Before going into a detailed description of Manyex characteristics and functioning, it is useful to present a simple example.

Suppose you want to create a simple quizz of just two questions for a mathematics exam, one on combinations and the other one on permutations. You want to have two different exams. Manyex allows you create these two exams from a database of exercises. In this case each exercise consists only of one question, but later we will see that exercise can be more complex.

The database of exercises consists of a base directory and subdirectories containing the different types of questions. In this simple case, the base directory has two subdirectories, each one containing three exercises (with just one question each).

Directory one is called `comb` and contains three files: `exer1`,
`exer2` and `exer3`. By default manyex will consider files
starting with the prefix “exer” as exercise files. The prefix can be
changed. The text for the questions will be processed through LaTeX, so
it can contain TeX commands and formattin.

File `exer1` contains:

block question The binomial coefficient ${n \choose k}$ equals . ${n \choose n-k}$. . $0$ if $k=0$. : The previous two answers are incorrect. endquestion endblock

This is the definition of an exercise, using a sytax which is going to
be explained later. Blocks are composed by questions and have a given
“type”, in this case it is a multiplechoice question, which is the
default. The question itself is enclosed between `question`

and
`endquestion`

, and it is composed by a statement (“The binomial
coefficient `${n \choose k}$`

equals”) and the different possible answers
(otpions). The first option is the correct one (this can be changed if
for instance the last option, “The previous two answers are
incorrect”, turns out to be the correct one). The semicollon (:) in the
last option means that this option is not going to be permuted,
otherwise the wording of the question would make no sense.

Similarly, `exer2` contains:

block question In how many ways can we choose $n$ objects from $k$ different objects, if the order of choice does not matter? . ${k(k-1)\cdots(k-n+1) \over n\cdot(n-1)\cdots2\cdot 1}$ . ${n(n-1)\cdots(n-k+1) \over k\cdot(k-1)\cdots2\cdot 1}$ endquestion endblock

And finally `exer3` contains:

block question How many different quadruples can one form from the objects 1, 1, 2, 3, 4, 5, 6, 7, 8, 9. (Two quadruples differing only in order are not considered different.) . ${8 \choose 4}+{8 \choose 3}+{8 \choose 2}$ . $10\cdot9\cdot8\cdot7$ : The previous two answers are incorrect endquestion endblock

The other directory, `perm`, contains three other exercises with
single questions, which are listed next:

`exer1`

block question How many circular orderings of the numbers $0,1,\ldots,10$ are there? (Two circular orderings which differ only by a rotation are not considered different.) . $10!$ . $11!$ . $9!$ . $3^{11}$ : None of the above answers is correct endquestion endblock

`exer2`

block question In how many ways can we choose 4 numbers from the set $\{1,\ldots,10\}$ if the order in which we choose them matters? . $\frac{10!}{6!}$ . $10^4$ . $6!$ . $\frac{10!}{6!4!}$ : None of the above answers is correct endquestion endblock

`exer3`

block question In how many ways can the numbers $0, 1, \ldots, 10$ be put in order? . $11!$ . $10!$ . $10\times 10$ . $2^{10}$ : None of the above answers is correct. endquestion endblock

To create the two exams a “test description file” has to be defined, together with a “LaTeX master file” where we will define the formatting of the exams.

The name of the “test description file” is free, for instance
`desc-test`, and will contain instructions to create tests. In this
simple case we have included the following instructions:

# test description file seed 12345 exercise use 2 from "comb" use 2 from "perm" endexercise create 2

The first line, starting with `#`

, is a comment. The second line
specifies the seed for the random number generator that is used to
permute the exercises, the questions and the options within in
multiplechoice questions, except those options that are specified to be
fixed with `:`

. The `exercise`

instruction starts a group of
exercises which are single questions, and therefore they will be indexed
only on the question level, and will not be indexed as exercises with
subindices corresponding to questions. Exactly what this means it will
be understood later when more complex exercises are shown. The
`use`

instructions will specify how many exercises of each type to
use, in this case two exercises from `comb` and two from
`perm`. The instruction `endexercise`

closes the question
numbering (if other exercises were given after this instruction, they
would start to be numbered as exercises with subnumbering of questions
within each exercise). The `exercise`

/ `endexercise`

group is
useful for exercises with just one question. The instruction
`create 2`

tells manyex to create 2 exams from the database of
exercises.

The other file that has to be created is a simple LaTeX style where a
series of macros are defined. These macros are written by manyex in the
output file, and define the headers and footers for exercises and
questions. By default this file is called `master.sty`, but the
name can be speficied in the test description file. The file will be
included in the LaTeX file being created by manyex, since a line with
`include`

command is written by the program.

The `master.sty` in this example is the following:

\newcommand{\mnglobalheader}{} \newcommand{\mnpaperheader}{ {\bf\Large Final Exam} {\bf\Large Exam type: \mnserialnumber} \bigskip } \newcommand{\mnpaperfooter}{} \newcommand{\mnexerciseheader}{} \newcommand{\mnexercisestartheader}{} \newcommand{\mnexercisefooter}{} \newcounter{question}\setcounter{question}{1} \newcommand{\mnquestionheader}{{\noindent \bf Question \arabic{question}: \addtocounter{question}{1}}} \newcommand{\mnquestionfooter}{}

