LaTeX Exam package: Align choices with oneparchoices












4















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

























  • did you try the noindent command after begin{choice}?

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

    – andhewoulddarkenthememory
    Jan 18 at 9:04
















4















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

























  • did you try the noindent command after begin{choice}?

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

    – andhewoulddarkenthememory
    Jan 18 at 9:04














4












4








4








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
















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















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 8:44









AboAmmar

34.2k32884




34.2k32884










asked Jan 18 at 8:07









andhewoulddarkenthememoryandhewoulddarkenthememory

233




233













  • did you try the noindent command after begin{choice}?

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

    – andhewoulddarkenthememory
    Jan 18 at 9:04



















  • did you try the noindent command after begin{choice}?

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

    – andhewoulddarkenthememory
    Jan 18 at 9:04

















did you try the noindent command after begin{choice}?

– Yorgos
Jan 18 at 8:21







did you try the noindent command after begin{choice}?

– 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










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
    Jan 18 at 9:05











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
});


}
});














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
    Jan 18 at 9:05
















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
    Jan 18 at 9:05














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 Jan 18 at 8:58

























answered Jan 18 at 8:49









Martin ScharrerMartin Scharrer

202k47645821




202k47645821













  • 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





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


















draft saved

draft discarded




















































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

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]