[Tex/LaTex] Even horizontal distribution of choices in exam document class

examhorizontal alignment

I want to display the options for multiple choice questions horizontally within the exam document class.

The oneparchoices environment displays the options horizontally, but the choices remain left-justified.

I attempted the following fix: \renewcommand{\choiceshook}{\setlength{\itemsep}{1in}}, but of course that doesn't affect the oneparchoices environment and apparently \oneparchoiceshook is not defined.

After much lost time, I switched to the \choices environment, added the multicol package and added a multicols environment to each question (see below).

Although this achieves the desired effect, besides being tiresomely repetitive, I can't change the \columnsep for the choices, globally (I know this must be easy, I just don't know how);
and the multicols environment inside the choices environment seems to add an indent (compare the same approach in a parts environment, below); not to mention the spacing issues that might arise using \columnsep if different questions had different numbers of choices …

`\documentclass[11pt]{exam}
 \RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
 \usepackage[margin=1in]{geometry}
 \usepackage{multicol}

 \begin{document}

 \begin{choices}
 \setlength{\columnsep}{30pt}
   \begin{multicols}{5}
      \choice First.
      \choice Second.
      \choice Third.
      \choice Fourth.
      \choice Fifth. 
   \end{multicols}
 \end{choices}

 % Compare multicols within a parts environment - no additional indent:

 \begin{parts}
 \setlength{\columnsep}{30pt}
    \begin{multicols}{5}
       \part A.
       \part B. 
       \part C. 
       \part D. 
       \part E.
    \end{multicols}
 \end{parts}
\end{document}

Is there a simple solution to this problem within the exam document class?

I don't know much about the use of different classes and am wondering to what extent it is desirable to stick to one class and make changes internally (there are some posts about this issue for the article class).

Best Answer

I assumed you wanted multiple choice because you mentioned the oneparchoices environment. I used the xpatch package to replace the 1em between choices with \hfill to evenly space the choices. This is good for very short answers. If you have longer answers, then you should look at some of the answers in this question. The code in the initial question (first code block) works well.

\documentclass[11pt]{exam}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\usepackage[margin=1in]{geometry}

\usepackage{xpatch}
\xpatchcmd{\oneparchoices}{\penalty -50\hskip 1em plus 1em\relax}{\hfill}{}{}
\xpatchcmd{\oneparchoices}{\penalty -50\hskip 1em plus 1em\relax}{\hfill}{}{}

\begin{document}

\begin{questions}
\question
First multiple choice question, with five evenly spread choices:

\begin{oneparchoices}
    \choice First.
    \choice Second.
    \choice Third.
    \choice Fourth.
    \choice Fifth. 
 \end{oneparchoices}

\question
Second multiple choice question, with four evenly spread choices:

\begin{oneparchoices}
    \choice First.
    \choice Second.
    \choice Third.
    \choice Fourth.
 \end{oneparchoices}

\question
Be careful. It gets screwy when the answers are long. 

\begin{oneparchoices}
    \choice First not long at all.
    \choice Second somewhat longer.
    \choice Third  getting to the longer choices.
    \choice Fourth now we have a really really long answer choice.
 \end{oneparchoices}

\end{questions}
\end{document}

enter image description here

Related Question