1

I am trying to make multiple choice questions and I saw your answer to a similar question.

\documentclass{article}


%--------------------------------------------------------------------
%--------------------------------------------------------------------
\newcounter{choice}
\renewcommand\thechoice{\Alph{choice}}
\newcommand\choicelabel{\thechoice.}

\newenvironment{choices}%
  {\list{\choicelabel}%
     {\usecounter{choice}\def\makelabel##1{\hss\llap{##1}}%
       \settowidth{\leftmargin}{W.\hskip\labelsep\hskip 2.5em}%
       \def\choice{%
         \item
       } % choice
       \labelwidth\leftmargin\advance\labelwidth-\labelsep
       \topsep=0pt
       \partopsep=0pt
     }%
  }%
  {\endlist}

\newenvironment{oneparchoices}%
  {%
    \setcounter{choice}{0}%
    \def\choice{%
      \refstepcounter{choice}%
      \ifnum\value{choice}>1\relax
        \penalty -50\hskip 1em plus 1em\relax
      \fi
      \choicelabel
      \nobreak\enskip
    }% choice
    % If we're continuing the paragraph containing the question,
    % then leave a bit of space before the first choice:
    \ifvmode\else\enskip\fi
    \ignorespaces
  }%
  {}
%--------------------------------------------------------------------
%--------------------------------------------------------------------

%--------------------------------------------------------------------
\begin{document}

\begin{enumerate}
\item One of these things is not like the others; one of these things
  is not the same.  Which one doesn't belong?
  \begin{choices}
    \choice George
    \choice Paul
    \choice John
    \choice Ringo
    \choice Socrates
  \end{choices}
\item What was the color of George Washinton's white horse?
  \begin{choices}
    \choice Green
    \choice Yellow
    \choice White
  \end{choices}
\item One of these things is not like the others; one of these things
  is not the same.  Which one doesn't belong?
  \begin{oneparchoices}
    \choice George
    \choice Paul
    \choice John
    \choice Ringo
    \choice Socrates
  \end{oneparchoices}
\item What was the color of George Washinton's white horse?
  \begin{oneparchoices}
    \choice Green
    \choice Yellow
    \choice White
  \end{oneparchoices}
\item One of these things is not like the others; one of these things
  is not the same.  Which one doesn't belong?

  \begin{oneparchoices}
    \choice George
    \choice Paul
    \choice John
    \choice Ringo
    \choice Socrates
  \end{oneparchoices}
\item What was the color of George Washinton's white horse?

  \begin{oneparchoices}
    \choice Green
    \choice Yellow
    \choice White
  \end{oneparchoices}
\end{enumerate}

\end{document}

I also want to show answers at the end. I saw another similar answer with answers showing at the end but they are with one parachoices which I do not want. Can you help me modify your answer with show answers at the end?

  • Please check tex.stackexchange.com/a/15354/34618, to see if it helps. – Jesse Dec 30 '13 at 11:55
  • By ``you'' I take it you mean Phil Hirschorn? Anyway, first you will need a way to indicate which is the right answer. Then stick whatever format you want into a float (table or figure) to be printed at the top of the last (or next) page. – John Kormylo Dec 30 '13 at 14:36
  • can somebody please change these codes for choices so that the choices show vertically in line not in one para – Manoj Kumar Jan 27 '14 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.