LaTeX Exam package: Align choices with oneparchoices

Clash Royale CLAN TAG#URR8PPP
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:
documentclassexam
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
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:
documentclassexam
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
did you try thenoindentcommand afterbeginchoice?
– Yorgos
Jan 18 at 8:21
@Yorgos: Aschoicesis a list environmentnoindentwill not work. The indention is done usingleftmarginnotindent.
– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04
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:
documentclassexam
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
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:
documentclassexam
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

I'm sure the more experienced users can solve this easily, but I'm stuck.
indentation exam
indentation exam
edited Jan 18 at 8:44
AboAmmar
33.6k22883
33.6k22883
asked Jan 18 at 8:07
andhewoulddarkenthememoryandhewoulddarkenthememory
233
233
did you try thenoindentcommand afterbeginchoice?
– Yorgos
Jan 18 at 8:21
@Yorgos: Aschoicesis a list environmentnoindentwill not work. The indention is done usingleftmarginnotindent.
– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04
add a comment |
did you try thenoindentcommand afterbeginchoice?
– Yorgos
Jan 18 at 8:21
@Yorgos: Aschoicesis a list environmentnoindentwill not work. The indention is done usingleftmarginnotindent.
– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04
did you try the
noindent command after beginchoice?– Yorgos
Jan 18 at 8:21
did you try the
noindent command after beginchoice?– Yorgos
Jan 18 at 8:21
@Yorgos: As
choices is a list environment noindent will not work. The indention is done using leftmargin not indent.– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos: As
choices is a list environment noindent will not work. The indention is done using leftmargin not indent.– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04
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 settowidthleftmarginW.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 setlengthleftmargin<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.
documentclassexam
makeatletter
% from exam.cls, line 4107:
renewenvironmentchoices%
listchoicelabel%
usecounterchoicedefmakelabel##1hssllap##1%
setlengthleftmargin15pt%
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
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
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 settowidthleftmarginW.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 setlengthleftmargin<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.
documentclassexam
makeatletter
% from exam.cls, line 4107:
renewenvironmentchoices%
listchoicelabel%
usecounterchoicedefmakelabel##1hssllap##1%
setlengthleftmargin15pt%
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
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
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 settowidthleftmarginW.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 setlengthleftmargin<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.
documentclassexam
makeatletter
% from exam.cls, line 4107:
renewenvironmentchoices%
listchoicelabel%
usecounterchoicedefmakelabel##1hssllap##1%
setlengthleftmargin15pt%
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
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
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 settowidthleftmarginW.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 setlengthleftmargin<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.
documentclassexam
makeatletter
% from exam.cls, line 4107:
renewenvironmentchoices%
listchoicelabel%
usecounterchoicedefmakelabel##1hssllap##1%
setlengthleftmargin15pt%
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
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

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 settowidthleftmarginW.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 setlengthleftmargin<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.
documentclassexam
makeatletter
% from exam.cls, line 4107:
renewenvironmentchoices%
listchoicelabel%
usecounterchoicedefmakelabel##1hssllap##1%
setlengthleftmargin15pt%
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
begindocument
beginquestions
question
Question 1
beginoneparchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endoneparchoices
question
Question 2
beginchoices
correctchoice Answer 1
choice Answer 2
choice Answer 3
endchoices
endquestions
enddocument

edited Jan 18 at 8:58
answered Jan 18 at 8:49
Martin Scharrer♦Martin Scharrer
201k45636818
201k45636818
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
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
Jan 18 at 9:05
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
Thanks a lot! That is well beyond my current knowledge of LaTeX. But with the code you provided I got it to work. :)
– andhewoulddarkenthememory
Jan 18 at 9:05
add a comment |
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');
);
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');
);
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');
);
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');
);
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
noindentcommand afterbeginchoice?– Yorgos
Jan 18 at 8:21
@Yorgos: As
choicesis a list environmentnoindentwill not work. The indention is done usingleftmarginnotindent.– Martin Scharrer♦
Jan 18 at 8:50
@Yorgos. Yes, I tried that. Should have mentioned it.
– andhewoulddarkenthememory
Jan 18 at 9:04