7

I am looking for a way to generate different copies of the same exam.

I usually prepare several exercises, with two versions for each exercise; then I divide my students in four groups (A,B,C,D) and hand out to each student a different copy of the exam, depending on his group.

For instance, a student will receive one of the following, non-random exam sheets:

Group A: exercises 1-a, 2-a, 3-a

Group B: exercises 1-a, 2-b, 3-b

Group C: exercises 1-b, 2-a, 3-b

Group D: exercises 1-b, 2-b, 3-a

I could accomplish my goal (and number each exercise) with beamer:

\documentclass{beamer}
\begin{document}
 \begin{frame}
  Exam
  \begin{enumerate}
   \only<1,2>{ 2+3 } %1-a, groups A and B
   \only<3,4>{ 2+4 } %1-b, groups C and D
   \only<1,3>{ 3-2 } %2-a, groups A and C
   \only<2,4>{ 4-3 } %2-b, groups B and D
   \only<1,4>{ 4:2 } %3-a, groups A and D
   \only<2,3>{ 6:3 } %3-b, groups B and C
  \end{enumerate}
 \end{frame}
\end{document}

I would like to get the same result in the article class.

3
  • 1
    Welcome to the site. Have you done any research on this at all? For example, looked at the various packages available to write exams listed at ctan.org/topic/exam or searched this site? There are a number of questions here about using classes designed for this, including those described in the CTAN topic.
    – cfr
    Feb 13, 2014 at 0:23
  • You could alternatively do this with something like ctan.org/pkg/textmerg.
    – cfr
    Feb 13, 2014 at 0:29
  • Thank you. Yes, I did search this site, through which I found the ctan exam list. As I understood, these packages only offer random generation, although I might have overlooked something. I shall read 'textmerg' documentation.
    – Coleridge
    Feb 13, 2014 at 9:32

2 Answers 2

6

You can do this using the exsheets package. See "Variations of an Exam," section 14 (page 29) of the exsheets documentation for an explanation.

In the header you declare \SetVariations{} to indicate how many you want, and then list them using the \variant{} and \vary{} commands. See documentation for syntax.

In the following, replace the variant number to generate each version:

\documentclass{article}
\usepackage{exsheets}
\SetVariations{4}
\variant{1} 

\begin{document}
\begin{question}
\vary{2+3}{2+3}{2+5}{2+5}   
\end{question}
\begin{question}
\vary{4-3}{5-2}{4-3}{5-2}   
\end{question}
\begin{question}  
What is \vary{2:4}{2:5}{2:4}{2:5}?  
\end{question}

\end{document}

An advantage of this method is that a small part of a question—like a single number somewhere in it—can be modified, while the rest of the question stays the same. This is illustrated briefly in the last question.

However, if you want to vary entire questions, you also have the option of assigning each question to a class, like

\SetupExSheets{use-classes={A,C}}
\begin{question}[class=A]
    2+3
\end{question}
\begin{question}[class=A]
    3+4
\end{question}
\begin{question}[class=B]
    3-1
\end{question}
\begin{question}[class=C]
    3-2
\end{question}

Then, for different versions, you'd vary which classes you indicated in \SetupExSheets{use-classes={A,C}}

3
  • ok, added working example Feb 13, 2014 at 2:13
  • Exercises are actually quite long expressions, so I would rather avoid the first option. The second one seems to do the trick; as soon as I come home I will try to install exsheets.
    – Coleridge
    Feb 13, 2014 at 10:44
  • 1
    @Coleridge I wouldn't try to install exsheets manually as it depends on the l3kernel and other packages. But exsheets is part of both MiKTeX and TeX Live 2013 so if you have an up to date TeX distribution you should already have exsheets installed.
    – cgnieder
    Feb 13, 2014 at 15:14
1

If your set up is relatively simple and you don't need all of the features of one of the classes dedicated to typesetting exams, you could just use something like the following:

\documentclass{article}

\usepackage{textmerg,filecontents,titling}
\newcommand{\exqn}[2]{% this just makes it slightly quicker to define the questions
  \newcommand{#1}{#2}%
  }
% define your questions: \onea, \oneb etc.
\exqn{\onea}{2+3}
\exqn{\oneb}{2+4}
\exqn{\twoa}{3-2}
\exqn{\twob}{4-3}
\exqn{\threea}{4:2}
\exqn{\threeb}{6:3}
% Assign questions to groups in a separate file.
% Because filecontents adds comments, you will get a spurious first page. If you use a really distinct file with 'A' on the first line, you won't.
\begin{filecontents}{questions.dat}
A
\onea
\twoa
\threea
B
\onea
\twob
\threeb
C
\oneb
\twoa
\threeb
D
\oneb
\twob
\threea
\end{filecontents}

\title{Examination of Extreme Excellence}
\author{Marvellous Mocker}
\date{23 January, 4\textsc{bce}}

\begin{document}

\Fields{\classgroup\qone\qtwo\qthree}% one field per line for a single variation of the exam - we have one group and three questions in each exam, so four fields are required.

\Merge{questions.dat}{%
\renewcommand{\maketitlehookb}{\centering \large Group \classgroup\par}% label exams by group
\pagenumbering{arabic}% make sure the first page of each exam is 1
\maketitle
\begin{enumerate}% typeset the questions however you wish
    \item \qone
    \item \qtwo
    \item \qthree
\end{enumerate}
}

\end{document}

This will produce:

4 exam variations

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .