[OS X TeX] Conditional Typesetting Inside Lists

Paul Mantz pcmantz at gmail.com
Tue Feb 26 11:36:07 EST 2008


I haven't checked out the exam document class, but I wish I had; I
coded a lot of that functionality already for an e-learning site I was
working for.

I found that the best way to generate an answer key is in whatever
\Question macro you're using, have something like this:

\addtocontents{ans}{{(internal question counter) (the answer letter) }

And then at the end of your file, include the following:

\newpage
\@starttoc{ans}

I remember when I did this, I also had to \protect the question
counter (yay lazy evaluation!) in order for the counter to work
correctly.

I would also suggest that instead of simply using enumerate, you make
your own custom answers list:

\newcounter{choices}
\newenvironment{choices}
{\begin{list}{\Alph{(choices)}} \usecounter{choices}} %usecounter
resets choices
{\end{list}}

At the least, using list with the counter argument would allow you to
change how your question choices are enumerated.

On Tue, Feb 26, 2008 at 10:13 AM, Adam M. Goldstein <agoldstein at iona.edu> wrote:
> Have you checked out the exam document class? It does much of what you
>  say without having to customize any environments. It is included in
>  the standard MacTeX distribution, and you can probably get going with
>  it pretty quickly by following the docs.
>
>  -Adam
>
>
>
>  On Feb 26, 2008, at 10:41 AM, Maurino Bautista wrote:
>
>  > We have a multiple choice section in our Calculus final exam and the
>  > questions and choices are entered using the \begin{enumerate} --
>  > \end{enumerate} environment in LaTeX. I would like to use the same
>  > file to generate the exam as well as the answer key for the exam. I
>  > would like to define a variable whose values are either exam or key.
>  > In the beginning of the document, this variable will be declared and
>  > if its value is exam, the file would be typeset as usual with the
>  > questions numbered 1, 2, 3, etc and the choices within each question
>  > labeled A, B, C, etc. If the value of the variable is key, the
>  > letter-label of the correct answer will be enclosed in a box.
>  > Alternative possibilities (which may be easier or harder) are:
>  > letter-label in bold, the correct answer (not the letter-label) is
>  > boxed or in bold, text after the correct answer stating this is the
>  > correct answer or some other symbol like a star, a dingbat, etc. I
>  > suppose, if I have the code for one of these, I could modify it to
>  > obtain any of the others. I just don't have enough knowledge to start
>  > it. Rather, I don't have time to really think about it. So, if any of
>  > you have done it before, I would appreciate getting some help.
>  >
>  >
>  > Maurino P. Bautista, Ph.D.
>  > Professor of Mathematics
>  > (585)-475-6122
>  > maobautista at gmail.com
>  >
>  > School of Mathematical Sciences
>  > Rochester Institute of Technology
>  > 85 Lomb Memorial Drive
>  > Rochester, NY 14623
>  >
>  > -------------------------- Helpful Info --------------------------
>  > TeX FAQ: http://www.tex.ac.uk/faq
>  > List Reminders and Etiquette: http://www.esm.psu.edu/mac-tex/list/
>  > List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>  > List Archive: http://tug.org/pipermail/macostex-archives/
>  > Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>  >
>
>  =================================
>  Adam M. Goldstein PhD MSLIS
>  Assistant Professor of Philosophy
>  Iona College
>  --
>  email:  agoldstein at iona.edu
>  web:    http://www.iona.edu/faculty/agoldstein/
>  tel:    (914) 637-2717
>  post:   Iona College
>          Department of Philosophy
>          715 North Avenue
>          New Rochelle, NY 10801
>
>
>
>
>
>
>  -------------------------- Helpful Info --------------------------
>  TeX FAQ: http://www.tex.ac.uk/faq
>  List Reminders and Etiquette: http://www.esm.psu.edu/mac-tex/list/
>  List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>  List Archive: http://tug.org/pipermail/macostex-archives/
>  Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>
>
>



More information about the MacOSX-TeX mailing list