LaTeX Exam package: Align choices with oneparchoices
I'm a fairly new LaTeX user, so please excuse me if this is a simple newbie question.
I am using the exam
package to create, well, an exam. I use both the choices
and oneparchoices
environments and I would like them to be aligned instead of the choices ones being far more indented. This MWE should illustrate my point:
documentclass{exam}
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
New contributor
add a comment |
I'm a fairly new LaTeX user, so please excuse me if this is a simple newbie question.
I am using the exam
package to create, well, an exam. I use both the choices
and oneparchoices
environments and I would like them to be aligned instead of the choices ones being far more indented. This MWE should illustrate my point:
documentclass{exam}
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
New contributor
did you try thenoindent
command afterbegin{choice}
?
– Yorgos
1 hour ago
@Yorgos: Aschoices
is a list environmentnoindent
will not work. The indention is done usingleftmargin
notindent
.
– Martin Scharrer♦
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago
add a comment |
I'm a fairly new LaTeX user, so please excuse me if this is a simple newbie question.
I am using the exam
package to create, well, an exam. I use both the choices
and oneparchoices
environments and I would like them to be aligned instead of the choices ones being far more indented. This MWE should illustrate my point:
documentclass{exam}
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
New contributor
I'm a fairly new LaTeX user, so please excuse me if this is a simple newbie question.
I am using the exam
package to create, well, an exam. I use both the choices
and oneparchoices
environments and I would like them to be aligned instead of the choices ones being far more indented. This MWE should illustrate my point:
documentclass{exam}
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
indentation exam
New contributor
New contributor
edited 1 hour ago
AboAmmar
33.4k22882
33.4k22882
New contributor
asked 2 hours ago
andhewoulddarkenthememoryandhewoulddarkenthememory
183
183
New contributor
New contributor
did you try thenoindent
command afterbegin{choice}
?
– Yorgos
1 hour ago
@Yorgos: Aschoices
is a list environmentnoindent
will not work. The indention is done usingleftmargin
notindent
.
– Martin Scharrer♦
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago
add a comment |
did you try thenoindent
command afterbegin{choice}
?
– Yorgos
1 hour ago
@Yorgos: Aschoices
is a list environmentnoindent
will not work. The indention is done usingleftmargin
notindent
.
– Martin Scharrer♦
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago
did you try the
noindent
command after begin{choice}
?– Yorgos
1 hour ago
did you try the
noindent
command after begin{choice}
?– Yorgos
1 hour ago
@Yorgos: As
choices
is a list environment noindent
will not work. The indention is done using leftmargin
not indent
.– Martin Scharrer♦
1 hour ago
@Yorgos: As
choices
is a list environment noindent
will not work. The indention is done using leftmargin
not indent
.– Martin Scharrer♦
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
Having a look at the source code of the exam
class shows me that the left margin (realized as leftmargin
in LaTeX) is set by choices
using a hard coded line settowidth{leftmargin}{W.hskiplabelsephskip 2.5em}%
, i.e. it is set to the width of W.
+ labelsep + 2.5em (em is relative to your font size).
I don't see an easy way to change that as there is no setting for this provided. You only could copy the definition of choices
from exam.cls
into your document, between makeatletter
and makeatother
, and change the above line to setlength{leftmargin}{<your prefered length>}
. I would recommend here 15pt which is the normal parindent
. Your can't apparently not use parindent
directly as the list environment in choices
seems to redefine it.
You also need to change newcommand
to renewcommand
of course.
documentclass{exam}
makeatletter
% from exam.cls, line 4107:
renewenvironment{choices}%
{list{choicelabel}%
{usecounter{choice}defmakelabel##1{hssllap{##1}}%
setlength{leftmargin}{15pt}%
defchoice{%
if@correctchoice
color@endgroup
endgroup
fi
item
do@choice@pageinfo
} % choice
defCorrectChoice{%
if@correctchoice
color@endgroup
endgroup
fi
ifprintanswers
ifhmode unskipunskipunvboxvoidb@x fi
begingroup color@begingroup @correctchoicetrue
CorrectChoice@Emphasis
fi
item
do@choice@pageinfo
} % CorrectChoice
letcorrectchoiceCorrectChoice
labelwidthleftmarginadvancelabelwidth-labelsep
topsep=0pt
partopsep=0pt
choiceshook
}%
}%
{if@correctchoice color@endgroup endgroup fi endlist}
makeatother
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470651%2flatex-exam-package-align-choices-with-oneparchoices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Having a look at the source code of the exam
class shows me that the left margin (realized as leftmargin
in LaTeX) is set by choices
using a hard coded line settowidth{leftmargin}{W.hskiplabelsephskip 2.5em}%
, i.e. it is set to the width of W.
+ labelsep + 2.5em (em is relative to your font size).
I don't see an easy way to change that as there is no setting for this provided. You only could copy the definition of choices
from exam.cls
into your document, between makeatletter
and makeatother
, and change the above line to setlength{leftmargin}{<your prefered length>}
. I would recommend here 15pt which is the normal parindent
. Your can't apparently not use parindent
directly as the list environment in choices
seems to redefine it.
You also need to change newcommand
to renewcommand
of course.
documentclass{exam}
makeatletter
% from exam.cls, line 4107:
renewenvironment{choices}%
{list{choicelabel}%
{usecounter{choice}defmakelabel##1{hssllap{##1}}%
setlength{leftmargin}{15pt}%
defchoice{%
if@correctchoice
color@endgroup
endgroup
fi
item
do@choice@pageinfo
} % choice
defCorrectChoice{%
if@correctchoice
color@endgroup
endgroup
fi
ifprintanswers
ifhmode unskipunskipunvboxvoidb@x fi
begingroup color@begingroup @correctchoicetrue
CorrectChoice@Emphasis
fi
item
do@choice@pageinfo
} % CorrectChoice
letcorrectchoiceCorrectChoice
labelwidthleftmarginadvancelabelwidth-labelsep
topsep=0pt
partopsep=0pt
choiceshook
}%
}%
{if@correctchoice color@endgroup endgroup fi endlist}
makeatother
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
add a comment |
Having a look at the source code of the exam
class shows me that the left margin (realized as leftmargin
in LaTeX) is set by choices
using a hard coded line settowidth{leftmargin}{W.hskiplabelsephskip 2.5em}%
, i.e. it is set to the width of W.
+ labelsep + 2.5em (em is relative to your font size).
I don't see an easy way to change that as there is no setting for this provided. You only could copy the definition of choices
from exam.cls
into your document, between makeatletter
and makeatother
, and change the above line to setlength{leftmargin}{<your prefered length>}
. I would recommend here 15pt which is the normal parindent
. Your can't apparently not use parindent
directly as the list environment in choices
seems to redefine it.
You also need to change newcommand
to renewcommand
of course.
documentclass{exam}
makeatletter
% from exam.cls, line 4107:
renewenvironment{choices}%
{list{choicelabel}%
{usecounter{choice}defmakelabel##1{hssllap{##1}}%
setlength{leftmargin}{15pt}%
defchoice{%
if@correctchoice
color@endgroup
endgroup
fi
item
do@choice@pageinfo
} % choice
defCorrectChoice{%
if@correctchoice
color@endgroup
endgroup
fi
ifprintanswers
ifhmode unskipunskipunvboxvoidb@x fi
begingroup color@begingroup @correctchoicetrue
CorrectChoice@Emphasis
fi
item
do@choice@pageinfo
} % CorrectChoice
letcorrectchoiceCorrectChoice
labelwidthleftmarginadvancelabelwidth-labelsep
topsep=0pt
partopsep=0pt
choiceshook
}%
}%
{if@correctchoice color@endgroup endgroup fi endlist}
makeatother
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
add a comment |
Having a look at the source code of the exam
class shows me that the left margin (realized as leftmargin
in LaTeX) is set by choices
using a hard coded line settowidth{leftmargin}{W.hskiplabelsephskip 2.5em}%
, i.e. it is set to the width of W.
+ labelsep + 2.5em (em is relative to your font size).
I don't see an easy way to change that as there is no setting for this provided. You only could copy the definition of choices
from exam.cls
into your document, between makeatletter
and makeatother
, and change the above line to setlength{leftmargin}{<your prefered length>}
. I would recommend here 15pt which is the normal parindent
. Your can't apparently not use parindent
directly as the list environment in choices
seems to redefine it.
You also need to change newcommand
to renewcommand
of course.
documentclass{exam}
makeatletter
% from exam.cls, line 4107:
renewenvironment{choices}%
{list{choicelabel}%
{usecounter{choice}defmakelabel##1{hssllap{##1}}%
setlength{leftmargin}{15pt}%
defchoice{%
if@correctchoice
color@endgroup
endgroup
fi
item
do@choice@pageinfo
} % choice
defCorrectChoice{%
if@correctchoice
color@endgroup
endgroup
fi
ifprintanswers
ifhmode unskipunskipunvboxvoidb@x fi
begingroup color@begingroup @correctchoicetrue
CorrectChoice@Emphasis
fi
item
do@choice@pageinfo
} % CorrectChoice
letcorrectchoiceCorrectChoice
labelwidthleftmarginadvancelabelwidth-labelsep
topsep=0pt
partopsep=0pt
choiceshook
}%
}%
{if@correctchoice color@endgroup endgroup fi endlist}
makeatother
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
Having a look at the source code of the exam
class shows me that the left margin (realized as leftmargin
in LaTeX) is set by choices
using a hard coded line settowidth{leftmargin}{W.hskiplabelsephskip 2.5em}%
, i.e. it is set to the width of W.
+ labelsep + 2.5em (em is relative to your font size).
I don't see an easy way to change that as there is no setting for this provided. You only could copy the definition of choices
from exam.cls
into your document, between makeatletter
and makeatother
, and change the above line to setlength{leftmargin}{<your prefered length>}
. I would recommend here 15pt which is the normal parindent
. Your can't apparently not use parindent
directly as the list environment in choices
seems to redefine it.
You also need to change newcommand
to renewcommand
of course.
documentclass{exam}
makeatletter
% from exam.cls, line 4107:
renewenvironment{choices}%
{list{choicelabel}%
{usecounter{choice}defmakelabel##1{hssllap{##1}}%
setlength{leftmargin}{15pt}%
defchoice{%
if@correctchoice
color@endgroup
endgroup
fi
item
do@choice@pageinfo
} % choice
defCorrectChoice{%
if@correctchoice
color@endgroup
endgroup
fi
ifprintanswers
ifhmode unskipunskipunvboxvoidb@x fi
begingroup color@begingroup @correctchoicetrue
CorrectChoice@Emphasis
fi
item
do@choice@pageinfo
} % CorrectChoice
letcorrectchoiceCorrectChoice
labelwidthleftmarginadvancelabelwidth-labelsep
topsep=0pt
partopsep=0pt
choiceshook
}%
}%
{if@correctchoice color@endgroup endgroup fi endlist}
makeatother
begin{document}
begin{questions}
question
Question 1
begin{oneparchoices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{oneparchoices}
question
Question 2
begin{choices}
correctchoice Answer 1
choice Answer 2
choice Answer 3
end{choices}
end{questions}
end{document}
edited 1 hour ago
answered 1 hour ago
Martin Scharrer♦Martin Scharrer
200k45636818
200k45636818
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
add a comment |
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
1 hour ago
add a comment |
andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.
andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.
andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.
andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470651%2flatex-exam-package-align-choices-with-oneparchoices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you try the
noindent
command afterbegin{choice}
?– Yorgos
1 hour ago
@Yorgos: As
choices
is a list environmentnoindent
will not work. The indention is done usingleftmargin
notindent
.– Martin Scharrer♦
1 hour ago
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
1 hour ago