This file has to define a series of macros that manyex writes in the
latex file. These are used to format the exam. It can also use some
macros that manyex writes (for instance `\def\mnquestionnumber{1}`

)
to number exercises and questions. In this case the numbering of the
questions is defined in the master file itself, since each exercise has
only one question and if we used manyex standard numbering procedure all
questions would be number 1 (if we write `\mnquestionnumber`

in
`\def\mnquestionheader{}`

, it would be always resolved to 1).

To create the actual exams, manyex has to be run from the base directory. If the base directory is specified in the test description file, manyex can be run from anywhere, but it will always create the exams in the directory from where it is being run.

The command to create “normal LaTeX exams” is:
`manyex -n -f desc-test`

This will create a file called by default `exam.tex` where the
actual exams are written. The output file name can also be changed from
the test description file. The file in this case will look as follows:

\documentclass[12pt,a4paper]{article} \usepackage{master} \pagestyle{empty} \begin{document} \mnglobalheader \def\mnserialnumber{1} \mnpaperheader \mnexercisestartheader \smallskip \def\mnquestionnumber{1} \mnquestionheader The binomial coefficient ${n \choose k}$ equals \begin{itemize} \item[(A)] $0$ if $k=0$. \item[(B)] ${n \choose n-k}$. \item[(C)] The previous two answers are incorrect. \end{itemize} \mnquestionfooter \smallskip \def\mnquestionnumber{1} \mnquestionheader How many different quadruples can one form from the objects 1, 1, 2, 3, 4, 5, 6, 7, 8, 9. (Two quadruples differing only in order are not considered different.) \begin{itemize} \item[(A)] $10\cdot9\cdot8\cdot7$ \item[(B)] ${8 \choose 4}+{8 \choose 3}+{8 \choose 2}$ \item[(C)] The previous two answers are incorrect \end{itemize} \mnquestionfooter \smallskip \def\mnquestionnumber{1} \mnquestionheader How many circular orderings of the numbers $0,1,\ldots,10$ are there? (Two circular orderings which differ only by a rotation are not considered different.) \begin{itemize} \item[(A)] $9!$ \item[(B)] $3^{11}$ \item[(C)] $11!$ \item[(D)] $10!$ \item[(E)] None of the above answers is correct \end{itemize} \mnquestionfooter \smallskip

\def\mnquestionnumber{1} \mnquestionheader In how many ways can we choose 4 numbers from the set $\{1,\ldots,10\}$ if the order in which we choose them matters? \begin{itemize} \item[(A)] $10^4$ \item[(B)] $6!$ \item[(C)] $\frac{10!}{6!}$ \item[(D)] $\frac{10!}{6!4!}$ \item[(E)] None of the above answers is correct \end{itemize} \mnquestionfooter \mnpaperfooter \pagebreak \def\mnserialnumber{2} \mnpaperheader \mnexercisestartheader \smallskip \def\mnquestionnumber{1} \mnquestionheader In how many ways can we choose $n$ objects from $k$ different objects, if the order of choice does not matter? \begin{itemize} \item[(A)] ${k(k-1)\cdots(k-n+1) \over n\cdot(n-1)\cdots2\cdot 1}$ \item[(B)] ${n(n-1)\cdots(n-k+1) \over k\cdot(k-1)\cdots2\cdot 1}$ \end{itemize} \mnquestionfooter \smallskip \def\mnquestionnumber{1} \mnquestionheader The binomial coefficient ${n \choose k}$ equals \begin{itemize} \item[(A)] $0$ if $k=0$. \item[(B)] ${n \choose n-k}$. \item[(C)] The previous two answers are incorrect. \end{itemize} \mnquestionfooter \smallskip \def\mnquestionnumber{1} \mnquestionheader How many circular orderings of the numbers $0,1,\ldots,10$ are there? (Two circular orderings which differ only by a rotation are not considered different.) \begin{itemize} \item[(A)] $3^{11}$ \item[(B)] $11!$ \item[(C)] $9!$ \item[(D)] $10!$ \item[(E)] None of the above answers is correct \end{itemize} \mnquestionfooter \smallskip \def\mnquestionnumber{1} \mnquestionheader In how many ways can the numbers $0, 1, \ldots, 10$ be put in order? \begin{itemize} \item[(A)] $2^{10}$ \item[(B)] $11!$ \item[(C)] $10\times 10$ \item[(D)] $10!$ \item[(E)] None of the above answers is correct. \end{itemize} \mnquestionfooter \mnpaperfooter \pagebreak \end{document}

Manyex also writes a file with the answer key for the two exams. Each
line of this file contains the exam number and the correct answers for
each question. The file is called `mn-correct`, and in this case it
contains:

001BBDC 002ABDB

This file can be used to correct the exams. Manyex also creates an
answer LaTeX file to distribute the correct answers, which by default is
called `answer.tex`, which we do not show in this simple
example. It can also create a LaTeX file to be converted into html code
with the program tth, to be published in the web as a form. We will
present a full example at the end of this manual.