## How to write a multiple choice test book with latex? [closed]

Reposted on TeX-SX at http://tex.stackexchange.com/q/15480/86

I want to write a book which will consist of many multiple choice exam sheets. Putting the codes below into my preamble, I wrote the question like as

\begin{enumerate} \item $2+2=?$ \choice $1$ \choice $2$ \choice $3$ \choice $4$ \choice $5$ \end{enumerate}

For each exam sheet, in the footer I want to create a table of correct answers. Is there any simple way to do this, or a latex macro script to do this automatically by mentioning correct answer in its latex codes? For example; \choice $1$ \choice $2$ \choice $3$ \correctchoice $4$ \choice $5$

In addition, since the choices are not side by side, I have lost many spaces. Is there any latex codes to write choices more symmetrically and automatically in one or two row?

%%% Codes in preamble %%%

\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 1.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


}%

-
You may have better luck at tex.stackexchange.com as this question isn't really about mathematics! – yatima2975 Apr 10 2011 at 17:28
This question is better suited for tex.stackexchange.com. – Zev Chonoles Apr 10 2011 at 17:28