exams
is the old (version 1) interface for Sweave-based
generation of PDF exams. It is only provided for backward compatibility
and is superseded by the far more flexible function
exams2pdf
.
exams
generates exams from lists of Sweave
source files by:
(1) running Sweave
on each exercise,
(2) including the resulting LaTeX files in a template
,
(3) running texi2dvi
on the template, and
(4) storing the resulting PDF file in an output dir
(or displaying it interactively).
Each exercise in an exam is essentially a standalone Sweave source file
that exams
knows (almost) nothing about, it just calls Sweave
(n
times). The only exception is some meta-information which
is passed by means of four commands back to exams
. The commands
are \extype (which may be mchoice or num),
\exsolution (e.g., 3.124
for a numeric solution and
10010
for a multiple choice solution), \exstring
(containing a human-readable string with the solution), and
\extol (a tolerance for numeric solutions).
The specification in file
should be either of form "foo"
or equivalently "foo.Rnw"
, where the file "foo.Rnw"
should
either be in the local directory, the edir
directory or in
the exercises
directory of the package. file
can either
be a simple vector or a list of vectors. In the latter case, exercises
are chosen randomly within each list element. For example, the specification
file = list(c("a", "b"), "xyz")
will result in an exam with two
exercises: the first exercise is chosen randomly between "a"
and
"b"
while "xyz"
is always included as the second exercise.
The template
is a (vector of) specification(s) of LaTeX templates.
It can be "foo"
or equivalently "foo.tex"
where "foo.tex"
should either be in the local directory (or provided with the full path)
or in the tex
directory
of the package. It should specify where in the template the exercises
are included, using the markup \exinput{exercises}. Additionally,
it may contain \exinput{questionnaire} and \exinput{header}.
template
can also be a vector, then for each of the n
runs
several output files (one for each template) are created.
The name prefix for each file is by default the base name of the
corresponding template
but can also be changed via name
.
exams
creates the PDF files and stores them in an output
directory together with the solution meta information as metainfo.rda
(see also below). If only a single PDF is created (currently
the default), dir
may be NULL
and it is only displayed
on the screen.
The argument control
is specified by a named list with elements
mchoice.print
and mchoice.symbol
. The element
mchoice.print
is used for specifying the characters used for
printing. It is again a named list where element True
gives the
(five) characters used for printing when the answer is correct and
False
if the answer is wrong. The symbol used for the
questionnaire output in the final PDF file is defined by
mchoice.symbol
which is vector with elements True
and
False
.