# Auto Multiple Choice

Design of MCQ tests with automated correction and grading

2021-11-21

AMC is a set of utilities allowing the use of MCQ written in plain text or LaTeX, and their automated correction and grading from scans of the answer sheets using Optical Mark Recognition (OMR). This document describes its use (for the version 1.5.2~r:d5fe5a59).

You can find the AMC web-site at https://www.auto-multiple-choice.net/, and the source code at https://gitlab.com/jojo_boulix/auto-multiple-choice/.

Alexis

    paamc@passoire.fr

Bienvenüe Main author
Anirvan Sarkar Author and Editor
Hiroto Kagotani Editor
Frédéric Bréal Author and Editor
2008-2021 Alexis Bienvenüe
Bérard Jean Translation from French
Khaznadar Georges Translation from French

This document can be used according to the terms of the GNU General Public License, version 2 or later.

## License

Auto Multiple Choice is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

## Prerequisites

### Operating system

The AMC utilities have been written for Linux. They can also be installed on MAC OS X using MacPorts.

### Software

If you install AMC with deb or RPM package (on debian, Ubuntu and derivatives, Mandriva, openSUSE, Fedora), every software used by AMC will be automatically installed.

The main packages/software that are required for the use of AMC are the following:

- LaTeX

- image processing libraries ImageMagick and OpenCV

- Perl, together with Gtk2-Perl and Glade::XML for the graphical user interface

#### Recommended versions for software used by AMC

A few bugs in old versions of software used by AMC are particularly detrimental to its operating normally:

- With old versions of Net::CUPS (debian package libnet-cups-perl), the command for printing the test sheets leads to a premature exit from the AMC graphical user interface. This bug is fixed in versions 0.61 and later of Net::CUPS.

- With old versions of ImageMagick, the merging of corrected answer sheets into a single PDF file per student does not work when answer sheets comprise more than one page. This bug is fixed in versions 6.5.5 ad later of ImageMagick.

### LaTeX

From version 1.1 of AMC, it is not mandatory anymore to write your questionnaires using LaTeX language (see for a plain text alternative syntax). However, LaTeX is still the native AMC language for questionnaires descriptions, and allows the user to design his questionnaires with tremendous freedom. The templates that are provided should allow those who are not deterred by LaTeX format to quickly start writing their own MCQs.

## Usage notes

### Numerical limitations

In the present version (starting with version 0.156), the maximum number of students per test is limited to 4 095, and the maximum number of pages per test is limited to 63 ( Modifiable default values, see ).

The maximum number of answers for a given question is limited to 199 (Unmodifiable default value).

LaTeX's own limitations may make compilation impossible, producing e.g. a « No room for a new \toks » error. In that case, try again using the package etex, thanks to the `\usepackage{etex}` command.

### Versions

Even though it should not have too many consequences, it is recommended not to change the program version while working with a given project (between the time when the test sheets are printed and the time when tests are corrected and graded). There are a few modifications which may interfere with AMC operating normally if you apply them while working with a given project:

- If you have compiled and printed with a version of AMC earlier than 0.155, and then handle the project with version 0.156 or later, add the option `versionA` in the reference to the package automultiplechoice in the LaTeX file. Example:

      \usepackage[box,completemulti,versionA]{automultiplechoice}

- From version 0.262 on, the drawing of the checkboxes changed to be slightly larger, which may alter the layout of the test sheets.

- From version 0.267, if you want to produce A4 format test sheets, you have to state it explicitly in the LaTeX file:

      \documentclass[a4paper]{article}

- From version 0.394, if your LaTeX code needs package graphicx, you have to load it explicitly (earlier versions of AMC loaded it).

- The LaTeX command `\AMCcode` was rewritten in version 0.518. It is now more robust and configurable, but you will have to adapt the LaTeX sources you wrote for older versions to keep the same layout.

- From version 1.1.0, all AMC data is stored in SQLite databases instead of lots of XML files. The first time you open a project, old XML files will be converted to the new format.

### Installation

With debian, Ubuntu, or a derived operating system, you can use the debian official repository and ubuntu AMC repositories. On Mandriva, openSUSE or Fedora, you can use prebuilt RPM packages. The installation procedure is described on the AMC web-site.

You can also download the source code archive on the project download space, then use the following commands in a terminal:

    tar xvzf auto-multiple-choice_xxxx_precomp.tar.gz
    cd auto-multiple-choice-xxx
    make
    sudo make install

### Access

Once the installation is made, the graphical user interface can be launched by choosing Applications Education Auto Multiple Choice in the Gnome general menu (or its KDE or other analog), but one can also use the `auto-multiple-choice` command.

## AMC-TXT syntax

For users who are not ready to learn LaTeX (if not already familiar with this language), AMC includes a filter to process simple plain text files in a particular format, named AMC-TXT. This section is devoted to detail the syntax of AMC-TXT files. If you prefer use LaTeX to gain a fine-control over your questionnaires, skip to next section.

Let us begin with a simple example:

    # AMC-TXT source file
    Title: My first AMC questionnaire

    Presentation: Please answer the following questions
    the best you can.

    * What is the capital city of Cameroon?
    + Yaounde
    - Douala
    - Kribi

    ** From the following numbers, which are positive?
    - -2
    + 2
    + 10

The file that contains your questionnaire must be a plain text file, UTF-8 encoded. This is the default encoding of several text editors, like `gedit`. Don't use a text editor that can format your text with bold, images, and so on, like OpenOffice/LibreOffice, or equivalent: these save your text with a lot of other data, and AMC won't be able to read it.

The default font that will be used is libertine, an open source font that contains characters for a lot of languages. You have to install this font or choose another one (see options below). If you install AMC with a debian/ubuntu package, this font will be install together as a recommended package.

You already understand AMC-TXT structure: some general options first, and then questions.

### Comments

You can write some comments inside your AMC-TXT source file in lines beginning with a ``#`'. These lines won't be considered by AMC.

### General options

Here are the options you can use (in any order):

Lang:

  use it to specify a language the questionnaire is written in. At present, only DE (German), ES (Spanish), FR (French), IT (Italian), NL (Dutch), NO (Norwegian), PT (portuguese), JA (Japanese, see ) and AR (Arabic, see ) are supported. Without this option, English will be selected. You can also define the localized string used for another language (see the `L-xxx` options).

PaperSize:

  Sets the paper size. Possible values are `A3`, `A4`, `A5`, `A6`, `B3`, `B4`, `B5`, `B6`, `letter`, `legal`, `ANSIA`, `ANSIB`, `ANSIC`, `ANSID`, `ANSIE`.

Title:

  The exam title, written on top of the sheet.

Presentation:

  A text that presents the exam (length, rules...).

ShuffleQuestions:

  If 1 (default), questions will be shuffled so that their order is different from one sheet to the other. If 0, the questions will always show with the same order as in your file.

RandomSeed:

  One can modify the seed of the random number generator used to produce the shuffle, thanks to the option. If the value that is assigned ( to be chosen between 1 and 4194303) is modified, then the shuffling will differ. Of course, one must not modify this value after the test sheets have been printed.

  The value is saved in the xy file (as `\rngstate{1}{1527384}`). The default value is equal to 1527384.

Code:

  Give a positive integer value n to add boxes so that students will be able to code their student number on their sheets, with n digits.

CodeDigitsDirection:

  Sets the direction for code's digits boxes (either `vertical` or `horizontal`). If unset, AMC will choose the direction from the number of digits (horizontal for small number of digits, and vertical for high number of digits).

Columns:

  Give a positive integer value n to get a subject with n columns.

CompleteMulti:

  If 1 (default), for multiple questions (those for which zero, one or several answers are correct), an answer "None of these answers are correct" will be added. Without it, it should be impossible to make a difference between "the student didn't answer for this question" and "the student thinks no answer is correct for this question". If you don't want this answer to be added, set this option to 0.

L-None:

  Give a string to replace None of these answers are correct (see previous option).

QuestionBlocks:

  If 1 (default), all questions will be enclosed in a invisible frame that prevents it to be split across several columns or pages. If 0, questions are allowed to be split if necessary: that can save pages at the cost of readability.

L-Question:

  Give a translation of Question in your questionnaire, if you need.

L-Name:

  Give a translation of Name and surname, a text written in the box where students are to write their identity.

L-Student:

  Small text that asks students to code their student numbers and write their name, when `Code` option is used.

TitleWidth:

  Width of the title zone, when `Code:` is not used. Default value is `.47\linewidth`.

NameFieldWidth:

  Width of the name field part. Usual LaTeX dimensions can be used. The default value is `5.8cm` when `Code:` is used, and `.47\linewidth` without `Code:`.

NameFieldLines:

  Number of lines in the name field box. Default is `2` when `Code:` is used, and `1` otherwise.

NameFieldLinespace:

  Line space in the name field box. Defaut value is `.5em`.

Pages:

  Gives a minimal number of pages for each question sheet. If a question has less pages, some white pages will be added. When using a separate answer sheet, this option can be written `q+a` (eg. `4+2`), where q will be the minimum number of pages for the question itself, and q+a the minimum number of pages for the whole sheet.

ManualDuplex:

  If 1 (this is not the default value), each subject will consist of an even number of pages, so that the user can manually print the PDF subject for all students in one go in duplex mode.

SingleSided:

  If 1 (this is not the default value), no blank page will be added between the question and the separate answer sheet, even if the question has an odd number of pages. This mode can be useful when the subjects are printed single-sided, or when it is not necessary to separate question and answer sheet.

BoxColor:

  Color of the boxes to be filled by the students. This allows to print the boxes with some color that won't disturb too much the data capture (for example red, but some light gray can also be considered). The color has to be given as a valid `xcolor` color (see `xcolor` LaTeX package documentation for details), such as red, magenta, pink, lightgray, cyan, or in the form `#RRGGBB`, like `#FFBEC8` for some light red.

DefaultScoringS:

  Default scoring strategy for simple questions (questions for which one and only one answer is correct). See for details. The default value gives one point for the right answer, and zero for others.

DefaultScoringM:

  Default scoring strategy for multiple questions (questions for which there can be zero, one or several correct answers). See for details. The default value is `haut=2`, so that a perfect answer gives 2 points, and each error (ticking a box that should not be ticked, or leaving a box that should be ticked unticked) takes one point off (keeping the score non-negative).

LaTeX:

  Set this option to 1 if you want to use LaTeX commands in your texts. This allows for example to insert mathematical formulas, like `$\sqrt{a+b}$`. If 0 (default), all your texts will be written unmodified.

LaTeX-Preambule:

  Give commands you want to be added to the LaTeX preambule (for example `\usepackage` commands).

LaTeX-BeginDocument:

  Give commands to be inserted at the beginning of the LaTeX `document` environment (for example macro definitions).

LaTeX-BeginCopy:

  Give LaTeX commands to be inserted at the beginning of the copy description.

LaTeX-EndCopy:

  Give LaTeX commands to be inserted at the end of the copy description.

PDF-BeginCopy:

  Give the name of a PDF file to be inserted at the beginning of all copies of the exam.

PDF-EndCopy:

  Give the name of a PDF file to be inserted at the end of all copies of the exam.

Disable:

  Gives a comma-separated list of features to disable. Current implemented features are `verbatim` (see ), `images` (see ), `embf` (see ) and `local_latex` (see ).

PackageOptions:

  Gives some more options to pass to the automultiplechoice LaTeX package (see ).

#### Separate answer sheet

To use separate answer sheets for your questionnaire, consider the following options:

SeparateAnswerSheet:

  If 1, a separate answer sheet will be added.

AnswerSheetTitle:

  Title of the answer sheet.

AnswerSheetPresentation:

  Presentation of the answer sheet. For example, remind the students that the answers are to be given on this sheet only.

AnswerSheetColumns:

  Number of columns for the answer sheet.

AutoMarks:

  If 1, uses `automarks` option (see ).

#### Nominative sheets

In some situations, it can be useful to prepare nominative sheets for all students, from a list of students. Let us see how this can be done.

PreAssociation:

  The list of the students' filename with .csv extension.

PreAssociationKey:

  Primary key from this list: the name of the column, in the list of students, with the students' numbers (see ).

PreAssociationName:

  \forname{} \name{} headers in the students list for the current student

- The students list has to be a CSV list. Suppose in the following that the file students.csv, in the project directory, is UTF8 encoded and that its content is like the following:

      name,forename,id,mail
      Boulix,Jojo,001,jojo@boulix.fr
      Golin,André,002,andre@golin.fr
      Moniuszko,Stanisław,003,Moniuszko@Stanisław.fr

  Do not use _ (underscore) with the student's name or forename. A compilation error will be displayed.

- `Code` must be equal to zero or omitted.

    # AMC-TXT source file and nominative sheets.

    PaperSize: A4
    Lang: EN
    PreAssociation: students.csv
    PreAssociationKey: id
    PreAssociationName: \forename{} \name{}
    Title: My first AMC questionnaire

    Presentation: Please answer the following questions
    the best you can.

    * What is the capital city of Cameroon?
    + Yaounde
    - Douala
    - Kribi

    ** From the following numbers, which are positive?
    - -2
    + 2
    + 10

More details about correction: see the last item .

### Questions

Simple questions (questions for which one and only one answer is correct) begin with a `*` at the beginning of the line, and multiple questions (questions for which there can be zero, one or several correct answers) begin with a `**`. Insert then the question itself, and the choices, introduced with a `+` for correct ones and with a `-` for wrong ones.

#### Questions options

Some options are available for questions. They must be separated by commas and enclosed by square brackets just after the leading `*`'s, as in the following example:

    *[ordered,horiz,id=sum] How much are
    one plus one?
    - 0
    - 1
    + 2

Available options for questions:

horiz

  present choices horizontally, not on separated lines.

columns=n

  make n columns for the choices.

ordered

  don't shuffle the choices, keep the same order as in the description file.

id=xxxx

  Give a name to the question, so as to locate the corresponding results easily in the exported spreadsheets. This name must contain only simple characters, without accents and LaTeX special characters such as `_`, `^`, `%`...

  `name` can also be used instead of `id` for compatibility with old versions, but you should prefer using `id`.

indicative

  don't use this question score to compute the global student's score.

next

  Use this option if you want the question to stay next to the previous one, even when using questions shuffling with `ShuffleQuestions` general option.

first

  Use this option to place the question always at the beginning of the group (see ).

last

  Use this option to place the question always at the end of the group (see ).

#### Scoring strategy

You can set the scoring strategy for a particular question or choice enclosing it with braces just after the leading characters (`*`, `**`, `+` or `-`) and the possible options, as in the following example. See for details about the scoring strategy syntax.

    *{b=2,m=-1} What is the capital city of France?
    + Paris
    - Lille
    - Marseille
    - Ouagadougou
    -{-2} New York

    **[ordered,horiz,id=positive]{haut=1} From the following numbers, which are positive?
    - -2
    + 2
    + 10

#### Open questions

You can define open question giving options (see ) enclosed with `<` and `>`, as in the following example:

    *<lines=4> Describe the moon.
    -[O]{0} O
    -[P]{1} P
    +[V]{2} V

You should also consider using the following global options:

L-OpenText:

  Text used to tell the student to write the answer on the separate answer sheet (if relevant).

L-OpenReserved:

  Text to be written along the open questions boxes to tell the student not to consider these boxes.

### Multi-line

You can always continue some text on the next lines (even if some of them are empty), provided that these following lines cannot be considered as the beginning of an option definition, of a question or of a choice. As an example, consider the following question:

    * How much are 2
    + 2?
    - 0
    + 4
    - 10

This is a correct AMC-TXT question. However, it won't be treated as you'd like to, because here the second line is not considered as being the following of the first one, but form the first choice of the question!

