First one has to take some care in preparing the quiz. As always, the tex file will be split in three parts:
- The preamble,
- The main body (which will include the problems),
- The ending.
Now, in order to produce the different versions, I wrote a bash script and a Python program. The script calls the Python program that does all the shuffling, and then it compiles the produced tex files (i.e. the different versions) and cleans up. The result is four versions of tex and the corresponding pdf files. Of course one can produce more or fewer versions by modifying the scripts. It is important that all the formatting of the example file is followed, otherwise the scripts will not run properly. By the way you will need Python 3 to run my scripts. (Python 2 will do too, but the bash script "shuffle" has to be modified by deleting the "3" from "python3".)
At the end of the each of the tex files, after the $\verb1\end{document}1$, the key is printed for convenience. Two pdf's are produced for each version: one with the correct answers indicated with a red checkmark, and one with no correct answers indicated. By the way, the correct answer is identified by typing $\verb1\answer1$ at the end of an item (see example file). I should also point out here that if you want a specific possible answer to not be included in the shuffling, you can make that happen with the flag $\verb1%dontshuffle1$. This is useful, for example, when one of the possible answers is "None of the above". Again, the example file in the link below includes all the relevant formatting that has to be followed.
So all one has to do after downloading the zip file below is unzip it, and run the shuffle script by opening a terminal and typing $\verb1./shuffle1$. It is important that only one tex file is in the folder of the files "shuffle" and "shuffle.py", but its name can be anything (it is read automatically by the script).
Download example by clicking here!
Thanks for sharing this, Andy. I was able to modify it (without really knowing Python) to randomize different sections (Multiple Choice, T/F, matching) of my exams (using exam.cls) in LaTeX. I appreciate your effort and generosity.
ReplyDeleteMike