0

My question is specific to the exam-randomizechoices package. It is a great package, but my TeX skills are limited, so I do not know how to remove the large margin to the left of the answer choices. For example

\documentclass{exam}
\usepackage{exam-randomizechoices}
\begin{document}

\begin{questions}

\question What is one plus two? \begin{randomizechoices} \choice one \choice two \CorrectChoice three \choice four \end{randomizechoices}

\end{questions} \end{document}

gives

enter image description here

It is a nicely formatted exam question and I LOVE the randomized choices, but there is a lot of space to the left of all of the choices. How do I align the choices to the left and remove those indentations?

Thanks!

P.S. I am not much of a TeX wizard. Maybe someone knows how to use the following resources to help me out?

User Guide: https://ctan.math.illinois.edu/macros/latex/contrib/exam-randomizechoices/exam-randomizechoices-doc.pdf

GitHub: https://github.com/jesseopdenbrouw/exam-randomizechoices

  • You might find https://tex.stackexchange.com/questions/615846/indenting-the-exam-question-for-two-different-formats-correctly useful. – John Kormylo Oct 10 '23 at 15:24
  • Thank you for your feedback!! If the answer meets your requirement, please accept it by checking the green tickmark on left side of the answer. – Simon Dispa Oct 12 '23 at 18:18

1 Answers1

1

This code will align the labels of the choices with the question.

a

\documentclass{exam}
\usepackage{exam-randomizechoices}

%*************************************** added <<<<<< \usepackage{calc} \usepackage{enumitem}

\renewcommand{\choiceshook}{% \settowidth{\labelwidth}{A.}%
\setlength{\labelsep}{1em} % after A., B. \setlength{\leftmargin}{\labelindent+\labelwidth+\labelsep-\itemindent} }
%***************************************

\begin{document}

\begin{questions}

    \question What is one plus two?
    \begin{randomizechoices}
        \choice one
        \choice two
        \CorrectChoice three
        \choice four
    \end{randomizechoices}

\end{questions}

\end{document}

The following code will align everything to the left margin.

b

\documentclass{exam}
\usepackage{exam-randomizechoices}

%*************************************** added <<<<<< \usepackage{calc} \usepackage{enumitem}

\renewcommand{\choiceshook}{% \setlength{\leftmargin}{0pt} \setlength{\labelwidth}{-\labelsep}% \def\makelabel##1{\hskip-\leftmargin##1}%
}

\renewcommand{\questionshook}{% \setlength{\leftmargin}{0pt}% \setlength{\labelwidth}{-\labelsep}% }
%***************************************

\usepackage{showframe} % ONLY to show the margins

\begin{document}

\begin{questions}

    \question What is one plus two?
    \begin{randomizechoices}
        \choice one
        \choice two
        \CorrectChoice three
        \choice four
    \end{randomizechoices}

\end{questions}

\end{document}

Simon Dispa
  • 39,141