A similar problem arises from the following AMC-TXT question, where ``Gershwin:`' is considered as a general option definition...

    * You all know Georges
      Gershwin: he is a composer.
      When was he born?
    + in 1898
    - in 1892
    - in 1902

This is a correct way to write it:

    * You all know Georges Gershwin:
      he is a composer.
      When was he born?
    + in 1898
    - in 1892
    - in 1902

Note that line breaks can be inserted leaving an empty line, as:

    Presentation: Title

    Description of the exam.

    ** Difficult question.

    How many stars in the sky?
    - one
    - two
    - ten millions

### Title

To get a title, enclose it between `[==` and `==]`.

### Verbatim content

To get a verbatim block (as computer code), enclose it between `[verbatim]` and `[/verbatim]`:

    * What does this program print?
    [verbatim]
    main( )
    {
        printf("hello, world\n");
    }
    [/verbatim]

    + [| hello, world |]
    - [| hello |]
    - [| world |]

### Bold, italic, typewriter, underlined

To get bold text, enclose it between `[*` and `*]`. To get italic text, enclose it between `[_` and `_]`. To get typewriter text, enclose it between `[|` and `|]`. To get underlined text, enclose it between `[/` and `/]`.

    * What is the [*capital city*] of [_France_]?
    + Paris
    - Lille
    - Marseille

### Images

You can add images in your document using the following syntax:

    ![height=2cm]images/bird.png!

Here, the image `images/bird.png` that is located in the project directory will be appended with 2cm height. Options that can be used inside the square brackets are those from the `\includegraphics` LaTeX command (width=3cm or keepaspectratio for example). To get a centered image that is three quarters of the line width, use

    !{center}[width=.75\linewidth]images/map.pdf!

### Pieces of LaTeX code

You can include some small parts of LaTeX code in your document, including it in double square brackets, as in:

    Questions with a [[\multiSymbole{}]] may have zero, one or more right answers.

### Questions groups

You can group some question so that they stay together even when shuffling, with the following syntax:

    *( Questions about Martin Luther King.

    * When was he born?
    - in 1901
    + in 1929
    - in 1968

    * When did he die?
    - in 1945
    - in 1515
    + in 1968
    - in 1999

    * Where was he born?
    + Atlanta
    - Memphis
    - New York

    *) End of questions on Martin Luther King.

You can specify some options on groups, like:

    *([shuffle=false,columns=2] Questions about Martin Luther King.

The following options are available:

shuffle=xxx

  Give true or false to tell if you want to shuffle the questions inside the group. The default value if the global one, from the `ShuffleQuestions` option.

columns=n

  Number of columns for the group's questions.

group=nom

  Give a name for the group (for internal matter).

numquestions=n

  With this option, only the first n questions of the group will be used. If the questions are shuffled, this allows to get n questions chosen at random from the group.

  Question with option `first` or `last` are not affected (they are always inserted). Moreover, questions stuck together with option `next` count as one single question.

needspace=dimen

  Gives a height (dimension with unit, such as 4cm) necessary to begin with the group. If the remaining vertical space on the current page is lower than this value, the group will begin on the next page.

### Arabic language

Writing a questionnaire in Arabic is a little special. Use of course option

    Lang: AR

You can also consider the following global options:

ArabicFont:

  This is the font used for Arabic text. Default value is Rasheeq, a font from the project ArabEyes (you can find it on debian/ubuntu in the ttf-arabeyes package).

To insert texts with non-Arabic characters, you must turn on `LaTeX` option and enclose these texts as a `\textLR` LaTeX command argument, as in `\textLR{xelatex command}`.

### Japanese language

Japanese language questionnaires can be produced with option

    Lang: JA

AMC will make some adjustments on the produced LaTeX source to allow Japanese characters to be included.

In this case, AMC will use `pTex` to process the LaTeX file made from your AMC-TXT source file. AMC needs a recent version of `pTex` to work. Versions of pTex from texlive 2009, that can be found on old versions of some linux distributions, are not compatible.

### Including other files

You can include other files with:

    IncludeFile: file-to-include.txt

Be very careful when including a single file from different projects! Suppose for example that `/home/alexis/questions-a.txt` is included from projects A and B. You already processed project A, and you are currently working on project B. You update the scoring strategy of a question in `/home/alexis/questions-a.txt`, and also add another question. If you need to update the marks in project A with this new scoring strategy, AMC will also see a new question for which no data capture has been made, and this will spoil all your marks in A...

### A minimal example (a little bit more complete)

An example from french forum

    # A minimal example (a little bit more complet)
    PaperSize: A4
    Lang: FR
    CompleteMulti: 0
    ShuffleQuestions: 0
    LaTeX:1
    LaTex-Preambule: \geometry{hmargin=2cm,headheight=2cm,headsep=.3cm,footskip=1cm,top=2.5cm,
    bottom=2cm}

    \usepackage{siunitx}
    \sisetup{locale = FR,detect-all,per-mode=symbol,quotient-mode=fraction,input-product=*,%
    list-final-separator = { \translate{et} },list-pair-separator = { \translate{et} },%
    range-phrase = { \translate{à} },separate-uncertainty = true,group-minimum-digits=3,%
    per-mode=symbol,inter-unit-product=\ensuremath{{}\!\cdot{}\!{}}}

    \usepackage[french]{babel}

    LaTeX-BeginDocument: \def\multiSymbole{$\star$}

    Title: Évaluation de SVT \no{}4   : Régimes et équilibres alimentaires

    Presentation: Colorier en noir la case correspondante à la proposition correcte pour chaque
     phrase.

    *([shuffle=true]
     PARTIE I : Quelques connaissances du cours

    **[horiz,last]Les aliments contiennent :
    + Des lipides
    - Des acides
    + Des sels minéraux

    **La dépense énergétique minimum de notre corps est :
    + Le métabolisme de base
    - Les besoins énergétiques
    - L'IMC

    **[columns=2]Les aliments nous apportent de :
    + La matière
    - Du diabète
    + De l'énergie

    **[columns=2]Les besoins énergétiques d'une personne varient suivant :
    + Le sexe
    + Les activités physiques
    - Les aliments consommés

    *[columns=2]Manger équilibré signifie :
    + Equilibrer nos apports et nos dépenses
    - Manger ce qui nous fait envie
    - Manger plus que ce qu'on dépense

    **[columns=2]Manger en excès par rapport à ses besoins peut aboutir à :
    - Des carences
    + Des maladies cardio-vasculaires
    - Un manque de nutriments

    **[columns=2]L'IMC signifie :
    - Indice de Maladies cardio-vasculaires
    + Indice de Masse Corporelle
    - Indice de Matière et de Composition

    *)

    *(PARTIE II : Le goûter de Vanessa

    **[columns=2]Dans le gouter de Vanessa, l'aliment le plus énergétique est :
    - les pruneaux
    + Les biscuits
    - les deux sont identiques.

    **[columns=2]Par rapport aux biscuits, les pruneaux contiennent  :
    + moins de protides
    - plus de glucides
    + moins de lipides

    **[columns=2]Les dépenses énergétiques journalières d'une adolescente sont en moyenne de
    \SI{10000}{\kilo\joule} .
     Vanessa a consommé \SI{3200}{kJ} au petit-déjeuner, \SI{3500}{kJ} à midi et
      \SI{2400}{\kilo\joule} au diner. Elle a donc mangé équilibré :
    - Faux
    + Vrai

    *)

The answer "None of these answers are correct" will be not added.

Questions will not be shuffled.

Allow to insert LaTeX code.

Different usefull packages.

The multisymbole is now a star.

Use of LaTeX language through the babelpackage.

Those questions will be shuffled.

This question will be always at last position.

`LaTeX:1` and `LaTeX-Preambule` make possible this LaTeX code.

## LaTeX source file

This section describes the LaTeX commands that allows you to design your exam answer sheets from a LaTeX source file. If you chose another format for your source file, you can skip this section. The MCQ can be described as a LaTeX file using the automultiplechoice package. You can check the LaTeX file you are designing at any moment by compiling it with the `latex` command, then visualizing the resulting dvi file.

We start with a few examples giving quick illustrations of how to build LaTeX files for MCQs; the corresponding tex file are available as templates, so that one can create a new MCQ project starting with one of these templates.

### A simple example

    \documentclass[a4paper]{article}

    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[box,completemulti]{automultiplechoice}
    \begin{document}

    \onecopy{10}{

    %%% beginning of the test sheet header:

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
    \centering\large\bf Test\\ Examination on Jan., 1st, 2008\end{minipage}
    \namefield{\fbox{
                    \begin{minipage}{.5\linewidth}
                      Firstname and lastname:

                      \vspace*{.5cm}\namefielddots
                      \vspace*{1mm}
                    \end{minipage}
             }}

    \begin{center}\em
    Duration : 10 minutes.

      No documents allowed. The use of electronic calculators is forbidden.

      Questions using the sign \multiSymbole{} may have
      zero, one or several correct answers.  Other questions have a single correct answer.

      Negative points may be attributed to \emph{very
        bad} answers.
    \end{center}
    \vspace{1ex}

    %%% end of the header

    \begin{question}{prez}
      Among the following persons, which one has ever been a President of the French Republic?
      \begin{choices}
        \correctchoice{René Coty}
        \wrongchoice{Alain Prost}
        \wrongchoice{Marcel Proust}
        \wrongchoice{Claude Monet}
      \end{choices}
    \end{question}

    \begin{questionmult}{pref}
      Among the following cities, which ones are French prefectures?
      \begin{choices}
        \correctchoice{Poitiers}
        \wrongchoice{Sainte-Menehould}
        \correctchoice{Avignon}
      \end{choices}
    \end{questionmult}

    % \AMCaddpagesto{3}

    }

    \end{document}

A few extra details on this example:

The packages inputenc and fontenc allow one to use the UTF-8 encoding. You can of course modify them depending on the encoding you want to use.

The options used here for the automultiplechoice LaTeX package prevent questions from being split between two pages (`box`) and to automatically complete any multiple choice question by a standard answer allowing the student to mention that, in her/his opinion, none of the listed answers is correct (`completemulti`).

The `onecopy` command produces as many (distinct) realizations of the MCQ test as desired (here 10). See for an alternative syntax using an environment.

Lines that start here describe the header of the test-sheet.

The `namefield` command specifies where students write their name or a barcode (see ). Will be completed with `\namefielddots` if you use `pdfform` option (see ).

The `namefielddots` command insert a dotted line or a field to fill if the `pdfform` option is avaible (see ).

The environments `question` and `choices` allow one to build a multiple choice question for which there is a single correct answer. A unique identifier for the question has to be specified (here: prez).

The environments `questionmult` and `choices` allow one to build a multiple choice question that may have zero, one or several correct answers. Student are asked to check all the boxes corresponding to an answer that she/he thinks is correct, or the last box (added automatically thanks to the `completemulti` option used in the reference to the package in line 6).

Uncomment this line to add enough blank pages to get a 3-pages copy (see).

This marks the end of the `onecopy` command (started at line 9).

### An example with groups of questions and shuffling

In this example, we want the order in which questions appear in the MCQ test to be different from one realization of the test to the other, but still keeping together questions dealing with the same subject. To this end, we create two groups of questions, within which questions are shuffled at random.

    \documentclass[a4paper]{article}

    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[box,completemulti]{automultiplechoice}
    \begin{document}

    %%% preparation of the groups

    \setdefaultgroupmode{withoutreplacement}

    \element{geographie}{
      \begin{question}{Paris}
        In which continent is Paris?
        \begin{choices}
          \correctchoice{Europe}
          \wrongchoice{Africa}
          \wrongchoice{Asia}
          \wrongchoice{planet Mars}
        \end{choices}
      \end{question}
    }

    \element{geographie}{
      \begin{question}{Cameroon}
        Which is the capital city of Cameroon?
        \begin{choices}
          \correctchoice{Yaoundé}
          \wrongchoice{Douala}
          \wrongchoice{Abou-Dabi}
        \end{choices}
      \end{question}
    }

    \element{histoire}{
      \begin{question}{Marignan}
        In which year did the battle of Marignan take place?
        \begin{choiceshoriz}
          \correctchoice{1515}
          \wrongchoice{1915}
          \wrongchoice{1519}
        \end{choiceshoriz}
      \end{question}
    }

    \element{histoire}{
      \begin{questionmult}{Nantes}
        What can be said about the \emph{Édit de Nantes}?
        \begin{choices}
          \correctchoice{It was signed in 1598}
          \correctchoice{Il has been revoked by Louis XIV}
          \wrongchoice{It was signed by Henri II}
        \end{choices}
      \end{questionmult}
    }

    %%% copies

    \onecopy{10}{

    %%% beginning of the test sheet header:

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
      \centering\large\bf History and geography\\ Examination on Jan. 1st, 2008
    \end{minipage}
    \namefield{\fbox{\begin{minipage}{.5\linewidth}
    Firstname and lastname:

    \vspace*{.5cm}\dotfill
    \vspace*{1mm}
    \end{minipage}}}

    %%% end of the header

    \begin{center}
      \hrule\vspace{2mm}
      \bf\Large Geography
      \vspace{1mm}\hrule
    \end{center}

    \insertgroup{geographie}

    \begin{center}
      \hrule\vspace{2mm}
      \bf\Large History
      \vspace{2mm}\hrule
    \end{center}

    \insertgroup{histoire}

    }

    \end{document}

### An example with a separate answer sheet

In this example, one wants the check-boxes to be put together in a separate sheet. This makes cheating more difficult, and, more importantly, it is enough to scan a single sheet per student, which makes things easier if one has to do a manual scan. In this example, the number of questions is limited: they fit into a single page, so that such a layout would not be really useful in this particular case. It is up to you to modify this example in order to use this layout with a large number of questions!

    \documentclass[a4paper]{article}

    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[box,completemulti,separateanswersheet]{automultiplechoice}
    \begin{document}

    \AMCrandomseed{1237893}

    \def\AMCformQuestion#1{{\sc Question #1:}}

    \setdefaultgroupmode{withoutreplacement}

    \element{general}{
      \begin{question}{prez}
        Among the following persons, which one has ever been a President of the French Republic?
        \begin{choices}
          \correctchoice{René Coty}
          \wrongchoice{Alain Prost}
          \wrongchoice{Marcel Proust}
          \wrongchoice{Claude Monet}
        \end{choices}
      \end{question}
    }

    \element{general}{
      \begin{questionmult}{pref}
        Among the following cities, which ones are French prefectures?
        \begin{choices}
          \correctchoice{Poitiers}
          \wrongchoice{Sainte-Menehould}
          \correctchoice{Avignon}
        \end{choices}
      \end{questionmult}
    }

    \element{general}{
      \begin{question}{nb-ue}
        How many different states were members of the European Union in Jan. 2009?
        \begin{choiceshoriz}[o]
          \wrongchoice{15}
          \wrongchoice{21}
          \wrongchoice{25}
          \correctchoice{27}
          \wrongchoice{31}
        \end{choiceshoriz}
      \end{question}
    }

    \onecopy{5}{

    %%% beginning of the test sheet header:

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
      \centering\large\bf Test\\ Examination on Jan. 1st, 2008
    \end{minipage}

    \begin{center}\em
    Duration : 10 minutes.

      No documents allowed. The use of electronic calculators is forbidden.

      Questions using the sign \multiSymbole{} may have
      zero, one or several correct answers.  Other questions have a single correct answer.

      Negative points may be attributed to \emph{very
        bad} answers.

    \end{center}
    \vspace{1ex}

    %%% end of the header

    \insertgroup{general}

    \AMCcleardoublepage

    % \AMCaddpagesto{3}

    \AMCformBegin

    %%% beginning of the answer sheet header

    {\large\bf Answer sheet:}
    \hfill \namefield{\fbox{
        \begin{minipage}{.5\linewidth}
          Firstname and lastname:

          \vspace*{.5cm}\namefielddots
          \vspace*{1mm}
        \end{minipage}
      }}

    \begin{center}
      \bf\em Answers must be given exclusively on this sheet:
      answers given on the other sheets will be ignored.
    \end{center}

    %%% end of the answer sheet header

    \AMCform

    % \AMCaddpagesto{5}

    }

    \end{document}

The following remarks should make the above example clearer :

The `separateanswersheet` option is what allows us to do what we wanted.

One can re-define in this manner the way the questions are identified on the answer sheet (this line is optional).

This page break is put before the special page where the check-boxes are put together. If one does recto-verso printing, it is preferable to use `\AMCcleardoublepage` so that this page is printed apart from the others. In the case of recto printing, one can simply use `\clearpage`.

Uncomment to get three pages for the question part of each copy, see . (Here, the command is commented so no effect.)

This command marks the beginning of the answer sheet part. Its use is necessary for the appropriate treatment of the questions which appear only in that part, e.g. those generated by `\AMCcodeGrid`.

Students should normally write their name on the answer sheet!

The `namefielddots` command insert a dotted line or a field to fill if the `pdfform` option is avaible (see ).

The LaTeX command `\AMCform` writes all the check-boxes.

Uncomment to get five pages for the whole copy (question+answer sheet), see .

When one uses a separate answer sheet, letters (or digits, if one uses the option `digits`, see ) are written in the check-boxes. To achieve a correct detection of the checked boxes, one has to ask students to completely fill the relevant boxes (checking by simply drawing a cross would not suffice). One also has to tune the gray level threshold (defining the proportion of black dots in a box above which that box is considered to be checked) to a value of order 0.5.

### Description of the LaTeX commands

#### Package options

To use the automultiplechoice package, one uses the line

    \usepackage[...]{automultiplechoice}

where the dots are replaced by a list of options separated by commas. Here are the available options:

- `lang=XX`: sets the subject language to XX. At present, only DE (German), ES (Spanish), FR (French), IT (Italian), JA (Japanese), NL (Dutch), NO (Norwegian) and PT (Portuguese) are available. Several strings added by automultiplechoice will be translated, such as "None of these answers are correct", see option `completemulti`.

- `pdfform`: creates a pdf file to fill.

- `box`: puts every question in a block, so that it cannot be split by a page break.

  You may occasionally cancel this option for each question with the command `\AMCnobloc`.

      {\AMCnobloc%
        \begin{question}{nb-ue}
          How many different states were members of the European Union in Jan. 2009?
          \begin{choiceshoriz}[o]
            \wrongchoice{15}
            \wrongchoice{21}
            \wrongchoice{25}
            \correctchoice{27}
            \wrongchoice{31}
          \end{choiceshoriz}
        \end{question}
      }%

- `asbox`: same as `box`, but inside the separate answer sheet.

- `completemulti`: automatically adds a "None of these answers are correct" choice at the end of each multiple question. Thus, for these questions, a distinction can be made between no answer and the answer consisting in treating none of the listed answers as correct. This behavior can be forced or canceled for a particular question using one of the commands `\AMCcompleteMulti` or `\AMCnoCompleteMulti` inside the corresponding `questionmult` environment.

- `noshuffle`: stops the automatic shuffling of the answers for every question

- `noshufflegroups`: stops the automatic shuffling of the group for the test (see )

- `answers`: produces the corrected version of the MCQ test, not the test sheet itself.

- `indivanswers` : produces the corrected version of each MCQ test.

- `separateanswersheet`: requires that all check-boxes be put together at the end of the test sheet (usually, this option is used when one wants to have only one sheet to scan per student - see the example in ).

- `digits`: if one uses the `separateanswersheet` option, the `digits` option requires the question to be identified with digits rather than with letters (which corresponds to the default setting).

- `outsidebox`: when using `separateanswersheet`, this option asks to print letters (or digits) outside the boxes on the answer sheet.

- `init` : initializes the random generator from time. This option is only for testing: don’t use it for a real exam!

- `insidebox`: when not using `separateanswersheet`, this options asks to print letters (or digits) inside the boxes to be filled by the students.

- `catalog`: use this option to make a catalog of your questions to be used to compose future exams. No need to use `\onecopy` with this layout.

- `keys=line`: allow one-line key printing in catalog mode.

- `postcorrect`: use this option if you want to give the correct answers after scans analysis, from a teacher completed answer sheet - see for details.

- `fullgroups` : cancels the use of the optional parameter of `\insertgroup` and `\copygroup`, so that each group is always fully inserted and fully copied. (see )

- `storebox` :If you choose to change the boxes' shape (square by default, see ) as ovals or circles, you may communicate this option to automultiplechoice to use `\storebox` rather than `\savebox` to store the design of the boxes.

- `automarks`: in `separateanswersheet` mode, use this option if you want to cancel marks printing on the subject pages. They will only be print on the answer sheet pages. To change the way pages numbers are print on the subject pages, redefine the `\AMCsubjectPageTag` command:

      \renewcommand\AMCsubjectPageTag{%
        \fbox{\texttt{\the\AMCid@etud:\thepage}}%
      }

  Only use `automarks` option if no data are to be collected on the subjects pages, as AMC won't be able to process these pages.

- `nopage`: use this option if you don't need margins, corner circles and page identification boxes, that is if the document is not intended to be used with AMC (for example to produce exercises lists).

- `nowatermark`: remove the watermark (draft) if you compile withoutAMC. Very hazardous.

- `survey`: to create a machine readable questionnaire in high typographical quality https://gitlab.com/CSaalbach/surveyamc-project/-/blob/master/surveyamc_tutorial.pdf..

#### Description of a copy

The LaTeX source code describing the content of the test sheet has to be included in a call to the command `\onecopy`, the first argument being the number of distinct realizations to be produced, and the second argument being the code used to generate a realization.

    \onecopy{50}{ ... }

An alternative syntax is available, using the `examcopy` environment, where the number of realizations is an option (default is 5).

    \begin{examcopy}[50]
    ...
    \end{examcopy}

To use examcopy, you need the environ package to be installed, which is not available in the TeX Live 2007 distribution, still used in Ubuntu distributions up to version 9.10 (Karmic Koala).

To differentiate between odd and even-numbered copy, use `\exemplairepair` command.

The command `\AMCStudentNumber` get the copy number.

#### Questions and answers

Do not nest a question inside a another environment question or tabularx otherwise exporting the notes will be incomplete (see ).

##### Simple questions

For simple questions (a single correct answer), one uses the following model:

    \begin{question}{identifier}
      Here is the question...
      \begin{choices}
        \correctchoice{The correct answer}
        \wrongchoice{A wrong answer}
        \wrongchoice{Another wrong answer}
      \end{choices}
    \end{question}

##### Multiple questions

Multiple questions (those for which no, one, or several answers can be correct) use the `questionmult` environment instead of `question`.

##### Open questions

One can sometimes require some open questions to be added to the subject. One way to do so is to reserve boxes use to the teacher for these questions. After the exam, the teacher reads the completed answer sheets and tick the boxes according to the answers written by the students for open questions. He will then scan the sheets and let AMC correct the multiple choice questions and integrate the open questions scores into the marks.

    \begin{question}{open}
      Define \emph{inflation}.
      \AMCOpen{lines=5}{\wrongchoice[W]{w}\scoring{0}\wrongchoice[P]{p}\scoring{1}\correctchoice[C]{c}\scoring{2}}
    \end{question}

In this example, the teacher will get three boxes. If the first (labeled W for wrong) is ticked, the student will get 0 points. If the second (labeled P for partial) is ticked, the student will get 1 point. If the third (labeled C for correct) is ticked, the student will get 2 points.

The first argument to `\AMCOpen` is a comma separated list of options. The available options are:

lineup=bool

  if `true`, the answering area and the scoring boxes will be on the same line. If `false` (this is default), the answering area is enclosed in a frame and placed below the scoring boxes.

lineuptext=text

  if `lineup=true`, the text and ansewering area will be on the same line.

lines=num

  sets the number of lines for the answer. Default value is `1`.

lineheight=dim

  sets the height of each line. Default value is `1cm`.

dots=bool

  if `true` (Default), each line will be realized by a line of dots.

contentcommand=cmdname

  Use this option if you want to customize the content of the answer area. You will have to define a `\cmdname` command that has to produce the content.

hspace=dim

  sets the space between boxes in the marking area.

backgroundcol=color

  sets the background color of the marking area.

foregroundcol=color

  sets the foreground color of the marking area.

scan=bool

  if `false`, the boxes are not scanned (this can be useful if you plan to use manual data capture only to mark this question, and don't want to take into account the students drawings on the boxes). Defaults to `true`.

annotate=bool

  if `false` (default value), the boxes from this question won't be annotated when annotating the answer sheets (only the score will be written).

question=text

  sets a short text that helps the examiner to identify the question. This text will be written before the scoring boxes, only if a separate answer sheet is used.

  The question's identifier will be displayed if you type question in the options list.

answer=text

  sets a short text that will be written in the answering area for corrected answer sheets.

Use the command `\savebox`, outside the `onecopy` command, to display a longer text with linebreaks.

    \newsavebox{\correcbox}
    \savebox{\correcbox}{\parbox{5cm}{\color{red}{Here a linebreak\\or\\here...}}}

Call out the boxe's contents:

    \AMCOpen{lines=4,lineheight=0.15cm, answer= \usebox{\correcbox}}{the scoring}

- If the answer contains a comma or the equal sign, text must be bracketed by braces.

- If the answer contains commands `\command` or definitions `\def`, you must add `\protect`.

    \FPeval\aRandomVariable{round(3+8*random,2)}
    \FPeval\aCalculateVariable{round(\aRandomVariable*9.81,2)}

    \AMCOpen{answer={m=\protect\SI{\aRandomVariable}{\kilo\gram},%
    P=\protect\SI{\aCalculateVariable}{\newton}}{the scoring}

width=dim

  sets the width of the frame enclosing the answering area when `lineup=false`. Default value is `.95\linewidth`.

framerule=dim

  sets the line width for the frame enclosing the answering area.

framerulecol=color

  sets the frame color for the answering area.

boxmargin=dim

  sets the margin around the scoring boxes.

boxframerule=dim

  sets the line width for the frame around the scoring boxes.

boxframerulecol=color

  sets the color of the frame around the scoring boxes.

You can set other default values (for the whole exam) for all these parameters using the command `\AMCopenOpts`, like

    \AMCopenOpts{boxframerule=2pt,boxframerulecol=red}

Moreover, a little text can be written in the marking area to tell the students not to tick these boxes, redefining the `\AMCotextReserved` command, as:

    \def\AMCotextReserved{\emph{Reserved}}

When using separate answer sheets, the text added to each open question can also be defined, as:

    \def\AMCotextGoto{\par{\bf\emph{Please write the answer on the separate answer sheet.}}}

if the number of boxes is significant, use this tip (`\parbox`) to force a linebreak.

    \AMCOpen{lines=6}{
              \hbox{\parbox{8.5cm}{
              \wrongchoice[F]{F}\scoring{0}
    			    \wrongchoice[1]{1}\scoring{1}
    			    \wrongchoice[2]{2}\scoring{2}
    			    \wrongchoice[3]{3}\scoring{3}
    			    \wrongchoice[4]{4}\scoring{4}
    			    \wrongchoice[5]{5}\scoring{5}
    			    \wrongchoice[6]{6}\scoring{6}
    			    \wrongchoice[7]{7}\scoring{7}
    			    \wrongchoice[8]{8}\scoring{8}
    			    \wrongchoice[9]{9}\scoring{9}
    			    \correctchoice[10]{10}\scoring{10}
                        }}
                }

##### Indicative question

When the answer to the question is not supposed to be taken into account in the grading, one uses the `\QuestionIndicative` command, as in the following example:

    \begin{question}{difficulty}\QuestionIndicative
      \scoring{auto=0,v=-1,e=-2}
      Did you find this class easy or difficult? Please answer on a scale from 0 (very difficult) to 5
      (very easy).
      \begin{choiceshoriz}[o]
        \correctchoice{0}
        \correctchoice{1}
        \correctchoice{2}
        \correctchoice{3}
        \correctchoice{4}
        \correctchoice{5}
      \end{choiceshoriz}
    \end{question}

##### Identifier

One must use a different identifier for every question. An identifier can be made of digits, letters, and simple characters (but do not use e.g. underscores, braces or brackets, that have a special meaning in LaTeX files). Don't end your question identifier with an integer enclosed in square brackets, as this syntax is reserved to codes input.

The style of the identifier may be

    group.identifier

or

    group:identifier

(see ) to get the total of a one group of questions when exporting notes (see ).

##### Question numbers, see also

###### display section N°.question N°

    \makeatletter
    \def\AMCbeginQuestion#1#2{\par\noindent{\bf \the\c@section.#1} #2\hspace*{1em}}
    \makeatother
    %use with amsmath package
    \numberwithin{AMCquestionaff}{section}

###### Reset the numeration

One can modify the number of the next question with the `\AMCnumero command`. At the beginning of each realization of the test, a call to

    \AMCnumero{1}

is done, but this command can be used at any place.

###### Do not display the number

When you want to hide the number for a particular question and do not want to increase the question number, use `\AMCquestionNumberfalse` command as in the following example:

    {
      \AMCquestionNumberfalse
      \def\AMCbeginQuestion#1#2{}
      \begin{question}
        ...
      \end{question}
    }

With nominative sheets (see ), set up it with a new command in the preamble.

    \def\Iswitch{\def\AMCbeginQuestion##1##2{}\AMCquestionNumberfalse}

and use it when you need it. (Do not forget to type inside brackets to limit the effect) :

    {\Iswitch
     \begin{question}{Number}
       Choose the greater.
       \begin{choiceshoriz}[o]
         \wrongchoice{200}\wrongchoice{2}\wrongchoice{20}\wrongchoice{200}\correctchoice{600}
       \end{choiceshoriz}
     \end{question}
    }

In this example, the question number will not be displayed through the command `\AMCquestionNumberfalse`.

###### Questions counter

The internal counter is `AMCquestionaff`. To display the total number of pages at the beginning, it is necessary declare the totcount package. Here an example:

    documentclass[a4paper]{article}

    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[english,box,completemulti]{automultiplechoice}
    \usepackage{totcount}
    \regtotcounter{AMCquestionaff}
    \begin{document}

    \exemplaire{10}{

    There is \total{AMCquestionaff} questions.

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
    \centering\large\bf Test\end{minipage}
    \champnom{\fbox{
                    \begin{minipage}{.5\linewidth}
                      Name and surname :

                      \vspace*{.5cm}\dotfill
                      \vspace*{1mm}
                    \end{minipage}
             }}

    \begin{question}{prez}
        Among the following persons, which one has ever been a President of the French Republic?
        \begin{choices}
          \correctchoice{René Coty}
          \wrongchoice{Alain Prost}
          \wrongchoice{Marcel Proust}
          \wrongchoice{Claude Monet}
        \end{choices}
      \end{question}
    \end{question}

      \begin{questionmult}{pref}
        Among the following cities, which ones are French prefectures?
        \begin{choices}
          \correctchoice{Poitiers}
          \wrongchoice{Sainte-Menehould}
          \correctchoice{Avignon}
        \end{choices}
      \end{questionmult}

    % \AMCaddpagesto{3}

    %\theAMCquestionaff
    }

    \end{document}

##### Putting answers on multiple columns

To put the answers on two columns, one can use the multicol package: load it in the preamble (just after the reference to the package automultiplechoice for instance) with

    \usepackage{multicol}

and include the choices environment inside a multicols environment in the following manner:

    \begin{multicols}{2}
      \begin{choices}
        \correctchoice{The correct answer}
        \wrongchoice{A wrong answer}
        \wrongchoice{Another wrong answer}
      \end{choices}
    \end{multicols}

For even shorter answers, one can require questions to be printed following one another, using the `choiceshoriz` environment instead of `choices`.

To put answers on several columns (and thus save space), one can embed the `choices` environment in a `multicols` environment, using the LaTeX package multicol.

If, moreover, the answers do not fit into a single line, an answer might be split over several columns, which might be a little puzzling for the reader. The `\AMCBoxedAnswers` command was defined in order to prevent this phenomenon, by embedding each answer into a box. Here is an example of use:

    \begin{question}{two columns}
      What is a bird ?
      \begin{multicols}{2}\AMCBoxedAnswers
        \begin{choices}
          \correctchoice{It is an animal with wings, laying eggs. There are birds with all sorts of colors.}
          \wrongchoice{It is a large piece of furniture, made of wood, and used most of the time to store
          household linen}
          \wrongchoice{It is a steam machine devised to seal cans at high speed.}
        \end{choices}
      \end{multicols}
    \end{question}

Let us note that it is also possible to parameterize the vertical space between two answer blocks, thanks to the dimension AMCinterBrep:

    \AMCinterBrep=.5ex

##### One-letter answers

Sometimes this is not necessary to write some long text to describe answers, and one letter or symbol is enough. When using a separate answer sheet, it is quite annoying to print the boxes both on the question and on the answer sheet. In such cases, use `\AMCBoxOnly` instead of the `choices` environment:

    \begin{question}{arm}
      Which letter shows the \textit{arm} on the diagram?
      \AMCBoxOnly{ordered=true}{\wrongchoice[A]{}\correctchoice[B]{}%
        \wrongchoice[C]{}\wrongchoice[D]{}}
    \end{question}

The first argument to `\AMCBoxOnly` is a comma separated list of options. The available options are:

help=text

  prints some reminder text before the boxes on the separate answer sheet.

ordered=bool

  if `true` (the default value is `false`), the answers won't be shuffled.

##### Explanation for the answers of a question

To provide explanation for the answers of a question, one can use the `\explain` command. The explanations are optional and are only displayed in the Solution and Catalog file.

Not displayed in the individual solution. To get around this, type in preamble:

    \makeatletter
    \renewcommand{\explain}[1]{%
      \ifAMC@correc%
      \AMCif@env{question}{\par\noindent{\AMC@loc@explain#1}}{\AMC@error@explain}\vspace{1ex}%
      \else%
      \AMCif@env{question}{}{\AMC@error@explain}%
      \fi%
    }
    \makeatother

Here is a simple example:

    \begin{question}{explanation}
      Which has the highest elevation among the following?
      \begin{choices}
          \correctchoice{Sagarmatha}
          \wrongchoice{K2}
          \wrongchoice{Mont Blanc}
          \wrongchoice{Aconcagua}
      \end{choices}
      \explain{Sagarmatha which literally means `Head of sky' is the native name of
               Mount Everest, the highest mountain in the world.}
    \end{question}

The `explain` command must be typed inside `question` like environments only. This includes `question`, `questionmult` and `questionmultx` environments.

By default this command prints Explanation: before each explanations. This behavior can be changed using the `\AMCtext` command (see section ).

If you want to change this default behavior only for some questions and not for all just use the `\AMCtext` command before the `\explain` command as in the following example:

    \begin{question}{elevation}
      Which has the highest elevation among the following?
      \begin{choices}
          \correctchoice{Sagarmatha}
          \wrongchoice{K2}
          \wrongchoice{Mont Blanc}
          \wrongchoice{Aconcagua}
      \end{choices}
      \explain{Sagarmatha which literally means `Head of sky' is the native name of
             Mount Everest, the highest mountain in the world.}
    \end{question}

    \begin{question}{odd}
      Pick the odd one out.
      \begin{choices}
          \correctchoice{Kilimanjaro}
          \wrongchoice{Himalayas}
          \wrongchoice{Alps}
          \wrongchoice{Andes}
      \end{choices}
      \AMCtext{explain}{\textit{\textbf{Reason: }}}
      \explain{Kilimanjaro is a mountain while the rest are mountain ranges.}
    \end{question}

    \begin{questionmult}{himalaya}
      Among the following which is in the Himalayas?
      \begin{choices}
          \correctchoice{Mount Everest}
          \correctchoice{K2}
          \wrongchoice{Mont Blanc}
          \wrongchoice{Aconcagua}
      \end{choices}
      \explain{Aconcagua is located in the Andes mountain range while Mont Blanc
                     is located in the Alps.}
    \end{questionmult}

This will now print Explanation: before the explanations of first and third question but Reason: before the explanation of second question.

##### Keep the original order of the answers

To keep the original order of the answers and prevent shuffling for this specific question, one can use the `o` option of the `choices` environment, replacing line 3 by the following:

    \begin{choices}[o]

###### Last choice

You may force AMC to let one or more answers as last choices with the command `\lastchoices`.

    \begin{question}{color}
      Which color?
      \begin{choiceshoriz}
        \wrongchoice{red}
        \wrongchoice{blue}
        \wrongchoice{yellow}
        \lastchoices
        \correctchoice{transparent}
        \wrongchoice{can't say}
      \end{choiceshoriz}
    \end{question}

    \begin{questionmult}{number}
      How many?
      \begin{choiceshoriz}
        \wrongchoice{none}
        \correctchoice{one}
        \wrongchoice{two}
        \wrongchoice{three}
        \lastchoices
        \correctchoice{not so much}
        \wrongchoice{a lot}
      \end{choiceshoriz}
    \end{questionmult}

##### Numerical answer (not available with AMC-TXT)

see

##### Space between answers

Let us note that it is also possible to parameterize the vertical space between many answer blocks, thanks to the dimension AMCinterIrep:

    \AMCinterIrep=.75ex

##### Remarks

###### Language package

Some language packages may interfere with the identifier (french for example) if you use colon. Better use the dot.

###### maximum number of responses

The maximum number of answers for a given question is limited to 199.

#### Define the marks' display area

You may add an additional option of marking area (see ) with the package tikz.

    \usepackage{tikz}

##### Without the `separateanswersheet` option

Type this command after `\begin{document}` and before the command `\onecopy` :

    \AMCsetScoreZone{width=1.5em,height=1.5ex,depth=.5ex,position=margins}

The variables width, height, depth describe the dimensions of the box marking and its location on the sheet.

The position value may be equal to : none, question, margin, margins.

##### With the `separateanswersheet` option

Type this command after `\begin{document}` and before the command `\onecopy` :

    \AMCsetScoreZoneAnswerSheet{width=1.5em,height=1.5ex,depth=.5ex,position=question}

The variables width, height, depth describe the dimensions of the box marking and its location on the sheet.

The position value may be equal to : none, question, margin, margins.

The option `margins` does not work with AMC-TXT.

Don't type one of those commands after printing.

#### Groups of questions

Putting questions into groups allows one to shuffle questions inside these groups, in a different way for each realization of the test. Every group of questions must have a name formed solely with plain letters.

One can put questions in a group one by one, as in the following example.

    \element{mygroup}{
      \begin{question}{easy}
        So, how much is one plus one?
        \begin{choiceshoriz}
          \correctchoice{two}
          \wrongchoice{zero}
          \wrongchoice{three}
        \end{choiceshoriz}
      \end{question}
    }

The formation of the group, using the `element` commands, must be made only once: thus, these commands have to be used before the `onecopy` command, which repeats some actions for every realization.

Finally, the group content can be output to the test sheet using command `\insertgroup`, as in

    \insertgroup{mygroup}

Group insertion can be controlled by the group mode, that can be set by the `\setgroupmode` command (called after group creation, once for all, before `\onecopy`):

    \setgroupmode{mygroup}{XXX}

where `XXX` can be one of the following: tutorial shuffle

fixed

  with this mode, group's elements are taken from the beginnig at each insertion.

cyclic

  the elements will be taken from the group following the last call group’s use, recycling if necessary.

withreplacement

  the same as `fixed`, but the group is shuffled before each use.

withoutreplacement

  like `cyclic`, adding some shuffling when comming back to the beginning of the group.

Note that a default group mode can be set for all groups that will be created next (a group is created at the first `\element` call), using the command

    \setdefaultgroupmode{XXX}

Without any mode definition, the `fixed` mode is used.

Once a group is formed, it is possible to shuffle questions inside this group using the `\shufflegroup` command. For instance

    \shufflegroup{mygroup}

Groups of questions can be manipulated more precisely thanks to the following commands:

- `\insertgroup[n]{mygroup}` (using optional parameter n) only inserts the n first elements from the group.

- `\insertgroupfrom[n]{groupname}{i}` does the same as `\insertgroup[n]{groupname}`, starting from element at index i (the first element has index 0).

- `\cleargroup{mygroup}` clears all group content.

- `\copygroup{groupA}{groupB}` copies all the elements from group groupA to the end of group groupB. With an optional argument n, only the n first elements will be copied: `\copygroup[n]{groupA}{groupB}`.

With these commands, you can for example make a exam taking 4 questions from group GA at random, 5 questions from group GB at random, and all the questions from group GO, shuffling all these questions, with the following code (to be used inside the argument of the command `\onecopy`, and supposing that the group mode of groups `GA`, `GB` and `all` is `withoutreplacement` or `withreplacement`):

    \cleargroup{all}
    \copygroup[4]{GA}{all}
    \copygroup[5]{GB}{all}
    \copygroup{GO}{all}
    \insertgroup{all}

- `\copygroupfrom[n]{groupA}{groupB}{i}` does the same as `\copygroup[n]{groupA}{groupB}` starting from element at index i (the first element has index 0).

#### Page size, margins

The `automultiplechoice` LaTeX package uses `geometry` to set the margins and page layout. You can overwrite its settings using the `\geometry` command just before the `\begin{document}` - see the geometry package documentation for details. The values initially set by AMC are:

    \geometry{hmargin=3cm,headheight=2cm,headsep=.3cm,footskip=1cm,top=3.5cm,bottom=2.5cm}

When reducing the margins to gain some space, keep in mind that:

- The four corner marks must be printed entirely (they could disappear due to the printer margins).

- The four corner marks must be entirely visible on the scans (if they are too close from the border and the paper moved a little or turned a little during scanning, this could not be the case).

It is also possible to set the paper size as an option to add to the list given as argument to the `\geometry` command. Available values include `a4paper`, `a5paper`, `a6paper`, `b4paper`, `b5paper`, `ansibpaper`, `ansicpaper`, `ansidpaper`, `letterpaper`, `executivepaper`, `legalpaper`.

For small paper sizes, it may also be interesting to change the position of the human readable sheet IDs (like `+1/1/53+`) in the header. This can be done using the `\AMCidsPosition` command, in the form

    \AMCidsPosition{pos=p,width=w,height=h}

where p can be `none`, `top` or `side`, and the dimensions w and h refers to the (invisible) box containing the ID. The default values are

    \AMCidsPosition{pos=side,width=4cm,height=3ex}

Let us end with an example for A5 paper sheets:

    \geometry{a5paper,hmargin=1.6cm,top=2.5cm}
    \AMCidsPosition{pos=top}

Do not load package `pgfpages` or any other layout applications

#### Check-box presentation style

The `\AMCboxStyle` (new name for the `\AMCboxDimensions` command which still compatible with the options) allows one to modify one or several dimensions of the check-boxes.

Default values are :

    \AMCboxStyle{shape=square,size=2.5ex,down=.4ex,rule=.5pt,outsidesep=.1em,color=black}

- `shape` is the shape of the boxes. Use the value square to get squares or rectangles, and oval to get circles or ovals. Note that the LaTeX package tikz must be loaded for oval to work.

- `width` is the width of the box;

- `height` is the height of the box;

- `size` is the size (`width` and `height`) of the box;

- `rule` is the thickness of the boundary of the box;

- `down` controls by how much boxes are pushed down.

- `outsidesep` for the distance between the box and the letter when printed outside the box when the `outsidebox` option is choosen (see ).

- `cross=true` only displayed on the answer sheet, shows the good answer with a cross instead of filling in black the box

- `crossrule=1.5pt` only displayed on the answer sheet, is the thickness of the cross.

- `color=col` gives the color to be used to draw boxes. The color col must be compatible with the `xcolor` package. For example, some names such as red can be used. You can also define your proper color, as in

      \definecolor{mylightgreen}{rgb}{0.67,0.88,0.5}
      \AMCboxStyle{color=mylightgreen}

To obtain smaller boxes, one can e.g. use the command

    \AMCboxStyle{size=1.7ex,down=.2ex}

When using `separateanswersheet` package option, you can also customize the boxes labeling. The default behavior is to use uppercase alphabetical labeling, or arabic numbering if the `digits` package option is used. To use your own labeling, one has to redefine the `\AMCchoiceLabel` command which takes as argument the name of the counter used to number the choices. For example, the following code will ask for lowercase letters to label the boxes:

    \def\AMCchoiceLabel#1{\alph{#1}}

As an other example, when using arabxetex package, the following code may be useful:

    \def\AMCchoiceLabel#1{\textLR{\Alph{#1}}}

One can also change the style of the boxes labels redefining the `\AMCchoiceLabelFormat` command, as in the following example (here we need bold labels):

    \def\AMCchoiceLabelFormat#1{\textbf{#1}}

One can also change the style of the outside labels redefining the `\AMCoutsideLabelFormat` command, as in the following example (here we need bold labels):

    \def\AMCoutsideLabelFormat#1{\textbf{#1}}

The switch used to tick or not correct answers is `\AMC@correctrue`. You can define a command to set it to true, just after the \begin{document}.

    \makeatletter
    \def\AMCforcecorrect{\AMC@correctrue}
    \makeatother

and then use it for a particular question (enclose in braces to limit its effect to one question):

    {\AMCforcecorrect\begin{questionmult}{test}\QuestionIndicative
       .....
     \end{questionmult}
    }

You should tell AMC not to count points for this question (with a 0-point scoring, or using `\QuestionIndicative`).

#### Questions presentation style

The way each question is presented can be modified by redefining the command `\AMCbeginQuestion`, whose default definition is the following:

    \def\AMCbeginQuestion#1#2{\par\noindent{\bf Question #1} #2\hspace*{1em}}

The first parameter transmitted to this command is the number of the question to be displayed. The second parameter contains `\multiSymbole` in the case of a multiple question, and is void in all other cases. The `\multiSymbole` command too can be modified: its goal is to distinguish multiple questions from the others. By default, it displays a club.

    \def\multiSymbole{$\clubsuit$}

##### Choices custom

The display of answers can be modified in the same fashion, if one uses the `choicescustom` environment instead of `choices` or `choiceshoriz`, redefining the three following LaTeX macros:

    \def\AMCbeginAnswer{}
    \def\AMCendAnswer{}
    \def\AMCanswer#1#2{#1 #2}

###### Example 1

The check boxes can be used to penalize students who delay their copy, for example (8 points less for a small delay and 20 points less for an exaggerated delay). It will be enough to include at the desired place (for example in the header, something like this):

    \fcolorbox{black}{gray}{\insertDelay}

the command `\insertDelay` is defined outside from \onecopy :

    \def\insertDelay{ %
    {\def\AMCbeginQuestion##1##2{}\AMCnobloc%
     \begin{questionmult}{00delay}
     \AMCnoCompleteMulti\AMCdontAnnotate%
     \def\AMCbeginAnswer{}\def\AMCendAnswer{}%
    Holded~\begin{choicescustom}[o]\wrongchoice{R1~}\scoring{b=0,m=-8}\wrongchoice{R2}\scoringb=0,m=-20}\end{choicescustom}%
     \end{questionmult}}%
    }

- the command `\def\AMCbeginQuestion##1##2{}` (combined with the use of the `reponsesperso` environment) allows AMC to write not "Question XX".

- `\def\AMCbeginAnswer{}\def\AMCendAnswer{}` also refine the result.

- `\AMCnoCompleteMulti` allows to tell AMC not to add the answer "none of these answers is correct" despite the use of questionmult.

- `\AMCdontAnnotate` ask AMC not to annotate these boxes there.

Inside the commande `\onecopy`, double the `#`.

    \def\AMCanswer##1##2{##1  ##2}
    \def\AMCbeginQuestion##1##2{}

###### Use in mathematics

    \begin{questionmultx}{formula}\scoring{mz=2}\AMCnoCompleteMulti
    How is the identity function defined?
      \begin{choicescustom}[o]
        \[f(x)=\correctchoice[$y$]{}\wrongchoice{[$x$]{}\correctchoice[$+$]{}\correctchoice[$x^2$]{}\]
      \end{choicescustom}
    \end{questionmultx}

##### Spacing

One can also change spacing redefining the following dimensions (here are the default values):

    \AMCinterIrep=0pt
    \AMCinterBrep=.5ex
    \AMCinterIquest=0pt
    \AMCinterBquest=3ex
    \AMCpostOquest=7mm
    \setlength{\AMChorizAnswerSep}{3em plus 4em}
    \setlength{\AMChorizBoxSep}{1em}

These dimensions are the vertical space between questions (`quest`) or answers (`rep`), in boxed mode (`B`, with `\AMCBoxedAnswers` or `box` package option) or standard mode (`I`) and the space left after an open question. The two last lengths are used in environment: `choicescustom`

#### Layout

##### Margins

Margins were chosen so that the document prints correctly on most printers. If your printer reduces, you can use the command `geometry` from laTex package geometry. For example, In order to narrow the top margin's copies, we can use `\geometry{top=3cm}` instead the default value 3.5cm, just before `\begin{document}`.

##### Number of pages

AMC automatically handles the number of pages for each subject. You can choose to fix a identical number of pages for each subject with the command `\AMCaddpagesto{integer}` to be called at a place you need to reach this number of pages (usually at the end of the copy description or between the question and the answer sheet).

#### Separate answer sheet presentation style

It is also possible to modify the layout of the separate answer sheet produced with the `separateanswersheet` option (see ).

1. If one only wants to modify the horizontal spacing between two check-boxes or the vertical spacing between two questions, one just has to redefine the following dimensions:

       \AMCformHSpace=.3em
       \AMCformVSpace=1.2ex

2. For a deeper modification of the display settings, one can also redefine the commands that are used at the beginning of each question and for each answer:

       \def\AMCformBeforeQuestion{\vspace{\AMCformVSpace}\par}
       \def\AMCformQuestion#1{\textbf{Question #1:}}
       \def\AMCformAnswer#1{\hspace{\AMCformHSpace} #1}

   These definitions have to be inserted just after `\begin{document}` in the LaTeX file.

3. You can force AMC not to respect the arrangement of the questions and to store the open questions in order to restore them together. This can be useful when you use package multicols, the answers to open questions needing more space when hand written.

   The command `\AMCformFilter{!\AMCifcategory{open}}` displays all questions except the open questions then the command `\AMCformFilter{\AMCifcategory{open}}` displays only the open questions. Both commands must be used together.

       %On two columns, the answers boxes are displayed
       %except the open questions.
       \begin{multicols}{2}
       \AMCformFilter{!\AMCifcategory{open}}
       \end{multicols}

       %All the open questions are displayed.
       \AMCformFilter{\AMCifcategory{open}}

   The ascending numbering is always respected.

#### Code acquisition

Code acquisition can be easily performed thanks to the LaTeX command

    \AMCcodeGridInt[options]{key}{n}

for instance to allow each student to enter her/his student number by herself/himself on the answer sheet. The two arguments of this command are a code/question key (identifier), and the number n of digits to be used by the code. One can e.g. use the following header

    {\setlength{\parindent}{0pt}\hspace*{\fill}\AMCcodeGridInt{etu}{8}\hspace*{\fill}
    \begin{minipage}[b]{6.5cm}
    $\longleftarrow{}$\hspace{0pt plus 1cm} please encode your student number below,
    and write your first and last names below.

    \vspace{3ex}

    \hfill\namefield{\fbox{
        \begin{minipage}{.9\linewidth}
          Firstname and lastname:

          \vspace*{.5cm}\dotfill

          \vspace*{.5cm}\dotfill
          \vspace*{1mm}
        \end{minipage}
      }}\hfill\vspace{5ex}\end{minipage}\hspace*{\fill}

    }

If the `separateanswersheet` option is used, the `\AMCcodeGridInt` command has to be placed after the `\AMCformBegin` command.

Note that the codes rendering can be adapted modifying the lengths `\AMCcodeHspace`, `\AMCcodeVspace` representing the horizontal and vertical amount of space between boxes. Default values are set with the following commands:

    \AMCcodeHspace=.5em
    \AMCcodeVspace=.5em

The command `\AMCcodeGrid[options]{key}{description}` can be used to handle more complex codes, as codes including letters. Here, description is a coma-separated list of character pools to offer. As an example, a client code formed with a lettre from A to E followed by three digits can be handled with `\AMCcodeGrid{client}{ABCDE,0123456789,0123456789,0123456789}`.

The two commands \AMCcodeGrid and \AMCcodeGridInt accept the following options (coma-separated into the optional options argument):

vertical=bool

  where bool is `true` or `false`, to indicate the direction to be used (the default value is `true`);

v

  is an alias for `vertical=true`;

h

  is an alias for `vertical=false`;

top

  allows to get top-aligned columns in vertical direction.

#### Choice of shuffling parameters

One can modify the seed of the random number generator used to produce the shuffle, thanks to the following command (to be used just at the beginning of the document, and in any case outside the `onecopy` command):

    \AMCrandomseed{1527384}

If the value that is assigned (to be chosen between 1 and 4194303) is modified, then the shuffling will differ. Of course, one must not modify this value after the test sheets have been printed.

The value is recorded in the xy file (as `\rngstate{1}{1515}`). The default value is 1515.

#### Using sectioning and separate answer sheet

For sectioning to be also visible in the separate answer sheet (if any), use `\AMCsection` and `\AMCsubsection` instead of `\section` and `\subsection` (`\AMCsection*` and `\AMCsubsection*` are also defined, for unnumbered sectionning)

#### Using references inside the test sheets

Using LaTeX commands `\label`, `\ref` and `\pageref` within questions or answers is problematic since they will be called with the same arguments for every realization of the test, which will alter the numbering of references. To solve this problem, one should use instead the commands `\AMClabel`, `\AMCref` and `\AMCpageref`: they add the realization number to their argument before transmitting it to `\label`, `\ref` and `\pageref`.

One also has to reset counters to zero at the beginning of each realization. For instance, if one wants to include references to pictures that are put together in a separate page, one might write something like

    \element{animals}{
      \begin{figure}[p]
        \centering
        \includegraphics[width=.6\linewidth]{tiger}
        \caption{An animal}
        \AMClabel{tiger}
      \end{figure}

      \begin{question}{tiger}
        Which is the animal on figure~\AMCref{tiger} page~\AMCpageref{tiger}?
        \begin{choices}
          \correctchoice{A tiger}
          \wrongchoice{A giraffe}
          \wrongchoice{An elephant}
          \wrongchoice{A cat}
        \end{choices}
      \end{question}
    }

and it is then important to add, just after the command `\onecopy` the line

    \setcounter{figure}{0}

so that the numbering of figures starts at 1 for every realization. Without that last command, the numbering of figures would go on from one realization to the next one, which is clearly not desirable.

##### Using the package cleveref

This package sort in an ascending order the questions' numbers, the questions' pages or the labels' pages (the documentation http://mirrors.ctan.org/macros/latex/contrib/cleveref/cleveref.pdf).

This package must be loaded after the package automultiplechoice.

To use this package, a new command was created: `\AMCstudentlabel`.

    \cref{\AMCstudentlabel{led},\AMCstudentlabel{lamp},\AMCstudentlabel{motor}}

led, lamp, motor are the created labels to reference the questions with the command \AMClabel{}.

#### Customizing some texts inserted by AMC

Use `\AMCtext` for the following customizations:

- `\AMCtext{none}{sentence}` replaces « None of these answers are correct. » (the English default text) with the given sentence when using option `completemulti`.

- `\AMCtext{corrected}{title}` replaces « Corrected » (the English default text) with the given title on the corrected answer sheet.

- `\AMCtext{catalog}{title}` replaces « Catalog » (the English default text) with the given title on the questions catalog produced thanks to option `catalog`.

- `\AMCtext{explain}{title}` replaces « Explanation » (the English default text) with the given title before the explanations produced due to the `explain` command.

  The default option for this command is:

      \AMCtext{explain}{\textit{\textbf{Explanation: }}}

- You can also consider using commands like the following ones (here the second argument is set to the default English value):

      \AMCtext{draft}{DRAFT}
      \AMCtext{message}{For your examination, preferably print documents
                        compiled from auto-multiple-choice.}

- `\AMCsetFoot{text}` sets the footer. Use for example `\AMCsetFoot{\thepage}` to write the page number.

#### Binary code

AMC identifies each test and the page number of test with the binary code.

- First row : 12 boxes (default value) : maximum number of tests = 2^12-1 = 4 095.

- Second row : 6 first boxes (default value) : maximum number of pages per tests = 2^6-1 = 63.

- Second row : 6 last boxes (default value) : check code.

To raise the number of tests and/or pages per test modify the commands' default values `\AMC@NCBetud`, `\AMC@NCBpage` et `\AMC@NCBcheck`.

Load those commands below in the preambule (here with the default values).

    \makeatletter
    \def\AMC@NCBetud{12}
    \def\AMC@NCBpage{6}
    \def\AMC@NCBcheck{6}
    \makeatother

### Options for AMC

You can add in the source file header (the first lines that begin with a '%') some options to be passed to AMC:

`%%AMC:preprocess_command=commandname`

  tells AMC to run the commandname command before calling LaTeX to process the source file. This command will be run inside the project directory, and the name of a source file copy will be passed as an argument. There is no problem for commandname to change this file content, because this is only a copy.

`%%AMC:latex_engine=engine`

  tells AMC to set the LaTeX engine to use for this file, regardless to the one entered as a preference by the user.

### Mathematical questions with randomized statements

#### Using package fp

Thanks to the LaTeX package fp, whose documentation is available at http://mirrors.ctan.org/macros/latex/contrib/fp/README, and which can be downloaded with the command

    \usepackage{fp}

added before that corresponding to automultiplechoice, one can create exercises with randomized numerical data. Let us start with a simple example.

    \begin{question}{addition}
      \FPeval\VQa{trunc(1+random*8,0)}
      \FPeval\VQb{trunc(4+random*5,0)}
      \FPeval\VQsomme{clip(VQa+VQb)}
      \FPeval\VQnonA{clip(VQa+VQb-1)}
      \FPeval\VQnonB{clip(VQa*VQb)}
      \FPeval\VQnonC{clip(VQa-VQb)}

      What is the sum of \VQa{} and \VQb{} ?
      \begin{choiceshoriz}
        \correctchoice{\VQsomme}
        \wrongchoice{\VQnonA}
        \wrongchoice{\VQnonB}
        \wrongchoice{\VQnonC}
      \end{choiceshoriz}
    \end{question}

The `\FPeval` command is used to perform computations:

Since `random` returns a real number in the interval [0,1], this command sets VQa to a random integer value between 1 and 8. The next line sets VQb to a random integer value between 4 and 8.

Putting the correct answer in the variable VQsomme.

Putting wrong answers in variables VQnonA, VQnonB and VQnonC...

Variable names beginning with VQ have been chosen so as to avoid interference with other LaTeX commands.

You can set the random seed with

    \FPseed=integer

integer must be fixed, and not computed from date/time values.

##### Choosing an interval

The `automultiplechoice` package moreover defines a `\AMCIntervals` command which makes this kind of construction simpler, as illustrated in the next example:

    \begin{question}{inf-expo-indep}
      \FPeval\VQa{trunc(2 + random * 4,0)}
      \FPeval\VQb{trunc(6 + random * 5,0)}
      \FPeval\VQr{VQa/(VQa+VQb)}

      Let $X$ and $Y$ be two independent random variables, following the exponential distribution with
    respective parameters \VQa{} and \VQb{}.
      To which interval does the probability $\mathbb{P}[X<Y]$ belong ?

      \begin{multicols}{5}
        \begin{choices}[o]
          \AMCIntervals{\VQr}{0}{1}{0.1}
        \end{choices}
      \end{multicols}
    \end{question}

This lines inserts ten answers corresponding to the intervals [0,0.1[ [0.1,0.2[ ... [0.9,1[, while indicating that the correct interval is the one containing VQr. The arguments of the `\AMCIntervals` command are the following:

1. The correct answer,

2. The left point of the first interval,

3. The right point of the last interval,

4. The length of each interval.

Note that the interval formatting can be changed redefining the `\AMCintervalFormat` command, which is originally defined as

    \def\AMCIntervalFormat#1#2{[#1,\,#2[}

to follow local conventions (writing [a,b) instead of [a,b[ is for example a common usage).

##### Coding the result

The students can also be asked to code the numerical answer, using the `\AMCnumericChoices` command, as in the following example:

    \begin{questionmultx}{sqrt}
      \FPeval\VQa{trunc(5+random*15,0)}
      \FPeval\VQs{VQa^0.5}
      Compute $\sqrt{\VQa}$ and round it with two digits after period.

      \AMCnumericChoices{\VQs}{digits=3,decimals=2,sign=true,
                     borderwidth=0pt,backgroundcol=lightgray,approx=5}
    \end{questionmultx}

Note the use of `questionmultx` environment: we need this question to be multiple as several boxes has to be ticked, but we can’t say that several answers are correct, so we don’t show the symbol for multiple questions.

###### Options

Available options that can be used in the second argument of the `\AMCnumericChoices` command are the following (bool can be `true` or `false`, and color must be a color known by the `xcolor` package):

digits=num

  gives the number of digits to request (defaults to 3).

decimals=num

  gives the number of digits after period to request (defaults to 0). Note that when num is positive, the LaTeX package `fp` must be loaded.

base=num

  gives the base for `digits` and `decimals` (defaults to 10).

significant=bool

  if `true`, the numbers to code are the first significant digits from the first argument of `\AMCnumericChoices`. For example, the right answer to

      \AMCnumericChoices{56945.23}{digits=2,significant=true}

  is 57.

exponent=num

  switch to scientific notation mode, with num digits for the exponent.

nozero=bool

  if true, the choice 0 is removed for all digits.

  May be useful when using `\AMCnumericChoices` to enter small (<10) positive values.

sign=bool

  requests (or not) a signed value (defaults to true).

exposign=bool

  same for the exponent sign.

strict=bool

  if `true`, a box has to be ticked for every digit (even null digits) and for the sign. If `false`, if some digits has no ticked box, they will be set to zero. Defaults to `false`.

vertical=bool

  if true, each digit is represented on one raw. If false (default), each digit is represented on one line.

expovertical=bool

  if `true`, the mantissa is above the exponent. If `false` (default), the mantissa is beside the exponent.

reverse=bool

  if true, place higher values of the digits on the top in `vertical` mode (defaults to true).

vhead=bool

  if true, in `vertical` mode, a header is placed over all digits rows, made using the command `\AMCntextVHead` that is originally defined as

      \def\AMCntextVHead#1{\emph{b#1}}

  This default value is useful to number the binary digits.

  Default value is `false`.

hspace=space

  sets the horizontal space between boxes (defaults to `.5em`).

vspace=space

  sets the vertical space between boxes (defaults to `1ex`).

borderwidth=space

  sets the width of the frame border around all the boxes (defaults to `1mm`).

bordercol=color

  sets the color of the frame (defaults to `lightgray`).

backgroundcol=color

  sets the background color (defaults to `white`).

Tsign=text

  sets the text to print at the top of the boxes to set the sign (Can also be redefined by `\def\AMCntextSign{text}`, and defaults to be empty).

Tpoint=text

  sets the text for the period. Can also be redefined by `\def\AMCdecimalPoint{text}`, and defaults to `\raisebox{1ex}{\bf .}`.

Texponent=text

  sets the text that separates mantissa and exponent. Can also be redefined by `\def\AMCexponent{text}`, and defaults to `$\times10$\textasciicircum`.

scoring=bool

  if `true`, a scoring strategy is given to AMC for this question. Defaults to `true`.

scoreexact=num

  gives the score for an exact answer (defaults to 2).

exact=num

  sets the maximal distance to the correct integer value (value without the decimal point) for an answer to be said exact and be rewarded to `scoreexact` points (defaults to 0).

scoreapprox=num

  gives the score for an approximative answer (defaults to 1).

approx=num

  sets the maximal distance to the correct integer value (value without the decimal point) for an answer to be said approximative and be rewarded to `scoreapprox` points (defaults to 0).

AMC converts all numbers (decimals included) to integers (simply removing the decimal point) before subtracting them and comparing with `approx`. As an example, with `decimals=2`, if the correct answer is 3.14 and the given answer is 3.2, then the integer difference is 320-314=6, so that the student gets `scoreapprox` points only if `approx` is 6 or greater.

scorewrong=num

  gives the score for an wrong answer (defaults to 0).

keepas=text

  keeps the value entered by the student for future use with alsocorrect in another question.

  All following questions must follow the lexicographic order of IDs

alsocorrect=text

  gives another acceptable answer, that can be based on the values entered by the student in the previous questions. The formula use perl code:

      +, -, *, /, ** (power)

     \begin{question}{carre-a}
        \QuestionIndicative
        Choose any number.
        \begin{reponseshoriz}[o]
          \wronhchoice{2}\scoring{2,setglobal.Number=2}
          \wronhchoice{3}\scoring{3,setglobal.Number=3}
          \wronhchoice{4}\scoring{4,setglobal.Number=4}
          \wronhchoice{5}\scoring{5,setglobal.Number=5}
        \end{reponseshoriz}
      \end{question}

      \begin{questionmultx}{carre-b}
        \AMCdontAnnotate\bareme{MAX=2}
        What is his square?
        \AMCnumericChoices{}{digits=2,approx=1,alsocorrect=Number**2}
      \end{questionmultx}

      \begin{minipage}{.3\linewidth}
        \begin{tikzpicture}
          \draw[fill=blue!50] (0,0) ellipse (1.5 and 0.2);
          \draw (1.5,0) -- (0,5) -- (-1.5,0);
          \draw (1.6,0) -- (2,0);
          \draw (1.6,5) -- (2,5);
          \draw[<->] (1.8,0) -- (1.8,5);
          \node[right] at (1.8,2.5) {$h=5$};
          \draw (0,-0.4) -- (0,-0.8);
          \draw (1.5,-0.4) -- (1.5,-0.8);
          \draw[<->] (0,-0.6) -- (1.5,-0.6);
          \node[below] at (0.75,-0.6) {$r=1.5$};
          \draw[fill=black] (0,0) circle (0.02);
        \end{tikzpicture}
      \end{minipage}
      \begin{minipage}{.65\linewidth}
        \begin{questionmultx}{cone-a}
          What is the area of the blue disc?
          \AMCnumericChoices{pi*1.5^2}{digits=3,decimals=2,exponent=2,approx=2,sign=false,
          exposign=true,expovertical=true,keepas=Surface}
        \end{questionmultx}

        \begin{questionmultx}{cone-b}
          What is the volume of the cone?
          \AMCnumericChoices{pi*1.5^2*5/3}{digits=3,decimals=2,exponent=2,approx=2,sign=false,
          exposign=true,expovertical=true,alsocorrect=Surface*5/3}
        \end{questionmultx}
      \end{minipage}

      \begin{questionmultx}{pipi2-a}
        What is the value of$\pi$ ?
        \AMCnumericChoices{pi}{digits=3,decimals=2,sign=false,keepas=Pi}
      \end{questionmultx}

      \begin{questionmultx}{pipi2-b}
        What is the value  $\pi^2$ ?
        \AMCnumericChoices{pi^2}{digits=3,decimals=2,sign=false,approx=1,alsocorrect=Pi**2}
      \end{questionmultx}

You can set other default values (for the whole exam) for all these parameters using the command `\AMCnumericOpts`, like

    \AMCnumericOpts{scoreexact=3,borderwidth=2pt}

Moreover, the text added at the end of the questions using `\AMCnumericChoices` when not in the separate answer sheet (and when a separate answer sheet is requested by the `separateanswersheet` package option) can also be set redefining the `\AMCntextGoto` command, as:

    \def\AMCntextGoto{\par{\bf\emph{Please code the answer on
                               the separate answer sheet.}}}

###### Access to values

intX

  raw value entered by student.

intV

  correct raw value.

#### Using package pgf/tikz

This package must be declared after the package automultiplechoice.

LaTeX package pgf/tikz (see http://www.ctan.org/tex-archive/graphics/pgf/base) provides mathematical functions that can be loaded with

    \usepackage{tikz}

First of all, you must set the random seed to be sure to get the same result each time latex is run to compile the subject:

    \pgfmathsetseed{2056}

##### A simple computation

Here is an example with a simple computation:

    \begin{question}{inverse}
      \pgfmathrandominteger{\x}{1}{50}

      How much is the reciprocal of $x=\x$?

      \begin{choices}
        \correctchoice{\pgfmathparse{1/\x}\pgfmathresult }
        \wrongchoice{\pgfmathparse{1/(\x +1))}\pgfmathresult}
        \wrongchoice{\pgfmathparse{cos(\x)} \pgfmathresult}
        \wrongchoice{\pgfmathparse{\x^(-0.5)}\pgfmathresult}
      \end{choices}
    \end{question}

Here, the command `\pgfmathparse` makes the computation, and `\pgfmathresult` outputs the result.

Output formatting is also available with the command `\pgfmathprintnumber`, as in the following example (three digits after decimal point, and use of the comma as a decimal point).

    \begin{question}{inverse3}
      \pgfmathrandominteger{\x}{1}{50}
      \pgfkeys{/pgf/number format/.cd,fixed,fixed zerofill,precision=3,use comma}
      How much is the reciprocal of $x=\pgfmathprintnumber{\x}$?

      \begin{choices}
        \correctchoice{\pgfmathparse{1/\x}\pgfmathprintnumber{\pgfmathresult}}
        \wrongchoice{\pgfmathparse{1/(\x +1))} \pgfmathprintnumber{\pgfmathresult}}
        \wrongchoice{\pgfmathparse{cos(\x)} \pgfmathprintnumber{\pgfmathresult}}
        \wrongchoice{\pgfmathparse{\x^(-0.5)} \pgfmathprintnumber{\pgfmathresult}}
      \end{choices}
    \end{question}

You can also use the `\AMCIntervals` and `\AMCnumericChoices` commands (see and )

##### Graphics

The tikz package also allows to make (random or not) graphs.

    \begin{questionmult}{graph}
      Let us consider the three functions which graphs are plotted below:
      \pgfmathrandominteger{\a}{2}{4}
      \begin{center}
        \begin{tikzpicture}[domain=0:4]
          \draw[very thin,color=gray] (-0.1,-4.1) grid (3.9,3.9);
          \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
          \draw[->] (0,-4.2) -- (0,4.2) node[above] {$f(x)$};
          \draw[color=red] plot (\x,{(1+\a/4)*\x-\a}) node[right] {$f_{1} (x)$};
          \draw[color=blue] plot (\x,{\a*sin(\x r)}) node[right] {$f_{2}(x)$};
          \draw[color=orange] plot (\x,{\a*cos(\x r)}) node[right] {$f_{3}(x)$};
        \end{tikzpicture}
      \end{center}
      Then:
      \begin{choices}
        \pgfmathrandominteger{\x0}{2}{4}
        \correctchoice{$f_{2}(\x0)$=\pgfmathparse{\a*sin(\x0 r)} \pgfmathprintnumber{\pgfmathresult}.}
        \correctchoice{$f_{3}(\x0)$=\pgfmathparse{\a*cos(\x0 r)} \pgfmathprintnumber{\pgfmathresult}.}
        \wrongchoice{La fonction $f_{1}(x)$ est une fonction linéaire.}
      \end{choices}
    \end{questionmult}

To make pretty graphs, package pgfplots can also be useful.

With pgfmath, precision is limited, so that a "Arithmetic overflow" error can be encountered. Packages tikz and pgfplots allows to overcome this problem, using `gnuplot` as a backend. You need to install `gnuplot` on your system, and use LaTeX option `--shell-escape`. To this purpose, go to AMC preferences window, and set the LaTeX engine for your project to "`pdflatex --shell-escape`" (without the quotes).

#### Using LuaLaTeX

LUA language can be used inside LaTeX documents thanks to the `lualatex` command. If you uses it, your document needs to be UTF-8 encoded, and you must not load the inputenc package. See http://www.luatex.org/documentation.html for some information.

LUA commands are to be given as a `\directlua` argument. The most useful LUA function is `tex.print`, which will output results back to LaTeX.

Once again, if you use random numbers, always fix the random seed to get the same results across different compilations:

    \directlua{math.randomseed (2048)}

Here is a very simple sample source file:

    \documentclass[a4paper]{article}
    %\usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[box,completemulti]{automultiplechoice}
    \begin{document}

    \onecopy{10}{

    %%% head

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
      \centering\large\bf LuaLaTeX sample exam
    \end{minipage}
    \namefield{\fbox{\begin{minipage}{.5\linewidth}
    Name :

    \vspace*{.5cm}\dotfill
    \vspace*{1mm}
    \end{minipage}}}

    %%%

    \directlua{math.randomseed (2048)}
    \directlua{a=math.random()}

    \begin{question}{square-root}
      How much is the square root of \directlua{tex.print(a)}?

      \begin{choices}
        \correctchoice{\directlua{tex.print(math.sqrt(a))}}
        \wrongchoice{\directlua{tex.print(math.sqrt(2*a))}}
        \wrongchoice{\directlua{tex.print(math.sqrt(a*1.001))}}
      \end{choices}
    \end{question}

    }

    \end{document}

Output formatting can be obtained using lua functions, or with the siunitx package.

You can also use the `\AMCIntervals` and `\AMCnumericChoices` commands (see and )

## Usage - Graphical interface

We shall describe here a usage example with the graphic interface from the conception of the multiple-choice test until the edition of students' scores.

### Creating a new project and subject

Let's open the graphic interface. This can be done ordinarily by selecting Applications Education Auto Multiple Choice in the general menu of Gnome (or its equivalent in KDE or other), but the command `auto-multiple-choice` can be used directly.

Let's now create a new project, thanks to Project New . A window opens and allows us to see existing project names (if any) and choose a name for our new project (made with simple characters; « test » will be OK for our short test), which we write in the field Project name. Then we push the New project button.

Now we must choose a LaTeX file as a source for the multiple-choice. Several possibilities are shown:

- model: this choice allows to choose from models shipped with AMC an exam to customize later.

- file: this choice allows to choose a LaTeX file already prepared for this exam. Somebody may have prepared the exam for you, or you can have prepared the exam outside AMC, using your favorite LaTeX editor.

- empty: using this choice, an empty LaTeX file will be created. You have to edit it to compose the exam from zero.

- archive: use this choice if you have a zip or tgz archive containing the exam definition (LaTeX source file, along with image files, parameters file for example). This archive can be made by an external software. It can also be a backup of one of your AMC projects.

For our test, let us choose model. The next window presents the models: choose for example Simple example from [EN] Documentation group. Now we can edit it to modify the shape of the document or the questions, thanks to the Edit LaTeX file button which launches the default editor.

### Preparing the subject

Preparing a project is done in two steps. First we must make the reference documents from the LaTeX source file. This can be done by clicking the Update documents or Alt+U. The following documents are produced:

- The question. This file can be printed to distribute its pages to students (see below).

- The solution. We can check that the chosen responses there are the good ones. It is also made to be distributed to students.

When produced, those documents can be viewed (and possibly printed) from the corresponding buttons.

Now we can begin the last step of the preparation: analyzing the layout. It can be launched with the button Layout detection. This analysis detects, in every page of the subject, the exact position of every element which must be analyzed in the students' copies.

To check whether the layouts have been correctly detected, we can use the button Check layouts. A short insight allows to check that red checkboxes are correctly located over the boxes of the subject.

### Mailing examan to student (with or without password).

Emailing exam sheets is possible.

- You must prepare nominative sheets (see (LaTeX) or (AMC-TXT)).

- Select printing to files : Preferences Main Printing Printing method to files .

- Select extracting method: Preferences Main Printing Extracting method pdftk / gs (ghostscipt) / qpdf (default) / sejda-console (not installed) .

  If option `pdfform` is available, select sejda-console : (to install)

      cd
      wget https://github.com/torakiki/sejda/releases/download/v3.2.85/sejda-console-3.2.85-bin.zip
      unzip sejda-console-3.2.85-bin.zip
      sudo ln -s ~/sejda-console-3.2.85/bin/sejda-console /usr/local/bin

- Print the files.

AMC allow to protect all the files with your owner password and each file with a user password.

The list include a column title with the password

    # STUDENTS / 1ST YEAR
    surname,name,id,email,password
    Bienvenüe,Alexis,001,paamc@passoire.fr,123456
    Boulix,Jojo,002,jojo.boulix@rien.xx,789test01
    Noël,Père,003,pere.noel@pole-nord.xx,clavierbepo

- Click on List… then select the csv file.

  Primary key from this list: the name of the column, in the list of students, with the students' numbers (see ).

- Send the exams.

### Printing and exam

Two alternative workflows can be considered:

- For the most robust, create as many exam sheets as necessary for all your students, with different sheets numbers, and print them all. Each page can be identified by its numbers and boxes at the top, so that you can scan several times the same completed answer sheet page carefree.

- Secondly, you can print a few subjects (or only one if you want), and photocopy them to get one subject for all students. Questions shuffling will be less efficient, and if you give several times a scan of the same page, AMC won't be able to know about it and will create an unwanted duplicate.

To use this second workflow using photocopies, there must be only one page for students to write on (using a separate answer sheet can help you for this). If not, you won't be able to continue with AMC! Indeed, it would be impossible for AMC to make the link between two pages from the same student.

When the preparation is over, we can print the subject, and distribute it to the students... In simple cases, we can directly print from the viewer (after clicking the line Subject in the list of work documents). When it is better to print the copies separately (for example if copies contain multiple pages and when the printer allows to staple them together), we shall rather use the button Print copies after calculating the layout.

### Test

Let the students pass the exam.

When the subject is printed and distributed, we may no more modify the work documents because they must remain identical to distributed copies.

It is preferable that students use a black or blue pen or B or HB pencil.

Depending on the situation, you can ask the students to tick or fill the boxes.

#### Tick the boxes

If you ask the students to tick the correct boxes, they can correct a ticked box ereasing their mark with a eraser or white-out fluid. However, they must not try to draw the boxes back. Trying to do so, they could draw lines inside the boxes, that could then be considered as ticked boxes.

You can also let the students correct ticked boxes filling them completely. If you choose this option, you have to set the upper darkness threshold (from Preferences menu, Project tab) to some value less than 1 (but not too low). If the darkness ratio of a box is between the darkness threshold and the upper darkness threshold, the box is considered as been ticked. If the darkness ratio is greater than the upper darkness ratio, the box is considered as not ticked.

#### Fill the boxes

When the letters (or numbers) referencing the answers are drawn inside the boxes, you must tell the students to fill the correct boxes, as AMC can't make the difference between a box with a letter and ticked box.

The stiudents can correct a ticked box ereasing their mark with a eraser or white-out fluid, but they don't have any other solution to correct a ticked box. You must set the upper darkness threshold to 1.

### Reading the copies

Now we shall describe the input from students' copies, which can be done automatically and/or manually.

Let's move to the Data capture tab of the graphical interface.

#### Automated input

For automatic recognition of the checked boxes in the students' pages, they must be previously digitalized. I use a copier/scanner which does it automatically (all the pages in a bundle without interaction with me), with the following settings: 300 dpi, OCR mode (for the characters' recognition, black and white without grayscale - but the scanner does not process any character recognition), each scan delivered as a single TIFF file per page.

To analyze the scans, we must have them in one or several image files (TIFF, JPG, PNG, etc.). Vector graphics formats (PDF, PS or EPS) are also suitable: scans will then be converted into PNG by AMC before analysis.

When giving scans for automated data capture the first time, you will have tell AMC which method you used: either different papers printed, or photocopied papers (see ).

Then we select this set of scan files in the dialog opened by the button Automated of the section Data capture after examination, then we validate with the OK button. AMC begins with Optical Mark Recognition to detect the position of the four circle corner marks on the scans, position the boxes, and detects the amount of black pixels in each box.

The result of the analysis of each page is indicated in the lists of the section Diagnosis:

- The value`update` displays the date the date the page was last modified. Hided by default. Click on the button columns to show it.

- The value MSD (mean square deviation) is an indication of the good framing of the marks (the four black dots surrounding each copy). When it is too great, the framing must be checked (right click on the page's line then choose page to view the scanned page and the boxes as they were detected).

- The value sensitivity is an indicator of proximity of the filling of the boxes with the threshold. If it is too great (from 8 to its max value 10), we must check whether the boxes recognized as checked are the good ones (a right click on the page's line the choose zoom to view the set of boxes in the copy, verify whether the detection worked correctly, and correct it if needed drag-and-dropping the boxes images).

- The value scan files displays the name of the handled page. Hided by default. Click on the button columns to show it.

#### Manual input

If we cannot use easily the scanner, or if, for a few copies, the automated input did not work as expected, we can manage the input manually. To do so, let's open the right window thanks to the button Manual of the section Input of the copies after exam. In that window, we can input the boxes which have been checked ourselves (by clicking them) on the wanted pages.

Every manual input will overwrite results eventually coming from a previous or posterior automated input for the same page.

##### Viewing empty or inavlid questions

By clicking on the page numbers, AMC wrap the boxes answers with a colored square :

- cyan for empty answers,

- yellow for invalid answers.

You may change this colors in the menu tab: Preferences Display Scan

It is possible to search a specific question (see )

##### Select a specific question

This option make it possible to manually mark on-screen a specific question. This save your having to search on each page the question if they are shuffled.

###### Mark an open question on-screen

- open the manual input tab and select "scan" as background,

- select the question to mark (drop-down menu above the list of pages) .

The open question's check-boxes are on the top of the window, and when you click next you move forward to the following student, always for the same question.

All questions can be checked like this.

###### Check on-screen pages with invalid or empty questions

- The marking must be ended before use (see section ),

- open the manual input tab and select "scan" as background,

- choose if you want to navigate through all pages, through pages with invalid answers (inv), or through pages with invalid or empty answers (i & e).

### Correction

In the Marking tab of the graphic interface, the part Marking allows us to deduce the scores of the students from the inputs, but also to read the codes written by the students (see ).

#### Process

The computation of the scores is launched with the button Mark, but we must previously make the following choice:

- If we check the box Update marking scale, the scoring strategy will be first extracted from the LaTeX source file. This allows to try many strategies at the end of the correction process. This action also updates which answers are specified as correct or as wrong. Hence, potential mistakes in the answers can be easily fixed after the exam. The method to specify the strategy in the LaTeX file will be explained in the section (a default scoring strategy is used when no indication is given).

When we click the button Mark, the correction is made (this can take some time if we also asked for the reading of the scale).

#### Scoring strategy

The strategy used to score the copies is indicated in the LaTeX source file, with the command `scoring`. It can be used in an environment `question` or `questionmult`, to set it for every response, but also in the environment `choices`, to give scaling indications about a single response. The argument of the LaTeX command `scoring` is made of indications like `parameter=value`, separated by comas. The usable parameters are the following (the table shows also in which context those parameters can be used):

parameter | simple | multiple | value
Q | A | Q | A
e | ● |  | ● |  | The score given when responses are incoherent: many boxes checked for a simple question, or, for a multiple question, the box "none of the responses are correct" checked while another box is also checked.
v | ● |  | ● |  | The score given in case of no response (no box is checked).
d |  |  | ● |  | An offset, i.e. a value added to every score not relevant of parameters e and v.
p |  |  | ● |  | The bottom score. If the calculation of the score in that question yields a value below the bottom value, the sore is set to the bottom value.
b | ● |  | ● | ● | Score for a good response to a question.
m | ● |  | ● | ● | Score for a bad response to a question.
|  | ● |  |  | Without parameter name (syntax: `\scoring{2}`), this indicates the score to give if the student has checked this response.
auto | ● |  |  |  | With this parameter, the value of the response numbered i will be auto+i-1. This option is mainly used with `\QuestionIndicative` (see section ).
mz | ● |  | ● |  | This parameter is used for a "maximum or zero" scoring: if all the answers are correct, the score is mz. If not, the score is zero.
haut |  |  | ● |  | When you give this parameter a value n, the score given for a perfect response will be n, and one point will be withdrawn for each error. `haut=n has been rewritten as d=n-N, p=0`
MAX | ● |  | ● |  | Gives the maximal value given for the question (for a "question scored 5", one can write MAX=5). To be used only when it is not the same value as when one replies every good response. If you specify `MAX = 3` with 4 points question, a student will have a score of 4/3 in this question.
formula | ● |  | ● |  | Gives the score to be given for the question, often using a formula that uses some variables (see ), without taking `b` and `m` values into account.
set.XXX | ● | ● | ● | ● | Gives a particular value to the variable named XXX, that will be available in a `formula`. In an answer context, the value is associated to the variable only if the box is ticked. As a particular case, give a non-null value to the variable `INVALID` to declare the responses incoherent (so that the score will be given by the variable `e`).
setglobal.XXX | ● | ● | ● | ● | Gives a value to the variable XXX for all following questions (relative to the lexicographic order of IDs)
default.XXX | ● |  | ● |  | Gives a value to the variable XXX in the case when no ticked boxes gave a value to XXX. If you use the parameter default, you must declare the variable XXX inside the scoring. You may assign the value set.XXX to the variables b and m.
    \begin{questionmult}{Q1}
    \bareme{default.CONF=1,m=-CONF,b=CONF}
requires.XXX | ● |  | ● |  | Tells that the variable XXX has to be defined, unless the data is told incoherent and the question scored with the value of `e`.

The default scale for a simple question is `e=0,v=0,b=1,m=0`, which gives one point for a good response and no point in the other cases. The default scaling for a multiple question is

    e=0,v=0,b=1,m=0,p=-100,d=0

which gives a point for every checked box, either good or not (good box checked or wrong box not checked).

The LaTeX command `\scoring` can also be used outside question definitions, for whole examination parameters:

- `SUF=`x gives a total number of points sufficient to get the maximal mark. For example, with 10 for the maximal mark and parameter `SUF=8`, a student getting a total of 6 points will get mark 6/8*10=7.5, whatever the value of the total number of points for a perfect answer sheet.

- `allowempty=x` allows the student to leave x questions unanswered. When summing up questions scores, x unanswered questions will be canceled.

Using all of these parameters in combination allows to define many kinds of scoring strategies, as in the following example:

    \documentclass{article}

    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[box,completemulti]{automultiplechoice}

    \begin{document}

    \element{qqs}{
    \begin{question}{good choice}
      How many points would you like for this question?
      \begin{choices}
        \correctchoice{Maximum: 10}\scoring{10}
        \wrongchoice{Only 5}\scoring{5}
        \wrongchoice{Two will be enough}\scoring{2}
        \wrongchoice{None, thanks}\scoring{0}
      \end{choices}
    \end{question}
    }

    \element{qqs}{
    \begin{questionmult}{added}
      Get free points checking the following boxes:
      \begin{choices}
        \correctchoice{2 points}\scoring{b=2}
        \wrongchoice{One negative point!}\scoring{b=0,m=-1}
        \correctchoice{3 points}\scoring{b=3}
        \correctchoice{1 point}
        \correctchoice{Half point}\scoring{b=0.5}
      \end{choices}
    \end{questionmult}
    }

    \element{qqs}{
    \begin{questionmult}{3 or zero}\scoring{mz=3}
      Only a perfect response will be scored 3 points - otherwise, null score.
      \begin{choices}
        \wrongchoice{Wrong}
        \wrongchoice{Wrong}
        \correctchoice{Right}
        \correctchoice{Right}
      \end{choices}
    \end{questionmult}
    }

    \element{qqs}{
    \begin{questionmult}{all for 2}\scoring{haut=2}
      Perfect response scored 2 points, and give back one point for any error...
      \begin{choices}
        \correctchoice{Right}
        \correctchoice{This one is OK}
        \correctchoice{Yes!}
        \wrongchoice{False!}
        \wrongchoice{Don't check!}
      \end{choices}
    \end{questionmult}
    }

    \element{qqs}{
    \begin{question}{attention}\scoring{b=2}
      Some very bad answer yields here to a negative score (-2), but the correct answer is rewarded 2 points.
      \begin{choices}
        \correctchoice{Good!}
        \wrongchoice{Not correct}
        \wrongchoice{Not correct}
        \wrongchoice{Not correct}
        \wrongchoice{Very bad answer!}\scoring{-2}
      \end{choices}
    \end{question}
    }

    \element{qqs}{
    \begin{questionmult}{as you like}
      Choose how much points you need:
      \begin{choices}
        \correctchoice{You take two points here}\scoring{b=2}
        \wrongchoice{Check to give 3 points}\scoring{b=0,m=3}
        \correctchoice{Get one if checked, but give one if not}\scoring{m=-1}
      \end{choices}
    \end{questionmult}
    }

    \element{qqs}{
    \begin{questionmult}{03}
      \scoring{default.COMP=10,default.PROP=11,formula=(COMP==PROP ? 1 : 0)}
      \AMCdontAnnotate
      Name an important gas in the air and its percentage.
        \begin{choices}
          \wrongchoice{steam}
          \wrongchoice{gas}
          \correctchoice{nitrogen}\scoring{set.COMP=1}
          \wrongchoice{oxygen}\scoring{set.COMP=2}
          \wrongchoice{carbon dioxide}
          \wrongchoice{20\%}\scoring{set.PROP=2}
          \wrongchoice{40\%}
          \wrongchoice{60\%}
          \correctchoice{80\%}\scoring{set.PROP=1}
        \end{choices}
    \end{questionmult}
    }

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \onecopy{20}{

    \noindent{\bf QCM  \hfill Scoring strategy test}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
    \centering\large\bf Test\\ Jan. 2008\end{minipage}
    \namefield{\fbox{\begin{minipage}{.5\linewidth}
    Name:

    \vspace*{.5cm}\dotfill
    \vspace*{1mm}
    \end{minipage}}}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \shufflegroup{qqs}

    \insertgroup{qqs}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    }

    \end{document}

#### Global scoring strategy

To use a strategy globally for a set of questions, one can define it in a LaTeX command, as in the following example:

    \def\barQmult{haut=3,p=-1}

    \begin{questionmult}\scoring{\barQmult}
      [...]
    \end{questionmult}

Another possibility comes with the LaTeX commands `\scoringDefaultS` and `\scoringDefaultM`, to be used in the begin of the document (outside the command `\onecopy`), which allow to give default values for the scoring strategy of simple and multiple questions:

    \scoringDefaultM{haut=3,p=-1}

If you use `formula` with `\scoringDefautM` or `\scoringDefautS`, you must cancel it to score different questions with a specific scoring.

    \begin{questionmult}\scoring{b=1,m=-0.5,formula=}
      [...]
    \end{questionmult}

In some cases, defining a global strategy can be interesting depending of the number of proposed responses. To do so, just input the value `N`. For example, to get a scale yielding 4 as the maximal score and such as the mean expected score of a student checking randomly the boxes is 1, one can use the scale `d=4,b=0,m=-(4-1)*2/N` (which give the score -2 if every response is false, i.e. the wrong boxes have been checked and the right boxes are not). Operations allowed in those formulas are the four simple operations (`+` `-` `*` `/`), test operator `( ? : )`, parenthesis and all perl operators.

The test operator is written

    ( test ? if true: if false)

The test part can use operators like `>` (greater), `>=` (greater or equal), `<` (lesser), `<=` (lesser or equal), `==` (equal), `!=` (different), `||` (or), `&&` (and).

Other variables can also be used:

- `N` is the number of proposed responses, without counting the response eventually added by the option `completemulti`.

- `NB` is the number of correct responses to the question (without taking in account checked or non-checked boxes).

- `NBC` is the count of correct responses which have been checked.

- `NM` is the number of wrong responses to the question (without taking in account checked or non-checked boxes).

- `NMC` is the count of wrong responses which have been checked.

- `IS` is set to 1 if the question is simple and 0 if not.

- `IMULT` is set to 1 if the question is multiple and 0 if not.

#### From scoring strategy to students marks

Here is how students' marks are computed: for every student,

1. The scoring strategy is applied for each question in turn, to get the questions scores.

2. All questions (except indicative ones) scores are added to get the student total score.

3. If a positive maximal mark is given as a parameter (in the Project tab of the Edit Preferences window), the total score of the student is divided by the maximum total score (which is the total score for a perfect copy), and multiplied by the difference (maximal mark - minimal mark), then added to the minimal mark to get the student's mark. This way, if the student answered perfectly to all questions, his mark will be the maximum mark, and a student with null score will get the minimal mark. If you set the maximal mark to 100 and the minimal mark to 0, the student's mark can be seen as a percentage of good answers.

4. This mark is rounded using the following settings from Edit Preferences Project :

   - Grain: set it to 1 if you need an integer value, set it to 0.25 if you need to round up to a quarter, etc. Set it to 0 if you want to cancel rounding.

   - Rounding type: lower, normal, greater

#### Correct the scoring errors

You may, even after the test, change the scoring. However, you must not never update the document. It is better to open the file with a text editor to make changes and save it.

You may :

- turn correct answer into wrong answers.

- turn wrong answer into correct answers.

- Modify the scoring scale for one or several question or the default scoring.

You can not :

- Turn a simple question into a multiple choices question.

- Turn a multiple choices question into a simple question.

- Add questions, answers.

- Remove questions, answers.

- Modify the order of the questions and/or answers.

If you want to cancel a question use this strategy `\scoring{b=0,m=0,e=0,v=0}` or this one `\QuestionIndicative`.

### Identification of the students

This stage is not mandatory. It deals with associating each copy with a student. The name of the student is not read in an automated fashion, but two reasonable possibilities are proposed:

1. It is possible to ask students to identify themselves on their copy with their student number, which will be written by checking one box per digit. A LaTeX command is designed to use this method on the copy (see the part ). After the exam, copies will be identified automatically taking into account a list matching the students' numbers and their names.

2. With no input of the students' numbers, or in the case when the automated identification has not succeeded perfectly (for example when a student made a wrong input), the graphical interface allows an assisted manual association.

Let's first move to the Marking tab of the graphical interface.

#### List of the students

We must previously supply a list of students. This list can obviously be used for many multiple-choices tests. This list is a CSV file with optional comments lines at the beginning with prefix ``#`', as in the following example:

    # STUDENTS / 1ST YEAR
    surname:name:id:email
    Bienvenüe:Alexis:001:paamc@passoire.fr
    Boulix:Jojo:002:jojo.boulix@rien.xx
    Noël:Père:003:pere.noel@pole-nord.xx

The first lines of the file which begin with the character ``#'` are comments. The first of the other lines contains (separated by the character ``:'`) the column titles. Then, with one line per student, we write the corresponding information. There must be at least one column named `name` or `surname`.

One can replace the separator ``:'` by a comma, a semicolon or a tabulation. However the same separator must be used everywhere in the file which contains the list of students. The used separator is detected by taking the character (out of the four possible characters) which appears most frequently in the first line which is not a comment.

Any CSV file should be suitable.

Type carefully the CSV file to send the same test to multiple recipients.

- A semi-colon or colon or tabulation to separate the headers and a comma to separate the email adresses.

- A comma to separate the headers and email adresses between inverted comma/quotation marks.

    name,forenama,email
    Boulix,Jojo,"jojo@boulix.fr,parents@boulix.com"

The prepared list of students will then be selected with the button Set file in the Students identification section. We must also choose one of the columns as a unique key which will identify the students (generally, one chooses the column containing the student's number). Last, to prepare an automated association, we must choose the name of the relevant code used in the LaTeX command `\AMCcode` (if used).

#### Association

##### Automated association

###### Without barcode

To make an automated association, at least one command `AMCcode` is required (see ) in the LaTeX source file, as well as a list of students with a column containing a reference (generally a number of student) which will be identical to the input given in the boxes produced by the command `AMCcodeGrid`.

To perform an automated association complete the two drop-down menus on the Notation tab:

- Primary key from this list: the name of the column, in the list of students, with the students' numbers (see ).

- Code name for automatic association: : the selected identifier thanks to the LaTeX command `\AMCcodeGrid` (see ).

- Check the name filed type: Preferences Project Name field type Image

- When we push the button Automatic in the part Students identification, matching of the codes given by the students begins. We can watch or improve the result later with a (partial) manual association.

###### With a barcode

The barcode must be sticked in the space created by `champnom`.

AMC does not create bar code, it is your responsibility to do so with external software.

To perform an automated association complete the two drop-down menus on the Notation tab:

- Primary key from this list: the name of the column, in the list of students, with the students' numbers (see ).

- Code name for automatic association: : _namefield

- Check the name filed type: Preferences Project Name field type Barcode or Barcode tail .

- Decode name fields: Menu Project Decode name fields .

- When we push the button Automatic in the part Students identification, matching of the codes given by the students begins. We can watch or improve the result later with a (partial) manual association.

##### Manual association

To open the window allowing recognition of the students' names, let's click on Manual button in the Students identification section. This window is made of an upper part which presents in sequence images of the names written by the students, a lower part containing a button for each student from the list we supplied, and a right part allowing to browse easily the copies to be identified. Let's click the button matching the name written in the upper part for each presented page (by default, only the copies not or badly identified are presented - this can be changed by checking the box associated). When every page is read, a blue background appears instead of the names, and we just need to click the Save button to end with association.

### Exporting the scores list

At this stage, we can get the list of scores under various formats (currently CSV and OpenOffice), with the button Export. This export will be followed by the opening of the produced file by the appropriate software (if available).

#### Export to ODS (OpenOffice, LibreOffice)

In the exported file, the following colors are used:

gray

  is used for non applicable. This may be for example scores for absentees, or scores corresponding to a question that was not shown to the corresponding student.

yellow

  is used for questions that has not been answered by the student.

red

  is used for questions with an invalid answer: the student ticked several boxes in a simple question, or he ticked some boxes and the box None of these answers are correct.

purple

  used for indicative questions.

green

  used for total score of questions in the same group (score or percentage). See et

### Annotation

When we push the button Annotate papers, copies annotation will begin: on every scan, the following annotations will be made (these are the default annotations, they can be configured):

- The boxes wrongly checked by the student will be circled in red;

- the non-checked boxes which should have been are checked in red;

- the checked boxes which had to be checked are checked in blue;

- for each question, obtained and maximal scores are indicated;

- the global score of the copy is indicated on the first page of the copy.

The text written on the first page of the copies can be configured ( Edit Preferences Annotation Header or Edit Preferences Project Papers annotation Header text ). Substitutions will be made within the provided text (please have a look at for some details on the meaning of those values):

`%S`

  is replaced by the student's total score.

`%M`

  is replaced by the maximum total score.

`%s`

  is replaced by the student's mark.

`%m`

  is replaced by the maximum mark.

`%(ID)`

  is replaced by the student's name.

`%(COL)`

  is replaced by the value of column COL in the students list for the current student.

This operation is made for each page, giving as a result PDF annotated papers. The name of the PDF file which will contain the corrected copy of a student is based on the template indicated in the field File name model. In that template, every substring as « (col) » is replaced by the contents of the column named `col` in the file containing the list of students (see section ). If we let this field empty, a default value is built up based on the student's name and student number.

#### Options with the option `separateanswersheet`

- `Only pages with answers` : the answer sheets will be annoted.

- `Question pages from subject` : the answer sheets will be annoted and the subject will be inclued to the pdf file.

- `Question pages from correction` : the answer sheets will be annoted and the corrected will be inclued to the pdf fil.

#### Marks' position

You may choose marks's position with the menu Edit Preference Project Marks position

Default choices

- (none)

- In the margin.

- In the both margins

- Beside the boxes.

- Where defined in the source (see ).

### Default values edit menu

Edit Preferences Scan

`Scans conversion`

- Vector formats density (DPI) : 250

- Black & white conversion threshold : 0.60

- Erase red from scans : unticked

- Force conversion: unticked

`Detection parameters`

- Marks size max increase: 0.20

- Marks size max decrease : 0.20

- Default darkness threshold : 0.15

- Default upper darkness threshold : 1

- Measured box proportion: 0.80

- Process scans with 3 corner marks : unticked

## Alternative usages

### Photocopied subject

As explained in , it is not always possible to photocopy one answer sheet to give to several students. However, when using a separate answer sheet and when questions and answers are not to be shuffled, you can photocopy the subject, and print all the answer sheets separately. We detail here the proper way to follow.

- Use `separateanswersheet` package option (see ).

- Write the subject before calling `\onecopy` command or outside `examcopy` environment.

- Use `\AMCformS` to output answer boxes in each answer sheet, inside `\onecopy`/`examcopy`.

Here is a minimal example:

    \documentclass[a4paper]{article}
    \usepackage[separateanswersheet]{automultiplechoice}
    \begin{document}

    \noindent{\bf Subject}

    \begin{question}{sum}
      How much are one plus one?
      \begin{choices}
        \wrongchoice{1}
        \correctchoice{2}
        \wrongchoice{3}
      \end{choices}
    \end{question}

    \begin{question}{k2}
      How high is the K2?
      \begin{choices}
        \wrongchoice{around 8000m}
        \correctchoice{around 8600m}
        \wrongchoice{around 9000m}
      \end{choices}
    \end{question}

    \AMCcleardoublepage

    \onecopy{5}{

    \AMCformBegin

    {\large\bf Answer sheet:}
    \hfill \namefield{\fbox{
        \begin{minipage}{.5\linewidth}
          Name:

          \vspace*{.5cm}\dotfill
          \vspace*{1mm}
        \end{minipage}
      }}

    \AMCformS

    }

    \end{document}

You will get from this LaTeX file one subject (sheet numbered 0) to print and photocopy to all students, and several answer sheets to print (one for each student).

### Post correcting

Suppose you want to use a single generic answer sheet for all your exams. You simply print answer boxes on it (say 5 for each questions, and 40 questions), and give the students a subject that you wrote somewhere else. The point here is that the correct choices are not pointed out in the LaTeX file, so that AMC does not know about them. The solution is to give one answer sheet to the teacher to fill correct choices. Then, after scanning and AMC analysis, you simply have to tell AMC which is the teacher completed answer sheet.

To implement this idea, follow these rules:

- Use `postcorrect`, `insidebox` and `noshuffle` package options (see ).

- Only use `\wrongchoice` for all your choices (never `\correctchoice`).

Here is a minimal example:

    \documentclass[a4paper]{article}
    \usepackage{multicol}
    \usepackage[insidebox,noshuffle,postcorrect]{automultiplechoice}

    \begin{document}

    \onecopy{5}{

    \noindent
    \begin{tabular}{|l|l|l|}
    \hline
    student number & class & subject\\
    \hline
     \vspace{-0.25cm}
     & &\\
    \AMCcode{StudentNum}{10}&
    \AMCcode{class}{2}&
    \AMCcode{subject}{3}
    \\
    \hline
    \end{tabular}
    \hfill\namefield{\fbox{
        \begin{minipage}{.25\linewidth}
          Name:

          \vspace*{.5cm}\dotfill

          \vspace*{.5cm}\dotfill
          \vspace*{1mm}
        \end{minipage}
      }}\hfill

    \vspace{.5cm}
    \noindent\hrulefill

    \begin{multicols}{2}\columnseprule=.4pt

    \begin{question}{01}
    \begin{choicescustom}
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \end{choicescustom}
    \end{question}

    \begin{question}{02}
    \begin{choicescustom}
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \wrongchoice{}%
    \end{choicescustom}
    \end{question}

    % continue here to get as many questions as needed...

    \end{multicols}

    }

    \end{document}

You can then process the LaTeX file in AMC, print the sheets, scan them after the exam, and start AMC automatic data capture (including the teacher sheet). When you click on Mark in the Marking tab, letting Update marking scale ticked, you will be prompted for the teacher answer sheet number. You can then continue as usual.

You can also write the letters outside the boxes: replace the `insidebox` option with `outsidebox`, and write your questions in the following way:

    \begin{question}{01}
      \begin{choicescustom}
        \wrongchoice{A }%
        \wrongchoice{B }%
        \wrongchoice{C }%
        \wrongchoice{D }%
        \wrongchoice{E }%
      \end{choicescustom}
    \end{question}

To use this option only for the questions answers (and not for the student number), type, just after `\begin{document}`

    \makeatletter
    \def\setoutsidebox{\AMC@outside@boxtrue}
    \makeatother

Then, use this command locally (inside braces) in the form :

    {\setoutsidebox\AMCform}

### Nominative sheets

In some situations, it can be useful to prepare nominative sheets for all students, from a list of students. Let us see how this can be done.

- The students list has to be a CSV list. Suppose in the following that the file students.csv, in the project directory, is UTF8 encoded and that its content is like the following:

      name,forename,id
      Boulix,Jojo,001
      Golin,André,002
      Moniuszko,Stanisław,003

  Do not use _ (underscore) with the student's name or forename. A compilation error will be displayed.

- `\onecopy{1}` must be equal to one.

- The number of papers must be equal to zero (graphical interface).

- The LaTeX source file has to load csvsimple package, with:

      \usepackage{csvsimple}

- In the LaTeX source file, define the subject as a command that produce a single subject. This command will be called once for each student by `\csvreader` (suppose here that the questions has already be defined and included in a group named `general`):

      \newcommand{\subject}{
        \onecopy{1}{

          \noindent{\bf AutoMultipleChoice  \hfill TEST}

          \vspace*{.5cm}

          \begin{center}\em
            Pre-filled test.
          \end{center}

          \hfill \namefield{\fbox{
              \begin{minipage}{.5\linewidth}
                Name:

                \Large\bf \name{} \surname{}

                \vspace*{1mm}
              \end{minipage}
            }}

          \noindent\hrulefill

          \vspace{1ex}

          \insertgroup{general}

          \AMCassociation{\id}
        %\AMCassociation[\name-\surname]{\id}
        }
      }

      %password protect
      %\AMCstudentslistfile{liste.csv}{id}

      \csvreader[head to column names]{students.csv}{}{\subject}
      %\csvreader[head to column names,separator=semicolon]{liste.csv}{}{\subject}

  The head to column names option for `\csvreader` defines commands `\name`, `\surname` and `\id` (named from the CSV headers), that can be used inside `\subject`. The `\AMCassociation` call tells AMC to associate the current sheet to student with id `\id`.

  Optional argument to \AMCassociation to suggest a file name when printing to file.

  To protect each file with a unique password.

  Use this command if the CSV file contains only one email address per student.

  Use this command if the CSV file contains multiple email addresses per student.

- After printing, scanning, data capture and marking, when associating copies with students, choose value "pre-association" for field "code-name for automatic association", and "id" for field "Primary key".

## Conflicts with other packages

### Packages to load after automultiplchoice

You must load the following packages after automultiplechoice : fancyvrb, fancybox, pstricks, minted.

To use `PSTricks`, you have to configure AMC : Edit Preferences Main Default LaTex engine latex+dvipdf

### verbatim

From wiki.

The verbatim environment interferes with AMC LaTeX package, so that it is impossible to use it inside `question` or `questionmult` environments... As an example, the following code won't compile:

    \begin{question}{program}
    What is the return value of the following R code?
    \begin{verbatim}
    sum(sapply(1:2^2,function(x) { x/2 }))
    \end{verbatim}
    \begin{choices}[o]
    \wrongchoice{2.5}
    \correctchoice{5}
    \wrongchoice{NaN}
    \end{choices}
    \end{question}

#### Escaping

For very small texts, it is possible to escape all characters that have a special meaning for LaTeX. However, this can become quickly tedious.

    \begin{question}{program}
    What is the return value of the following R code?
    \begin{center}
    \texttt{sum(sapply(1:2\textasciicircum 2,function(x) \{ x/2 \}))}
    \end{center}
    \begin{choices}[o]
    \wrongchoice{2.5}
    \correctchoice{5}
    \wrongchoice{NaN}
    \end{choices}
    \end{question}

#### `\UseVerb` from fancyvrb package.

https://www.ctan.org/pkg/verbatim.

You can also record some one-line verbatims with the fancyvrb package (define your verbatim outside, before `\onecopy)`:

    \SaveVerb{theRcode}'sum(sapply(1:2^2,function(x) { x/2 }))'
    ...
    \begin{question}{program}
    What is the return value of the following R code?
    \begin{center}
    \UseVerb{theRcode}
    \end{center}
    \begin{choices}[o]
    \wrongchoice{2.5}
    \correctchoice{5}
    \wrongchoice{NaN}
    \end{choices}
    \end{question}

#### verbatimbox package

For larger verbatims, the verbatimbox package can help you (define your verbatim outside, before `\onecopy)`:

    \begin{myverbbox}{\Rcode}
    sum(sapply(1:2^2,function(x) { x/2 }))
    \end{myverbbox}
    ...

    \begin{question}{program}
    What is the return value of the following R code?
    \begin{center}
    \Rcode
    \end{center}
    \begin{choices}[o]
    \wrongchoice{2.5}
    \correctchoice{5}
    \wrongchoice{NaN}
    \end{choices}
    \end{question}

#### Import external files

Reading the verbatim from a separate file often helps. As an example, for a syntax highlighted python code stored in a file named `prog.py` in the project directory, you can use

##### listings package

    \lstset{language=Python}
    \lstinputlisting{prog.py}

##### minted package

Compile with `-shell-escape`.

     \inputminted{python}{prog.py}

## Commands manual

You may skip this part if you want to use only the graphical user interface (and that should usually be the case). However, every action carried out with the graphical interface can also be performed using the various commands whose syntax is described here.

auto-multiple-choice 1 Auto Multiple Choice 1.5.2
auto-multiple-choice Automated treatment of MCQs
`auto-multiple-choice` action arguments `auto-multiple-choice` project

#### Description

The `auto-multiple-choice` command transmits its arguments to the `AMC-action.pl` command.

The second form, which does not mention any action, calls the graphical interface `auto-multiple-choice gui`, possibly with the name of a project to be opened.

#### See also

Different AMC actions: auto-multiple-choice-prepare 1 , auto-multiple-choice-imprime 1 , auto-multiple-choice-analyse 1 , auto-multiple-choice-note 1 , auto-multiple-choice-association-auto 1 , auto-multiple-choice-export 1 , auto-multiple-choice-annotate 1 , auto-multiple-choice-regroupe 1 .

auto-multiple-choice-prepare 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-prepare prepares working documents from LaTeX source file
`auto-multiple-choice` prepare --mode s --prefix project-dir mcq-source-file `auto-multiple-choice` prepare --mode b --data project-data-dir mcq-source-file

#### Description

The `auto-multiple-choice prepare` command extracts working documents from the source file describing the multiple choice questionnaire. Information to be extracted depends on the `--mode` argument value. In any mode, the source filename must be given as an argument.

- with "`--mode s`", `auto-multiple-choice prepare` makes the subject file (answer sheet to be printed and given to the students), the correction (single corrected answer sheet) and the positions file (file containing information about the positions of the boxes on the pages). The following arguments can be used:

  `--out-sujet subject.pdf`

    sets the subject file to build.

  `--out-corrige corrected.pdf`

    sets the correction to build.

  `--out-calage calage.xy`

    sets the positions file to build.

  `--prefix directory`

    this directory is only necessary if one or more of the three previous options are not used: default values are then `directory/sujet.pdf`, `directory/corrige.pdf` and `directory/calage.xy`.

- with "`--mode b`", `auto-multiple-choice prepare` extracts scoring data from the source file. In this mode, the `--data` argument must be used (see below).

The following optional arguments can be used in any mode:

`--with latex-engine`

  gives the LaTeX engine (command) to be used. latex-engine can be `pdflatex` or `xelatex` for example.

`--filter filter`

  sets the filter name to transform the MCQ source file into a LaTeX file. Native filters are `latex` (no change at all) and `plain` (source is an AMC-TXT file).

`--filtered-source mcq-latex-file`

  gives the LaTeX file to make from the source file using specified filter. If omitted, a filename derived from mcq-source-file adding `_filtered.tex` is used.

`--n-copies n`

  sets the number of copies to produce, overriding the number given in the LaTeX source file (first argument of the `\onecopy` command).

`--debug file.log`

  gives a file to fill with debugging information.

`--epoch EPOCH`

  gives an epoch (number of seconds since january 1, 1970) to get a reproducible pdf output.

`--data project-data-dir`

  sets the directory where the project's SQLite data files are.

auto-multiple-choice-meptex 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-meptex gets the layout information from the working document to the layout database
`auto-multiple-choice` meptex --src calage.xy --data directory

#### Description

The `auto-multiple-choice meptex` command extracts the layout information (exact positions of the boxes, the marks, the name field on all the pages) from a working document calage.xy and fills the layout database (a SQLite file) in the data directory directory.

auto-multiple-choice-imprime 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-imprime prints AMC multiple choice answer sheets to be distributed to the students
`auto-multiple-choice` imprime --sujet subject.pdf --fich-nums numbers-file.txt --data data-dir --methode method where-to-print-arguments

#### Description

The `auto-multiple-choice imprime` command prints selected copies from a AMC multiple choice answer sheet.

##### What to print

The following arguments describe what to print:

`--sujet subject.pdf`

  sets the subject file (prepared by auto-multiple-choice-prepare 1 ).

`--fich-nums numbers-file.txt`

  gives a file where the numbers of the copies to be printed are written (one number per line). If this argument is not given, all the copies will be printed.

`--data data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-meptex 1 ). The layout database in the data directory is used to know at which page of the subject file each copy begins and ends.

`--split`

  asks to print separate answer sheets separately.

`--answer-first`

  asks to reorder the pages of each copy to get the separate answer sheet first.

##### Where to print

Several printing methods are currently defined:

- with "`--methode CUPS`", `auto-multiple-choice imprime` prints to a CUPS printer. One print job is sent for each copy, allowing for example to use stapling. Use the following options with this method:

  `--imprimante printer`

    sets the CUPS printer name to print to.

  `--options cups-options`

    gives CUPS options, in the `opt1=value1,opt2=value2,...` format.

- with "`--methode file`", `auto-multiple-choice imprime` outputs the answer sheets to files (one for each copy).

  `--output filename`

    sets the filename for outputs. The '`%e`' sequence will be replaced by a 4-digits copy number. If filename does not contain '`%e`', the string '`-%e.pdf`' will be added at its end.

- with "`--methode command`", `auto-multiple-choice imprime` will use a provided command for each copy.

  `--print-command command`

    gives the command to be used for printing. The command string will be split at each space character (even when using quotes...). The sequence '`%f`' will be replaced by a PDF filename (containing the copy to print), and '`%e`' will be replaced by the copy number.

##### Other options

Other available options:

--extract-with command

  gives the command to use to extract pages from the PDF subject. Currently, `pdftk`, `gs` and `qpdf` are available. The default value is `pdftk`, but `qpdf` and then `gs` will be used if the `pdftk` command is not installed.

auto-multiple-choice-getimages 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-getimages prepares scan images before sending them to auto-multiple-choice-analyse 1 for analysis
`auto-multiple-choice` getimages --copy-to project-scans-dir --vector-density density --list list-file scan-files

#### Description

The `auto-multiple-choice getimages` command prepares scan files before sending them to auto-multiple-choice-analyse 1 :

- multipage image files are split to get one file per page.

- vector images (such as PDF, EPS) are converted to bitmap images.

The input images can be given either as arguments to `auto-multiple-choice getimages`, either as the name of a file which contains all the paths of the scan files.

`--list list-file`

  gives the name of the file that optionally contains (one per line) the paths of the scan files. This file will be cleared and filled with the paths of the scan files after processing, so that the same path can be passed to `auto-multiple-choice analyse` as the `--list-fichiers` option value.

`--copy-to project-scans-dir`

  gives a directory where to copy all the scans files.

`--vector-density density`

  sets the density used to convert vector graphics scans to bitmap files. Defaults to 300.

auto-multiple-choice-analyse 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-analyse automatic data capture from scans for AMC multiple choice exams.
`auto-multiple-choice` analyse --projet project-dir --seuil-coche threshold --tol-marque tol --list-fichiers files-list.txt scan-files

#### Description

The `auto-multiple-choice analyse` command performs automatic data capture from scans of completed answer sheets of an AMC multiple choice questionnaire. Before calling `auto-multiple-choice analyse`, auto-multiple-choice-prepare 1 should have been called to make working documents (`--mode s`) and the layout should have been processed with auto-multiple-choice-meptex 1 .

`--data data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-meptex 1 ). Defaults to `project-dir/data`.

`--cr project-cr-dir`

  gives a directory where to create image reports of the data capture (zooms on the boxes in a `zooms` sub-directory, name filed extraction as a `name-*.jpg` file, and layout report as a `page-*.jpg` file).

`--projet project-dir`

  When using this option, if `--cr` is not used, project-cr-dir will be set to `project-dir/cr`.

Giving the names of the scan files to process can be done in two ways:

- these names can be given as arguments,

- these names can be written to a plain file (one filename per line), using the `--list-fichiers files-list.txt` to give the name of this file.

Some parameters for data capture may be set using the following options:

`--prop proportion`

  sets the proportion of each box that will be measured to decide if the box is ticked or not. Default value is 0.8.

`--bw-threshold threshold`

  This parameter is used when converting the grayscale scan file to black and white. To get more black pixels, use a greater value. To get more white pixels, use a smaller value. The threshold must be between 0 and 1. The default value is 0.6.

`--ignore-red`

  With this option, only red channel will be used from color scans. This way, all that is written in red will be ignored in the scan. This can be useful when the boxes are printed in red.

`--tol-marque tol`

  defines the tolerance when detecting the four marks in the scans corners. These marks are detected looking for black connected components which dimensions are closed to the target dimension target (exact dimensions of the marks if printing/scanning process where perfectly accurate). If tol is a real number, accepted dimensions are those between (1-tol)*target and (1+tol)*target. If tol is "tinf,tsup" (where tinf and tsup are real numbers), accepted dimensions are those between (1-tinf)*target and (1+tsup)*target. A standard value is 0.2.

`--multiple`

  This option is to be used when the scans are photocopies from some subjects (different students can have the same subject). In this case, copy numbers are allocated to students so that their answer sheets, with the same subject number, can be differentiated.

`--pre-allocate copy_id`

  This option can be used in conjunction with `--multiple`. The copy numbers used for the scans will start from copy_id, in the same order than the scans given as arguments.

--try-three | --no-try-three

  Use one of these options to tell if you allow processing of scans where only three corner marks are present.

`--debug file.log`

  gives a file to fill with debugging information.

auto-multiple-choice-note 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-note computes marks after scans data capture for AMC multiple choice exams.
`auto-multiple-choice` note --data project-data-dir --seuil threshold --grain granularity --arrondi rounding --notemin min --notemax max --no-plafond --plafond

#### Description

The `auto-multiple-choice note` command computes marks for all students from the scoring strategy extracted from the LaTeX source file by auto-multiple-choice-prepare 1 and from the data capture reports made by auto-multiple-choice-analyse 1 .

`--data project-data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-meptex 1 ).

`--seuil threshold`

  gives the black ratio threshold for deciding whether a box is ticked or not. When deciding whether a box is checked or not, `auto-multiple-choice note` compares the black ratio (number of black pixels over total number of pixels) to threshold. If the black ratio is greater then threshold, the box is declared to be checked. Standard values can be 0.15 in the standard layout, or 0.5 for separate answer sheet layout (in this last case, letters are drawn in the boxes, and the students are told to fill the boxes entirely).

`--seuil-up upper_threshold`

  gives the black ratio threshold over which a box is considered as not being ticked. You can set this value to (for example) 0.6 to allow students to cancel a ticked box filling it completely: if the black ratio is between threshold and upper_threshold, the box is considered as being ticked, but if the black ratio is greater than upper_threshold (for example when the box is filled), the box is considered as not being ticked. The default value is 1.0, so that this feature is disabled.

`--grain granularity --arrondi rounding`

  ask marks to be rounded to a multiple of granularity. If rounding is '`i`', rounding is done from below (as with floor 3 ). If rounding is '`n`', rounding is done to the nearest multiple of granularity. If rounding is '`s`', rounding is done from above (as with ceil 3 ). For example, with options "`--grain 0.25 --arrondi s`", mark 6.285 is rounded to 6.5.

`--notemin min`

  with this option, all marks below min will be replaced by min.

`--notemax max`

  gives the mark to associate to a sheet where all answers are correct. If not used, marks are not scaled.

`--plafond`

  with this option, all marks above max will be replaced by max.

`--debug file.log`

  gives a file to fill with debugging information.

`--postcorrect-student s --postcorrect-copy c`

  requests port-correction from the completed answer sheet identified by student and copy numbers. In post-correction mode, correct answers are not extracted from the LaTeX source file, but taken from the answers given on this sheet.

auto-multiple-choice-association-auto 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-association-auto automatic association between students and answer sheets for AMC multiple choice exams.
`auto-multiple-choice` association-auto --data project-data-dir --notes-id id --liste students-list.csv --encodage-liste list-encoding --liste-key key

#### Description

The `auto-multiple-choice association-auto` command associates students with their answer sheet (when there are no errors from students when coding their student number and no error during data capture). See from English user documentation for details.

`--data project-data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-prepare 1 ).

`--notes-id id`

  gives the identification string of the code provided for student numbers (command `\AMCcode` in the LaTeX source file).

`--pre-association`

  if used, the `--notes-id` option is ignored and the automatic association is made from the pre-association data (command `\AMCassociation` in the LaTeX source file).

`--liste students-list.csv`

  gives the students list.

`--encodage-liste list-encoding`

  gives the students list file encoding (default is utf-8).

`--liste-key key`

  gives the column name where to find the student number in the students list.

`--debug file.log`

  gives a file to fill with debugging information.

auto-multiple-choice-association 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-association manual association between students and answer sheets for AMC multiple choice exams.
`auto-multiple-choice` association --data project-data-dir --list `auto-multiple-choice` association --data project-data-dir --set --student student-sheet-number --copy copy-number --id student-id

#### Description

The `auto-multiple-choice association` command handles association data between students and their answer sheet.

`--data project-data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-prepare 1 ).

With option `--list`, all association data is output.

With option `--set`, a manual association is updated.

auto-multiple-choice-export 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-export exports marks for AMC multiple choice exams.
`auto-multiple-choice` export --data project-data-dir --module module --fich-noms students-list.csv --noms-encodage list-encoding --o output-file

#### Description

The `auto-multiple-choice export` command exports marks from an Auto Multiple Choice exam.

`--data project-data-dir`

  gives the directory where data files are (see for example auto-multiple-choice-prepare 1 ).

`--module module`

  selects a module for export. See below for the modules included in the AMC standard distribution.

`--fich-noms students-list.csv`

  sets the students list file.

`--noms-encodage list-encoding`

  selects an encoding for file students-list.csv (default is utf-8).

`--o output-file`

  gives the output file name.

`--option-out options`

  gives an option for selected module, in the form `key=value` (see below for possible options for each module). To specify multiple options, use `--option` several times.

`--sort sort-type`

  sort the students names, depending on sort-type. If sort-type is `l`, use line number from students list file to sort. If sort-type is `m`, use mark (and name if marks are equal) to sort. If sort-type is `i`, use student number to sort. If sort-type is `n`, use name to sort (or line from students list if equal).

`--useall all`

  if all is `0` or empty, only students with a scanned answer sheet appears in the output. If all is `1`, all students in the students list appears in the output.

#### Modules

##### OpenDocument

With "`--module ods`", an OpenDocument (for use by OpenOffice or LibreOffice for example) is produced. The following options are recognized:

nom

  gives a name for the exam, to be written on the beginning of the sheet.

code

  gives an short name for the exam, to be used as a tab name.

columns

  sets the list of columns that are to be added to each student.

  Default value is `student.key,student.name`.

stats

  with a true value, a table will be added with statistics for all questions.

statsindic

  with a true value, a table will be added with statistics for all indicative questions.

##### CSV

With "`--module CSV`", a CSV file is produced. The following options are recognized:

columns

  sets the list of columns that are to be added to each student.

  Default value is `student.copy,student.key,student.name`.

decimal

  sets the decimal point (default is a dot).

encodage

  sets the encoding to use for output (default is utf-8).

separateur

  sets the character used between columns (default is a comma).

entoure

  sets the character used to enclose strings (default is a double quote).

ticked

  if not empty, additional columns (with "`CHECKED:`" prefix) are included to give all the checked boxes on all the sheets. This can be used by an external program to retrieve all the checked boxes when marks are not sufficient. Use value `01` to get 0;0;1;1;0 if boxes 3 and 4 are checked, and value `AB` to get CD if boxes 3 and 4 are checked.

##### List

With "`--module List`", a PDF file is produced with a list of marks for all students. The following options are recognized:

pagesize

  The page size. Default value is `a4`.

nom

  gives the name of the exam, to be printed at the top of the page.

ncols

  The number of columns. Default value is 2.

decimal

  sets the decimal point (default is a dot).

auto-multiple-choice-annotate 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-annotate completed answer sheets annotation after marking for AMC multiple choice exams.
`auto-multiple-choice` annotate --project project-dir --names-file students.csv annotation options

#### Description

The `auto-multiple-choice annotate` command annotates papers scans with scores for all questions, global score and mark, resulting in PDF files (one for each student, or one single file).

##### General options

`--project project-dir`

  sets the project name or directory.

`--data project-data-dir`

  gives the directory where data files are (default value is `project-dir/data`).

`--pdf-dir pdf-dir`

  sets the project pdf directory, where to output annotated scans (default value is `project-dir/cr/corrections/pdf`).

`--names-file students-list.csv`

  sets the students list file name.

`--names-encoding encoding`

  selects an encoding for file students-list.csv (default is utf-8).

`--association-key key`

  sets the key (column name in the students list file) that is used for association. Default value is stored in the database from value actually used for association, so this option should not be used.

`--subject subject.pdf`

  sets the path to the PDF question file (default is `project-dir/DOC-sujet.pdf`).

`--compose mode`

  use this option if you want to take pages from the subject when there is no boxes to be filled on them (for example, question pages before the annotated answer sheet). When mode equals 1, the pages are taken from the subject, are filled or not according to the student's answers (the same as on the answer sheet), and the same correction marks are drawn as on the answer sheet. When mode equals 2, the pages are taken from the corrected answer sheet (so the ticked answers are the correct ones), and no correction marks are drawn.

`--corrected corrected.pdf`

  sets the path to the PDF corrected subject (default is `project-dir/DOC-corrected.pdf`). If not present, this file will be built using values from options `--n-copies`, `--with`, `--filter` and `--filtered-source`).

`--darkness-threshold t`

  sets the darkness threshold. Default value is stored in the database from value actually used for scoring, so this option should not be used.

`--darkness-threshold-up upper_t`

  sets the upper darkness threshold. Default value is stored in the database from value actually used for scoring, so this option should not be used.

`--csv-build-name name-model`

  sets the model for building students names from the students list file. Default value is '`(nom|surname) (prenom|name)`', so that the name is built using the `nom` column content (or the `surname` column if the `nom` column does not exist), followed by the content of the `prenom` column (or the `name` column), so that the result should be OK for French or English simple CSV files.

`--id-file ids.txt`

  gives a filename where to find the ids of copies to annotate (one per line, either the student number if photocopy mode is off, or `student:copy` if the photocopy mode is on). If no file is given, then all copies will be annotated.

`--debug file.log`

  gives a file to fill with debugging information.

##### PDF output options

`--single-output`

  use this option if you need all annotated copies in a single PDF file. Default behavior is to build one PDF file per student.

`--sort s`

  sets the sort key (only useful when using `--single-output`): use

  l

    to keep students in the same order as in the students list file.

  m

    to sort students according to their marks.

  i

    to sort students according to the copy id.

  n

    to sort students according to their names.

`--filename-model model`

  sets a file name model for annotated PDFs. In this model, some sequences will be substituted:

  `(N)`

    is replaced by the student's name (see `--csv-build-name`).

  `(ID)`

    is replaced by the student number.

  `(COL)`

    is replaced by the value of column COL in the students list for the current student.

  The default value is '`(N)-(ID).pdf`'.

##### Source file options

These options are used when the `--corrected` path points to a non-existing file, so that this file can be rebuilt.

`--src mcq-source-file --n-copies n --with latex-engine --filter filter-name --filtered-source fs.tex`

  see auto-multiple-choice-prepare 1 .

##### Options for embedded scans

When present, scans are embedded in the annotated PDF file. The following options control the quality of the embedded scans, to reduce the annotated file size.

`--embedded-max-size maxsize`

  sets the maximal size for scans (in the format `widthxheight`, in pixels). Default value is the empty string, which means there is no maximum size. Scans that are larger will be reduced before being included in the annotated file.

`--embedded-format format`

  sets the format for scans inclusion: jpeg or png.

`--embedded-jpeg-quality quality`

  sets the JPEG quality (from 1 to 100) for jpeg embedded scans.

##### Annotation options

These options controls what kind of annotations are being to be drawn.

`--font-size fs`

  sets the font size, in points, for annotations.

`--text-color color`

  text color for annotations. Default value is red.

`--verdict header`

  sets the text header to be printed on each first page of the students copies. This text may contain CR characters for multi-line headers. Some sequences are substituted in it:

  `%S`

    is replaced by the student total score.

  `%M`

    is replaced by the maximum total score.

  `%s`

    is replaced by the student mark.

  `%m`

    is replaced by the maximum mark.

  `%(ID)`

    is replaced by the student's name.

  `%(COL)`

    is replaced by the value of column COL in the students list for the current student.

`--position pos`

  sets the position where question scores are to be written:

  marge

    the scores will be written in the left margin

  marges

    the scores will be written in the closest margin (left or right).

  case

    the scores will be written near the boxes

  none

    the scores won't be written.

--verdict-question perl-expression

  sets the text to be printed next to all questions, through a perl expression to be evaluated (if you need a simple text, simply quote it with `"`). Some sequences are substituted in it before evaluation:

  `%S`

    is replaced by the student score for this question.

  `%M`

    is replaced by the maximum score for this question.

  `%s`

    is the same as `%S`, but rounded to nc significant digits (see option `--ch-sign`).

  `%m`

    is the same as `%M`, but rounded to nc significant digits (see option `--ch-sign`).

  A standard value for this option is `"\"%s/%m\""`. You can also use tests (with the perl syntax `( TEST ? IF-YES : IF-NO )`) to write Valid if the score is the maximal score, or Failed if not, using

      --verdict-question "(%S==%M ? \"Valid\" : \"Failed\")"

--verdict-question-cancelled perl-expression

  same as `--verdict-question`, but applies for cancelled questions (see `allowempty` scoring strategy). The default value is `"X"`.

`--indicatives`

  use this option to request boxes annotation for indicative questions (these questions' scores won't be taken into account while computing the global score. The correct/wrong status is often irrelevant for these questions, so there is no point correcting the corresponding boxes).

`--line-width width`

  sets the line width (in points) when drawing symbols to correct answers.

`--symbols symbols-definition`

  defines how boxes will be annotated. symbols-definition is a comma separated list of `H-A:shape:color` constructs, where H is `0` or `1` depending on whether the box has to be checked or not, A is `0` or `1` depending on whether the box is actually checked or not, shape is one of `none`, `circle`, `mark`, `box` and color is a color (name or #RGB, see ImageMagick or GraphicsMagick documentation for details).

  Default value is "`0-0:none,0-1:circle:red,1-0:mark:red,1-1:mark:blue`".

##### Lengths

The following length can be given with a unit (`in`, `ft`, `pt`, `cm` or `mm`).

`--dist-to-box d`

  sets the distance from the boxes (going left) where to write questions scores when using `--position case`.Defaults to `1cm`.

`--dist-margin d`

  sets the margin size. Defaults to `5mm`.

`--dist-margin-global d`

  sets the margin size for the header. Defaults to `3mm`.

auto-multiple-choice-mailing 1 Auto Multiple Choice 1.5.2
auto-multiple-choice-mailing mail PDF annotated completed answer sheets to students
`auto-multiple-choice` mailing --xmlargs args.xml --project project-dir --students-list students-list.csv --list-encoding encoding --email-column col --sender sender-email --subject subject --text email-body --text-content-type content-type --debug file.log transport arguments

#### Description

The command `auto-multiple-choice mailing` sends by email the PDF annotated completed answer sheets to the students. Email addresses are taken from the students list file.

`--project project-dir`

  Gives the project directory.

`--students-list students-list.csv`

  sets the students list file name.

`--list-encoding encoding`

  selects an encoding for file students-list.csv (default is utf-8).

`--email-column col`

  sets the name of the column containing the email addresses of the students in the students list file.

`--sender sender-email`

  sets the sender email.

`--cc cc-email-address`

  sets the carbon copy email address.

`--bcc bcc-email-address`

  sets the blind carbon copy email address.

`--subject subject`

  sets the subject of the emails to send.

`--text email-body`

  sets the body text of the emails to send.

`--text-content-type content-type`

  sets the content-type of email text. content-type may be `text/plain` or `text/html`.

`--attach filename`

  adds file filename as an attachment to all emails sent. Use this option several times to attach multiple files.

`--transport transport`

  sets the transport to use. transport may be `sendmail` or `SMTP`.

`--debug file.log`

  gives a file to fill with debugging information.

`--delay time`

  sets a delay of time seconds between each sending.

#### Transport arguments

Depending on the value used for argument transport, the following arguments can be added:

##### Transport sendmail

`--sendmail-path path`

  sets the path to the `sendmail` command (defaults to `/usr/sbin/sendmail`).

##### Transport SMTP

`--smtp-host host`

  sets the SMTP hostname (defaults to `smtp`).

`--smtp-port port`

  sets the port to use (default value is 25).

`--smtp-ssl mode`

  sets the security mode for the SMTP connection. The option mode can be `ssl`, `starttls`, or `0` (unsecured).

`--smtp-user user`

  sets the username for authenticated SMTP.

`--smtp-passwd-file file`

  gives the path of a file containing the password (as the first line of the file) for authenticated SMTP.

#### Arguments in a XML file

To avoid encoding problems, one can place some arguments in a XML file and use the `--xmlargs file.xml` argument as the first command argument. Here is an example of such a file:

    <?xml version="1.0" encoding="UTF-8"?>
    <arguments>
      <arg>--sender</arg><arg>Bienvenüe &lt;paamc@passoire.fr&gt;</arg>
      <arg>--text</arg><arg>Voilà votre copie corrigée</arg>
      <arg>--subject</arg><arg>QCM</arg>
    </arguments>

## Miscellaneous

### AMC and TeXLive «vanilla» (ubuntu et debian)

#### AMC and TeXLive are not installed

- Install TeXLive on line.

    wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
    tar -xzf install-tl-unx.tar.gz
    cd install-tl-20xxxx
    sudo ./install-tl

Replace xxxx with the digits or type TABULATION.

- Select O then L and enter 3 times.

  Select R then I.

TexLive-full is the setting default. If you don't want all the packages, press C then select your packages then R and finally I.

    sudo apt install equivs --no-install-recommends
    mkdir -p /tmp/tl-equivs && cd /tmp/tl-equivs
    equivs-control texlive-local

- Open the web link and note the version number:

  .

    wget -O texlive-local http://www.tug.org/texlive/files/debian-equivs-20xx-ex.txt
    equivs-build texlive-local
    sudo dpkg -i texlive-local_20xx-x_all.deb
    sudo apt install -f

- Install AMC.

    sudo add-apt-repository ppa:alexis.bienvenue/stable && sudo apt-get update
    sudo apt-get install auto-multiple-choice && sudo apt-get install msmtp

- Create a symbolic link.

    sudo ln -s /usr/share/texmf/tex/latex/AMC /usr/local/texlive/texmf-local/tex/latex/AMC
    sudo mktexlsr
    sudo tlmgr update --self --all

#### AMC is not installed and TeXLive is(/usr/local/)

- Create a symbolic link.

    sudo ln -s /usr/share/texmf/tex/latex/AMC /usr/local/texlive/texmf-local/tex/latex/AMC
    sudo mktexlsr

### Cut the `DOC-sujet.pdf` file in several files

Preferences Main Printing Printing with method to files

Preferences Main Printing Extracting method pdftk / gs (ghostscipt) / qpdf (default) / sejda-console (not installed) .

### processing chain : 2 pages per sheet (2 A5 on 1 A4)

You may print the `DOC-sujet.pdf` file on 2 pages per 1 sheet with any pdf reader but AMC will not be able to analyse automatic data capture from scans, you have to crop it.

- convert pdf scans to pbm images.

      pdfimages yourfile.pdf foo

- Crop each image into two pages.

      mogrify -rotate -90 -crop 50%x100% *.pbm

  Noneeded to do after the previous command:

      mogrify -rotate +90 -crop 50%x100% *.pbm

  all pages will be treated and automatically renamed with ImageMagick.

  You can force ImageMagick to apply simultaneous black/white threshold to the image to make box checking easier (here 80%).

      mogrify -rotate -90 -crop 50%x100% -threshold 80% *.pbm

- Let’s move to the Data capture tab of the graphical interface and select this set of `pbm` images.

### pythontex

From and

- You need to add a script nammed prePythonTex4AMC and make it executable.

    #! /bin/sh
    SRC=$1
    echo "***** JOBNAME=$AMC_JOBNAME"
    echo "***** CMD=$AMC_CMD"
    rm -rf ./pythontex-files-*
    rm -f $AMC_JOBNAME.pytxcode
    $AMC_CMD
    echo "***** PYTHON"
    python /path/to/file/pythontex.py $AMC_JOBNAME.pytxcode
    echo "***** END FILTER"

python3 works too.

    python3 /path/to/file/pythontex3.py

- Add the following three lines to the beginning of the LaTex file.

    %%AMC:preprocess_command=/path/to/file/prePythonTex4AMC
    %%AMC:jobspecific=1
    %%AMC:latex_engine=pdflatex --shell-escape

Some python modules need to be installed (sympy, pygments)

#### An french example with python (from José OUIN : http://www.joseouin.fr)

    %%AMC:preprocess_command=/path/to/file/prePythonTex4AMC
    %%AMC:jobspecific=1
    %%AMC:latex_engine=pdflatex --shell-escape

    \documentclass[a4paper]{article}
    \usepackage[T1]{fontenc}

    \usepackage[english,bloc,completemulti]{automultiplechoice}
    \usepackage{fancyhdr,amssymb,amsmath}

    % ---------- Utilisation de codes Python -----
    \usepackage{pythontex}
    %----------------------------------------------

    \begin{pycode}
    import numpy as np
    from sympy import *

    np.random.seed(12345)
    # IMPORTANT : ramdom seed

    def polyv2(b,p,d,q) :
      x=Symbol('x')
      myp = expand((x-b)**p*(x-d)**q)
      return latex(myp)

    def dp1x(a,b,c) :
        x=Symbol('x')
        y=Symbol('y')
        f=(a*y-1)/(b*x-1)**c

        g=diff(f,x,1)
        g2=g/b
        g3=g*(-1)
        g4=g2*(-1)

        gl = latex(g)
        g2l = latex(g2)
        g3l = latex(g3)
        g4l = latex(g4)

        return np.array([gl,g2l,g3l,g4l])

    \end{pycode}

    \begin{document}

    \element{Questions}{%
    \begin{question}{QA}The value of $\pi$ is
    \begin{choices}
    \correctchoice{\py{np.pi}}
    \wrongchoice{\py{100+200}}
    \wrongchoice{\py{np.random.randint(10)+3.15}}
    \end{choices}
    \end{question}

    \begin{question}{QB}
    \pyc{a=np.random.randint(10)}
    \pyc{b=np.random.randint(10)}
    \pyc{z=np.complex(a,b)}

     Let the complex number $\underline{Z}= py{a}+i. py{b}$, what is the value of
    $\underline{Z} 2$~?

    \begin{choices}
    \correctchoice{\py{z**2}}
    \wrongchoice{\py{np.conj(z**2)}}
    \wrongchoice{\py{1/z}}
    \end{choices}
    \end{question}
    }%

    \onecopy{5}{

    %%% beginning of the test sheet header:

    \noindent{\bf QCM  \hfill TEST}

    \vspace*{.5cm}
    \begin{minipage}{.4\linewidth}
      \centering\large\bf Test\\ Examination on Jan. 1st, 2008
    \end{minipage}
    %-------------------------------------

    \begin{center}\em

    Duration : 10 minutes.

      No documents allowed. The use of electronic calculators is forbidden.

      Questions using the sign \multiSymbole{} may have
      zero, one or several correct answers.  Other questions have a single correct answer.

      Negative points may be attributed to \emph{very bad} answers.

    \end{center}

      \end{minipage}\hspace*{\fill}
      }

    \vspace{5ex}

    \begin{question}{deriv-px-1}

          \pyc{a=np.random.randint(2,7)} %
          \pyc{b=np.random.randint(2,5)} %
          \pyc{c=np.random.randint(2,5)} %
          \pyc{drvx=dp1x(a,b,c)}

    Let the following function: $f(x,y)= \dfrac{\py{a} y-1}{(\py{b} x-1)^{\py{c}}}$

    What is the partial derivative $ \dfrac{\partial f(x,y)}{\partial x}$ ?

    \begin{choiceshoriz}
    \correctchoice{$\py{drvx[0]}$}
    \wrongchoice{$\py{drvx[1]}$}
    \wrongchoice{$\py{drvx[2]}$}
    \wrongchoice{$\py{drvx[3]}$}
    \end{choiceshoriz}

    \end{question}
    %---------------
    % POLYNOME
    %--------------

    \begin{question}{polynome-v2}

          \pyc{b=np.random.randint(2,7)} % racine r = b
          \pyc{p=np.random.randint(2,4)} % p : ordre de mult de b
          \pyc{d=np.random.randint(2,5)} % racine r = d
          \pyc{q=np.random.randint(2,3)}  % q : ordre de mult de d
          \pyc{mypoly=polyv2(b,p,d,q)}    % construction de mypolyv2

    Let the polynomial: $\py{mypoly}$

    What is the root multiplicity order $r = \py{b}$ ?

    \begin{choiceshoriz}
    \correctchoice{$\py{p}$}
    \wrongchoice{$\py{p+1}$}
    \wrongchoice{$\py{p-1}$}
    \wrongchoice{$\py{p+2}$}
    \end{choiceshoriz}

    \end{question}

    \restituegroupe{Questions}

    }

    \end{document}

### AMC and moodle

### Configure AMC to use GMAIL

Login to your gmail account then enable the option : Allowing less secure apps to access your account.

#### Linux users (Ubuntu,Xubuntu,Lubuntu etc.)

Type in a terminal :

    sudo apt-get install msmtp

    sudo gedit /etc/msmtprc

add the following content to msmtprc file and save it.

    account gmail
    host smtp.gmail.com
    tls on
    tls_certcheck off
    port 587
    auth login
    from your_user_name@gmail.com
    user your_user_name@gmail.com
    password your_password

Set up AMC : Edit Preferences Email Mail delivery method , select sendmail and type the path :

    /usr/bin/msmtp

#### Macintosh users

Type in a terminal :

    sudo port install msmtp

    sudo pico ~/.msmtprc

add the following content to msmtprc file and save it.

    account default
    host smtp.gmail.com
    tls on
    tls_certcheck off
    port 587
    auth login
    from your_user_name@gmail.com
    user your_user_name@gmail.com
    password your_password

Modify the access rights:

    sudo chown user_name:user_name/Users/user_name/.msmtprc
    chmod 0600 /Users/user_name/.msmtprc

Set up AMC : Edit Preferences Email Mail delivery method , select sendmail and type the path :

    /opt/local/bin/msmtp