0

I'm using the package mcexam to build tests with randomised multiple choice questions and randomised answers.

The package usage is as follows:

\usepackage[output=exam, numberofversions=58, version=26, randomizequestions=true,randomizeanswers=true]{mcexam}

where with the option numberofversions I set the number of randomised tests, and with the option version I print the 26th version as a pdf output.

I would ask if it is possible to print more versions in the same output pdf (fo example from 1 to 25), without changing the version number every time to create the different output. Thank you

1

This is easy to achieve with \foreach. But care must be taken, to ensure that you don't end up with duplicate tests.

A randomization table is generated by the mcquestions environment, i.e. it will be different for each loop. So the tests will look randomized, but you may end up with duplicates.

To prevent this, seed must be set to constant value before the mcquestions environment and the version must be incremented in each loop.

The incementation is done by \foreach and version and seed are set with \setkeys.

Here is the code:

\documentclass[a4paper]{article}
\usepackage[output=exam, numberofversions=58, randomizequestions=true,randomizeanswers=true]{mcexam}
\begin{document}
\foreach \i in {1,...,25}{
  \newpage
  \setkeys{mcexam.sty}{version=\i,seed=123}
  \begin{mcquestions}
    \question How much is $2+2$?
    \begin{mcanswerslist}
      \answer two
      \answer[correct] four
      \answer five
    \end{mcanswerslist}
    \question How much is $5-3$?
    \begin{mcanswerslist}
      \answer 1
      \answer[correct] 2
      \answer 3
    \end{mcanswerslist}
    \question How much is $0 \times 2$?
    \begin{mcanswerslist}[fixlast]
      \answer 1
      \answer 2
      \answer[correct] none of the above
    \end{mcanswerslist}
  \end{mcquestions}
}
\end{document}

Oh, and next time, please provide a minimal working example (MWE).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.