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

2

1 Answer 1

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}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .