The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Basic use of Exam Randomizer

Alejandro Gonzalez Recuenco

2024-01-23

This vignette describes the basic way of randomizing exams using this package.

What problem is this software adressing

When you are creating a LaTeX exam or homework. I have found in my own teaching that these are the things that I am more interested in.

  1. Using a software that doesn’t require me to get out of my LaTeX environment to randomize it
  2. To have options to add personalized information for each individual student (Name, class, favorite color, etc)
  3. To have a program that adapts to my structure, rather than adapting my structure to the program
  4. To be able to toggle on and off randomization on different depth levels of the structure
  5. To produce automatically an answer sheet, that can be used to gather statistics about the exam itself.

This package and the corresponding scripts and TexShop engines that come distributed with it tries to address these issues.

In essence, it will understand any ‘LaTeX’ “itemize” structure that follows the \begin{envname} \end{envname} structure, with some kind of command that produces “items” within that environemnt \item. It will create a tree with that nested structure that you define, and it will randomize it keeping the root of the tree fixed on each branch.

The default structure that it will understand is that of the exam class, but it is heavily customizable.

This packages comes together with a script that can already be used to randomize exams and a couple of .engines to be used with TexShop engines

How to start

If you are using the exam class structure on your exam already, that is already the default, and you will only need to specify the output number. 1

\documentclass{exam}
...
\begin{document}

\begin{questions}
    \question bla, lippsum bla
    \begin{choices}
    \choice bla blah

    \choice ehem 
    \CorrectChoice and
    more 
    text
    
    \choice last choice
    
    \end{choices}
    ...
    \question
\end{questions}

\end{document}
       

Instalation

All the executables that are necessary are found inside the exec/ folder. Which you can find by running

system.file("exec", package = "TexExamRandomizer")
## [1] "/private/var/folders/f9/gx8nkt0j6kgcwslqj681v8jw0000gp/T/Rtmp3qkaKd/Rinst10a993d21e2d0/TexExamRandomizer/exec"
  1. Copy the examrandomizer executable somewhere in your $PATH. Copy the gradeexamrandomizer as well on the same location if you are intending to use the automatic grading.

  2. Then, drop the examrandomizer.engine on the TexShop engine library (Usually it is found in ~/Library/TeXShop/Engines)2.

  3. Once you have done that, just add a line in your ‘LaTeX’ document within the first 200 lines of your documen that says (let’s assume you want 5 versions)3

    %! TexExamRandomizer = {"noutput" = 5}

  4. Choose the examrandomizer engine from the TexShop engines list.

  1. You will find in the location where your tex file was found a folder with the answer sheets and the compiled documents. (Don’t loose the answer sheets please.)

For a more detailed explanation of all the options given by the interface, please look at

vignette("ExamOptions", package = "TexExamRandomizer")

Personalization

It also adds a layer of personalization as well by being able to modify the values of commands on the preamble on a per-document basis, this is explained further on vignette("ExamOptions", package = "TexExamRandomizer"):

Creating your own scripts

The implementation of a json-like parser within the document certainly makes it a lot more concise to use. However, that is simply a wrapper of the underlying functions that define this R library.

If you want to use the full functionality and try to create your own scripts, instead of using the functions I provide. You might want to start by looking at: - The functions CreateRandomExams and GenerateHomework for randomizing homework and exams - Grading is done by calling GradeExams and ObtainExamStats… although if your exam structure is a bit wild it might have issues trying to understand it.

Examples

Examples of how to write your latex document, and the options that you can use, can be found on

system.file("extdata", "ExampleTexDocuments", package = "TexExamRandomizer")
## [1] "/private/var/folders/f9/gx8nkt0j6kgcwslqj681v8jw0000gp/T/Rtmp3qkaKd/Rinst10a993d21e2d0/TexExamRandomizer/extdata/ExampleTexDocuments"
  1. exam_testing_nquestions.tex showcases how to pick a set of questions from each option
  2. exam_testing_norandomizing.tex showcases how to stop certain sections form being randomized
  3. exam_testing_itemize.tex showcases how to change the names of environments

Grading

If you are planning to also use the automatic grading then, after your students respond to the exams:

  1. Add as well the gradeexamrandomizer to a folder included in $PATH.

  2. You have to collect the student’s responses in a table. Where the columns of the responses should be named “Q 1”, “Q 2”, etc.

    • To give extra points, if you write a column called “Extra Points” those points will be added to the total grade.
  3. In that same folder, you need to copy the “full answer sheet”” that you got from compiling the exam with this software.

  4. Run the following command

    gradeexamrandomizer --resp <student responses csv> --answer <fullanswersheet csv>
  5. You will find a *_Graded.csv and a *_Stats.csv file in the same folder as the student’s responses with the grades and stats of the exam.

For a more detailed explanation, look at the following vignette

vignette("GradingExams", package = "TexExamRandomizer")

You can find on this vignette how to omit questions after you have already created the exam, or how to change the correct choices.

Known “issues”

If you have the expertise or you are willing to put some time to fix these issues I would be happy to talk with you.


  1. If you are using another structure, it is explained in the advance section how to tell the program what are you using. vignette("ExamOptions", package = "TexExamRandomizer")↩︎

  2. If you are using another ‘LaTeX’ distribution that doesn’t allow .engine scripts, you will have to use the examrandomizer directly on the terminal, which is not difficult↩︎

  3. The double quotes around noutput are necessary↩︎

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.