LaTeX Exam package: Align choices with oneparchoices












3















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}


This is what I get.



I'm sure the more experienced users can solve this easily, but I'm stuck.










share|improve this question









New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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. Yes, I tried that. Should have mentioned it.

    – andhewoulddarkenthememory
    1 hour ago
















3















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}


This is what I get.



I'm sure the more experienced users can solve this easily, but I'm stuck.










share|improve this question









New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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. Yes, I tried that. Should have mentioned it.

    – andhewoulddarkenthememory
    1 hour ago














3












3








3








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}


This is what I get.



I'm sure the more experienced users can solve this easily, but I'm stuck.










share|improve this question









New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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}


This is what I get.



I'm sure the more experienced users can solve this easily, but I'm stuck.







indentation exam






share|improve this question









New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 hour ago









AboAmmar

33.4k22882




33.4k22882






New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









andhewoulddarkenthememoryandhewoulddarkenthememory

183




183




New contributor




andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






andhewoulddarkenthememory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • 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. 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













  • @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

















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










1 Answer
1






active

oldest

votes


















3














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}


enter image description here






share|improve this answer


























  • 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











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.










draft saved

draft discarded


















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









3














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}


enter image description here






share|improve this answer


























  • 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
















3














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}


enter image description here






share|improve this answer


























  • 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














3












3








3







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}


enter image description here






share|improve this answer















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}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 1 hour ago









Martin ScharrerMartin 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



















  • 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










andhewoulddarkenthememory is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Polycentropodidae

Magento 2 Error message: Invalid state change requested

Paulmy