I would like to do an exam with LaTeX. I want to use the srcartcl class and the exam itself is ready. But I like to have a number as a unique identifier for the students. So, for 60 students, I like to have written 01, 02, 03, ... up to 60 at a defined position in the document. The rest of course stays unchanged. Is that somehow achievable?


It would probably help to have a better idea of how you're formatting your exam. But I'll give it a go. I teach in an extremely crowded classroom. So, when I administer exams and quizzes, I use multiple versions of the quiz. This can be a pain in the neck to write. But there are ways to streamline the process.

First, I separate the preamble and LaTeX command definitions from the body of the document. So the master file I process through LaTeX is very plain looking:


I can then issue a versioning command and repeated input the quiz as follows:






The mechanics of this are a bit more complicated than you probably need for your document. This is where knowing something a bit more about how you implement your exam could be useful. But here are some basics:

Here's an example:

The preamble: filehandle preamble.tex

This is where I load all packages and where I define all counters and commands that I will use throughout the document.

%% student specific commands
%% formatting the header and footer
\rhead{Student ID: \texttt{\large\studentid}}
%% formatting for quiz questions
                          \noindent\textbf{\sffamily QP\thequizproblemcounter.}%

The quiz file: filehandle: quizbody.tex

This is the content of the document. No new commands are defined here. No new counters are defined.

\quizproblem \lipsum[1]

\quizproblem \lipsum[2]

\quizproblem \lipsum[3]

\quizproblem \lipsum[4]

\quizproblem \lipsum[5]

\quizproblem \lipsum[6]

\quizproblem \lipsum[7]

\quizproblem \lipsum[8]

\quizproblem \lipsum[9]

The master document: filehandle--your call

Here I just input the various files that I'll need and only execute actions necessary between formatting the next version of the quiz.




To reformat the student id:

  • Great! Thanks! But two additional questions: Can I somehow force a blank page if the quizbody has an odd number of pages? This would be nice to have when printing two sided. And question two: Can I force the numbers to have the format 01, 02, etc instead of 1, 2, ...? – DaPhil Feb 11 '13 at 20:46
  • 1) \cleardoublepage{} – schoettl Feb 11 '13 at 21:23
  • Your first additional question has been answer in someone else's comment. I've added an edit above to show how to get the numbering of ids as you would like. – A.Ellett Feb 11 '13 at 21:31

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.