summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/esami
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/esami
Initial commit
Diffstat (limited to 'macros/latex/contrib/esami')
-rw-r--r--macros/latex/contrib/esami/README96
-rw-r--r--macros/latex/contrib/esami/VERSION1
-rw-r--r--macros/latex/contrib/esami/doc/esami-doc-en.pdfbin0 -> 459201 bytes
-rw-r--r--macros/latex/contrib/esami/doc/esami-doc-en.tex798
-rw-r--r--macros/latex/contrib/esami/doc/esami-doc-it.pdfbin0 -> 466907 bytes
-rw-r--r--macros/latex/contrib/esami/doc/esami-doc-it.tex802
-rw-r--r--macros/latex/contrib/esami/doc/esami.bib64
-rw-r--r--macros/latex/contrib/esami/doc/examples/master-sol.tex96
-rw-r--r--macros/latex/contrib/esami/doc/examples/master.tex96
-rw-r--r--macros/latex/contrib/esami/doc/examples/problem1.tex22
-rw-r--r--macros/latex/contrib/esami/doc/examples/problem2-tabella.tex35
-rw-r--r--macros/latex/contrib/esami/doc/examples/problem2.tex32
-rw-r--r--macros/latex/contrib/esami/doc/examples/problem3-matching.tex32
-rw-r--r--macros/latex/contrib/esami/doc/examples/problem4-fillin.tex25
-rw-r--r--macros/latex/contrib/esami/doc/examples/test1.tex19
-rw-r--r--macros/latex/contrib/esami/doc/examples/test11.tex19
-rw-r--r--macros/latex/contrib/esami/doc/examples/test12.tex42
-rw-r--r--macros/latex/contrib/esami/doc/examples/test13.tex57
-rw-r--r--macros/latex/contrib/esami/doc/examples/test14.tex259
-rw-r--r--macros/latex/contrib/esami/doc/examples/test2.tex53
-rw-r--r--macros/latex/contrib/esami/doc/examples/test3.tex61
-rw-r--r--macros/latex/contrib/esami/doc/examples/test4.tex71
-rw-r--r--macros/latex/contrib/esami/doc/examples/test5-fillin.tex26
-rw-r--r--macros/latex/contrib/esami/doc/examples/test9.tex57
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-luatex-sol.pdfbin0 -> 65018 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-luatex.pdfbin0 -> 55273 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-sol.pdfbin0 -> 232036 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-sol.tex121
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-xetex-sol.pdfbin0 -> 61685 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA-xetex.pdfbin0 -> 52621 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA.pdfbin0 -> 177496 bytes
-rw-r--r--macros/latex/contrib/esami/doc/examples/testA.tex121
-rw-r--r--macros/latex/contrib/esami/doc/examples/totale-versioni.tex47
-rw-r--r--macros/latex/contrib/esami/es-UKenglish.lng66
-rw-r--r--macros/latex/contrib/esami/es-USenglish.lng58
-rw-r--r--macros/latex/contrib/esami/es-french.lng58
-rw-r--r--macros/latex/contrib/esami/es-german.lng60
-rw-r--r--macros/latex/contrib/esami/es-greek.lng68
-rw-r--r--macros/latex/contrib/esami/es-italian.lng79
-rw-r--r--macros/latex/contrib/esami/es-serbian.lng65
-rw-r--r--macros/latex/contrib/esami/es-spanish.lng71
-rw-r--r--macros/latex/contrib/esami/esami-xyz.cfg352
-rw-r--r--macros/latex/contrib/esami/esami.sty2172
43 files changed, 6101 insertions, 0 deletions
diff --git a/macros/latex/contrib/esami/README b/macros/latex/contrib/esami/README
new file mode 100644
index 0000000000..ccb8c24163
--- /dev/null
+++ b/macros/latex/contrib/esami/README
@@ -0,0 +1,96 @@
+The esami package v. 2.5
+ For generation of texts and solutions of exams in LaTeX
+2018/05/06
+
+File: README
+Author: Grazia Messineo and Salvatore Vassallo
+
+
+DESCRIPTION
+===========
+
+The package allows to write various type of exercises (multiple choiche questions with answers
+varying in random order, with closed or open answer, matching, problems, and so on). Questions
+of each group are randomly scrambled across the exam and variants of each exercise are chosen
+randomly from a file which contains them all and.
+
+Copyright: (C) 2008--2018 Grazia Messineo & Salvatore Vassallo
+Licence: LPPL
+
+FILES IN DISTRIBUTION
+=====================
+
+ BASE DISTRIBUTION:
+
+ VERSION
+ README This file.
+ esami.sty The main file
+ xyz.cfg A template of configuration file
+ es-*.lng Localisation files
+
+ DOCUMENTATION:
+
+ esami-doc-en.pdf User manual in English
+ esami-doc-it.pdf User manual in Italian
+ esami-doc-*.tex Sources for documentation
+ esami.bib Source for references
+
+ EXAMPLES:
+ Templates for the production of exams with solutions
+ master-sol.tex
+ master.tex
+
+ Template of file for testing exercise
+ totale-versioni.tex
+
+ Exercises for test
+ test1.tex
+ test2.tex
+ test3.tex
+ test4.tex
+ test5-fillin.tex
+ test9.tex
+ test11.tex
+ test12.tex
+ test13.tex
+ test14.tex
+
+ Exercises with open answers
+ problem1.tex
+ problem2.tex
+ problem2-tabella.tex
+ problem3-matching.tex
+ problem4-fillin.tex
+
+ Examples of an exam (and solutions) built using above exercises using pdflatex, xelatex and lualatex
+ testA.pdf
+ testA.tex
+ testA-luatex-sol.pdf
+ testA-luatex.pdf
+ testA-sol.pdf
+ testA-sol.tex
+ testA-xetex-sol.pdf
+ testA-xetex.pdf
+ testA.pdf
+ testA.tex
+ testA-sol.loe
+
+BASIC INSTALLATION
+====================
+
+File sty and files cfg and lng must be copied in a folder where LATEX can find them
+
+ For a basic installation on a TDS compliant system, move the
+ following files to the following directories:
+
+ <texmf>/tex/latex/esami/
+ esami.sty The main file
+ xyz.cfg A template of configuration file
+ es-*.lng Localisation files
+
+
+ <texmf>/doc/latex/esami/
+ README
+ doc-esami-en.pdf User manual in English
+ doc-esami-it.pdf User manual in Italian
+ doc-esami-*.tex Sources for documentation \ No newline at end of file
diff --git a/macros/latex/contrib/esami/VERSION b/macros/latex/contrib/esami/VERSION
new file mode 100644
index 0000000000..d7a901e88e
--- /dev/null
+++ b/macros/latex/contrib/esami/VERSION
@@ -0,0 +1 @@
+VERSION 2.5 DATE=May 06, 2018
diff --git a/macros/latex/contrib/esami/doc/esami-doc-en.pdf b/macros/latex/contrib/esami/doc/esami-doc-en.pdf
new file mode 100644
index 0000000000..8c00ce718d
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/esami-doc-en.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/esami-doc-en.tex b/macros/latex/contrib/esami/doc/esami-doc-en.tex
new file mode 100644
index 0000000000..bb1f7f319b
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/esami-doc-en.tex
@@ -0,0 +1,798 @@
+%\documentclass[10pt]{article}
+
+%\iffalse This is a METACOMMENT
+%
+%<*driver>
+%\ProvidesFile{esami.dtx}
+\documentclass{ltxdoc}
+%\usepackage[colorlinks,hyperindex]{hyperref}
+%\usepackage{esami}
+\usepackage[braces]{colordoc}
+\usepackage[T1]{fontenc}
+\usepackage{calc}
+\usepackage{hologo}
+%\usepackage{textcomp}
+\usepackage{lmodern}
+\usepackage[utf8]{inputenc}
+\usepackage[english]{babel}
+\usepackage{graphicx}
+\usepackage[dvipsnames,svgnames]{xcolor}
+\usepackage{fancyvrb}
+\usepackage[lmargin=3.5cm,rmargin=3.5cm]{geometry}
+\usepackage[colorlinks=true,pdftex,hyperindex=true]{hyperref}
+\newcounter{esempio}
+\newsavebox{\fcolbox} %\newlength{\fcolwidth}
+\newenvironment{esempio}
+{\par \medskip
+\begin{example}
+ }
+ {\end{example}\medskip}
+
+\newenvironment{example}
+{\noindent\stepcounter{esempio}%\setlength{\fcolwidth}{\textwidth-2\fboxsep-2\fboxrule}%
+\begin{lrbox}{\fcolbox}%
+\begin{minipage}[c]{\textwidth-2\fboxsep-2\fboxrule}
+\textbf{\textsf{Example \theesempio.}}
+}
+{\end{minipage}\end{lrbox}\fbox{\usebox{\fcolbox}}}
+
+
+\EnableCrossrefs
+\CodelineIndex
+\PageIndex
+\RecordChanges
+\OnlyDescription
+\CheckSum{6041}
+\begin{document}
+%\GetFileInfo{esami.sty}
+% \DocInput{esami.dtx}
+%\PrintChanges
+%\PrintIndex
+
+%</driver>
+%\fi
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+
+\changes{Version 1.0}{2013/03/08}{First version released to CTAN}
+\changes{Version 1.1}{2013/12/09}{Inserted the dependance on the package \texttt{environ} to remove some errors in the \LaTeX\ compilation. Removed the dependance on the package \texttt{icomma} in the italian localization file es-italian.lng because of the introduction of new features in the package \texttt{babel} for the Italian language (macro \texttt{IntelligentComma}).}
+\changes{Version 2.0}{2015/02/25}{Eliminated the dependance on \texttt{pstricks}. Modified the use of \emph{fill-in} questions. Inserted the possibility to extract more than one variant from a file. Now it is possible to view the solutions in tests. Modified the visualization of decimal places in command \texttt{FPsv}. Modified the definition of \texttt{FPval} to allow the use of decimal places. Modified the algorithm of choice of a variant of an exercise, now completely deterministic. Added the command \texttt{Acapo}. Added the serbian localization (latin alphabet). The compilation produces a new file with the list of the chosen exercises.}
+\changes{Versione 2.1}{2016/07/25}{Modified \texttt{es-german.lng} and \texttt{es-spanish.lng} for an error in the input of the solutions. The command \texttt{randestrai} has been introduced. The command \texttt{FPsignpol} has been introduced. The control on the total points of the exercises has been introduced. Removed the incompatibility between the command \texttt{fillin} and the commands \texttt{sempli} and \texttt{semplix}.}
+\changes{Version 2.2}{2017/07/01}{Introduced the possibility to have two different seeds for the choice of exercises (\cmd{\semeex}) and for the permutations and choice of the parameters (\cmd{\seme}): by default, they are equal. Slightly modified the command \cmd{\estrai} so that it is possible to use it to extract parameters from a list. Documentation integrated.}
+\changes{Version 2.3}{2017/09/18}{Corrected a misprint in the code.}
+\changes{Version 2.4}{2018/02/10}{Documentation corrected. }
+\changes{Version 2.5}{2018/05/06}{Corrected a misprint in the code. Improved the selection of random exercises.}
+
+%\IndexPrologue{\section*{Index} Numbers written in italic refer to the page where the item is described; underlined numebers refer to the line of code in which the item is described; other references are to the line of code where the item is used.}
+\GlossaryPrologue{\section*{Changelog}}
+\def\MacroFont{\fontencoding\encodingdefault
+ \fontfamily\ttdefault
+ \fontseries\mddefault
+ \fontshape\updefault
+ \footnotesize}
+\GetFileInfo{esami.sty}
+\def\fileversion{version 2.5}
+\def\filedate{2018/05/06}
+
+
+\title{Package esami\thanks{This document
+ refers to the package \textsf{esami}~\fileversion, with date \filedate.}}
+\author{Grazia Messineo <grazia.messineo@unicatt.it> \\ Salvatore Vassallo <salvatore.vassallo@unicatt.it>}
+\newcommand{\nuovo}[1]{\marginpar{\raggedleft{ \footnotesize{\textsf{New #1}}}}}
+
+\maketitle
+
+\tableofcontents
+\newpage
+\newcommand*\pkgname[1]{\texttt{#1}}
+\newcommand*\clsname[1]{\texttt{#1}}
+\newcommand*\optname[1]{\emph{#1}}
+\newcommand*\envname[1]{\textsf{#1}}
+
+%\section{Il pacchetto esami}
+\section{Introduction and motivations}
+Package \texttt{esami} (i.e. exams in Italian) was created to generate texts and solutions for the exams of Mathematics in the Faculty of Economics of Catholic University of Milan and satisfies the need of generating many versions (usually from 12 to 50) of the same exam, containing similar, but different, exercises, of printing solutions and, if Multiple Choice Questions (MCQ) are inserted, the string of correct answers.
+
+The package allows to write various type of exercises (multiple choiche questions with answers varying in random order, with closed or open answer, \emph{matching}, problems, and so on). Questions of each group are randomly scrambled across the exam and variants of each exercise are chosen randomly from a file which contains them all and, as far as we know, it is the only package which allows to do this just using \LaTeX\ ad not auxiliary programs.
+
+The development of the package has begun in 2008 (\cite{esami}, \cite{tug}) with the aim of unify and extend some properties of the packages \pkgname{exerquiz} e \pkgname{eqexam} by D.P. Story \cite{acrotex} and \pkgname{probsoln} by N.Talbot \cite{probsoln}.
+\section{Required packages}
+Package \pkgname{esami} depends on some other non standard packages\footnote{The complete list of the packages used in a normal compilation of an exam is: etex, graphicx, enumerate, fp, currfile, array, environ, ifthen, xargs, xkeyval, multicol, amssymb, amsfonts, xcolor, babel, etoolbox, icomma, numprint, amsmath, fontenc, inputenc, lmodern. Obviously, every loaded package can have other dependencies.}:
+\begin{enumerate}
+ \item \pkgname{fp}: for mathematical operations;
+ \item \pkgname{currfile}: to obtain the file and folder names;
+ \item \pkgname{xargs}: to have more than one optional parameter;
+ \item \pkgname{environ}: to transform commands in environments;
+\end{enumerate}
+Moreover following packages are optional, but recommended:
+\begin{enumerate}
+ \item \pkgname{ifluatex} and \pkgname{ifxetex} to compile with \Hologo{XeLaTeX} and \Hologo{LuaLaTeX} (here below we will refer only to the compilation with \hologo{pdfLaTeX})\nuovo{vers. 2.0}\footnote{At the moment the support for \Hologo{XeLaTeX} and \Hologo{LuaLaTeX} is only partial and it is not possibile to use some type of exercises.}.
+ \item \pkgname{lmodern} and \pkgname{amsfonts}: useful for a good pdf output;
+ \item \pkgname{numprint}: to have a better output and different formats for numbers, depending on language;
+ %\item \pkgname{icomma}: from \pkgname{ws} package, for a correct format of commas;
+ \item \pkgname{eurosym}: (optional) to use the euro symbol in Financial Mathematics exercises;
+ \item \pkgname{icomma}: from the package \pkgname{ws} for a correct formatting of commas. This package can be substituted, for the Italian language, by the macro \cmd{\IntelligentComma} of the package \pkgname{babel}: this is the default option in the italian localization file \texttt{es-italian.lng} and can be modified by commenting the macro \cmd{\IntelligentComma} (or by using the macro \cmd{\NoIntelligentComma});\nuovo{vers. 1.1}
+ \item \pkgname{pstricks, pstricks-add} and \pkgname{auto-pst-pdf} or \pkgname{tikz} or another package for graphics.\nuovo{vers. 2.0}
+\end{enumerate}
+All these packages are available both in \TeX Live and in MiK\TeX.
+
+\section{Installation}
+
+The package contains the file {\tt esami.sty}, some configuration files {\tt *.cfg}, the localization files, 3 templates for the compilation and the documentation files. File {\tt sty} and files {\tt cfg} and {\tt lng} must be copied in a folder where \LaTeX\ can find them (i.e. {\tt texmf-local/tex/latex/esami}). An update of the database must be run.
+
+\section{How to write an exam}
+In this section we will see how to build an exam using the ``esami'' package.
+
+\subsection{Preamble}
+\begin{verbatim}
+\documentclass[language]{article}
+\usepackage[<options>]{esami}
+\end{verbatim}
+Options are discussed in section \ref{sec:opzioni}.
+\begin{verbatim}
+\def\numcompiti{10}
+\date{2018/04/21}%%% THE DATE IN THE FORMAT YYYY/MM/DD
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+\end{verbatim}
+Command \cmd{\date} is the standard \LaTeX\ command, but the date must be written in the form YYYY/MM/DD. Command \cmd{\numcompiti} states the number of versions to generate. Command \cmd{\Date} now prints the date in the form DD MMMM YYYY (\cmd{\longdate}) or DD/MM/YYYY
+\subsection{The document}
+\begin{verbatim}
+\begin{document}
+\pagestyle{esame}
+%\setcounter{vers}{m}
+\end{verbatim}
+Command \cmd{\pagestyle} is defined in a configuration file (see section \ref{sec:cfg}) and defines headers and footers. The commented command \cmd{\setcounter}\{vers\}\{$m$\} is used, jointly to the command \cmd{\numcompiti} with inside a number $n$ (greater than $m$), to generate the versions from $m+1$ to $n$.
+\begin{verbatim}
+ \whiledo{\thevers<\numcompiti}{\stepvers
+\end{verbatim}
+the routine for the compilation of variants begins here and it will end at the end of document.
+\begin{verbatim}
+\FPeval\seme{round((\thenomefile+\thevers):0)}
+\randomi=\seme
+\end{verbatim}
+generates the seed for the randomization process and assigns it also to \cmd{\randomi}.
+
+\textcolor[rgb]{1.00,0.00,0.00}{\textbf{N.B.} If the seed is a number smaller than 1, it is initialized using date and hour, so two compilations will give different outputs.}
+\nuovo{vers. 2.2} It is now possible to define in a different way the seed for permutations (\cmd{\seme}) and the one for the choice of the exercises (\cmd{\semeex}): the need arises from the request to be able to choose for each exam the same exercises for all the students (\cmd{\semeex} depends only on the date), but also to be able to permute them in each version.
+\begin{verbatim}
+\permuta
+\testa
+\istruzionii
+\end{verbatim}
+\cmd{\testa}, \cmd{\istruzionii} are defined in the configuration file and contain the instructions for the heading and the instructions for the exam, while the macro \cmd{\permuta} allows the randomization of exercises order.
+
+\begin{verbatim}
+\begin{test}[points]
+\begin{questions}
+\esercizi{test1,test2,test3,test4}
+\begin{esdb}{dbone}
+ \selectrandomlyn{2}{dbtest1}
+\selectrandomlyn{4}{dbtest2}
+\end{esdb}
+\end{questions}
+\end{test}
+\end{verbatim}
+Here we define an environment for a test with (usually) MCQ. The command \cmd{\esercizi} chooses randomly the exercises from the files written in it and scrambles them, the environment \envname{esdb} defines a virtual database of exercises in which they are put by the command \cmd{\selectrandomlyn}.
+\begin{verbatim}
+ \esercizi{problema1, problema2}
+\end{verbatim}
+chooses between two exercises with open answer.
+\begin{verbatim}
+\closevers
+}
+%%\def\stringasol{}
+\end{document}
+\end{verbatim}
+It ends the routine for the compilation. The macro \verb+\def\stringasol{}+ is used to avoid the generation of the string of correct answers in the solution file, if you don't want it.
+
+\nuovo{vers. 2.0} The compilation produces a pdf file with all the desired variants. The compilation of the solutions file produces also another file, namely \texttt{filename-sol.loe} (loe = list of exercises) which contains the labels assigned to the chosen exercises, to identify them: each chosen exercise is identified by a string such as \emph{e:number of version -file:name of file-q:number of question in roman digits}.
+
+\nuovo{vers. 2.1} At the end of the solutions file there is the string of the correct answers for multiple choice questions: as a default behaviour this string is, for each version, included in a \envname{minipage} environment. If this choice is not suitable for our purposes (i. e. if we have 40 multiple choice questions and the answers cannot be contained in a page) it is possibile to modify it adapting the macros \cmd{\stepverssols} and \cmd{\closeverssols}: in the example cfg file there are (commented) the definitions to have a continuous string of correct answers.
+
+During the compilation, we have introduced a control that checks if the number of points marked for a test or an exercises divided in parts is equal to the sum of the partial points. This possibility can be excluded by commenting in the configuration file the definition of the command \cmd{\checkpoints}. \nuovo{vers. 2.1}
+
+\section{Package options}\label{sec:opzioni}
+The package can be loaded with the usual command
+\cmd{\usepackage}[\meta{options}]\{esami\}. The possibile options are:
+\begin{itemize}
+ \item \optname{allowrandomize} and \optname{norandomize}: with the first one the answers in MCQ are shuffled (default), with the second one they are printed in the same order in which they are written;
+ \item \optname{shuffle}, \optname{shufflerandom} and \optname{noshuffle}: the first one (the default) shuffles the exercises (randomly if they are more than eight, in a deterministic way if they are 8 or less), with the second one the exercises are always shuffled randomly (uncommenting some lines in the file \texttt{esami.sty} it is possible to modify it so that the choice is random for more than $n<8$ exercises and deterministic otherwise), with the third the exercises are not shuffled;
+ \item \optname{xyz}: it reads the file (\verb|esami-xyz.cfg|) that contains some commands and configurations, such as the name of the course, the instructions for the students, etc. The name of some configuration files is written in the file \texttt{esami.sty}, but it is possible to read a configuration file without modifying it: it is sufficient to put an unknown option like \optname{zzz} and write the file \verb|esami-zzz.cfg|;
+ \item \optname{pointsonright}: it is a boolean option that generates a little box on the right of the page with the score of the exercise;
+ \item \optname{nosolutions}: with this option the exam is generated without solutions (default);
+ \item \optname{solutions}: it generates the solutions file;
+ \item \optname{noquizsolutions}: it generates the test without solutions in MCQ;\nuovo{vers. 2.0}
+ \item \optname{quizsolutions}: it generates the test with the solutions in MCQ;\nuovo{vers. 2.0}
+ \item \optname{prova}: it is the Italian word for trial. Compiling the file \verb|totale-versioni| with this option, a PDF file is generated with all the variants of an exercise; automatically the correct answers of MCQ and the solutions of the exercises are shown;
+ \item \optname{param}: with this option, used only in conjunction with the option \optname{prova}, the versions of the exercise are printed in parametric form, moreover it shows the range of variation of the parameters;
+ \item \optname{correzione}: it is the Italian word for correction. It can be used only with the option \optname{prova}. It prints only the text of all the exercises, without solution;
+ \item {\color{blue}{\optname{fillb}}}: deprecated, it remains for compatibility with previous versions. It is used with ``fillin'' exercises, but it is recommended to use the macro \cmd{\fillinproblem} (see \ref{par:fillin})\nuovo{vers. 2.0}
+ \item \optname{twocolumns}: with this option the multiple choice questions are printed in two columns;
+ \item \optname{sansserif}: a \textit{sans serif} font is used.
+ \item \optname{autopston} e \optname{autopstoff}: both these options load the packages \pkgname{pstricks}, \pkgname{pstricks-add} and \pkgname{auto-pst-pdf} but the second one with the option \optname{off}; in this way it is possible to compile the file directly with pdf\LaTeX\ also if the exercises contain graphics in \pkgname{pstricks}, the graphics package we use. With the first one the images are generated and included in the document, while the second one does not generate the images but includes them if they exist.\VerbatimFootnotes
+ \footnote{The package \pkgname{auto-pst-pdf} requires pdf\LaTeX\ to be called with the \texttt{shell-escape} (in \TeX Live) or \texttt{write18} (in MiK\TeX) option}.
+ \item {\optname{language}}: it reads the localisation file es-language.lng (see \ref{sec:lng}). In this file there are the translations of the labels (exercise, solution, \dots), of the error messages, of the headings contained in the file (\texttt{esami-xyz.cfg}). By default Italian language is chosen. Since these language options have the same name of the languages in \pkgname{babel} it's possible to put the option in \cmd{\documentclass}.
+\end{itemize}
+
+
+\section{Exercises}
+\subsection{Variants}
+Each exercise (with all its variants) must be written in a separate file.
+\DescribeMacro{\newproblem}
+Each variant is enclosed in the command
+\cmd{\newproblem\{ \dots \}} (which has no optional arguments).
+\begin{esempio}
+ \begin{verbatim}
+%%% This is file1.tex with 2 variants of an exercise
+\newproblem{Text of first variant}
+\newproblem{Text of second variant}
+\end{verbatim}
+\end{esempio}
+Command \cmd{\newproblem} is a highly modified version of the similar command of the package \pkgname{probsoln}.
+\subsection{The environment test}
+\DescribeEnv{test}
+The environment \envname{test} allows to write exercises with MCQ or with open short answer, in which each question is randomly chosen from one of the files containing all the exercises and their variants.
+The environment is created by the command
+\begin{verbatim}
+ \begin{test}[<points>]
+ ...
+ \end{test}
+\end{verbatim}
+\DescribeMacro{points}
+The optional parameter \oarg{points} represents the total number of points given to the whole group of questions.
+
+\DescribeEnv{questions}
+The questions of each group, in the master file, are enclosed in the environment \emph{questions} which is a modified version of the environment with the same name in the package \pkgname{exerquiz}:
+\begin{verbatim}
+ \begin{questions}
+ ....
+ \end{questions}
+\end{verbatim}
+It is possibile to insert in a \envname{test} environment more than one \envname{questions} environment. The exercises of each group will be independently scrambled.
+\begin{esempio}
+ \begin{verbatim}
+\begin{test}
+ \begin{questions}
+ ....
+ \end{questions}
+....
+ \begin{questions}
+ ....
+ \end{questions}
+\end{test}
+\end{verbatim}
+\end{esempio}
+\DescribeMacro{\esercizi}
+Inside this environment, questions are ``loaded'' in two ways: with the environment \envname{esdb} which will be described later, or with the command \cmd{\esercizi} (exercises in Italian):
+\begin{verbatim}
+ \esercizi{name of source file 1, name of source file 2,...}
+\end{verbatim}
+The mandatory parameter is the name of each exercise you want to insert into the test, separated by a comma\footnote{We will describe other similar commands for loading the exercises in subsection \ref{list}.}.
+
+It is possibile both to insert all the exercises in a unique command and to use more than one command \cmd{\esercizi} or \cmd{\estraies} or \cmd{\randestraies} (see \ref{estraies} and \ref{randestraies}).\label{duecolonne}
+This is useful for example if you want exercises from two different subsets (5 exercises on limits chosen among 7 and 3 exercises on derivatives chosen among 5) or if you want to have some exercises on two columns and other on one column, for a better layout of the page. In this case you must precede the part on two columns with
+\cmd{\begin\{multicols\}\{2\}} and end it with \cmd{\end\{multicols\}}. You \textbf{must not} use option \optname{twocolumns}.
+\begin{esempio}
+ \begin{verbatim}
+ \begin{test}[punti]
+ \begin{multicols}{2}
+ \esercizi{es1,es2,es3}
+ \end{multicols}
+ \esercizi{es4,es5,es6}
+ \end{test}
+\end{verbatim}
+\end{esempio}
+In this way, exercises \texttt{es1,es2,es3} are typeset on two columns, while exercises \texttt{es4,es5,es6} are typeset on one column.
+
+\DescribeEnv{esdb}
+\DescribeMacro{selectrandomlyn}
+
+The environment \envname{esdb}\marg{nome db} defines a virtual database of exercises named \emph{nome db} (the name of the database \textbf{must} be different from the name of every other file of exercises, of other databases and from the name given to the master file, because it is the name of a file written during the compilation). Within this environment, one or more exercises can be chosen with the commands \cmd{\selectrandomlyn}\marg{numero esercizi}\marg{nome file}, where \emph{nome file} is the name of the file from which exercises are extracted and \emph{numero esercizi} is the number of exercises to be extracted (if the number of exercises is ``all'' or is greater than the number of variants in the file, all the exercises are chosen)\nuovo{vers. 2.0}.
+
+The environment generates a file \texttt{nome db.tex} which contains the references to all the exercises chosen. When the environment is closed, exercises are automatically written with the command \cmd{\esercizidb}\marg{nome db} (not to be written). If more than one environment \envname{esdb} is used, each one must be given a different name.
+
+Also this environment is a modified version of a similar environment in \pkgname{probsoln} and, at the moment, does not work nor with \hologo{XeLaTeX} nor with \hologo{LuaLaTeX}.
+
+
+In the file of the exercises, in
+\cmd{\newproblem} you must write:
+\begin{verbatim} \item \PTs{points}
+...text...
+\begin{answers}{number of columns}
+ \bChoices[random]
+\Ans0 wrong answer \eAns
+\Ans0 wrong answer \eAns
+\Ans1 correct answer \eAns
+ \eFreeze
+\Ans0 none of the other answers is correct \eAns
+ \eChoices
+\end{answers}
+ \end{verbatim}
+in which:
+\begin{itemize}
+ \item {\color{blue}{\begin{verbatim}
+\item \PTs{points}
+\end{verbatim}}}
+ \DescribeMacro{\PTs}
+ introduces a question with points written in the command \cmd{\PTs} (it can be a decimal number and the separator can be the comma).
+
+ \item {\color{blue}{\begin{verbatim}
+\begin{answers}{number of columns}
+ \bChoices[random]
+ ...
+ \eChoices
+\end{answers}
+\end{verbatim}}}
+ \DescribeEnv{answers}
+ \DescribeMacro{\Ans0}
+ \DescribeMacro{\Ans1}
+ \DescribeMacro{\bChoices}
+ \DescribeMacro{\eChoices}
+ \DescribeMacro{\eFreeze}
+ introduces answers split on the specified number of columns. Answers will be randomly shuffled only if the option \optname{random} is specified.
+
+ \item {\color{blue}{\cmd{\Ans0} }} introduces a wrong answer
+ \item {\color{blue}{\cmd{\Ans1}}} introduces the correct answer
+ \item {\color{blue}{\cmd{\eFreeze}}} introduces (if desireded) one or more answers which will not be randomly shuffled.
+\end{itemize}
+\DescribeEnv{solution}
+The environment \envname{solution} can be inserted \emph{after} the environment \envname{answers} and shows, using the option \optname{quizsolutions}, the solutions of the exercise.\nuovo{vers. 2.0}
+\begin{esempio}
+ \begin{verbatim}
+\newproblem{
+\item \PTs{1} The solutions of the equation
+\[x^2-5x+6=0\]
+are
+\begin{answers}{2}
+ \bChoices[random]
+\Ans0 $x=3$ e $x=-2$ \eAns
+\Ans0 $x=-3$ e $x=-2$ \eAns
+\Ans1 $x=3$ e $x=2$ \eAns
+ \eFreeze
+\Ans0 none of the other answers is correct \eAns
+ \eChoices
+\end{answers}
+}
+
+\newproblem{
+\item \PTs{1} The solutions of the equation
+\[x^2+5x+6=0\]
+are
+\begin{answers}{2}
+ \bChoices[random]
+\Ans0 $x=3$ e $x=-2$ \eAns
+\Ans1 $x=-3$ e $x=-2$ \eAns
+\Ans0 $x=3$ e $x=2$ \eAns
+ \eFreeze
+\Ans0 none of the other answers is correct \eAns
+ \eChoices
+\end{answers}
+}
+ \end{verbatim}
+\end{esempio}
+
+Besides MCQ, you can use in the environment \envname{test} other kinds of questions, that will be described in section \ref{sec:altri_esercizi}. Unfortunately using \texttt{fill-in} type exercises, if you have more than one blank space to fill, the string of correct answers will be less useful because the numbering of the questions is wrong.
+
+\textbf{N.B.} By default each question of the test is enclosed in \envname{minipage} environment. In the example cfg file there are some commented lines which allow to have questions out of this environment.
+
+
+\subsection{Environments problem and problem*}
+\DescribeEnv{problem}
+\DescribeEnv{problem*}
+These environments are used to write problems with open answers. They are used in the file which contains the variants of the exercise, nested in the command \cmd{\newproblem}, with the following syntax:
+\begin{verbatim}
+\begin{problem}
+ ...
+\end{problem}
+\end{verbatim}
+if you choose to write an open answer exercise with only one part; with the syntax
+\begin{verbatim}
+\begin{problem*}
+ ...
+\end{problem*}
+\end{verbatim}
+if you choose to write an open answer exercise with more than one part. The code for these environments is taken, with various modifications, from the code of the environment exercise in the package \pkgname{exerquiz}\footnote{The environment \envname{exercise} still exists and can be used as a template to build other environments such as new exercises, examples, etc.}.
+\paragraph{Exercises in one part}
+
+It is introduced by the environment \envname{problem}.
+\begin{verbatim}
+\begin{problem} [score]
+........Text..........
+\begin{solution}[space for the solution]
+.... text of solution ......
+\end{solution}
+\end{problem}
+ \end{verbatim}
+\DescribeEnv{solution}
+The argument \oarg{score} contains the points of the exercise, the argument \oarg{space for the solution} contains the dimension of the \emph{possible} white space which must be left for the solution.
+\paragraph{Exercise in more than one part}
+\DescribeEnv{parts}
+It is introduced by the environment \envname{problem*}.
+\begin{verbatim}
+\begin{problem*} [score]
+....text....
+\begin{parts}
+\item \PTs{partial score}
+....text....
+ \begin{solution}[space for the solution]
+ .... text of solution ......
+ \end{solution}
+\item \PTs{partial score}
+.....
+\end{parts} \end{problem*}
+ \end{verbatim}
+The argument \cmd{\PTs\{partial score\}} contains the points of each part.
+
+\paragraph{Exercises in a minipage}
+\DescribeEnv{problemmp}
+\DescribeEnv{problemmp*}
+We have also created the environments \envname{problemmp} and \envname{problemmp*} \nuovo{vers. 2.1} which are identical to the environments \envname{problem} and \envname{problem*}, but enclose all the text of the problem in a \envname{minipage} environment.
+
+\subsection{Other kinds of exercise}\label{sec:altri_esercizi}
+We have defined other new kinds of exercise:
+\paragraph{fillin:}\label{par:fillin} \DescribeMacro{\fillin}
+it is used to create exercises in which some parts of the text is left blank and must be filled by the student. It can also be used to create exercises with an open short answer. This kind of exercise is similar to the one introduced by D. P. Story in \pkgname{eqexam}.
+
+These exercises are introduced with a slightly different syntax and they are defined in the text by the command \cmd{\newfillinproblem} or by \cmd{\newproblem}\cmd{\fillinproblem}\texttt{\{text of the problem\}}. \nuovo{vers. 2.0}
+The syntax is:\\
+\cs{fillin}\verb+[+\meta{type}\verb+]{+\meta{width of blank}\verb+}{+\meta{answer}\verb+}+
+
+The two mandatory parameters are the width of the blank space, expressed as a length, and the correct answer (text or number) that the student has to write: it will be printed only in the solutions.
+The optional parameter \meta{type} defines the way in which the blank space is denoted: \texttt{u} (\emph{underlined}), the default, produces an underlined space, \texttt{b} (\emph{boxed}) produces a little box , \texttt{e} (\emph{empty}) produces an empty space.
+%In the blank space it is not possible to use the commands \cmd{\sempli} or \cmd{\semplix} (see Section \ref{sec:comandi}).
+
+If the answer contains mathematical expressions, it must be written between \$\ even if the command \cmd{\fillin} is already contained in a mathematical environment.
+
+This kind of exercise cannot be used, at the moment, with \Hologo{XeLaTeX} or \Hologo{LuaLaTeX}.
+\paragraph{domanda:}\DescribeEnv{domanda} (the word ``domanda'' means ``question'' in Italian)
+this environment must contain the text of the exercise (not the solution). It is used in \envname{problem} and \envname{problem*} and with the package option \optname{solutionsonly} only the solution of the exercise is printed and not the text. In previous versions of this package (not released to CTAN) there was another environment in order to obtain this.
+\paragraph{risposta:}\DescribeEnv{risposta} This environment generates a ruled or boxed space in which the student has to write the answer of an exercise (``risposta'' is the Italian word for ``answer'').
+The syntax of the command is:
+\begin{verbatim}[\small]
+\begin{risposta}{type}{vertical_space}
+ ...
+\end{risposta}
+\end{verbatim}
+The parameter \texttt{type} defines if the blank space has to be boxed (option \texttt{b}, the default) or ruled (option \texttt{l}). The parameter \verb+vertical_space+ defines the height of the space for the answer: it is a length if it is boxed or the number of rules if it is ruled.
+
+\paragraph{matching:}\DescribeMacro{\matching} it is based on an idea of the package \pkgname{examdesign} \cite{examdesign}. It is used to create exercises in which the student has to match items in two lists.
+
+\DescribeMacro{\pair} The pairs are defined by the command \cmd{\pair}:
+\begin{verbatim}
+ \pair{item 1}{item 2}
+\end{verbatim}
+repeated for each couple of items to match.
+
+The two lists are shuffled and then printed with the command \cmd{\matching}.
+
+\begin{esempio}
+
+ \begin{minipage}{.4\textwidth}
+ \begin{verbatim}
+ \pair{United Kingdom}{London}
+ \pair{France}{Paris}
+ \pair{Italy}{Rome}
+ \pair{Germany}{Berlin}
+ \pair{Greece}{Athens}
+ \matching
+\end{verbatim}
+ \end{minipage}
+ \begin{minipage}{.4\textwidth}
+ \begin{center}
+ \begin{tabular}{l l l }
+ \rule{1cm}{1pt} & Greece & (A) Paris \\
+ \rule{1cm}{1pt} & United Kingdom & (B) Berlin \\
+ \rule{1cm}{1pt} & France & (C) Rome \\
+ \rule{1cm}{1pt} & Italy & (D) London \\
+ \rule{1cm}{1pt} & Germany & (E) Athens
+ \end{tabular}
+ \end{center}
+ \end{minipage}
+\end{esempio}
+The solutions show the correct matching.
+
+Also this kind of exercise does not work with \Hologo{XeLaTeX} or \Hologo{LuaLaTeX}.
+\paragraph{tabella:}\DescribeEnv{tabella} (the word ``tabella'' means ``table'' in Italian) it is used to create exercises with many short open answers in column.
+
+The syntax is (the \cs{cr} at the end of the line is necessary):
+\begin{verbatim}
+ \begin{tabella}[num_visible_cols]
+{visible_cols_align}
+{hidden_col_align}
+ ... & ... \cr
+\end{tabella}
+\end{verbatim}
+The first parameter (default 2) is the number of columns of the table visible in the text of the exercise. The last column is invisible in the text and visible in the solutions.
+The second parameter gives the alignment of the visible columns (the same for all the columns) and the third one the alignment of the hidden column.
+
+This kind of exercise works with \Hologo{XeLaTeX}, but not with \Hologo{LuaLaTeX}.
+\begin{esempio}
+ With the code
+ \begin{verbatim}
+\begin{center}
+\renewcommand\arraystretch{3}
+\begin{tabella}[1]{l}{l}
+ \hline
+The domain of the function is:
+&$D=(-\infty;2]$\cr
+ \hline
+The range of $f(x)$ is:
+& $f(D)=(-\infty,0]$ \cr
+ \hline
+ \end{tabella}
+\end{center}
+ \end{verbatim}
+ we obtain (the second column is visible in the solutions only):
+ \renewcommand\arraystretch{3}
+ \begin{center}
+ \DeleteShortVerb{\|}
+ \MakeShortVerb{\!}
+ \begin{tabular}{r|c}
+ \hline
+ The domain of the function is:
+ & \textcolor[rgb]{1.00,0.00,0.00}{$D=(-\infty;2]$} \\
+ \hline
+ The range of $f(x)$ is:
+ & \textcolor[rgb]{1.00,0.00,0.00}{$f(D)=(-\infty,0]$} \\
+ \hline
+ \end{tabular}
+ \end{center}
+\end{esempio}
+\paragraph{workarea:}\DescribeEnv{workarea} this environment defines a blank space on the paper sheet where the student can write. The syntax is:
+\begin{verbatim}
+\begin{solution}{height}
+\end{solution}
+\begin{workarea}[width]{height}
+\end{workarea}
+\end{verbatim}
+The height of \envname{workarea} and of \envname{solution} should be equal; on the contrary, if the text of the \envname{workarea} is greater than the height of the solution, it will be misaligned in the space of the solution, overlapping to the exercise. The width of the \envname{workarea} is optional and by default is equal to the textwidth. Differently from the environment \envname{solution}, in the blank space it's possible to put some text, a graphic, coordinate axis, etc.
+
+\subsection{Other commands}
+The package defines other two commands used in the file {\tt totale-versioni} (see \ref{sec:totale})
+\begin{itemize}
+ \item {\color{blue}{\cmd{\selectallproblems\{\textbackslash esercizio\}}}}:\DescribeMacro{\selectallproblems}\ it is used in the file which shows all the variants of an exercise, with calculated or uncalculated parameters.
+ \item {\color{blue}{\cmd{\esercizio}}}:\DescribeMacro{\esercizio}\ it is used in the file which shows all the variants of an exercise and defines the name of the exercise on that you are working and which is the argument of the command \cmd{\selectallproblems}. It will be printed as the title of the generated file. The syntax is \cmd{\def\textbackslash esercizio\{name\}}.
+\end{itemize}
+
+\section{Commands to work with parameters and lists}
+\subsection{Commands to work on (random) parameters} \label{sec:comandi}
+We have defined some commands to work with (random) parameters.
+
+These commands are based on the package \pkgname{fp} \cite{fp}, which allows the execution of (complex) operations inside a \LaTeX\ document.
+
+\DescribeMacro{\FPsetpar} \ The basic command to define a parameter is
+ {\color{blue}{\cmd{\FPsetpar}\oarg{seed}\marg{parameter-name}\marg{first value}\marg{last value}\oarg{{excl-values}}}}.
+The name of the random parameter will be\cs{param-name} and its range will be between \texttt{inf} and \texttt{sup} (included).
+
+The parameter will be an integer number.\footnote{Even if it is possible to define rational or (pseudo)real parameters, as in the package \pkgname{rangen} \cite{rangen}, we preferred to limit the choice to integer numbers and to obtain the other cases with operations on parameters.}
+The optional parameter \oarg{seed} is used to have a different seed for the generation of the random number. The default value is \cmd{\seme} (the Italian word for seed): it is defined in the preamble and it is based on the date of the exam and on the number of version.
+
+It's possible to exclude one or more values from the choice (parameter \oarg{excl-values}). If the excluded values are more than one, they are enclosed in braces. The lower and the upper bounds (\marg{inf} and \marg{sup}, with \marg{inf} $<$ \marg{sup}) and the excluded values can be random parameters defined before. In order to satisfy the conditions, the generation of the random number is repeated many times: the maximum number of repetitions is given by the command \cmd{\maxLoopLimit}, by default $10$ (it can be redefined in the preamble of the document).
+
+
+\begin{esempio}
+ \begin{verbatim}
+ \FPsetpar{a}{2}{10}
+\end{verbatim}
+ creates a parameter \cmd{\a} which can be a random value between $2$ and $10$, in this case, the seed is defined in the preamble of the document.
+ The commands
+ \begin{verbatim}
+\FPsetpar{a}{2}{10}[3]
+\FPsetpar{b}{4}{12}[{\a,6}]
+\end{verbatim}
+ create two parameters, \cmd{\a} (which can be a random value between 2 and 10, except 3) and \cmd{\b} (which can be a random value between 4 and 12,
+ except 6 and the value assigned to \cmd{\a}).
+\end{esempio}
+
+You can work on the parameters defined with this command as on numbers and we have defined commands which allow to work on them showing both the numerical result and the operations in a parametric form.
+
+\begin{itemize}
+ \item {\color{blue}{\cmd{\FPsv}\oarg{decimal places}\marg{operation}}}:\DescribeMacro{\FPsv}\ it is used to do operations (on numbers or parameters) obtaining or the numeric value with \meta{decimal} decimal places (by default 0 decimal places), eliminating the useless zeroes or, with the option \optname{param} in the package, the typesetting of the operation (if you choose the option \optname{param} in the package \pkgname{esami}).
+
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{l|l|l}
+ \color{blue}{Instruction} & \color{blue}{Numerical result} & \color{blue}{Option \texttt{param}} \\
+ \hline
+ \hline
+ \verb|\FPsv{2*k+1}| & $5$ & $2*k+1$ \\
+ \verb|\FPsv[2]{(2*k+1)/2}| & $2.50$ & $(2*k+1)/2$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ The fundamental characteristics of the command \cmd{\FPsv} are (in the examples, $k=2$):
+ \begin{itemize}
+ \item the operations must be written explicitly
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb!$\FPsv{2*k}$! & $4$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item each operation is automatically enclosed in parenthesis. The parenthesis is not printed if the numerical value is shown, but it is printed when you use the option \optname{param}
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{l|l|l}
+ \color{blue}{Instruction} & \color{blue}{Numerical result} & \color{blue}{Option \texttt{param}} \\
+ \verb|$\FPsv{2*k+1}x$| & $5x$ & $(2*k+1)x$
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item you can use the following symbols for operations: \verb|+,-,*,/,^|
+ \item Attention must be paid to the fact that the package \pkgname{fp} cannot handle powers with a negative basis.
+ \end{itemize}
+
+ \item {\color{blue}{\cmd{\FPval}\marg{name}\oarg{decimal places}\marg{parameter/operation on parameters}}}:\DescribeMacro{\FPval}\
+ it assigns to \marg{nome} the rounded value of the operation (it is the command \cmd{\FPeval} from \pkgname{fp}, modified) or it prints the operation if you choose the option \optname{param} in the package \pkgname{esami}, as
+ with \cmd{\FPsv}. The result is given with the chosen number of decimal places, eliminating the useless zeroes.\nuovo{vers. 2.0}
+ \begin{esempio}
+ Let $k=2$. The code
+ \begin{verbatim}
+ \FPsetpar{k}{1}{3}
+ \FPval{a}{2*k+1}
+ \FPsetpar{b}{2}{20}[\a]
+ \end{verbatim}
+ generates a parameter \cmd{\b} which assumes a random value between $2$ and $20$, with the exception (in this case) of the value $5$. In the parametric version, a similar string appears (as far as the parameter \cmd{\b} is concerned)
+ \begin{center}
+ The parameter $b$ varies between $2$ and $20$. $b\neq (2*k+1)$. The seed is 209.
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\sempli}\marg{num}\marg{den}}}:\DescribeMacro{\sempli}\ it simplifies a fraction where \meta{num} and \meta{den} can contain parameters or operations on them.
+ Inside the command \cmd{\sempli} you must not use \cmd{\FPsv}.
+ \begin{esempio}
+
+ If $k=1$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb!$\sempli{2*k}{3*k+1}$! & $ \frac12$ \\[2mm]
+ \hline \\
+ \verb!$\frac{\FPsv{2*k}}{\FPsv{3*k+1}}$! & $\frac24$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ In the log file it is possible to see if and in which exercises the result of this operation is $1$ or $-1$ (see below).
+ \item {\color{blue}{\cmd{\semplix}\marg{num}\marg{den}}}:\DescribeMacro{\semplix}\ it simplifies a fraction where \marg{num} and \marg{den} can contain parameters, but where the result $1$ does not appear and the result $-1$ is shown like a minus sign ``$-$'' (for example it can be used before a $x$).
+
+ It works exactly as the command \cmd{\sempli}.
+
+ The command can also be used, setting the denominator equal to $1$, to format coefficients of a variable, so that the value $1$ does not appear and the value $-1$ appears as $-$.
+
+ \begin{esempio}
+
+ If the parameter $k$ is equal to $2$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb|$\FPsv{k-1}x$| & $1x$ \\[2mm]
+ \hline \\
+ \verb!$\semplix{k-1}{1}x$! & $x$ \\[2mm]
+ \hline \\
+ \verb|$\semplix{1-k}{1}x$| & $-x$ \\[2mm]
+ \hline \\
+ \verb|$\semplix{2*k}{k+2}x$| & $x$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\esempli}\marg{num}\marg{den}}}:\DescribeMacro{\esempli}\ it simplifies a fraction so that the result $1$ cannot appear, but the result $-1$ has to appear explicitly (like in exponents). The command can be used also with denominator equal to $1$ to format the exponents correctly.
+
+ It works exactly as the command \cmd{\sempli}.
+
+ The command can also be used, setting the denominator equal to $1$, to format exponents, so that the value $1$ does not appear and the value $-1$ appears as $-1$.
+ \begin{esempio}
+
+ If the parameter $k$ is equal to $2$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb|$x^{\FPsv{k-1}}$| & $x^1$ \\[2mm]
+ \hline \\
+ \verb|$x^{\esempli{k-1}{1}}$| & $x$ \\[2mm]
+ \hline \\
+ \verb|$x^{\esempli{1-k}{1}}$| & $x^{-1}$
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd\sempliz\marg{num}\marg{den}}}:\DescribeMacro{\sempliz}\ simplifies fractions that can assume the value $0$ (for example, in answers). While with the other commands the result $0$ gives an \textbf{error} and stops the compilation, with this command the value $0$ is written.
+
+ It works exactly as the command \cmd{\sempli}.
+ \item {\color{blue}{\cmd{\simpsqrt}\marg{ind}\marg{rad}}}:\DescribeMacro{\simpsqrt}\ With this command it's possible to extract factors from radicals. With these factors is not possible to do other operations. The first mandatory parameter \marg{ind} is the index of the radical and can be parametric; the second one, \marg{rad} is the radicand and can be also a parameter or an operation (also in this case \cmd{\FPsv} must not be used inside it).
+ \begin{esempio}
+
+ If $a$ is equal to $2$ and $b$ is equal to $1$
+
+ \begin{tabular}{lr}
+ \verb|$\simpsqrt{2}{a^2+4*b}$| & $2\sqrt{2}$
+ \end{tabular}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\RandS}}}:\DescribeMacro{\RandS}\ it is used to give a random sign ($+$ o $-$) to a number. The command is similar to the one of the package \pkgname{rangen}.
+
+ \item {\color{blue}{\cmd{\FPsignpol}\marg{expression}}}:\DescribeMacro{\FPsignpol}\ gives the value of ``expression'' with its sign: it is useful, for example, if ``expression'' is the coefficient of a polynomial. This macro has been contributed by Hjalmar Basile. \nuovo{vers. 2.1}
+ \begin{esempio}
+
+ If $a$ is $2$ and $b$ is $-1$
+
+ \begin{tabular}{lr}
+ \verb|$x^2\FPsignpol{a+4*b}{x}-2$| & $x^2-2x-2$
+ \end{tabular}
+
+ If $a$ is $2$ and $b$ is $1$
+
+ \begin{tabular}{lr}
+ \verb|$x^2\FPsignpol{a+4*b}{x}-2$| & $x^2+6x-2$
+ \end{tabular}
+ \end{esempio}
+\end{itemize}
+\subsection{Commands to choose from a list}\label{list}
+Besides the command \cmd{\esercizi} that we have already presented there are other commands to choose exercises, or, more in general, objects, from a list.
+
+The first command allows to choose randomly $n-m$ elements of a list
+\DescribeMacro{\estrai}.\ The command \cmd{\estrai}\oarg{m}\marg{list}\marg{name} is the user command to extract the elements from the list \marg{list} excluding \emph{m} of them. The chosen elements will have the name \cmd{\namei}, \cmd{\nameii}, \dots.
+The elements of the list must be comma separated.
+\begin{esempio}
+
+ With the command \cmd{\estrai[1]\{sets,logic,powers\}\{alpha\}} you choose 2 elements of the set and these elements will have the name\cmd{\alphai} e \cmd{\alphaii}. If these names are names of exercises, it is possible to insert in the file list argument of the command \cmd{\esercizi} also \cmd{\alphai} e \cmd{\alphaii}.
+\end{esempio}
+
+\DescribeMacro{\randestrai}.\ The macro \cmd{\randestrai}\oarg{m}\marg{list}\marg{name} is similar to the macro \cmd{\estrai}, but the choice of the elements is completely randomized. \nuovo{vers. 2.1}
+
+\DescribeMacro{\estraialfa} The command \cmd{\estraialfa}\marg{m}\marg{list}\marg{name} extracts \marg{m} random objects from the list
+\marg{list}, preserving the order. The chosen elements will have name \cmd{\namei}, \cmd{\nameii}, \dots.
+The elements of the list must be comma separated.
+\begin{esempio}
+
+ With the command \cmd{\estraialfa[2]\{a,b,c,d\}\{alpha\}} you choose 2 elements from the set, preserving the alphabetical order, and these elements will be named \cmd{\alphai} and \cmd{\alphaii}.
+\end{esempio}
+\DescribeMacro{\estraies} \label{estraies} The command \cmd{\estraies}\oarg{m}\marg{list} works as the command \cmd{\estrai}, but only on a list of exercises. Once the elements have been chosen, it prints them as the command \cmd{\esercizi}.
+
+\DescribeMacro{\randestraies} \label{randestraies} The macro \cmd{\randestraies}\oarg{m}\marg{list} works as the macro \cmd{\randestrai}, but only on a list of exercises. Once the elements have been chosen, it prints them as the command \cmd{\esercizi}.
+
+\section{The auxiliary files}
+\subsection{The localisation file}\label{sec:lng}
+The package has localisations in Italian (the default), UK English, US English, French, Spanish (thanks to Maria Hernandez Cifre), German (thanks to Kerstin von Kirschhausen), Serbian with latin alphabet (thanks to Dusko Latas), Greek (thanks to Sotiris Hasapis). Using greek language (and maybe other non latin localisations) it's necessary to load the packages \pkgname{fontenc}, \pkgname{inputenc} e \pkgname{babel} before the package \pkgname{esami}\footnote{The option \optname{greek} requires at this moment the option \optname{iso-8859-7} for the package \pkgname{inputenc}}. In this file one can also load some language dependent packages, such as \pkgname{numprint}, \pkgname{geometry}, etc. and there are the definitions of the commands \cmd{\shortdate} and \cmd{\longdate} to write the date.
+
+\textcolor[rgb]{1.00,0.00,0.00}{\textbf{N.B.:} There is an known incompatibility between the package \pkgname{babel} for the French language (which is not necessary for the localization) and the package \pkgname{fp}: to manage this incompatibility, one can use the macro \cmd{\shorthandoff\{:\}} immediately after \cmd{\begin\{document\}}.}
+\subsection{The configuration file}\label{sec:cfg}
+The configuration file \texttt{esami-xyz.cfg} contains various definitions, i.e. the header (command \cmd{\testa}), the footer, the format for the solution file, the page style, the instructions for the exam.
+\subsection{The \texttt{master} and \texttt{master-sol} files}
+These two files differ only because the second one shows the solutions. They contain the instructions to generate the test. In both the files you must write the date (command \cmd{\date}) in the format YYYY/MM/DD, the number of versions to generate (command \cmd{\numcompiti}), and, obviously, the exercises. The test can be divided in parts and in each one of them you can use one or more of the environments and commands that we have presented.
+
+The files has to be renamed before compiling them, otherwise compilation stops with an error message.
+
+In the file, with the command \cmd{\maxLoopLimit}, the maximum number of tries that \cmd{\FPsetpar} should make in order to satsfy the conditions and how to calculate the initial seed for the generation of random numbers (command \cmd{\seme}).
+
+It is also possible to define the name of the parts in which the test is divided.
+\subsection{The \texttt{totale-versioni} file}\label{sec:totale}
+The file \texttt{totale-versioni} is used to generate all the variants of an exercise. With this file the package has always the option \optname{prova} and you can use the option \optname{param} to generate the parametric version of exercises.
+
+Inside this file you should use only one command, \cmd{\def \textbackslash esercizio\{name\}}, that should contain the name of the exercise to compile. If you compile the parametric version, the parameters and their intervals are shown at the end of the exercise.
+\section{Changelog}
+\begin{description}
+ \item[Version 1.0 (2013/03/08)] First version released to CTAN.
+ \item[Version 1.1 (2013/12/09)] Inserted the dependance on the package \texttt{environ} to remove some errors in the \LaTeX\ compilation. Removed the dependance on the package \texttt{icomma} in the italian localization file es-italian.lng because of the introduction of new features in the package \texttt{babel} for the Italian langaguage (macro \texttt{IntelligentComma}).
+ \item[Version 2.0 (2015/02/25)] Eliminated the dependance on \pkgname{pstricks}. Modified the use of \emph{fill-in} questions. Inserted the possibility to extract more than one variant from a file. Now it is possible to view the solutions in tests. Modified the visualization of decimal places in command \cmd{\FPsv}. Modified the definition of \cmd{\FPval} to allow the use of decimal places. Modified the algorithm of choice of a variant of an exercise, now completely deterministic. Added the command \cmd{\Acapo}. Added the serbian localization (latin alphabet). The compilation produces a new file with the list of the chosen exercises.
+ \item[Versione 2.1 (2016/07/25)] Modified \texttt{es-german.lng} and \texttt{es-spanish.lng} for an error in the input of the solutions. Introduced the macro \texttt{randestrai}. Introduced the macro \texttt{FPsignpol}. Introduced a control on the total points of the exercises. Solved the incompatibility with \pkgname{babel} for the Spanish language. Removed the incompatibility between the command \cmd{\fillin} and the commands \cmd{\sempli} and \cmd{\semplix}.
+ \item[Version 2.2 (2017/07/01)] Introduced the possibility to have two different seeds for the choice of exercises (\cmd{\semeex}) and for the permutations and choice of the parameters (\cmd{\seme}): by default, they are equal. Slightly modified the command \cmd{\estrai} so that it is possible to use it to extract parameters from a list. Documentation integrated.
+ \item[Version 2.3 (2017/09/18)] Corrected a misprint in the code.
+ \item[Version 2.4 (2018/02/10)] Documentation corrected.
+ \item[Version 2.5 (2018/05/06)] Corrected a misprint in the code. Improved the selection of random exercises.
+
+\end{description}
+
+\bibliographystyle{plain}
+\bibliography{esami}
+
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/esami-doc-it.pdf b/macros/latex/contrib/esami/doc/esami-doc-it.pdf
new file mode 100644
index 0000000000..1233910008
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/esami-doc-it.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/esami-doc-it.tex b/macros/latex/contrib/esami/doc/esami-doc-it.tex
new file mode 100644
index 0000000000..f44d3a9d5d
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/esami-doc-it.tex
@@ -0,0 +1,802 @@
+%\documentclass[10pt]{article}
+
+%\iffalse This is a METACOMMENT
+%
+%<*driver>
+%\ProvidesFile{esami.dtx}
+\documentclass{ltxdoc}
+%\usepackage[colorlinks,hyperindex]{hyperref}
+%\usepackage{esami}
+\usepackage[braces]{colordoc}
+\usepackage[T1]{fontenc}
+\usepackage{calc}
+\usepackage{hologo}
+\usepackage{lmodern}
+%\usepackage{comandi}
+\usepackage[utf8]{inputenc}
+\usepackage[italian]{babel}
+\usepackage{graphicx}
+\usepackage[dvipsnames,svgnames]{xcolor}
+\usepackage{fancyvrb}
+\usepackage[lmargin=3.5cm,rmargin=3.5cm]{geometry}
+\usepackage[colorlinks=true,pdftex,hyperindex=true]{hyperref}
+\newcounter{esempio}
+\newsavebox{\fcolbox} %\newlength{\fcolwidth}
+\newenvironment{esempio}
+{\par \medskip
+\begin{example}
+ }
+ {\end{example}\medskip}
+
+\newenvironment{example}
+{\noindent\stepcounter{esempio}%\setlength{\fcolwidth}{\textwidth-2\fboxsep-2\fboxrule}%
+\begin{lrbox}{\fcolbox}%
+\begin{minipage}[c]{\textwidth-2\fboxsep-2\fboxrule}
+\textbf{\textsf{Esempio \theesempio.}}
+}
+{\end{minipage}\end{lrbox}\fbox{\usebox{\fcolbox}}}
+
+
+\EnableCrossrefs
+\CodelineIndex
+\PageIndex
+\RecordChanges
+\OnlyDescription
+\CheckSum{6041}
+\begin{document}
+%\GetFileInfo{esami.sty}
+% \DocInput{esami.dtx}
+%\PrintChanges
+%\PrintIndex
+
+%</driver>
+%\fi
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+
+\changes{Versione 1.0}{2013/03/08}{Prima versione rilasciata al CTAN}
+\changes{Versione 1.1}{2013/12/09}{Reinserita la dipendenza dal pacchetto \texttt{environ} per eliminare alcuni errori nella compilazione con \hologo{LaTeX}. Eliminata la dipendenza dal pacchetto \texttt{icomma} nel file di localizzazione es-italian.lng a seguito dell'introduzione di nuove funzionalità nel pacchetto \texttt{babel} per la lingua italiana (comando \texttt{IntelligentComma}).}
+\changes{Versione 2.0}{2015/02/25}{Eliminata la dipendenza da \texttt{pstricks}. Modificato l'inserimento di domande di tipo \emph{fill-in}. Inserita la possibilità di estrarre più esercizi da un solo file. Ora è possibile visualizzare le soluzioni nei test. Modificata la visualizzazione dei decimali nel comando \texttt{FPsv}. Modificata la definizione di \texttt{FPval} in modo da avere cifre decimali. Modificato l'algoritmo di scelta della variante di un esercizio in modo completamente deterministico. Aggiunto il comando \cmd{\Acapo}. Aggiunta la localizzazione serba (alfabeto latino). Ora la compilazione produce un nuovo file con la lista degli esercizi scelti.}
+\changes{Versione 2.1}{2016/04/11}{Modificato \texttt{es-german.lng} e \texttt{es-spanish.lng} per errore nell'input delle soluzioni. Introdotto il comando \texttt{randestrai}. Introdotto il comando \texttt{FPsignpol}. Introdotto controllo punteggio totale degli esercizi. Rimossa l'incompatibilità tra il comando \texttt{fillin} e i comandi \texttt{sempli} e \texttt{semplix}.}
+\changes{Versione 2.2}{2017/07/01}{Introdotta la possibilità di avere due semi diversi per la scelta degli esercizi (\cmd{\semeex}) e per le permutazioni e scelta dei parametri (\cmd{\seme}): di default sono uguali. Leggermente modificato il comando \cmd{\estrai} così da poter essere usato per estrarre parametri numerici da una lista. Integrata la documentazione.}
+\changes{Versione 2.3}{2017/09/18}{Corretto un errore di battitura nel codice.}
+\changes{Versione 2.4}{2018/02/10}{Corretta la documentazione .}
+\changes{Versione 2.5}{2018/05/06}{Corretto un errore di battitura nel codice. Migliorata la scelta aleatoria degli esercizi.}
+
+%\IndexPrologue{\section*{Indice} I numeri scritti in italico rimandano alla pagina dove è descritto l'item; i numeri sottolineati rimandano alla riga di codice in cui l'item è descritto; le altre referenze sono alla riga di codice dove l'item è usato.}
+\GlossaryPrologue{\section*{Changelog}}
+\def\MacroFont{\fontencoding\encodingdefault
+ \fontfamily\ttdefault
+ \fontseries\mddefault
+ \fontshape\updefault
+ \footnotesize}
+\GetFileInfo{esami.sty}
+\def\fileversion{versione 2.5}
+\def\filedate{2018/05/06}
+
+
+\title{Il pacchetto esami\thanks{Questo documento
+ corrisponde al pacchetto \textsf{esami}~\fileversion, con data \filedate.}}
+\author{Grazia Messineo <grazia.messineo@unicatt.it> \\ Salvatore Vassallo <salvatore.vassallo@unicatt.it>}
+\newcommand{\nuovo}[1]{\marginpar{\raggedleft{ \footnotesize{\textsf{Nuovo #1}}}}}
+
+\maketitle
+
+\tableofcontents
+\newpage
+\newcommand*\pkgname[1]{\texttt{#1}}
+\newcommand*\clsname[1]{\texttt{#1}}
+\newcommand*\optname[1]{\emph{#1}}
+\newcommand*\envname[1]{\textsf{#1}}
+
+%\section{Il pacchetto esami}
+\section{Introduzione e motivazioni}
+Il pacchetto \texttt{esami} è stato creato per produrre i testi e le soluzioni per gli esami di Matematica nella Facoltà di Economia dell'Università Cattolica di Milano e nasce dall'esigenza di poter generare molte versioni (da 12 a 50 solitamente) di una stessa prova d'esame contenenti esercizi simili, ma diversi e di stampare le soluzioni e, se fossero presenti domande a risposta chiusa, la stringa delle soluzioni.
+
+Il pacchetto consente di scrivere esercizi di vario tipo (a risposta multipla con risposte che variano in ordine casuale, a risposta chiusa o aperta, \emph{matching}, problemi, ecc.). Le domande di ogni gruppo ruotano in modo casuale all'interno del compito e le varianti di ciascun esercizio vengono scelte in modo casuale da un file che le contiene tutte e, a nostra conoscenza, è l'unico che permetta di ottenere tali risultati senza utilizzare programmi esterni a \hologo{LaTeX}.
+
+Lo sviluppo del pacchetto è iniziato nel 2008 (\cite{esami}, \cite{tug}) con l'intento di estendere e unificare alcune proprietà dei pacchetti \pkgname{exerquiz} e \pkgname{eqexam} di D.P. Story \cite{acrotex} e \pkgname{probsoln} di N.Talbot \cite{probsoln}.
+\section{Pacchetti richiesti}
+Il pacchetto \pkgname{esami} dipende da alcuni altri pacchetti non standard\footnote{La lista completa dei pacchetti usati in una normale compilazione di un esame è: etex, graphicx, enumerate, fp, currfile, array, environ, ifthen, xargs, xkeyval, multicol, amssymb, amsfonts, xcolor, babel, etoolbox, icomma, numprint, amsmath, fontenc, inputenc, lmodern. Ovviamente ogni pacchetto caricato può avere altre dipendenze.}
+\begin{enumerate}
+ \item \pkgname{fp}: per le operazioni matematiche;
+ \item \pkgname{currfile}: per ottenere il nome del file e della cartella di lavoro;
+ \item \pkgname{xargs}: per avere più di un parametro opzionale;
+ \item \pkgname{environ}: per trasformare comandi in ambienti.\nuovo{vers. 1.1}
+\end{enumerate}
+Inoltre i seguenti pacchetti sono opzionali, ma raccomandati:
+\begin{enumerate}
+ \item \pkgname{ifluatex} e \pkgname{ifxetex} per la compilazione con \Hologo{XeLaTeX} e \Hologo{LuaLaTeX} (nel seguito si farà riferimento solo alla compilazione con \hologo{pdfLaTeX})\nuovo{vers. 2.0}\footnote{Al momento il supporto per \Hologo{XeLaTeX} e \Hologo{LuaLaTeX} è molto parziale e alcune tipologie di esercizio non sono utilizzabili.}.
+ \item \pkgname{lmodern} and \pkgname{amsfonts}: necessari per un buon output in pdf;
+ \item \pkgname{numprint}: per un output migliore dei numeri e per avere formati numerici diversi a seconda del linguaggio;
+ \item \pkgname{eurosym}: per usare la valuta;
+ \item \pkgname{icomma}: dal pacchetto \pkgname{ws} per una corretta formattazione delle virgole. Tale pacchetto può essere sostituito per la lingua italiana dal comando \cmd{\IntelligentComma} di \pkgname{babel}: questa opzione è di default nel file di localizzazione \texttt{es-italian.lng} e può essere modificata commentando il comando \cmd{\IntelligentComma} (o usando il comando \cmd{\NoIntelligentComma})\nuovo{vers. 1.1};
+ \item \pkgname{pstricks}, \pkgname{pstricks-add} e \pkgname{auto-pst-pdf} oppure \pkgname{tikz} o altro pacchetto per i grafici\nuovo{vers. 2.0}.
+\end{enumerate}
+Tutti i pacchetti sono disponibili sia in \Hologo{TeX} Live che in \Hologo{MiKTeX}.
+
+\section{Installazione} Il pacchetto è composto dal file {\tt esami.sty}, da alcuni file di configurazione {\tt *.cfg}, dai file di localizzazione, da 3 template per la compilazione e dalla documentazione. Il file {\tt sty} e i file {\tt cfg} e {\tt lng} devono essere copiati in una cartella dove possano essere trovati da \Hologo{LaTeX} (ad esempio {\tt texmf-local/tex/latex/esami} e in seguito deve essere aggiornato il database.
+
+\section{Come scrivere un esame}
+In questa sezione si vedrà come costruire una prova d'esame usando il pacchetto \pkgname{esami}.
+
+\subsection{Il preambolo}
+\begin{verbatim}
+\documentclass[italian]{article}
+\usepackage[<opzioni>]{esami}
+\end{verbatim}
+Le opzioni sono discusse nella sezione \ref{sec:opzioni}
+\begin{verbatim}
+\def\numcompiti{10}
+\date{2018/04/21}%%% THE DATE IN THE FORMAT YYYY/MM/DD
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+\end{verbatim}
+Il comando \cmd{\date} è quello solito di \Hologo{LaTeX}, ma la data deve essere scritta nel formato YYYY/MM/DD, mentre il comando \cmd{\numcompiti} serve a definire il numero di versioni che devono essere generate.
+Il comando \cmd{\Data} stamperà la data in formato lungo (D MMMM YYYY \cmd{\longdate}) o corto (D/M/YYYY \cmd{\shortdate}).
+\subsection{Il documento}
+\begin{verbatim}
+\begin{document}
+\pagestyle{esame}
+%\setcounter{vers}{m}
+\end{verbatim}
+Il comando \cmd{\pagestyle} è definito in un file di configurazione (si veda la sezione \ref{sec:cfg}) e definisce gli header e i footer.
+Il comando commentato \cmd{\setcounter}\{vers\}\{$m$\} serve, ponendo nel preambolo \cmd{\numcompiti} un numero $n$ (maggiore di $m$), a generare le versioni da $m+1$ a $n$.
+\begin{verbatim}
+ \whiledo{\thevers<\numcompiti}{\stepvers
+\end{verbatim}
+inizia la routine di compilazione delle varianti che terminerà alla fine del documento.
+\begin{verbatim}
+\FPeval\seme{round((\thenomefile+\thevers):0)}
+%\FPeval\semeex{round(\thenomefile+1-trunc(\thenomefile/(2^31-1):0)*(2^31-1):0)}
+\randomi=\seme
+\end{verbatim}
+genera il seme per i processi di randomizzazione e lo assegna anche a \cmd{\randomi}. \textcolor[rgb]{1.00,0.00,0.00}{\textbf{N.B.} Se il seme è un numero minore di 1, il seme viene inizializzato usando la data e l'ora e quindi due compilazioni daranno esiti diversi.}
+\nuovo{vers. 2.2} È possibile ora definire in modo diverso il seme per le permutazioni (\cmd{\seme}) e quello per la scelta degli esercizi (\cmd{\semeex}): l'esigenza è nata dalla richiesta di poter scegliere per ogni compito gli stessi esercizi per tutti gli studenti (\cmd{\semeex} dipende solo dalla data), ma di poterli permutare in ogni versione.
+\begin{verbatim}
+\permuta
+\testa
+\istruzionii
+\end{verbatim}
+\cmd{\testa}, \cmd{\istruzionii} vengono definiti nel file di configurazione e contengono le istruzioni per la testata e delle eventuali istruzioni per lo svolgimento dell'esame, mentre la macro \cmd{\permuta} permette la randomizzazione dell'ordine degli esercizi.
+\begin{verbatim}
+\begin{test}[punti]
+\begin{questions}
+\esercizi{test1,test2,test3,test4}
+\begin{esdb}{dbone}
+\selectrandomlyn{2}{dbtest1}
+\selectrandomlyn{4}{dbtest2}
+\end{esdb}
+\end{questions}
+\end{test}
+\end{verbatim}
+In questo modo si definisce un ambiente per un test tipicamente con domande a risposta multipla, il comando \cmd{\esercizi} serve per scegliere casualmente gli esercizi dai file indicati e per rimescolarli, l'ambiente \envname{esdb} serve a definire un database (virtuale) di esercizi in cui vengono inseriti con il comando \cmd{\selectrandomlyn}.
+\begin{verbatim}
+\esercizi{problema1, problema2}
+\end{verbatim}
+sceglie tra due esercizi a risposta aperta.
+\begin{verbatim}
+\closevers
+}
+%%\def\stringasol{}
+\end{document}
+\end{verbatim}
+Termina la routine di compilazione. L'istruzione \verb|\def\stringasol{}| serve a non generare la stringa delle soluzioni se non desiderata. La compilazione produce un file pdf con tutte le varianti richieste.
+\nuovo{vers. 2.0} Compilando il file delle soluzioni si ottiene anche un file \texttt{filename-sol.loe} (loe = list of exercises) che contiene le label che vengono assegnate agli esercizi scelti, in modo da poterli identificare: infatti ogni esercizio scelto è identificato da una stringa del tipo \emph{e:numero di versione -file:nome del file-q:numero della domanda in cifre romane}.
+
+\nuovo{vers. 2.1} Al termine del file delle soluzioni vi è la stringa delle soluzioni delle domande a risposta chiusa: di default tale stringa è per ogni versione inserita in un ambiente \envname{minipage}. Se tale formattazione non fosse adatta ai propri scopi (ad esempio se si hanno 40 domande a risposta chiusa le cui risposte non stanno in una pagina) è possibile modificarla adattando i comandi \cmd{\stepverssols} e \cmd{\closeverssols}: nel file di configurazione di esempio sono presenti, commentate, le definizioni per avere una stringa di soluzioni continua.
+
+Durante la compilazione viene controllato che il numero di punti indicato per un test o un esercizio in più parti sia uguale alla somma dei punteggi parziali. \nuovo{vers. 2.1} Tale possibilità può essere esclusa commentando nel file di configurazione la definizione del comando \cmd{\checkpoints}.
+
+\section{Le opzioni del pacchetto}\label{sec:opzioni}
+Per usare il pacchetto bisogna usare il solito comando
+\cmd{\usepackage}[\meta{options}]\{esami\}. Le opzioni possibili sono:
+\begin{itemize}
+ \item {\color{blue}{\optname{allowrandomize}}} e {\color{blue}{\optname{norandomize}}}: la prima permette di permutare in modo casuale l'ordine delle risposte nelle domande a risposta chiusa, la seconda di non permutarlo (di default le risposte vengono permutate in modo casuale).
+ \item {\color{blue}{\optname{shuffle}}}, {\color{blue}{\optname{shufflerandom}}} e {\color{blue}{\optname{noshuffle}}}: la prime due permettono di permutare gli esercizi, la prima in modo deterministico se il numero degli esercizi è minore di 9 e casuale se è maggiore, la seconda del tutto casualmente, la terza di non permutarli (l'opzione di default è \optname{shuffle}).
+ \item {\color{blue}{\optname{xyz}}}: Fa caricare un file di configurazione (\texttt{esami-xyz.cfg}) con nome dell'esame, istruzioni, ecc. relative a questo esame. Nel file {\tt esami.sty} sono predefinite alcune opzioni; è possibile caricare altre configurazioni definendole in {\tt esami.sty} o creare un proprio file di configurazione e farlo leggere senza modificare il file {\tt esami.sty}: è sufficiente scrivere un'opzione sconosciuta (ad esempio \verb|math|) e scrivere il file {\tt esami-math.cfg}.
+ \item {\color{blue}{\optname{pointsonright}}}: fa apparire la casella con il punteggio sulla destra dell'esercizio. Se l'opzione non è specificata, la casella non appare.
+ \item {\color{blue}{\optname{nosolutions}}}: questa opzione genera il compito senza soluzioni negli esercizi a risposta aperta e l'indicazione della risposta corretta in quelli a risposta chiusa (default).
+ \item {\color{blue}{\optname{solutions}}}: genera il file delle soluzioni.
+ \item {\color{blue}{\optname{noquizsolutions}}}: questa opzione genera il compito senza soluzioni nelle domande a risposta chiusa (default).\nuovo{vers. 2.0}
+ \item {\color{blue}{\optname{quizsolutions}}}: genera il compito con le soluzioni nelle domande a risposta chiusa.
+ \item {\color{blue}{\optname{prova}}}: si usa solo con il file {\tt totale-versioni} (si veda \ref{sec:totale}) e serve per visualizzare tutte le varianti di un esercizio. Fa visualizzare automaticamente le risposte esatte negli esercizi a risposta multipla e la soluzione nei problemi da svolgere.
+ \item {\color{blue}{\optname{param}}}: serve per visualizzare le lettere che rappresentano i parametri casuali anziché il valore numerico attribuito. Stampa anche una frase, nella quale sono contenuti il valore iniziale e finale attribuiti ai parametri usati nell'esercizio. Può essere usata solo insieme all'opzione \texttt{prova}.
+ \item {\color{blue}{\optname{correzione}}}: stampa solo i testi di tutti gli esercizi, senza soluzioni (funziona solo nel file {\tt totale-versioni}).
+ \item {\color{blue}{\optname{fillb}}}: deprecata, resta per compatibilità con le versioni precedenti. Serve quando si usano esercizi di tipo ``fillin'', ma è consigliato usare il comando \cmd{\fillinproblem} (si veda\ref{par:fillin})\nuovo{vers. 2.0}
+ \item {\color{blue}{\optname{twocolumns}}}: per scrivere il testo delle domande a risposta chiusa su due colonne (ma si veda anche \ref{duecolonne}).
+ \item {\color{blue}{\optname{sansserif}}}: usa caratteri sans serif.
+ \item {\color{blue}{\optname{autopston}}} e {\color{blue}{\optname{autopstoff}}}: caricano i pacchetti \pkgname{pstricks}, \pkgname{pstricks-add} e \pkgname{auto-pst-pdf} e permettono di compilare il file direttamente con \hologo{pdfLaTeX} (anche se contiene codice di \pkgname{pstricks}). La prima opzione crea e include direttamente nel documento i file delle immagini, la seconda non crea i file delle immagini (e rende più veloce la compilazione)\VerbatimFootnotes
+ \footnote{Per usare \pkgname{auto-pst-pdf} è necessario
+ abilitare \texttt{shell-escape} (\Hologo{TeX} Live) o \texttt{write18} (\Hologo{MiKTeX}) nell'esecuzione di \hologo{pdfLaTeX}.}.\nuovo{vers. 2.0}
+ \item {\color{blue}{\optname{language}}}: legge il file di localizzazione es-language.lng (si veda \ref{sec:lng}). Nel file sono contenute le traduzioni delle etichette (esercizio, soluzione, \dots ), dei messaggi d'errore, delle intestazioni contenute nel file (\texttt{esami-xyz.cfg}). Di default viene caricato il file della lingua italiana. Poiché le opzioni linguistiche hanno lo stesso nome di quelle usate in \pkgname{babel} è possibile passare l'opzione in \cmd{\documentclass}.
+\end{itemize}
+
+\section{Gli esercizi}
+\subsection{Le varianti}
+Ogni esercizio (con tutte le sue varianti) va scritto in un file separato.
+\DescribeMacro{\newproblem}
+Ogni variante è racchiusa nel comando
+\cmd{\newproblem\{\dots \}} (che non ha alcun argomento opzionale).
+\begin{esempio}
+ \begin{verbatim}
+%%%% Questo è il file file1.tex con 2 varianti di un esercizio
+\newproblem{Testo della prima variante}
+\newproblem{Testo della seconda variante}
+\end{verbatim}
+\end{esempio}
+Il comando \cmd{\newproblem} è una versione molto modificata dell'analogo comando del pacchetto \pkgname{probsoln}.\\[2mm]
+\setlength\fboxrule{2pt}
+\setlength\fboxsep{2mm}
+\fcolorbox{red}{white}{
+ \begin{minipage}[c]{\textwidth-2\fboxsep-2\fboxrule}
+ È assolutamente necessario che ogni versione degli esercizi sia argomento del comando \cmd{\newproblem}, se così non è o il programma si arresta con un errore o l'output è del tutto imprevedibile.
+ \end{minipage}
+}
+\subsection{L'ambiente test}
+\DescribeEnv{test}
+L'ambiente \envname{test} consente di scrivere esercizi a risposta multipla o a risposta aperta breve, in cui ciascuno dei quesiti è tratto casualmente da uno dei file nel quale sono contenuti tutti gli esercizi con le rispettive varianti.
+
+L'ambiente viene creato dal comando
+\begin{verbatim}
+ \begin{test}[punti]
+ ...
+ \end{test}
+\end{verbatim}
+\DescribeMacro{punti}
+Il parametro opzionale \oarg{punti} indica il punteggio \textbf{totale} attribuito all'intero gruppo di domande.
+
+\DescribeEnv{questions}
+I quesiti del gruppo, nel documento principale, sono racchiusi nell'ambiente \emph{questions} che è una versione modificata dell'ambiente omonimo del pacchetto \pkgname{exerquiz}:
+\begin{verbatim}
+ \begin{questions}
+ ....
+ \end{questions}
+\end{verbatim}
+È possibile inserire all'intero di un unico ambiente \envname{test} più ambienti \envname{questions}. Gli esercizi di ogni gruppo saranno mescolati indipendentemente.
+\begin{esempio}
+ \begin{verbatim}
+\begin{test}
+ \begin{questions}
+ ....
+ \end{questions}
+....
+ \begin{questions}
+ ....
+ \end{questions}
+\end{test}
+\end{verbatim}
+\end{esempio}
+\DescribeMacro{\esercizi}
+All'interno di tale ambiente, i quesiti vengono ``caricati'' in due modi: o con l'ambiente \envname{esdb} che verrà descritto successivamente, o con il comando
+\begin{verbatim}
+ \esercizi{nome file sorgente 1, nome file sorgente 2,...}
+\end{verbatim}
+Il parametro obbligatorio è il nome di ciascuno degli esercizi
+che si vogliono inserire nel test, separati da una virgola\footnote{In seguito
+ verranno introdotti altri comandi simili per il caricamento di esercizi}.
+
+È possibile sia inserire tutti gli esercizi con un unico comando, sia usare
+più comandi \cmd{\esercizi} o \cmd{\estraies} o \cmd{\randestraies} (si veda \ref{estraies} e \ref{randestraies}).
+
+\label{duecolonne}Questa possibilità è utile ad esempio se si vuole che ci siano esercizi da due
+sottoinsiemi diversi (5 esercizi sui limiti scelti tra 7 e 3 esercizi sulle derivate scelti tra 5) o se si vuole per esigenze di impaginazione avere alcuni esercizi su due colonne ed altri su una colonna: in tale caso
+si deve introdurre la parte che deve essere su due colonne con
+\cmd{\begin\{multicols\}\{2\}} e concluderla con \cmd{\end\{multicols\}}. \textbf{Non} si usa l'opzione \optname{twocolumns}.
+\begin{esempio}
+ \begin{verbatim}
+ \begin{test}[punti]
+ \begin{multicols}{2}
+ \esercizi{es1,es2,es3}
+ \end{multicols}
+ \esercizi{es4,es5,es6}
+ \end{test}
+\end{verbatim}
+\end{esempio}
+In questo modo gli esercizi \texttt{es1,es2,es3} sono formattati su due colonne mentre gli esercizi \texttt{es4,es5,es6} sono formattati su una colonna.
+
+\DescribeEnv{esdb}
+\DescribeMacro{selectrandomlyn}
+
+L'ambiente \envname{esdb}\marg{nome db} definisce un database virtuale di esercizi di nome \emph{nome db} (il nome del database \textbf{deve} essere diverso dal nome di ogni altro file di esercizi, di ogni altro database e del file master, poiché è il nome di un file che viene scritto in fase di compilazione). All'interno di tale ambiente possono essere scelti uno o più esercizi da uno o più file con i comandi \cmd{\selectrandomlyn}\marg{numero esercizi}\marg{nome file}, dove \emph{nome file} indica il file da cui estrarre gli esercizi e \emph{numero esercizi} indica quanti esercizi devono essere estratti (se il numero di esercizi è ``all'' oppure è maggiore del numero di varianti presenti nel file vengono scelti tutti gli esercizi)\nuovo{vers. 2.0}.
+
+L'ambiente genera un file \texttt{nome db.tex} che contiene i riferimenti agli esercizi scelti. Alla chiusura dell'ambiente gli esercizi vengono mandati automaticamente in output mediante il comando \cmd{\esercizidb}\marg{nome db} (da non dare esplicitamente). Ovviamente se si usano più ambienti \envname{esdb} ad ognuno deve essere assegnato un nome diverso.
+
+Anche questo ambiente è una versione modificata di un analogo ambiente presente nel pacchetto \pkgname{probsoln} e, al momento non funziona né con \hologo{XeLaTeX} né con \hologo{LuaLaTeX}.
+
+Nel file degli esercizi, la sintassi da usare all'interno di
+\cmd{\newproblem} è la seguente:
+\begin{verbatim} \item \PTs{punteggio}
+...testo\dots
+\begin{answers}{numero colonne}
+ \bChoices[random]
+\Ans0 risposta errata \eAns
+\Ans0 risposta errata \eAns
+\Ans1 risposta esatta \eAns
+ \eFreeze
+\Ans0 nessuna delle precedenti \eAns
+ \eChoices
+\end{answers}
+\begin{solution}
+Soluzione
+\end{solution}
+ \end{verbatim}
+nella quale:
+\begin{itemize}
+ \item {\color{blue}{\begin{verbatim}
+\item \PTs{punteggio}
+\end{verbatim}}}
+ \DescribeMacro{\PTs}
+ introduce una domanda con punteggio indicato in \cmd{\PTs} (può essere anche un numero decimale e il separatore può essere la virgola).
+
+ \item {\color{blue}{\begin{verbatim}
+\begin{answers}{numero colonne}
+ \bChoices[random]
+ ...
+ \eChoices
+\end{answers}
+\end{verbatim}}}
+ \DescribeEnv{answers}
+ \DescribeMacro{\Ans0}
+ \DescribeMacro{\Ans1}
+ \DescribeMacro{\bChoices}
+ \DescribeMacro{\eChoices}
+ \DescribeMacro{\eFreeze}
+ introduce le risposte disposte sul numero di colonne specificate. Le risposte vengono permutate in modo casuale solo se è specificata l'opzione (\optname{random}).
+
+ \item {\color{blue}{\cmd{\Ans0} }} introduce una risposta errata
+ \item {\color{blue}{\cmd{\Ans1}}} introduce la risposta esatta \footnote{Se nella risposta appare il segno di tabulazione \& è necessario racchiudere la risposta tra parentesi graffe.}
+ \item {\color{blue}{\cmd{\eFreeze}}} introduce (se si vuole) una o più risposte che non saranno in ordine casuale.
+\end{itemize}
+È possibile aumentare lo spazio tra l'etichetta dell'item e il testo della risposta impostando la lunghezza \verb|\mylabelsep|.
+
+\DescribeEnv{solution}
+L'ambiente \envname{solution} può essere inserito o meno \emph{dopo} l'ambiente \envname{answers} e permette di visualizzare, usando l'opzione \optname{quizsolutions}, le soluzioni dell'esercizio.\nuovo{vers. 2.0}
+\begin{esempio}
+ \begin{verbatim}
+\newproblem{
+\item \PTs{1} Le soluzioni dell'equazione
+\[x^2-5x+6=0\]
+sono:
+\begin{answers}{2}
+ \bChoices[random]
+\Ans0 $x=3$ e $x=-2$ \eAns
+\Ans0 $x=-3$ e $x=-2$ \eAns
+\Ans1 $x=3$ e $x=2$ \eAns
+ \eFreeze
+\Ans0 nessuna delle precedenti \eAns
+ \eChoices
+\end{answers}
+\begin{solution}
+Le soluzioni dell'equazione di secondo grado sono date dalla formula
+$x_{1,2}=\dfrac{5\pm\sqrt{5^2-4 \cdot 6}}{2}$.
+\end{solution}
+}
+
+\newproblem{
+\item \PTs{1} Le soluzioni dell'equazione
+\[x^2+5x+6=0\]
+sono:
+\begin{answers}{2}
+ \bChoices[random]
+\Ans0 $x=3$ e $x=-2$ \eAns
+\Ans1 $x=-3$ e $x=-2$ \eAns
+\Ans0 $x=3$ e $x=2$ \eAns
+ \eFreeze
+\Ans0 nessuna delle precedenti \eAns
+ \eChoices
+\end{answers}
+}
+ \end{verbatim}
+\end{esempio}
+
+Oltre alle domande a risposta multipla è possibile inserire nell'ambiente \envname{test} altri tipi di domande che verranno descritti nella sezione \ref{sec:altri_esercizi}, ma se si usano esercizi di tipo \texttt{fill-in} se ci sono più spazi bianchi da riempire la stringa delle soluzioni avrà un utilità minore poiché non seguirà la numerazione delle risposte.
+
+\textbf{N.B.} Di default ogni domanda del test è inserita in un ambiente \envname{minipage}. Nel file di configurazione di esempio ci sono alcune righe commentate che permettono di avere le domande fuori da tale ambiente.
+
+\subsection{Gli ambienti problem e problem*}
+\DescribeEnv{problem}
+\DescribeEnv{problem*}
+Servono per scrivere problemi con risposte aperte. Si usano all'interno del file che contiene le varianti dell'esercizio, annidati nel comando \cmd{\newproblem}, con la seguente sintassi:
+\begin{verbatim}
+\begin{problem}
+ ...
+\end{problem}
+\end{verbatim}
+se si sceglie di scrivere un esercizio a risposta aperta in una sola parte; con la sintassi
+\begin{verbatim}
+\begin{problem*}
+ ...
+\end{problem*}
+\end{verbatim}
+se invece si sceglie di scrivere un esercizio a risposta aperta in più parti. Il codice di questi ambienti è derivato, con molte modificazioni, dal codice dell'ambiente \envname{exercise} del pacchetto \pkgname{exerquiz} \footnote{L'ambiente \envname{exercise} è rimasto e può essere usato come template per la costruzione di altri ambienti come nuovi esercizi, esempi o altro.}.
+\paragraph{Esercizio senza parti}
+È introdotto, come si è detto, dall'ambiente \envname{problem}.
+\begin{verbatim}
+\begin{problem} [punteggio]
+........Testo..........
+\begin{solution}[spazio_soluzione]
+.\dots testo soluzione ......
+\end{solution}
+\end{problem}
+ \end{verbatim}
+\DescribeEnv{solution}
+In \oarg{punteggio} va il punteggio dell'esercizio, in \oarg{spazio\_soluzione} va l'\emph{eventuale} spazio bianco che deve essere lasciato per la soluzione.
+\paragraph{Esercizio in più parti}
+\DescribeEnv{parts}
+È introdotto dall'ambiente \envname{problem*}.
+\begin{verbatim}
+\begin{problem*} [punteggio]
+....testo....
+\begin{parts}
+\item \PTs{punteggio della parte}
+....testo....
+ \begin{solution}[spazio_soluzione]
+ .\dots testo soluzione ......
+ \end{solution}
+\item \PTs{punteggio della parte}
+.....
+\end{parts} \end{problem*}
+ \end{verbatim}
+Con \cmd{\PTs\{punteggio della parte\}} si indica il punteggio della singola parte.
+\paragraph{Esercizi in una minipage}
+\DescribeEnv{problemmp}
+\DescribeEnv{problemmp*}
+Esistono anche gli ambienti \envname{problemmp} e \envname{problemmp*} \nuovo{vers. 2.1} che sono del tutto identici agli ambienti \envname{problem} e \envname{problem*}, ma inseriscono tutto il testo dell'esercizio in un ambiente \envname{minipage}.
+
+\subsection{Altre tipologie di esercizi}\label{sec:altri_esercizi}
+Sono state definite alcune nuove tipologie di esercizio:
+\paragraph{fillin:} \label{par:fillin}\DescribeMacro{\fillin}
+serve per creare esercizi ``a riempimento''. Parte del testo viene lasciata vuota e deve essere riempita dallo studente. Può essere usato anche per creare esercizi a risposta aperta breve. Anche questo tipo di esercizio è simile ad un tipo di esercizio introdotto da D.P. Story nel pacchetto \pkgname{eqexam}.
+
+Questi esercizi sono introdotti con una sintassi leggermente diversa e nel testo sono definiti o dal comando \cmd{\newfillinproblem} o da \cmd{\newproblem}\cmd{\fillinproblem}\texttt{\{testo del problema\}}. \nuovo{vers. 2.0}
+La sintassi è
+\begin{verbatim}
+ \fillin[u|e|b]{larghezza dello spazio}{risposta}
+\end{verbatim}
+I due parametri obbligatori sono la \marg{larghezza dello spazio} da lasciare, che deve essere espressa con una lunghezza (cm, pt, ecc.) e la \marg{risposta} esatta (parola o numero) che lo studente dovrebbe inserire (che verrà stampata solo nel file delle soluzioni).
+
+Il parametro opzionale definisce come deve essere segnalato lo spazio in cui inserire la risposta: \emph{u} (\emph{underlined}), che è l'opzione di default, fa sì che lo spazio sia evidenziato mediante una riga su cui va inserita la risposta, \emph{e} (\emph{empty}) crea uno spazio vuoto (non evidenziato in alcun modo), \emph{b} (\emph{boxed}) crea uno spazio circondato da un riquadro.
+
+Se la risposta contiene espressioni matematiche, deve essere inserita esplicitamente tra \$\ anche se il comando \cmd{\fillin} è già contenuto in un ambiente matematico.
+
+%All'interno del comando \cmd{\fillin} (nello spazio per la risposta) non è possibile usare i comandi \cmd{\sempli} o \cmd{\semplix} (si veda la sezione \ref{sec:comandi}).
+
+Questo tipo di esercizio non può al momento essere usato né con \Hologo{XeLaTeX} né con \Hologo{LuaLaTeX}
+\paragraph{domanda:}\DescribeEnv{problema} questo ambiente deve contenere il testo dell'esercizio (non le soluzioni). Viene usato negli ambienti \envname{problema} e \envname{problema*}, con l'opzione \optname{solutionsonly} non viene stampato il testo degli esercizi, ma solo la soluzione. Nelle versioni precedenti del pacchetto per lo stesso scopo veniva usato un altro ambiente.
+\paragraph{risposta:}\DescribeEnv{risposta} serve per creare, in esercizi a risposta aperta lunga, lo spazio per inserire la risposta in un box o su righe.
+
+La sintassi del comando è
+\begin{verbatim}
+ \begin{risposta}{b|l}{spazio verticale}
+ \end{risposta}
+\end{verbatim}
+Il primo parametro definisce se lo spazio per la risposta deve essere riquadrato (opzione \emph{b}, di default) oppure diviso in righe su cui andrà scritta la risposta (opzione \emph{l}). Il secondo parametro definisce invece l'altezza dello spazio per la risposta (in cm se con opzione \emph{b}, in numero di righe se con opzione \emph{l}) \paragraph{matching:}\DescribeMacro{\matching} è basato su un'idea del pacchetto \pkgname{examdesign} \cite{examdesign}. Serve per creare esercizi in cui le parole o formule contenute su due colonne vanno abbinate dallo studente in modo corretto.
+
+\DescribeMacro{\pair}Le coppie vengono definite dal comando \cmd{\pair}:
+\begin{verbatim}
+ \pair{nome 1}{nome 2}
+\end{verbatim}
+che va inserito tante volte quanti sono i nomi o le formule da abbinare.
+
+L'elenco dei nomi (mischiati in ordine casuale su ciascuna colonna) viene visualizzato con il comando \cmd{\matching}.
+
+\begin{esempio}
+
+ \begin{minipage}{.4\textwidth}
+ \begin{verbatim}
+ \pair{Regno Unito}{Londra}
+ \pair{Francia}{Parigi}
+ \pair{Italia}{Roma}
+ \pair{Germania}{Berlino}
+ \pair{Grecia}{Atene}
+ \matching
+\end{verbatim}
+ \end{minipage}
+ \begin{minipage}{.4\textwidth}
+ \begin{center}
+ \begin{tabular}{l l l }
+ \rule{1cm}{1pt} & Grecia & (A) Parigi \\
+ \rule{1cm}{1pt} & Regno Unito & (B) Berlino \\
+ \rule{1cm}{1pt} & Francia & (C) Roma \\
+ \rule{1cm}{1pt} & Italia & (D) Londra \\
+ \rule{1cm}{1pt} & Germania & (E) Atene
+ \end{tabular}
+ \end{center}
+ \end{minipage}
+\end{esempio}
+Nelle soluzioni viene invece visualizzato l'abbinamento corretto.
+
+Anche questo esercizio non funziona né con \Hologo{XeLaTeX} né con \Hologo{LuaLaTeX}.
+\paragraph{tabella:}\DescribeEnv{tabella} serve per creare esercizi con più risposte aperte incolonnate.
+
+La sintassi è
+\begin{verbatim}
+ \begin{tabella}[numero colonne sempre visibili]
+ {allineamento colonne visibili}{allineamento colonna nascosta}
+ \dots & \dots \cr
+ \end{tabella}
+\end{verbatim}
+Il primo parametro (il cui valore di default è 2) indica il numero di colonne della tabella il cui contenuto deve essere visibile anche nel testo dell'esercizio (e non solo nella soluzione), mentre è possibile avere solo una colonna il cui contenuto è invisibile nel testo, ma appare nella soluzione. Il secondo parametro consente di scegliere l'allineamento delle colonne il cui contenuto è sempre visibile e il terzo l'allineamento della colonna invisibile.
+Come per le domande a risposta chiusa, le risposte che contengono il carattere di tabulazione \&\ devono essere racchiuse tra parentesi graffe.
+
+Questo tipo di esercizio funziona con \Hologo{XeLaTeX}, ma non con \Hologo{LuaLaTeX}.
+\begin{esempio}
+ Con il codice
+ \begin{verbatim}
+\begin{center}
+\renewcommand\arraystretch{3}
+\begin{tabella}[1]{r}{c}
+\hline
+ Il dominio della funzione è & $D_f=(-\infty;2]$\cr
+ \hline
+ L'insieme immagine della funzione è & $Im(f)=(-\infty,0]$ \cr
+ \hline
+ \end{tabella}
+\end{center}
+ \end{verbatim}
+
+ si ottiene il seguente risultato
+ \renewcommand\arraystretch{3}
+ \begin{center}
+ \DeleteShortVerb{\|}
+ \MakeShortVerb{\!}
+ \begin{tabular}{r|c}
+ \hline
+ Il dominio della funzione è & \color{red}{$D_f=(-\infty;2]$} \\
+ \hline
+ L'insieme immagine della funzione è & \color{red}{$Im(f)=(-\infty,0]$} \\
+ \hline
+ \end{tabular}
+ \end{center}
+
+\end{esempio}
+\paragraph{workarea:}\DescribeEnv{workarea} non è una tipologia di esercizi, ma serve a creare un'area di lavoro, cioè uno spazio bianco sul foglio in cui lo studente possa scrivere. La sintassi è
+\begin{verbatim}
+\begin{solution}{lunghezza}
+ \begin{workarea}[larghezza]{lunghezza}
+ \end{workarea}
+ \end{solution}
+\end{verbatim}
+La lunghezza dello spazio soluzione e della workarea dovrebbero essere uguali, in caso contrario il testo presente nella workarea
+viene posizionato male nello spazio della soluzione, sovrapponendosi al testo dell’esercizio
+se la sua lunghezza è maggiore di quella della soluzione. La larghezza della workarea è opzionale e di default è uguale alla larghezza del testo. A differenza dell’ambiente \envname{solution}, nella workarea è possibile inserire testo, grafici, ecc.; ad esempio, è possibile inserire degli assi
+coordinati per disegnare un grafico.
+
+\subsection{Altri comandi}
+Il pacchetto definisce altri due comandi utilizzati nel file {\tt totale-versioni} (si veda \ref{sec:totale})
+\begin{itemize}
+ \item {\color{blue}{\cmd{\selectallproblems\{\textbackslash esercizio\}}}}:\DescribeMacro{\selectallproblems}\ si usa all'interno del file che serve per visualizzare tutte le varianti di un esercizio, con i parametri calcolati oppure no.
+ \item {\color{blue}{\cmd{\esercizio}}}:\DescribeMacro{\esercizio}\ si usa all'interno del file che serve per visualizzare tutte le varianti di un esercizio e serve per definire il nome dell'esercizio sul quale si sta lavorando, che verrà usato nel comando \cmd{\selectallproblems} visto in precedenza e verrà stampato come titolo del file pdf prodotto. La sintassi per definire il nome di un esercizio è \cmd{\def\textbackslash esercizio\{nome\}}.
+\end{itemize}
+Inoltre il comando \cmd{\Acapo} \DescribeMacro{\Acapo} equivalente di default a \verb|\par| separa gli esercizi; questo comando può essere ridefinito ad esempio in \cmd{\newpage} così da avere un esercizio per pagina (utile per studenti DSA o ipovedenti). \nuovo{vers. 2.0}
+
+\section{I comandi per lavorare con i parametri e con le liste}
+\subsection{Comandi per lavorare con i parametri (casuali)} \label{sec:comandi}
+Sono stati definiti alcuni comandi per lavorare con i parametri (casuali).
+
+Questi comandi si basano sul pacchetto \pkgname{fp} \cite{fp}, che permette di eseguire calcoli anche molto complessi all'interno di un documento \Hologo{LaTeX}.
+Il comando fondamentale che serve per definire un parametro è {\color{blue}{\cmd{\FPsetpar}\oarg{seme}\marg{nome-parametro}\marg{primo valore}\marg{ultimo valore}\oarg{{valori esclusi}}}} che serve per dichiarare i parametri casuali all'interno di un esercizio (a risposta chiusa o aperta). Il parametro avrà nome \cmd{\nome-parametro} e varierà tra il primo valore e l'ultimo valore (inclusi).\DescribeMacro{\FPsetpar} \ Il parametro sarà un numero intero\footnote{Anche se è possibile definire parametri razionali o (pseudo)reali, come nel pacchetto \pkgname{rangen} \cite{rangen} abbiamo preferito restringere la scelta al caso intero e ottenere gli altri casi operando sui parametri.}.
+Il parametro opzionale \oarg{seme}, serve a imporre un seme diverso per la generazione del numero casuale. Il valore di default del parametro è \cmd{\seme} ed è definito a partire dalla data dell'esame e dal numero della versione.
+È possibile escludere dalla scelta uno o più valori (ultimo parametro tra parentesi quadre). Se i valori sono più di uno devono essere posti tra parentesi graffe e separati tra virgole; tra i valori esclusi ci possono essere anche altri parametri purché già definiti in precedenza (anche il primo e l'ultimo valore possono essere parametri: in questo caso bisogna prestare attenzione al fatto che il primo valore deve essere minore dell'ultimo). \DescribeMacro{\maxLoopLimit}Il meccanismo usato per soddisfare tali condizioni consiste nel ripetere la generazione più volte: il numero massimo di ripetizioni è determinato dal parametro \cmd{\maxLoopLimit}, il cui valore di default è 10, ma che è definibile anche in fase di compilazione.
+\begin{esempio}
+ \begin{verbatim}
+ \FPsetpar{a}{2}{10}
+\end{verbatim}
+ crea una variabile \cmd{\a} che può assumere un valore casuale tra $2$ e $10$, in questo caso, il seme è quello stabilito nel preambolo del documento.
+ I comandi
+ \begin{verbatim}
+\FPsetpar{a}{2}{10}[3]
+\FPsetpar{b}{4}{12}[{\a,6}]
+\end{verbatim}
+ creano due variabili \cmd{\a} (che può assumere un valore casuale tra 2 e 10, escluso 3) e \cmd{\b} (che può assumere un valore tra 4 e 12,
+ escluso 6 e il valore già assegnato ad \cmd{\a}).
+\end{esempio}
+
+Sui parametri definiti è possibile operare come su numeri e sono stati definiti comandi che permettono di operare su tali parametri mostrando il risultato numerico o le operazioni in forma parametrica.
+
+\begin{itemize}
+ \item {\color{blue}{\cmd{\FPsv}\oarg{numero di cifre decimali}\marg{parametro/operazione su parametri}}}:\DescribeMacro{\FPsv}\ serve ad eseguire operazioni su parametri e restituirne il valore numerico (con il numero prescelto di cifre decimali, eliminando gli zeri superflui) o stampare l'operazione eseguita (se si sceglie l'opzione \optname{param} nel pacchetto esami).
+
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{l|l|l}
+ \color{blue}{Istruzione} & \color{blue}{Risultato numerico} & \color{blue}{Opzione \texttt{param}} \\
+ \hline
+ \hline
+ \verb|\FPsv{2*k+1}| & $5$ & $2*k+1$ \\
+ \verb|\FPsv[2]{(2*k+1)/2}| & $2.50$ & $(2*k+1)/2$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ Le principali caratteristiche del comando \cmd{\FPsv} sono (negli esempi, $k=2$):
+ \begin{itemize}
+ \item le operazioni devono essere sempre indicate in modo esplicito
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb!$\FPsv{2*k}$! & $4$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item in via automatica, ogni operazione viene racchiusa tra parentesi tonde. La parentesi non viene visualizzata quando si vuole il risultato numerico, mentre lo è con l'opzione \optname{param}
+ \begin{esempio}
+ \begin{center}
+ \begin{tabular}{l|l|l}
+ \color{blue}{Istruzione} & \color{blue}{Risultato numerico} & \color{blue}{Opzione \texttt{param}} \\
+ \verb|$\FPsv{2*k+1}x$| & $5x$ & $(2*k+1)x$
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item Si possono usare i seguenti simboli per le operazioni: \verb|+,-,*,/,^|
+ \item Occorre prestare attenzione al fatto che il pacchetto \pkgname{fp} non può gestire potenze con base negativa
+ \end{itemize}
+
+ \item {\color{blue}{\cmd{\FPval}\marg{nome}\oarg{numero di cifre decimali}\marg{parametro/operazione su parametri}}}:\DescribeMacro{\FPval}\
+ assegna a \marg{nome} il valore dell'operazione arrotondato (è il comando \cmd{\FPeval} di \pkgname{fp} modificato) o stampare l'operazione eseguita se si sceglie l'opzione \optname{param} nel pacchetto esami, come con \cmd{\FPsv}, il risultato viene approssimato al numero di cifre decimali indicato (di default è un intero) eliminando gli zeri superflui.\nuovo{vers. 2.0}
+ \begin{esempio}
+ Sia $k=2$. Il codice
+ \begin{verbatim}
+ \FPsetpar{k}{1}{3}
+ \FPval{a}{2*k+1}
+ \FPsetpar{b}{2}{20}[\a]
+ \end{verbatim}
+ genera una variabile \cmd{\b} che assume un valore casuale tra $2$ e $20$, escluso (in questo caso) il valore $5$. Nella versione parametrica appare invece una stringa di questo tipo (per quanto riguarda la variabile \cmd{\b})
+ \begin{center}
+ Il parametro $b$ varia da $2$ a $20$. $b \neq (2*k+1)$. Il seme vale 209.
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\sempli}\marg{num}\marg{den}}}:\DescribeMacro{\sempli}\ serve per scrivere delle frazioni in cui il numeratore o il denominatore contengono parametri e che potrebbero dover essere ridotte ai minimi termini.
+ All'interno del comando \cmd{\sempli} non si deve usare \cmd{\FPsv}.
+ \begin{esempio}
+
+ Se $k=1$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb!$\sempli{2*k}{3*k+1}$! & $ \frac12$ \\[2mm]
+ \hline \\
+ \verb!$\frac{\FPsv{2*k}}{\FPsv{3*k+1}}$! & $\frac24$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ Nel file di \texttt{log} è possibile vedere se e in quali esercizi il risultato di tale operazione è uguale a $1$ o $-1$ (si veda sotto).
+ \item {\color{blue}{\cmd{\semplix}\marg{num}\marg{den}}}:\DescribeMacro{\semplix}\ serve per scrivere delle frazioni in cui il numeratore o il denominatore contengono parametri e che potrebbero dover essere ridotte ai minimi termini, ma nelle quali il risultato pari ad $1$ non deve apparire (ad esempio perché davanti ad una incognita).
+
+ Il funzionamento è identico a quello del comando \cmd{\sempli}.
+
+ Il comando può essere utilizzato ponendo il denominatore uguale ad 1 anche per la formattazione di coefficienti affinché non appaia il valore $1$ e il valore $-1$ appaia come $-$ (segno meno).
+ \begin{esempio}
+
+ Se il parametro $k$ assume valore $2$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb|$\FPsv{k-1}x$| & $1x$ \\[2mm]
+ \hline \\
+ \verb!$\semplix{k-1}{1}x$! & $x$ \\[2mm]
+ \hline \\
+ \verb|$\semplix{1-k}{1}x$| & $-x$ \\[2mm]
+ \hline \\
+ \verb|$\semplix{2*k}{k+2}x$| & $x$ \\
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\esempli}\marg{num}\marg{den}}}:\DescribeMacro{\esempli}\ serve per scrivere delle frazioni in cui il numeratore o il denominatore contengono parametri e che potrebbero dover essere ridotte ai minimi termini, ma nelle quali il risultato pari ad $1$ non deve apparire, ma deve apparire esplicitamente il valore $-1$ (ad esempio per gli esponenti).
+
+ Il funzionamento è identico a quello del comando \cmd{\sempli}.
+
+ Il comando può essere utilizzato ponendo il denominatore uguale ad 1 anche per la formattazione di esponenti affinché non appaia il valore $1$ e il valore $-1$ appaia come $-1$.
+ \begin{esempio}
+
+ Se il parametro $k$ assume valore $2$:
+ \begin{center}
+ \begin{tabular}{lr}
+ \verb|$x^{\FPsv{k-1}}$| & $x^1$ \\[2mm]
+ \hline \\
+ \verb|$x^{\esempli{k-1}{1}}$| & $x$ \\[2mm]
+ \hline \\
+ \verb|$x^{\esempli{1-k}{1}}$| & $x^{-1}$
+ \end{tabular}
+ \end{center}
+ \end{esempio}
+ \item {\color{blue}{\cmd\sempliz\marg{num}\marg{den}}}:\DescribeMacro{\sempliz}\ serve per scrivere delle frazioni in cui il numeratore o il denominatore contengono parametri e che potrebbero dover essere ridotte ai minimi termini e che possono assumere il valore $0$ (ad esempio nelle risposte). Mentre con gli altri comandi il risultato $0$ dà luogo a un \textbf{errore} e al blocco della compilazione, con il comando \cmd{\sempliz} viene scritto il risultato $0$.
+
+ Il funzionamento è identico a quello del comando \cmd{\sempli}.
+ \item {\color{blue}{\cmd{\simpsqrt}\marg{ind}\marg{rad}}}:\DescribeMacro{\simpsqrt}\ serve per portar fuori da una radice tutti i fattori possibili. I fattori portati fuori dalla radice non possono essere semplificati con altri (ad esempio, se la radice è al numeratore di una frazione, non è possibile eseguire eventuali semplificazioni tra numeratore e denominatore). Il primo parametro obbligatorio, \marg{ind}, è l'indice della radice; il secondo, \marg{rad}, il radicando. Il primo può contenere un numero o un parametro; il secondo un numero, un parametro o un'operazione su parametri (anche in questo caso non si deve usare all'interno \cmd{\FPsv}).
+ \begin{esempio}
+
+ Se $a$ vale $2$ e $b$ vale $1$
+
+ \begin{tabular}{lr}
+ \verb|$\simpsqrt{2}{a^2+4*b}$| & $2\sqrt{2}$
+ \end{tabular}
+ \end{esempio}
+ \item {\color{blue}{\cmd{\RandS}}}:\DescribeMacro{\RandS}\ serve per attribuire un segno casuale ($+$ o $-$) ad un numero. Il comando è simile a quello del pacchetto \pkgname{rangen}.
+ \item {\color{blue}{\cmd{\FPsignpol}\marg{espressione1}\marg{espressione2}}}:\DescribeMacro{\FPsignpol}\ restituisce il valore di ``espressione1'' con il suo segno moltiplicato per ``espressione2'': è utile, ad esempio, se ``espressione1'' è il coefficiente di un polinomio. Se ``espressione2'' è vuoto il comando restituisce il valore di ``espressione1'' con il suo segno (contributo di Hjalmar Basile). \nuovo{vers. 2.1}
+ \begin{esempio}
+
+ Se $a$ vale $2$ e $b$ vale $-1$
+
+ \begin{tabular}{lr}
+ \verb|$x^2\FPsignpol{a+4*b}{x}-2$| & $x^2-2x-2$
+ \end{tabular}
+
+ Se $a$ vale $2$ e $b$ vale $1$
+
+ \begin{tabular}{lr}
+ \verb|$x^2\FPsignpol{a+4*b}{x}-2$| & $x^2+6x-2$
+ \end{tabular}
+ \end{esempio}
+\end{itemize}
+\subsection{Comandi per la scelta da una lista }
+Oltre al comando \cmd{\esercizi} già visto esistono altri comandi per la scelta di esercizi da una lista o, più in generale, di oggetti da una lista.
+
+Il primo comando permette di scegliere casualmente $n-m$ elementi di una lista
+\DescribeMacro{\estrai}.\ Il comando \cmd{\estrai}\oarg{m}\marg{lista}\marg{nome} è il comando utente per estrarre gli elementi
+dalla lista \marg{lista} escludendone \emph{m}. Gli elementi estratti avranno nome \cmd{\nomei}, \cmd{\nomeii}, \dots.
+Gli elementi della lista devono essere separati da virgole.
+\begin{esempio}
+
+ Con il comando \cmd{\estrai[1]\{insiemi,logica,potenze\}\{alpha\}} si scelgono 2 elementi dell'insieme e questi due elementi si chiameranno \cmd{\alphai} e \cmd{\alphaii}. Se questi nomi corrispondono a nomi di file di esercizi è possibile inserire nella lista di file argomento del comando \cmd{\esercizi} anche \cmd{\alphai} e \cmd{\alphaii}.
+\end{esempio}
+\DescribeMacro{\randestrai}.\ Il comando \cmd{\randestrai}\oarg{m}\marg{lista}\marg{nome} è simile al comando \cmd{\estrai}, ma l'estrazione degli elementi è completamente aleatoria. \nuovo{vers. 2.1}
+
+\DescribeMacro{\estraialfa} Il comando \cmd{\estraialfa}\marg{m}\marg{lista}\marg{nome} estrae \marg{m} oggetti casuali dalla lista
+\marg{lista} mantenendo l'ordine fissato. Gli elementi estratti avranno nome \cmd{\nomei}, \cmd{\nomeii}, \dots.
+Gli elementi della lista devono essere separati da virgole.
+\begin{esempio}
+
+ Con il comando \cmd{\estraialfa[2]\{a,b,c,d\}\{alpha\}} si scelgono 2 elementi dell'insieme, mantenendo l'ordine
+ alfabetico e questi due elementi si chiameranno \cmd{\alphai} e \cmd{\alphaii}.
+\end{esempio}
+\DescribeMacro{\estraies} \label{estraies} Il comando \cmd{\estraies}\oarg{m}\marg{lista} funziona come il comando \cmd{\estrai}, ma esclusivamente su una lista di esercizi. Una volta effettuata l'estrazione, li stampa come il comando \cmd{\esercizi}.
+\DescribeMacro{\randestraies} \label{randestraies} Il comando \cmd{\randestraies}\oarg{m}\marg{lista} funziona come il comando \cmd{\randestrai}, ma esclusivamente su una lista di esercizi. Una volta effettuata l'estrazione, li stampa come il comando \cmd{\esercizi}.
+
+\section{I file ausiliari}
+\subsection{Il file di localizzazione}\label{sec:lng}
+Al momento sono presenti le localizzazioni in italiano (default), inglese (UK), inglese (US), francese, spagnolo (contributo di Maria Hernandez Cifre), tedesco (contributo di Kerstin von Kirschhausen), serbo con alfabeto latino (contributo di Dusko Latas), greco (contributo di Sotiris Hasapis). Usando la lingua greca (e forse altre localizzazioni in caratteri non latini) è necessario caricare i pacchetti \pkgname{fontenc}, \pkgname{inputenc} e \pkgname{babel} prima del caricamento del pacchetto \pkgname{esami}\footnote{L'opzione \optname{greek} prevede al momento l'utilizzo dell'opzione \optname{iso-8859-7} per il pacchetto \pkgname{inputenc}}. In questo file possono venire caricati anche alcuni pacchetti dipendenti dalla localizzazione, quali \pkgname{numprint}, \pkgname{geometry}, ecc. e vengono definiti i comandi \cmd{\shortdate} e \cmd{\longdate} per esprimere la data.
+\textcolor[rgb]{1.00,0.00,0.00}{\textbf{N.B.:} È nota un'incompatibilità tra il pacchetto \pkgname{babel} per la lingua francese (che non è comunque necessario per la localizzazione) e il pacchetto \pkgname{fp}: per ovviare a tale incompatibilità è sufficiente usare il comando \cmd{\shorthandoff\{:\}} subito dopo \cmd{\begin\{document\}}.}
+\subsection{Il file di configurazione}\label{sec:cfg}
+Il file di configurazione \texttt{esami-xyz.cfg} contiene varie definizioni tra cui la testata (comando \cmd{\testa}), il piè di pagina, la formattazione della stringa delle soluzioni, lo stile di pagina, le istruzioni per l'esame.
+\subsection{I file \texttt{master} e \texttt{master-sol}}
+Questi due file differiscono solo perché il secondo mostra le soluzioni e contengono le istruzioni per generare effettivamente la prova d'esame. \textbf{I file vanno rinominati prima della compilazione}: in caso contrario la compilazione si arresta con un messaggio di errore. In entrambi è necessario indicare la data (comando \cmd{\date}) in formato YYYY/MM/DD, il numero di compiti da generare (comando \cmd{\numcompiti}), e, ovviamente, gli esercizi. Il tema d'esame può essere diviso in più parti e in ognuna si può usare uno o più degli ambienti introdotti e uno o più comandi per la stampa degli esercizi.
+
+Nel file possono essere definiti anche il numero massimo di ripetizioni che il comando \cmd{\FPsetpar} deve eseguire per cercare di soddisfare le condizioni poste (comando \cmd{\maxLoopLimit}) e il meccanismo di calcolo del seme iniziale per la generazione dei numeri casuali (comando \cmd{\seme}).
+
+È anche possibile definire il nome delle parti in cui è diviso il tema d'esame.
+\subsection{Il file \texttt{totale-versioni}}\label{sec:totale}
+Il file \texttt{totale-versioni} serve per generare tutte le varianti di un esercizio. Con questo file il pacchetto ha sempre l'opzione \optname{prova} e può essere definita l'opzione \optname{param} per generare la versione parametrica degli esercizi.
+
+Al suo interno si deve usare un solo comando, \cmd{\def \textbackslash esercizio\{nome\}}, che deve contenere il nome dell'esercizio da compilare. Se si compila la versione parametrica, i parametri e i loro intervalli di variazione vengono indicati alla fine dell'esercizio.
+
+\section{Changelog}
+\begin{description}
+ \item[Versione 1.0 (2013/03/08)] Prima versione rilasciata al CTAN
+ \item[Versione 1.1 (2013/12/09)] Reinserita la dipendenza dal pacchetto \pkgname{environ} per eliminare alcuni errori nella compilazione con \Hologo{LaTeX}. Eliminata la dipendenza dal pacchetto \pkgname{icomma} nel file di localizzazione es-italian.lng a seguito dell'introduzione di nuove funzionalità nel pacchetto \pkgname{babel} per la lingua italiana (comando \cmd{\IntelligentComma}).
+ \item[Versione 2.0 (2015/02/25)] Eliminata la dipendenza da \pkgname{pstricks}. Modificato l'inserimento di domande di tipo \emph{fill-in}. Inserita la possibilità di estrarre più esercizi da un solo file. Ora è possibile visualizzare le risposte nei test. Modificata la visualizzazione dei decimali nel comando \cmd{\FPsv}. Modificata la definizione di \cmd{\FPval} in modo da avere cifre decimali. Modificato l'algoritmo di scelta della variante di un esercizio in modo completamente deterministico. Aggiunto il comando \cmd{\Acapo}. Aggiunta la localizzazione serba (alfabeto latino). Ora la compilazione produce un nuovo file con la lista degli esercizi scelti.
+ \item[Versione 2.1 (2016/07/25)] Modificato \texttt{es-german.lng} e \texttt{es-spanish.lng} per errore nell'input delle soluzioni. Introdotto il comando \texttt{randestrai}. Introdotto il comando \texttt{FPsignpol}. Introdotto controllo punteggio totale degli esercizi. Risolta l'incompatibilità con \pkgname{babel} per la lingua spagnola. Rimossa l'incompatibilità tra il comando \cmd{\fillin} e i comandi \cmd{\sempli} e \cmd{\semplix}.
+ \item[Versione 2.2 (2017/07/01)] Introdotta la possibilità di avere due semi diversi per la scelta degli esercizi (\cmd{\semeex}) e per le permutazioni e scelta dei parametri (\cmd{\seme}): di default sono uguali. Leggermente modificato il comando \cmd{\estrai} così da poter essere usato per estrarre parametri numerici da una lista. Integrata la documentazione.
+ \item[Versione 2.3 (2017/09/18)] Corretto un errore di battitura nel codice.
+ \item[Versione 2.4 (2018/02/10)] Corretta la documentazione .
+ \item[Versione 2.5 (2018/05/06)] Corretto un errore di battitura nel codice. Migliorata la scelta aleatoria degli esercizi.
+
+
+\end{description}
+
+
+\bibliographystyle{plain}
+\bibliography{esami}
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/esami.bib b/macros/latex/contrib/esami/doc/esami.bib
new file mode 100644
index 0000000000..4380dffa62
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/esami.bib
@@ -0,0 +1,64 @@
+% This file was created with JabRef 2.9.2.
+% Encoding: Cp1252
+
+@MISC{examdesign,
+ author = {Jason Alexander},
+ title = {The package \pkgname{examdesign}},
+ howpublished = {\url{CTAN:/macros/latex/contrib/examdesign}},
+ year = {2006}
+}
+
+@MISC{random,
+ author = {Donald Arseneau},
+ title = {The package \pkgname{random}},
+ howpublished = {\url{CTAN:/macros/generic/misc/random.tex}}
+}
+
+@MISC{fp,
+ author = {Michael Mehlich},
+ title = {The package \pkgname{fp}},
+ howpublished = {\url{CTAN:/macros/latex/contrib/fp}},
+ year = {1999}
+}
+
+@ARTICLE{esami,
+ author = {Grazia Messineo and Salvatore Vassallo},
+ title = {Il pacchetto \pkgname{esami} per la creazione di prove scritte},
+ journal = {ArsTeXnica},
+ year = {2012},
+ volume = {14},
+ pages = {95-103}
+}
+
+@MISC{acrotex,
+ author = {D. P. Story},
+ title = {Exerquiz \& \protect{Acro\TeX}},
+ howpublished = {http://www.acrotex.net/},
+ year = {2012},
+ url = {http://www.acrotex.net/}
+}
+
+@MISC{rangen,
+ author = {D. P. Story},
+ title = {The package \pkgname{rangen}},
+ howpublished = {\url{http://www.math.uakron.edu/~dpstory/rangen.html}},
+ year = {2009},
+ url = {http://www.math.uakron.edu/~dpstory/rangen.html}
+}
+
+@MISC{probsoln,
+ author = {Nicola L.C. Talbot},
+ title = {The package \pkgname{probsoln}},
+ howpublished = {\url{CTAN:macros/latex/contrib/probsoln}},
+ year = {2011}
+}
+
+@ARTICLE{tug,
+ author = {Messineo, G. and Vassallo, S.},
+ title = {The \pkgname{esami} package for examinations},
+ journal = {TUGboat},
+ year = {2013},
+ volume = {34},
+ pages = {40-46},
+ number = {1}
+}
diff --git a/macros/latex/contrib/esami/doc/examples/master-sol.tex b/macros/latex/contrib/esami/doc/examples/master-sol.tex
new file mode 100644
index 0000000000..2882a37245
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/master-sol.tex
@@ -0,0 +1,96 @@
+\documentclass[a4paper,italiano]{article}
+
+\usepackage[shuffle,xyz,pointsonright,solutions,noquizsolutions,twocolumns]{esami}%%%%% TEMA
+
+%%%% substitute "xyz" with your own config file
+
+%%% some packages we use
+
+ \usepackage{fixltx2e}
+ \usepackage[T1]{fontenc}
+ \usepackage[utf8]{inputenc}
+ \usepackage{lmodern,textcomp}
+
+% +=============================+
+% | DEFINITIONS |
+% +=============================+
+
+\def\examname{The name of the exam}
+\def\numcompiti{10}%%% The number of the versions
+\date{2014/07/22}%%% THE DATE IN THE FORMAT YYYY/M/D or D/M/YYYY
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+%\def\cartella{d:/folder}%%% The folder where are the exercises: by default the current folder%
+%\def\Acapo{\newpage}
+\usepackage{babel}
+
+\begin{document}
+
+\testversioni
+\pagestyle{esame}
+
+\whiledo{\thevers<\numcompiti}{\stepvers
+% +=============================+
+% | THE SEED |
+% +=============================+
+
+\FPeval\seme{round((\thenomefile+(3*\thevers)):0)}
+%%% OR SOME OTHER LIKE
+%\FPeval\seme{round(\thenomefile*(\thevers)+1-trunc(\thenomefile*(\thevers)/(2^31-1):0)*(2^31-1):0)}
+%\FPeval\seme{round(1+abs(\thenomefile/(\thevers)+sin(\thevers)*(\thevers)^(2)):0)}
+
+\randomi=\seme
+
+\permuta
+% +=============================+
+% | STUFF DEFINED IN CFG FILE |
+% +=============================+
+
+\testa%%% the heading
+\istruzionii%%% some instructions
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section*{Part One}
+
+
+\begin{test}[8]
+\begin{questions}
+%%% this is an example of "esdb"
+
+\begin{esdb}{mydb} %% some exercises from 2 files
+ \selectrandomlyn{3}{test2}
+ \selectrandomlyn{2}{test3}
+ \end{esdb}
+
+%%%% this is an example of "esercizi"
+
+\esercizi{
+test14,
+test1,
+test4,
+test9,
+test5-fillin
+}
+%%% all the problems of a file
+\selectallproblems[random]{test11}
+
+
+\end{questions}
+
+%%%% You can write other questions here using \begin{questions}... \end{question}
+
+\end{test}
+
+\section*{Part two}
+\istruzioniii%%% Some other instructions
+
+%%%% This is an example of open question problem
+
+\esercizi{problem1}
+\closevers
+\newpage %
+ %
+\setcounter{page}{1} %%% dvi
+}
+
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/examples/master.tex b/macros/latex/contrib/esami/doc/examples/master.tex
new file mode 100644
index 0000000000..6f10238495
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/master.tex
@@ -0,0 +1,96 @@
+\documentclass[a4paper,italiano]{article}
+
+\usepackage[shuffle,xyz,pointsonright,nosolutions,noquizsolutions,twocolumns]{esami}%%%%% TEMA
+
+%%%% substitute "xyz" with your own config file
+
+%%% some packages we use
+
+ \usepackage{fixltx2e}
+ \usepackage[T1]{fontenc}
+ \usepackage[utf8]{inputenc}
+ \usepackage{lmodern,textcomp}
+
+% +=============================+
+% | DEFINITIONS |
+% +=============================+
+
+\def\examname{The name of the exam}
+\def\numcompiti{10}%%% The number of the versions
+\date{2014/07/22}%%% THE DATE IN THE FORMAT YYYY/M/D or D/M/YYYY
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+%\def\cartella{d:/folder}%%% The folder where are the exercises: by default the current folder%
+%\def\Acapo{\newpage}
+\usepackage{babel}
+
+\begin{document}
+
+\testversioni
+\pagestyle{esame}
+
+\whiledo{\thevers<\numcompiti}{\stepvers
+% +=============================+
+% | THE SEED |
+% +=============================+
+
+\FPeval\seme{round((\thenomefile+(3*\thevers)):0)}
+%%% OR SOME OTHER LIKE
+%\FPeval\seme{round(\thenomefile*(\thevers)+1-trunc(\thenomefile*(\thevers)/(2^31-1):0)*(2^31-1):0)}
+%\FPeval\seme{round(1+abs(\thenomefile/(\thevers)+sin(\thevers)*(\thevers)^(2)):0)}
+
+\randomi=\seme
+
+\permuta
+% +=============================+
+% | STUFF DEFINED IN CFG FILE |
+% +=============================+
+
+\testa%%% the heading
+\istruzionii%%% some instructions
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section*{Part One}
+
+
+\begin{test}[8]
+\begin{questions}
+%%% this is an example of "esdb"
+
+\begin{esdb}{mydb} %% some exercises from 2 files
+ \selectrandomlyn{3}{test2}
+ \selectrandomlyn{2}{test3}
+ \end{esdb}
+
+%%%% this is an example of "esercizi"
+
+\esercizi{
+test14,
+test1,
+test4,
+test9,
+test5-fillin
+}
+%%% all the problems of a file
+\selectallproblems[random]{test11}
+
+
+\end{questions}
+
+%%%% You can write other questions here using \begin{questions}... \end{question}
+
+\end{test}
+
+\section*{Part two}
+\istruzioniii%%% Some other instructions
+
+%%%% This is an example of open question problem
+
+\esercizi{problem1}
+\closevers
+\newpage %
+ %
+\setcounter{page}{1} %%% dvi
+}
+
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/examples/problem1.tex b/macros/latex/contrib/esami/doc/examples/problem1.tex
new file mode 100644
index 0000000000..62327718cf
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/problem1.tex
@@ -0,0 +1,22 @@
+\newproblem{
+\begin{problem*}[4]\estraialfa{4}{a,b,c,x,y,z}{element}Let $A=\{\elementi,\elementii,\elementiii\}$ and $B=\{\elementi,\elementiii,\elementiv\}$.
+\begin{parts}
+\item \PTs{2}
+List (without repetition) the elements of the set $A\cup B$
+\begin{solution}[3cm]
+\[A \cup B=\left\{\elementi,\elementii,\elementiii,\elementiv\right\}\]
+\end{solution}
+\begin{workarea}{3cm}
+$A \cup B=$
+\end{workarea}
+\item \PTs{2}
+List (without repetition) the elements of the set $A\cap B$
+\begin{solution}[3cm]
+\[A \cap B=\left\{\elementi,\elementiii\right\}\]
+\end{solution}
+\begin{workarea}{3cm}
+$A \cap B=$
+\end{workarea}
+\end{parts}
+\end{problem*}
+}
diff --git a/macros/latex/contrib/esami/doc/examples/problem2-tabella.tex b/macros/latex/contrib/esami/doc/examples/problem2-tabella.tex
new file mode 100644
index 0000000000..8929d2c84d
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/problem2-tabella.tex
@@ -0,0 +1,35 @@
+\newproblem{
+\FPsetpar{a}{5}{8}
+\FPsetpar{b}{2}{4}
+\begin{problem}[4]
+Solve the following equations:
+
+\begin{tabella}[1]{l}{r}
+Equation & Solution \cr
+\hline
+$x^2+\FPsv{a+b}x+\FPsv{a*b}=0$& $x=\a;\; x=\b$ \cr
+\hline
+$x^2-\FPsv{a+b}x+\FPsv{a*b}=0$&$ x=-\a;\; x=-\b$ \cr
+\hline
+$x^2+\FPsv{a-b}x-\FPsv{a*b}=0$& $x=-\a;\; x=\b$ \cr
+\hline
+$x^2-\FPsv{a-b}x-\FPsv{a*b}=0$& $x=\a;\; x=-\b $\cr
+\end{tabella}
+\end{problem}
+}
+
+\newproblem{
+\begin{problem}[5]
+Complete the following table of derivatives:
+
+\begin{tabella}[1]{l}{r}
+Function & Derivative \cr
+\hline
+$f(x)=x^2$ & $f'(x)=2x$\cr
+\hline
+$f(x)=\sin x$ & $f'(x)=\cos x$\cr
+\hline
+$f(x)=\cos x $& $f'(x)=-\sin x$\cr
+\end{tabella}
+ \end{problem}
+ }
diff --git a/macros/latex/contrib/esami/doc/examples/problem2.tex b/macros/latex/contrib/esami/doc/examples/problem2.tex
new file mode 100644
index 0000000000..35d816150a
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/problem2.tex
@@ -0,0 +1,32 @@
+\newproblem{
+\begin{problem}[4]\estraialfa{3}{a,b,c,x,y,z}{element}List all the elements of the power set (set of subsets) of
+\[\left\{\elementi, \; \elementii,\; \elementiii\right\}\]
+\begin{solution}
+\[\emptyset,\; \left\{\elementi\right\},\;\left\{\elementii\right\},\;\left\{\elementiii\right\},\;
+\left\{\elementi,\elementii\right\},\;\left\{\elementi,\elementiii\right\},\;\left\{\elementii,\elementiii\right\},\;\left\{\elementi,\elementii,\elementiii\right\}\]
+\end{solution}
+\end{problem}
+}
+
+%\newproblem{
+%\begin{problem*}[4]\estraialfa{4}{a,b,c,x,y,z}{element}Let $A=\{\elementi,\elementii,\elementiii\}$ and $B=\{\elementi,\elementiii,\elementiv\}$.
+%\begin{parts}
+%\item \PTs{2}
+%List (without repetition) the elements of the set $A\cup B$
+%\begin{solution}[3cm]
+%\[A \cup B=\left\{\elementi,\elementii,\elementiii,\elementiv\right\}\]
+%\end{solution}
+%\begin{workarea}{3cm}
+%$A \cup B=$
+%\end{workarea}
+%\item \PTs{2}
+%List (without repetition) the elements of the set $A\cap B$
+%\begin{solution}[3cm]
+%\[A \cap B=\left\{\elementi,\elementiii\right\}\]
+%\end{solution}
+%\begin{workarea}{3cm}
+%$A \cap B=$
+%\end{workarea}
+%\end{parts}
+%\end{problem*}
+%}
diff --git a/macros/latex/contrib/esami/doc/examples/problem3-matching.tex b/macros/latex/contrib/esami/doc/examples/problem3-matching.tex
new file mode 100644
index 0000000000..ede6dddc74
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/problem3-matching.tex
@@ -0,0 +1,32 @@
+\newproblem{
+\begin{problem}[3]
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{3}{5}
+\FPsetpar{c}{\a}{8}
+
+ $a=\a$, $b=\b$, $c=\c$
+
+\pair{$\a+\b$}{$\FPsv{a+b}$}
+\pair{$\c-\a$}{$\FPsv{c-a}$}
+\pair{$\a \times \b$}{$\FPsv{a*b}$}
+
+\matching
+\end{problem}
+ }
+
+\newproblem{
+\begin{problem}[3]
+\FPsetpar{a}{12}{15}
+\FPsetpar{b}{13}{15}
+\FPsetpar{c}{2}{4}
+\FPsetpar{k}{3}{5}
+ $a=\a$, $b=\b$, $c=\c$
+
+\pair{$\FPsv{k*a}:\a$}{$\k$}
+\pair{$\k^{\c}$}{$\FPsv{k^c}$}
+\pair{$\a \times \b$}{$\FPsv{a*b}$}
+
+\matching
+
+\end{problem}
+ }
diff --git a/macros/latex/contrib/esami/doc/examples/problem4-fillin.tex b/macros/latex/contrib/esami/doc/examples/problem4-fillin.tex
new file mode 100644
index 0000000000..6ddbeb1f86
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/problem4-fillin.tex
@@ -0,0 +1,25 @@
+\newproblem{
+\FPsetpar{a}{12}{15}
+\FPsetpar{b}{13}{15}
+\FPsetpar{c}{2}{4}
+\FPsetpar{k}{4}{5}
+\begin{problem}[4]
+ $a=\a$, $b=\b$, $c=\c$, $k=\k$
+
+Evaluate $\a-\c=$\fillin[b]{1cm}{$\FPsv{a-c}$} $ \b:\k$ with two exact decimals \fillin[b]{1cm}{$\FPsv[2]{b/k}$} and $\k^{\c}$=\fillin{20pt}{$\FPsv{k^c}$}
+ \end{problem}
+ }
+\newproblem{
+\FPsetpar{a}{12}{15}
+\FPsetpar{b}{13}{15}[\a]
+\FPsetpar{c}{2}{4}
+\FPsetpar{k}{4}{5}[\c]
+\begin{problem}[4]
+ $a=\a$, $b=\b$, $c=\c$, $k=\k$
+
+If $A=\left\{a,b,c,d,\a,\c,\k\right\}$ and $B=\left\{c,a,\c,1,\b\right\}$ then \\
+ $A\cup B=$\fillin[u]{4cm}{$\left\{a,b,c,d,\a,\c,\k,\b,1\right\}$}\\
+ $ A\cap B=$\fillin[u]{4cm}{$\left\{a,c,\c\right\}$} \\
+ $A\setminus B$=\fillin{60pt}{$\left\{b,d,\k\right\}$}
+ \end{problem}
+ } \ No newline at end of file
diff --git a/macros/latex/contrib/esami/doc/examples/test1.tex b/macros/latex/contrib/esami/doc/examples/test1.tex
new file mode 100644
index 0000000000..0bced77966
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test1.tex
@@ -0,0 +1,19 @@
+\newproblem{
+%\FPsetpar{a}{2}{5}
+\estrai[2]{2,3,7}{a}
+\item \PTs{1} exercise 1a $a=\ai$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\item \PTs{1} exercise 1b $a=\a$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \eChoices\end{answers}}
+
diff --git a/macros/latex/contrib/esami/doc/examples/test11.tex b/macros/latex/contrib/esami/doc/examples/test11.tex
new file mode 100644
index 0000000000..06b577138f
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test11.tex
@@ -0,0 +1,19 @@
+\newproblem{\estraialfa{3}{a,b,c,x,y,z}{element}
+\FPsetpar{a}{2}{5}
+\item \PTs{1} exercise 11a
+\[\left\{\elementi, \; \elementii,\; \elementiii\right\}\]
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \eChoices\end{answers}}
+\newproblem{\estraialfa{3}{a,b,c,x,y,z}{element}
+\FPsetpar{a}{2}{5}
+\item \PTs{1} exercise 11b
+\[\left\{\elementi, \; \elementii,\; \elementiii\right\}\]
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \eChoices\end{answers}}
+
diff --git a/macros/latex/contrib/esami/doc/examples/test12.tex b/macros/latex/contrib/esami/doc/examples/test12.tex
new file mode 100644
index 0000000000..44f012d7e2
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test12.tex
@@ -0,0 +1,42 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 12a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 12b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 12c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
diff --git a/macros/latex/contrib/esami/doc/examples/test13.tex b/macros/latex/contrib/esami/doc/examples/test13.tex
new file mode 100644
index 0000000000..4b8a8f0cd9
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test13.tex
@@ -0,0 +1,57 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 13a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 13b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 13c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 13d $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
diff --git a/macros/latex/contrib/esami/doc/examples/test14.tex b/macros/latex/contrib/esami/doc/examples/test14.tex
new file mode 100644
index 0000000000..da8e182851
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test14.tex
@@ -0,0 +1,259 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14d $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14e $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+ \newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14f $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14g $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14h $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14k $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14i $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14j $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14l $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14m $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14n $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 14o $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}\begin{solution}
+ This is the solution $a=\a$, $b=\b$, $c=\c$
+ \end{solution}}
diff --git a/macros/latex/contrib/esami/doc/examples/test2.tex b/macros/latex/contrib/esami/doc/examples/test2.tex
new file mode 100644
index 0000000000..ff3f0dee60
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test2.tex
@@ -0,0 +1,53 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 2a $a=\a$, $b=\b$, $c=\c$
+seme=\seme
+
+semeex=\semeex
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 2b $a=\a$, $b=\b$, $c=\c$
+
+seme=\seme
+
+semeex=\semeex
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 2c $a=\a$, $b=\b$, $c=\c$
+
+seme=\seme
+
+semeex=\semeex
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
diff --git a/macros/latex/contrib/esami/doc/examples/test3.tex b/macros/latex/contrib/esami/doc/examples/test3.tex
new file mode 100644
index 0000000000..f24db14b77
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test3.tex
@@ -0,0 +1,61 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 3a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}answer 1\end{solution}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 3b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}answer 1\end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 3c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}answer 1\end{solution}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 3d $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}
+ \begin{solution}answer 1\end{solution}}
diff --git a/macros/latex/contrib/esami/doc/examples/test4.tex b/macros/latex/contrib/esami/doc/examples/test4.tex
new file mode 100644
index 0000000000..ea78990cbd
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test4.tex
@@ -0,0 +1,71 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 4a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 4b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 4c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 4d $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{1} exercise 4e $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
diff --git a/macros/latex/contrib/esami/doc/examples/test5-fillin.tex b/macros/latex/contrib/esami/doc/examples/test5-fillin.tex
new file mode 100644
index 0000000000..14fcc410e4
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test5-fillin.tex
@@ -0,0 +1,26 @@
+
+\newfillinproblem{
+\FPsetpar{a}{12}{15}
+\FPsetpar{b}{13}{15}
+\FPsetpar{c}{2}{4}
+\FPsetpar{k}{4}{5}
+\item \PTs{1}
+ $a=\a$, $b=\b$, $c=\c$, $k=\k$
+
+Evaluate with two exact decimals
+
+$$ \b:\k= \fillin[b]{3cm}{ \FPsv[2]{b/k}}$$
+ }
+
+
+\newfillinproblem{
+\FPsetpar{a}{12}{15}
+\FPsetpar{b}{13}{15}
+\FPsetpar{c}{2}{4}
+\FPsetpar{k}{4}{5}
+\item \PTs{1}
+ $a=\a$, $b=\b$, $c=\c$, $k=\k$
+
+Evaluate with two exact decimals
+
+$$ \a:\c= \fillin[b]{3cm}{ \FPsv[2]{a/c}}$$ } \ No newline at end of file
diff --git a/macros/latex/contrib/esami/doc/examples/test9.tex b/macros/latex/contrib/esami/doc/examples/test9.tex
new file mode 100644
index 0000000000..0d19df40a3
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/test9.tex
@@ -0,0 +1,57 @@
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 9a $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 9b $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 9c $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
+
+
+\newproblem{
+\FPsetpar{a}{2}{5}
+\FPsetpar{b}{2}{5}
+\FPsetpar{c}{2}{8}
+
+\item \PTs{2} exercise 9d $a=\a$, $b=\b$, $c=\c$
+ \begin{answers}{1}\bChoices[random]
+ \Ans1 answer 1 correct\eAns
+ \Ans0 answer 2 wrong\eAns
+ \Ans0 answer 3 wrong\eAns
+ \Ans0 answer 4 wrong\eAns
+ \Ans0 answer 5 wrong \eAns
+ \eChoices\end{answers}}
diff --git a/macros/latex/contrib/esami/doc/examples/testA-luatex-sol.pdf b/macros/latex/contrib/esami/doc/examples/testA-luatex-sol.pdf
new file mode 100644
index 0000000000..74b27a1343
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-luatex-sol.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA-luatex.pdf b/macros/latex/contrib/esami/doc/examples/testA-luatex.pdf
new file mode 100644
index 0000000000..73b4e342a4
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-luatex.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA-sol.pdf b/macros/latex/contrib/esami/doc/examples/testA-sol.pdf
new file mode 100644
index 0000000000..67ec2164f8
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-sol.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA-sol.tex b/macros/latex/contrib/esami/doc/examples/testA-sol.tex
new file mode 100644
index 0000000000..f0d8d42076
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-sol.tex
@@ -0,0 +1,121 @@
+\documentclass[a4paper,italian]{article}
+\usepackage{ifxetex}%%NUOVO
+\usepackage{ifluatex}%%%NUOVO
+
+%\usepackage[shuffle,xyz,pointsonright,nosolutions,noquizsolutions,twocolumns]{esami}%%%%% TEMA
+\ifluatex
+ \usepackage{luatextra} % also loads fixltx2e, fontspec, xunicode
+ \usepackage{unicode-math}
+ \setmathfont{Latin Modern Math}
+ \usepackage[utf8]{luainputenc}
+\else\ifxetex
+ \usepackage{fixltx2e}
+ \usepackage{fontspec}
+ \usepackage{unicode-math}
+ \XeTeXinputencoding utf8
+\else
+ \usepackage{fixltx2e}
+ \usepackage[T1]{fontenc}
+ \usepackage[utf8]{inputenc}
+ \usepackage{lmodern,textcomp}
+\fi\fi
+\usepackage[shuffle,xyz,pointsonright,solutions,quizsolutions,twocolumns]{esami}%%%%% TEMA
+
+% +=============================+
+% | DEFINITIONS |
+% +=============================+
+
+\def\examname{The name of the exam}
+\def\numcompiti{4}%%% The number of the versions
+\date{2014/07/22}%%% THE DATE IN THE FORMAT YYYY/M/D or D/M/YYYY
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+%\def\cartella{pop}%%% The folder where are the exercises: by default the current folder%
+%\def\Acapo{\newpage}
+\usepackage{babel}
+
+\begin{document}
+\testversioni
+\pagestyle{esame}
+
+\whiledo{\thevers<\numcompiti}{\stepvers
+% +=============================+
+% | THE SEED |
+% +=============================+
+
+%\FPeval\seme{round((\thenomefile+(3*\thevers)):0)}
+%%% OR SOME OTHER LIKE
+\FPeval\seme{round(\thenomefile*(\thevers)+1-trunc(\thenomefile*(\thevers)/(2^31-1):0)*(2^31-1):0)}
+%\FPeval\seme{round(1+abs(\thenomefile/(\thevers)+sin(\thevers)*(\thevers)^(2)):0)}
+
+\randomi=\seme
+
+\permuta
+% +=============================+
+% | STUFF DEFINED IN CFG FILE |
+% +=============================+
+
+\testa%%% the heading
+\istruzionii%%% some instructions
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section*{Part One}
+
+
+\begin{test}[18]
+\begin{questions}
+%\ifluatex
+%\esercizi{
+%test14,
+%test1,
+%test4,
+%test9
+%}
+%\else\ifxetex
+%\esercizi{
+%test14,
+%test1,
+%test4,
+%test9
+%}
+%\else
+\begin{esdb}{mydb} %% some exercises from 2 files
+ \selectrandomlyn{3}{test2}
+ \selectrandomlyn{2}{test3}
+ \end{esdb}
+
+\esercizi{
+%prova-colombia,
+test14,
+test1,
+test4,
+test9,
+test5-fillin,
+}
+%%% all the problems of a file
+\selectallproblems[random]{test11}
+%\fi\fi
+
+\end{questions}
+
+Some other questions\\[5mm]
+
+
+%\begin{questions} %% a new set of questions
+%\esercizi{test12,
+%test13
+%}
+%\end{questions}
+\end{test}
+
+\section*{Part two}
+\istruzioniii%%% Some other instructions
+
+\esercizi{problem1}
+\closevers
+\newpage %
+ %
+\setcounter{page}{1} %%% dvi
+}
+
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/examples/testA-xetex-sol.pdf b/macros/latex/contrib/esami/doc/examples/testA-xetex-sol.pdf
new file mode 100644
index 0000000000..fc64643065
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-xetex-sol.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA-xetex.pdf b/macros/latex/contrib/esami/doc/examples/testA-xetex.pdf
new file mode 100644
index 0000000000..30aad4bfd9
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA-xetex.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA.pdf b/macros/latex/contrib/esami/doc/examples/testA.pdf
new file mode 100644
index 0000000000..c29557ff0b
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA.pdf
Binary files differ
diff --git a/macros/latex/contrib/esami/doc/examples/testA.tex b/macros/latex/contrib/esami/doc/examples/testA.tex
new file mode 100644
index 0000000000..b468611935
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/testA.tex
@@ -0,0 +1,121 @@
+\documentclass[a4paper,italian]{article}
+\usepackage{ifxetex}%%NUOVO
+\usepackage{ifluatex}%%%NUOVO
+
+%\usepackage[shuffle,xyz,pointsonright,nosolutions,noquizsolutions,twocolumns]{esami}%%%%% TEMA
+\ifluatex
+ \usepackage{luatextra} % also loads fixltx2e, fontspec, xunicode
+ \usepackage{unicode-math}
+ \setmathfont{Latin Modern Math}
+ \usepackage[utf8]{luainputenc}
+\else\ifxetex
+ \usepackage{fixltx2e}
+ \usepackage{fontspec}
+ \usepackage{unicode-math}
+ \XeTeXinputencoding utf8
+\else
+ \usepackage{fixltx2e}
+ \usepackage[T1]{fontenc}
+ \usepackage[utf8]{inputenc}
+ \usepackage{lmodern,textcomp}
+\fi\fi
+\usepackage[shuffle,xyz,pointsonright,nosolutions,noquizsolutions,twocolumns]{esami}%%%%% TEMA
+
+% +=============================+
+% | DEFINITIONS |
+% +=============================+
+
+\def\examname{The name of the exam}
+\def\numcompiti{4}%%% The number of the versions
+\date{2014/07/22}%%% THE DATE IN THE FORMAT YYYY/M/D or D/M/YYYY
+\def\Data{\longdate}%%% or \shortdate: the date in the heading
+%\def\cartella{pop}%%% The folder where are the exercises: by default the current folder%
+%\def\Acapo{\newpage}
+\usepackage{babel}
+
+\begin{document}
+\testversioni
+\pagestyle{esame}
+
+\whiledo{\thevers<\numcompiti}{\stepvers
+% +=============================+
+% | THE SEED |
+% +=============================+
+
+%\FPeval\seme{round((\thenomefile+(3*\thevers)):0)}
+%%% OR SOME OTHER LIKE
+\FPeval\seme{round(\thenomefile*(\thevers)+1-trunc(\thenomefile*(\thevers)/(2^31-1):0)*(2^31-1):0)}
+%\FPeval\seme{round(1+abs(\thenomefile/(\thevers)+sin(\thevers)*(\thevers)^(2)):0)}
+%\FPeval\semeex{round(\thenomefile+1-trunc(\thenomefile/(2^31-1):0)*(2^31-1):0)}
+\randomi=\seme
+
+\permuta
+% +=============================+
+% | STUFF DEFINED IN CFG FILE |
+% +=============================+
+
+\testa%%% the heading
+\istruzionii%%% some instructions
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section*{Part One}
+
+
+\begin{test}[15]
+\begin{questions}
+%\ifluatex
+%\esercizi{
+%test14,
+%test1,
+%test4,
+%test9
+%}
+%\else\ifxetex
+%\esercizi{
+%test14,
+%test1,
+%test4,
+%test9
+%}
+%\else
+\begin{esdb}{mydb} %% some exercises from 2 files
+ \selectrandomlyn{3}{test2}
+ \selectrandomlyn{2}{test3}
+ \end{esdb}
+
+\esercizi{
+%prova-colombia,
+test14,
+test1,
+test4,
+test9,
+test5-fillin,
+}
+%%% all the problems of a file
+\selectallproblems[random]{test11}
+%\fi\fi
+
+\end{questions}
+
+Some other questions\\[5mm]
+
+
+%\begin{questions} %% a new set of questions
+%\esercizi{test12,
+%test13
+%}
+%\end{questions}
+\end{test}
+
+\section*{Part two}
+\istruzioniii%%% Some other instructions
+
+\esercizi{problem1}
+\closevers
+\newpage %
+ %
+\setcounter{page}{1} %%% dvi
+}
+
+\end{document}
diff --git a/macros/latex/contrib/esami/doc/examples/totale-versioni.tex b/macros/latex/contrib/esami/doc/examples/totale-versioni.tex
new file mode 100644
index 0000000000..18dcb22fcb
--- /dev/null
+++ b/macros/latex/contrib/esami/doc/examples/totale-versioni.tex
@@ -0,0 +1,47 @@
+\documentclass[UKenglish]{article}
+%%\usepackage[xyz,prova,pointsonright]{esami}%%% numeric version
+\usepackage[xyz,prova,pointsonright,autopstoff,param]{esami}%%% parametric version
+\date{2013/4/8}%%% it's necessary for the random number generation, but can be any date
+\FPeval\seme{2010}%%% or what you like
+\randomi=\seme
+
+\begin{document}
+
+% +=======================================================+
+% | UNCOMMENT THE PART YOU NEED |
+% | AND WRITE THE NAME OF THE FILE IN \def\esercizio{} |
+% +=======================================================+
+
+% +=============================+
+% | FOR TEST |
+% +=============================+
+
+\def\esercizio{test3}
+\makeatletter
+\ifes@param
+\begin{center} {\textbf{\esercizio -p}}\vspace{5mm}\end{center}
+\else
+\begin{center} {\textbf{\esercizio}}\vspace{5mm}\end{center}
+\fi
+\begin{shortquiz}
+\begin{questions}
+\selectallproblems{\esercizio}
+
+\end{questions}
+\end{shortquiz}
+
+
+% +=============================+
+% | FOR EXERCISES |
+% +=============================+
+
+%\def\esercizio{}
+%\makeatletter
+%\ifes@param
+%\begin{center} {\textbf{\esercizio -p}}\vspace{5mm}\end{center}
+%\else
+%\begin{center} {\textbf{\esercizio}}\vspace{5mm}\end{center}
+%\fi
+%\selectallproblems{\esercizio}
+\end{document}
+
diff --git a/macros/latex/contrib/esami/es-UKenglish.lng b/macros/latex/contrib/esami/es-UKenglish.lng
new file mode 100644
index 0000000000..692f17c061
--- /dev/null
+++ b/macros/latex/contrib/esami/es-UKenglish.lng
@@ -0,0 +1,66 @@
+%%% Labels (esami.sty)
+
+\def\es@pointname{point}
+\def\es@pointsname{points}
+\def\es@exercisename{Exercise}
+\def\es@solutionname{Solution}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Student's signature}
+\def\studlastname{Last Name}
+\def\studfirstname{First Name}
+\def\studid{Student's ID}
+\def\versionname{Version}
+\def\pagename{Page}
+\def\solutionsname{Solutions}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space
+ assume the values #1 \string}\string\newline}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{The option \CurrentOption\space does not exists}
+\def\es@cfgerrormessagelong{Package esami needs an option for the configuration file}
+\def\es@parametermessage#1#2#3{The parameter $#1$ is between $#2$ and $#3$.}
+\def\es@seedmessage#1{The seed is equal to $#1$.}
+\def\es@numcompitierror{It's necessary to specify the number of versions!}
+\def\es@mastererror{WARNING: YOU CANNOT COMPILE THE MASTER FILE:\MessageBreak
+ PRESS 'x' TO EXIT AND RENAME THE FILE}
+\def\es@zerodenerror#1#2{The fraction #1/#2 in exercise \nome \space has the denominator equal to 0}
+\def\es@zeronumerrorshort#1#2{The fraction #1/#2 in exercise \nome \space is equal to 0}
+\def\es@zeronumerrorlong#1#2{If the fraction can be 0, you must use the "sempliz" command}
+\def\es@fraconewarn#1#2{The fraction #1/#2 in exercise \nome \space is equal to 1}
+\def\es@radicalerror{The radicand in exercise \nome \space is negative}
+\def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries}
+
+\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1}
+\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound}
+
+\def\es@pointerrorshort{Wrong score}
+\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{\ifcase#3\or
+ 1st\or 2nd\or 3rd\or 4th\or 5th\or
+ 6th\or 7th\or 8th\or 9th\or 10th\or
+ 11th\or 12th\or 13th\or 14th\or 15th\or
+ 16th\or 17th\or 18th\or 19th\or 20th\or
+ 21st\or 22nd\or 23rd\or 24th\or 25th\or
+ 26th\or 27th\or 28th\or 29th\or 30th\or
+ 31st\fi~\ifcase#2\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or
+ December\fi \space #1}
+\def\es@shortdate#1/#2/#3\@empty{#1/#2/#3}
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{babel}
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+%\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+}
diff --git a/macros/latex/contrib/esami/es-USenglish.lng b/macros/latex/contrib/esami/es-USenglish.lng
new file mode 100644
index 0000000000..cae0480af2
--- /dev/null
+++ b/macros/latex/contrib/esami/es-USenglish.lng
@@ -0,0 +1,58 @@
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{The parameter $#1$ is between $#2$ and $#3$.}
+\def\es@seedmessage#1{The seed is equal to $#1$.}
+\def\es@pointname{point}
+\def\es@pointsname{points}
+\def\es@exercisename{Exercise}
+\def\es@solutionname{Solution}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Student's signature}
+\def\studlastname{Last Name}
+\def\studfirstname{First Name}
+\def\studid{Student's ID}
+\def\versionname{Version}
+\def\pagename{Page}
+\def\solutionsname{Solutions}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{The option \CurrentOption\space does not exists}
+\def\es@cfgerrormessagelong{Package esami needs an option for the configuration file}
+\def\es@numcompitierror{It's necessary to specify the number of versions!}
+\def\es@mastererror{WARNING: YOU CANNOT COMPILE THE MASTER FILE:\MessageBreak
+ PRESS 'x' TO EXIT AND RENAME THE FILE}
+\def\es@zerodenerror#1#2{The fraction #1/#2 in exercise \nome \space has the denominator equal to 0}
+\def\es@zeronumerrorshort#1#2{The fraction #1/#2 in exercise \nome \space is equal to 0}
+\def\es@zeronumerrorlong#1#2{If the fraction can be 0, you must use the "sempliz" command}
+\def\es@fraconewarn#1#2{The fraction #1/#2 in exercise \nome \space is equal to 1}
+\def\es@radicalerror{The radicand in exercise \nome \space is negative}
+\def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space
+ assume the values #1 \string}\string\newline}
+\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1}
+\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound}
+
+\def\es@pointerrorshort{Wrong score}
+\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{\ifcase#2\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or
+ December\fi \space #3,\space #1}
+\def\es@shortdate#1/#2/#3\@empty{#1/#2/#3}
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{babel}
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+%\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+}
diff --git a/macros/latex/contrib/esami/es-french.lng b/macros/latex/contrib/esami/es-french.lng
new file mode 100644
index 0000000000..10c379665c
--- /dev/null
+++ b/macros/latex/contrib/esami/es-french.lng
@@ -0,0 +1,58 @@
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{Le param\`{e}tre $#1$ varie entre $#2$ et $#3$.}
+\def\es@seedmessage#1{La graine est $#1$.}
+\def\es@pointname{point}
+\def\es@pointsname{points}
+\def\es@exercisename{Exercice}
+\def\es@solutionname{Solution}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Signature de l'\'{e}tudiant}
+\def\studlastname{Nom}
+\def\studfirstname{Pr\'{e}nom}
+\def\studid{Num\'{e}ro de matricule}
+\def\versionname{Version}
+\def\pagename{Page}
+\def\solutionsname{Solutions}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Les expressions $#2i$, $#2ii$ \string\dots\space
+ prennent les valeurs #1 \string}\string\newline}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{L'option \CurrentOption\space n'existe pas}
+\def\es@cfgerrormessagelong{Vous devez sp\'{e}cifier une option pour le file de configuration du paquet esami}
+\def\es@numcompitierror{Vous devez sp\'{e}cifier le nombre de versions!}
+\def\es@mastererror{ATTENTION: VOUS NE POUVEZ PAS TRAVAILLER SUR LE FILE MASTER:\MessageBreak
+ PRESSEZ "X" POUR SORTIR ET CHANGER LE NOM DU FILE}
+\def\es@zerodenerror#1#2{La fraction #1/#2 dans l'exercice \nome \space a le d\'{e}nominateur \'{e}gal à 0}
+\def\es@zeronumerrorshort#1#2{La fraction #1/#2 dans l'exercise \nome \space est \'{e}gal à 0}
+\def\es@zeronumerrorlong#1#2{Si vous voulez qu'une fraction peut être 0, utilisez la commande "sempliz"}
+\def\es@fraconewarn#1#2{La fraction #1/#2 dans l'exercice \nome \space est \'{e}gal à 1}
+\def\es@radicalerror{Le radicande dans l'exercice \nome \space est n\'{e}gatif}
+\def\es@fpsetparerrorshort{Les conditions ne sont pas satisfaites apr\`{e}s \maxLoopLimit\space tentatives}
+\def\es@fpsetparerrshort#1{Ce n'est pas possible de définir #1}
+\def\es@fpsetparerrlong#1{Dans la definition de le paramètre #1 l'extreme inferieur est plus grand que l'extreme superior}
+
+\def\es@pointerrorshort{Score incorrect}
+\def\es@pointerrorlong{Dans la version \thevers\space le score total \the\punteggio\space est différent du score prévu \punti \MessageBreak}
+
+%% The date
+
+\def\es@longdate#1/#2/#3\@empty{#3\space \ifcase#2\or
+ janvier\or fevrier\or mars\or avril\or mai\or juin\or
+ juillet\or ao\^{u}t\or septembre\or octobre\or novembre\or
+ d\'{e}cembre\fi \space #1}
+\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1}
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+\usepackage{icomma}
+\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+}
diff --git a/macros/latex/contrib/esami/es-german.lng b/macros/latex/contrib/esami/es-german.lng
new file mode 100644
index 0000000000..8ea804d344
--- /dev/null
+++ b/macros/latex/contrib/esami/es-german.lng
@@ -0,0 +1,60 @@
+%%% German translation by Kerstin von Kirschhausen
+
+
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{Der Parameter $#1$ liegt zwischen $#2$ und $#3$.}
+\def\es@seedmessage#1{Die Saat gleicht $#1$.}
+\def\es@pointname{Punkt}
+\def\es@pointsname{Punkte}
+\def\es@exercisename{Aufgabe}
+\def\es@solutionname{\unexpanded{L\"{o}sung}}% modified for input error
+
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Professor}
+\def\studsignname{Unterschrift des Studenten}
+\def\studlastname{Nachname}
+\def\studfirstname{Vorname}
+\def\studid{Matrikelnummer}
+\def\versionname{Version}
+\def\pagename{Seite}
+\def\solutionsname{L\"{o}sungen}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{Die Möglichkeit \CurrentOption\space existiert nicht}
+\def\es@cfgerrormessagelong{Das Paket "esami" braucht eine Möglichkeit für die Konfigurationsdatei}
+\def\es@numcompitierror{Die Anzahl der Versionen muss ausdrücklich angegeben werden}
+\def\es@mastererror{Achtung! Sie können die Stammdatei nicht erstellen: \MessageBreak
+Drücken Sie "x" um zu beenden und bennen Sie die Datei um. }
+\def\es@zerodenerror#1#2{In der Aufgabe \nome \space hat der Bruch #1/#2 den Nenner gleich 0}
+\def\es@zeronumerrorshort#1#2{In der Aufgabe \nome \space ist der Bruch #1/#2 gleich 0}
+\def\es@zeronumerrorlong#1#2{Wenn das Ergebnis des Bruchs 0 ergibt, dann sollst Du den "sempliz" Befehl anwenden}
+\def\es@fraconewarn#1#2{In der Aufgabe \nome \space ist der Bruch #1/#2 gleich 1}
+\def\es@radicalerror{Der Radikand in der Aufgabe \nome \space ist negativ}
+\def\es@fpsetparerrorshort{Nicht alle Bedingungen sind nach \maxLoopLimit\space versuchen befriedigt}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Die Ausdrücke $#2i$, $#2ii$ \string\dots\space
+ setzten den Wert #1 voraus\string}\string\newline}
+\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1}
+\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound}
+
+\def\es@pointerrorshort{Falsche Punktzahl}
+\def\es@pointerrorlong{In der Version \thevers\space die Gesamtpunktzahl \the\punteggio\space unterscheidet sich von der erwarteten Punktzahl \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{#3\space\ifcase#2\or
+ Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or
+ Juli\or August\or September\or Oktober\or November\or Dezember\fi \space #1}
+\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1}
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+}
diff --git a/macros/latex/contrib/esami/es-greek.lng b/macros/latex/contrib/esami/es-greek.lng
new file mode 100644
index 0000000000..6d1b78022e
--- /dev/null
+++ b/macros/latex/contrib/esami/es-greek.lng
@@ -0,0 +1,68 @@
+%%% Greek translation by Sotiris Hasapis
+
+
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{Ç ðáñÜìåôñïò $#1$ åßíáé ìåôáîý $#2$ êáé $#3$.}
+\def\es@seedmessage#1{The seed is equal to $#1$.}
+\def\es@pointname{âáèìüò}
+\def\es@pointsname{âáèìïß}
+\def\es@exercisename{¢óêçóç}
+\def\es@solutionname{Ëýóç}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{ÊáèçãçôÞò \ }
+\def\studsignname{ÕðïãñáöÞ ÌáèçôÞ}
+\def\studlastname{Åðþíõìï}
+\def\studfirstname{¼íïìá}
+\def\studid{Áñ.Ôáõôüôçôáò}
+\def\versionname{Ýêäïóç}
+\def\pagename{Óåëßäá}
+\def\solutionsname{Ëýóåéò}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{Ç åðéëïãÞ \CurrentOption\space äåí õðÜñ÷åé}
+\def\es@cfgerrormessagelong{Ôï ðáêÝôï esami áðáéôåß ìßá ðáñÜìåôñï ãéá ôï áñ÷åßï äéáìüñöùóçò}
+\def\es@numcompitierror{Áðáéôåßôáé ï ðñïóäéïñéóìüò ôïõ ðëÞèïõò ôùí åêäüóåùí!}
+\def\es@mastererror{WARNING: YOU CANNOT COMPILE THE MASTER FILE:\MessageBreak
+ PRESS 'x' TO EXIT AND RENAME THE FILE}
+\def\es@zerodenerror#1#2{The fraction #1/#2 in exercise \nome \space has the denominator equal to 0}
+\def\es@zeronumerrorshort#1#2{The fraction #1/#2 in exercise \nome \space is equal to 0}
+\def\es@zeronumerrorlong#1#2{If the fraction can be 0, you must use the "sempliz" command}
+\def\es@fraconewarn#1#2{The fraction #1/#2 in exercise \nome \space is equal to 1}
+\def\es@radicalerror{The radicand in exercise \nome \space is negative}
+\def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space
+ assume the values #1 \string}\string\newline}
+\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1}
+\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound}
+
+\def\es@pointerrorshort{Wrong score}
+\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{\ifcase#3\or
+ 1ç\or 2á\or 3ç\or 4ç\or 5ç\or
+ 6ç\or 7ç\or 8ç\or 9ç\or 10ç\or
+ 11ç\or 12ç\or 13ç\or 14ç\or 15ç\or
+ 16ç\or 17ç\or 18ç\or 19ç\or 20ç\or
+ 21ç\or 22ç\or 23ç\or 24ç\or 25ç\or
+ 26ç\or 27ç\or 28ç\or 29ç\or 30ç\or
+ 31ç\fi~\ifcase#2\or
+ ÉáíïõÜñéïò\or ÖåâñïõÜñéïò\or ÌÜñôéïò\or Áðñßëéïò\or ÌÜúïò\or Éïýíéïò\or
+ Éïýëéïò\or Áýãïõóôïò\or ÓåðôÝìâñéïò\or Ïêôþâñéïòr\or ÍïÝìâñéïò\or
+ ÄåêÝìâñéïò\fi \space #1}
+\def\es@shortdate#1/#2/#3\@empty{#1/#2/#3}
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{babel}
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+%\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+}
diff --git a/macros/latex/contrib/esami/es-italian.lng b/macros/latex/contrib/esami/es-italian.lng
new file mode 100644
index 0000000000..a8b2a626d4
--- /dev/null
+++ b/macros/latex/contrib/esami/es-italian.lng
@@ -0,0 +1,79 @@
+%%% Labels (esami.sty)
+
+\def\es@pointname{punto}
+\def\es@pointsname{punti}
+\def\es@exercisename{Esercizio}
+\def\es@solutionname{Soluzione}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Firma leggibile dello studente}
+\def\studlastname{Cognome}
+\def\studfirstname{Nome}
+\def\studid{Matricola}
+\def\versionname{Versione}
+\def\pagename{Pagina}
+\def\solutionsname{Soluzioni}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Le espressioni $#2i$, $#2ii$ \string\dots\space
+ assumono i valori #1 \string}\string\newline}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{L'opzione \CurrentOption\space non esiste}
+\def\es@cfgerrormessagelong{Si deve specificare un'opzione per la configurazione nel pacchetto esami}
+\def\es@parametermessage#1#2#3{Il parametro $#1$ varia da $#2$ a $#3$.}
+\def\es@parametermessagea#1#2{Il parametro $#1$ vale $#2$.}
+\def\es@seedmessage#1{Il seme vale $#1$.}
+
+\def\es@numcompitierror{Si deve specificare il numero delle versioni!}
+\def\es@mastererror{ATTENZIONE: NON SI PUO' LAVORARE SUL FILE MASTER: \MessageBreak
+ PREMERE 'x' PER USCIRE E CAMBIARE NOME AL FILE}
+\def\es@zerodenerror#1#2{La frazione #1/#2 nell'esercizio \nome \space ha il denominatore 0}
+\def\es@zeronumerrorshort#1#2{La frazione #1/#2 nell'esercizio \nome \space vale 0}
+\def\es@zeronumerrorlong#1#2{Se si vuole che una frazione possa valere 0 usare il comando "sempliz"}
+\def\es@fraconewarn#1#2{La frazione #1/#2 nell'esercizio \nome \space vale 1}
+\def\es@radicalerror{Il radicando nell'esercizio \nome \space è negativo}
+\def\es@fpsetparerrorshort{Non sono state soddisfatte tutte le condizioni dopo \maxLoopLimit\space tentativi}
+\def\es@fpsetparerrshort#1{Non si può definire il parametro #1}
+\def\es@fpsetparerrlong#1{Nella definizione del parametro #1 l'estremo inferiore è maggiore dell'estremo superiore}
+
+\def\es@pointerrorshort{Punteggio sbagliato}
+\def\es@pointerrorlong{Nella versione \thevers\space il punteggio totale \the\punteggio\space è diverso dal punteggio previsto \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{#3\space%%% the date
+ \ifcase#2\or
+ gennaio\or febbraio\or marzo\or aprile\or maggio\or giugno\or
+ luglio\or agosto\or settembre\or ottobre\or novembre\or
+ dicembre\fi\space #1
+ }
+
+\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1}
+
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage[italian]{babel}
+%\NoIntelligentComma
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=22mm,tmargin=10mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+\usepackage{icomma}
+\usepackage{eurosym}
+%\usepackage[np,autolanguage]{numprint}
+\usepackage[np]{numprint}
+%\newcommand*\npstyleitalian{%
+\npthousandsep{\,}%
+%\npdecimalsign{,}%
+\npproductsign{\ensuremath{\cdot}}%
+\npunitseparator{~}%
+ \npthousandthpartsep{}
+\npfourdigitnosep
+%}
+ % \npaddtolanguage{italian}{italian}
+ \DeclareRobustCommand{\officialeuro}{%
+ \ifmmode\expandafter\text\fi
+ {\fontencoding{U}\fontfamily{eurosym}\selectfont e}}%euro in math
+}
diff --git a/macros/latex/contrib/esami/es-serbian.lng b/macros/latex/contrib/esami/es-serbian.lng
new file mode 100644
index 0000000000..67e37ac093
--- /dev/null
+++ b/macros/latex/contrib/esami/es-serbian.lng
@@ -0,0 +1,65 @@
+%%% Serbian translation by Dusko Latas
+
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{Parametar $#1$ je između $#2$ i $#3$.}
+\def\es@seedmessage#1{Delilac je jednak $#1$.}
+\def\es@pointname{poen}
+\def\es@pointsname{poena}
+\def\es@exercisename{Zadatak}
+\def\es@solutionname{Re\v senje}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Potpis studenta}
+\def\studlastname{Prezime}
+\def\studfirstname{Ime}
+\def\studid{Broj indeksa}
+\def\versionname{Verzija}
+\def\pagename{Strana}
+\def\solutionsname{Re\v senja}
+
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{Opcija \CurrentOption\space ne postoji}
+\def\es@cfgerrormessagelong{Paketu esami je potrebno podesiti konfiguracioni fajl}
+\def\es@numcompitierror{Neophodno je navesti!}
+\def\es@mastererror{UPOZORENjE: NE MOZETE DA KOMPAJLIRATE FAJL:\MessageBreak
+PRITISNITE 'x' DA BISTE IZASLI ILI PREIMENUJTE FAJL}
+\def\es@zerodenerror#1#2{Razlomak #1/#2 u zadatku \nome \space ima imenilac koji je jednak 0}
+\def\es@zeronumerrorshort#1#2{Razlomak #1/#2 u zadatku \nome \space je jednak 0}
+\def\es@zeronumerrorlong#1#2{Da bi razlomak mogao da bude 0, morate da korisitie "sempliz" komandu}
+\def\es@fraconewarn#1#2{Razlomak #1/#2 u zadatku \nome \space je jednak 1}
+\def\es@radicalerror{Potkorena velicina u zadatku \nome \space je negativna}
+\def\es@fpsetparerrorshort{Nisu zadovoljeni svi uslovi nakon \maxLoopLimit\space pokusaja}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Izrazi $#2i$, $#2ii$ \string\dots\space
+pretpostavlja vrednosti #1 \string}\string\newline}
+\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1}
+\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound}
+
+\def\es@pointerrorshort{Wrong score}
+\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{#3\space\ifcase#2\or
+januar\or februar\or mart\or april\or maj\or jun\or
+jul\or avgust\or septembar\or oktobar\or novembar\or decembar\fi \space #1}
+\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1}
+
+
+\AtEndOfPackage{
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+\newcommand*\npstyleitalian{%
+\npthousandsep{\,}%
+\npdecimalsign{,}%
+\npproductsign{\ensuremath{\cdot}}%
+\npunitseparator{~}%
+ \npthousandthpartsep{}
+}
+}
diff --git a/macros/latex/contrib/esami/es-spanish.lng b/macros/latex/contrib/esami/es-spanish.lng
new file mode 100644
index 0000000000..6d9852ba87
--- /dev/null
+++ b/macros/latex/contrib/esami/es-spanish.lng
@@ -0,0 +1,71 @@
+%%% Spanish translation by María Hernández Cifre
+
+
+%%% Labels (esami.sty)
+
+\def\es@parametermessage#1#2#3{El par\'ametro $#1$ se encuentra entre $#2$ y $#3$.}
+\def\es@seedmessage#1{La semilla es igual a $#1$.}
+\def\es@pointname{punto}
+\def\es@pointsname{puntos}
+\def\es@exercisename{Ejercicio}
+\def\es@solutionname{\unexpanded{Soluci\'on}}
+
+%%% Labels (xyz.cfg)
+
+\def\profname{Prof.\ }
+\def\studsignname{Firma del alumno}
+\def\studlastname{Apellido}
+\def\studfirstname{Nombre}
+\def\studid{Identificaci\'on del alumno}
+\def\versionname{\unexpanded{Versi\'on}}
+\def\pagename{P\'agina}
+\def\solutionsname{Soluciones}
+
+%%% Error Messages
+
+\def\es@cfgerrormessageshort{La opci\'{o}n \CurrentOption\space no existe}
+\def\es@cfgerrormessagelong{El paquete esami necesita una opción para la configuración del fichero}
+\def\es@numcompitierror{Es necesario especificar el número de versiones!}
+\def\es@mastererror{AVISO: NO SE PUEDE COMPILAR EL FICHERO PRINCIPAL:\MessageBreak
+ PRESIONE 'x' PARA SALIR Y RENOMBRE EL FICHERO}
+\def\es@zerodenerror#1#2{El denominador de la fracción #1/#2 en el ejercicio \nome \space es 0}
+\def\es@zeronumerrorshort#1#2{La fracción #1/#2 en el ejercicio \nome \space vale 0}
+\def\es@zeronumerrorlong#1#2{Si la fracción puede ser 0, debe utilizar el comando "sempliz"}
+\def\es@fraconewarn#1#2{La fracción #1/#2 en el ejercicio \nome \space vale 1}
+\def\es@radicalerror{El radicando en el ejercicio \nome \space es negativo}
+\def\es@fpsetparerrorshort{No se verifican todas las condiciones después de \maxLoopLimit\space intentos}
+\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Las expresiones $#2i$, $#2ii$ \string\dots\space
+ toman los valores #1 \string}\string\newline}
+\def\es@fpsetparerrshort#1{No es posible definir el parámetro #1}
+\def\es@fpsetparerrlong#1{En la definición del parámetro #1 la cota inferior es mayor de la cota superior}
+
+\def\es@pointerrorshort{Wrong score}
+\def\es@pointerrorlong{En la versión \thevers\space la puntuación total score \the\punteggio\space es diferente de la puntuación prevista \punti \MessageBreak}
+
+%%% The date
+
+\def\es@longdate#1/#2/#3\@empty{#3\space \ifcase#2\or
+ Enero \or Febrero \or Marzo \or Abril
+ \or Mayo \or Junio \or Julio \or Agosto
+ \or Septiembre \or Octubre \or Noviembre
+ \or Diciembre\fi \space #1}
+
+\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1}
+
+
+%%% Useful Language dependent packages
+
+\AtEndOfPackage{
+\usepackage{geometry}
+\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm}
+\usepackage{icomma}
+\usepackage{eurosym}
+\usepackage[np,autolanguage]{numprint}
+\newcommand*\npstylespanish{%
+\npthousandsep{\,}%
+\npdecimalsign{,}%
+\npproductsign{\ensuremath{\cdot}}%
+\npunitseparator{~}%
+ \npthousandthpartsep{}
+}
+}
diff --git a/macros/latex/contrib/esami/esami-xyz.cfg b/macros/latex/contrib/esami/esami-xyz.cfg
new file mode 100644
index 0000000000..eb17b9b96e
--- /dev/null
+++ b/macros/latex/contrib/esami/esami-xyz.cfg
@@ -0,0 +1,352 @@
+%% Package `esami' to use with LaTeX 2e
+%% Copyright (C) 2008-2018 G. Messineo e S. Vassallo
+%%
+%% This is file `esami-xyz.cfg',
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% esami-xyz.cfg, 2018-05-06 %%
+%% Copyright (C) 2008-2018 G. Messineo e S. Vassallo %%
+%% %%
+%% This program can be redistributed and/or modified %%
+%% under the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%% other packages
+\AtEndOfPackage{
+\usepackage{amsmath}
+%========================================================%
+% Some shortcuts and Italian maths %
+%========================================================%
+
+\DeclareMathOperator{\sen}{sen}
+\DeclareMathOperator{\tg}{tg}
+\DeclareMathOperator{\arcsen}{arcsen}
+\DeclareMathOperator{\arctg}{arctg}
+\providecommand*{\dif}{\mathop{}\!\mathrm{d}}
+\providecommand{\dlim}{\displaystyle \lim}
+\providecommand{\me}{\mathrm{e}}
+\providecommand{\D}{\displaystyle}
+
+\newenvironment{sistema}{%%% Taken from somewhere in GUIT forum to write equations systems
+\left\lbrace\begin{array}{@{}l@{}}}%
+ {\end{array}\right.%
+ }
+
+\DeclareRobustCommand{\annu}[2]{_{%%% the annuity command
+ \def\arraystretch{0}
+ \setlength\arraycolsep{1pt}
+\setlength\arrayrulewidth{.2pt}
+\begin{array}[b]{c c}
+ \setlength\arraycolsep{1.5pt}
+ \begin{array}
+ [b]{r|}\hline
+ \\[\arraycolsep]
+ \scriptstyle #1
+ \end{array}&\scriptstyle#2%
+\end{array}%
+}}
+
+\newcommand{\vect}[1]{\boldsymbol{#1}}
+
+%%% We prefer var greek math %%%
+
+\newcommand{\eps}{\varepsilon}
+\newcommand{\oldtheta}{\theta} \renewcommand{\theta}{\vartheta}
+\newcommand{\oldepsilon}{\epsilon} \renewcommand{\epsilon}{\varepsilon}
+\newcommand{\oldrho}{\rho} \renewcommand{\rho}{\varrho}
+\newcommand{\oldphi}{\phi} \renewcommand{\phi}{\varphi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
+}
+
+% +=============================+
+% | THE HEADING |
+% +=============================+
+
+ \@ifpackagewith{esami}{prova}{%
+ \def\testa{\relax}}
+{%
+\def\testa{
+{\bfseries\sffamily\small
+\begin{center}
+\begin{tabular}{|lp{.33\textwidth}|lp{.3\textwidth}|lp{.3\textwidth}|}
+\hline
+\multicolumn{1}{|p{.33\textwidth}|}{\examname \newline \Data}&\multicolumn{1}{|p{.3\textwidth}|}{\profname } &\multicolumn{1}{|p{.3\textwidth}|}{\studsignname}\\[4ex]
+\hline
+\multicolumn{1}{|p{.33\textwidth}|}{\studlastname:}&\multicolumn{1}{|p{.3\textwidth}|}{\studfirstname:}&\multicolumn{1}{|p{.3\textwidth}|}{\studid:}\\[4ex]
+\hline
+\end{tabular}\\[3ex]
+\end{center}}
+ }
+ }
+
+% +=============================+
+% | THE FOOTER |
+% +=============================+
+
+\ifes@solutions%%%solutions
+\def\ps@esame{\let\@oddhead\@empty\def\@oddfoot{\hfil \textbf{\versionname\
+n. \thevers} -- %%
+\textbf{\solutionsname} -- %%
+ \pagename\ \thepage
+\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty}
+\else%%% no solutions
+ \def\ps@esame{
+ \let\@oddhead\@empty\def\@oddfoot%%
+ {\hfil \textbf{\versionname\ n. \thevers\
+ -- \pagename\ \thepage}\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty}
+\fi
+
+% +=============================+
+% | THE SOLUTION STRING |
+% +=============================+
+
+\def\ps@soltest{\let\@oddhead\@empty\def\@oddfoot{\hfil %\textbf{\versionname\ n. \thevers} -- %%
+\textbf{\solutionsname} -- \pagename\ \thepage
+\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty}
+
+\ifes@solutions
+\newcommand{\stringasol}{\newpage%
+\vspace{.8cm}
+\pagestyle{soltest}
+ \input{\jobname.sol.tex} %
+}
+\else
+\newcommand{\stringasol}{\relax}
+\fi
+
+
+% +=============================+
+% | SOME INTRUCTIONS |
+% +=============================+
+
+\def\istruzionii{{
+\sffamily \textbf{INSTRUCTIONS}
+\begin{itemize}
+ \item Write here your instructions
+ \item two è con accento
+ \item three è à é ò ù
+\end{itemize}}}
+
+\def\istruzioniii{\setlength{\fboxsep}{1.5ex}\setlength{\fboxrule}{1.2pt}{\sffamily
+\framebox{\parbox{\textwidth}{\textbf{Some other instructions.}}}}\\[3ex]}
+
+ %\AtBeginDocument{
+ %\renewcommand\stepverssols{\immediate\write\sols{{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}}
+%}
+ %\renewcommand\closeverssols{
+ %\immediate\write\sols{\string\vspace{5ex}}}
+% }
+
+%%% THIS CODE IS TO CHECK the total score of exercises
+
+
+\AtEndOfPackage{
+\newdimen\punteggio %% NEW 2016/04/11 to check the total score of exercises
+\setlength{\punteggio}{0pt}
+\def\@PTs#1{%
+\addtolength{\punteggio}{#1 pt} %% NEW 2016/04/11 to check the total score of exercises
+\global\punteggio=\punteggio
+ \gdef\es@PTs{#1}\ifx\es@PTs\@empty\gdef\es@PTs{1}\fi
+ \global\let\esPTs=\es@PTs\global\let\es@PTs=\@empty
+ \if\es@star*\else\PTs@Hook\fi
+}
+\renewcommand{\checkpoints}{%
+\ifdim\punteggio=\punti pt %% NEW 2016/04/11 to check the total score of exercises
+ \else
+\PackageError{esami}{\es@pointerrorshort} {\es@pointerrorlong}
+ \fi
+ \global\punteggio=0pt%
+ }
+ }
+
+
+%%%% %%%%% HERE I GET RID OF THE MINIPAGE IN MULTIPLE CHOICE QUESTIONS
+%\AtEndOfPackage{
+%\renewcommand{\selectrandomly}[1]{%
+%\global\@probN=0\relax
+%\firstpasstrue
+%\tmp@quest=0
+%\input{#1}%%%%%
+%\firstpassfalse%%% now prints the question
+%\tmp@quest=0
+%\input{#1}
+%\@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16
+%\setrannum{\rnd@cnta}{1}{\@probN}
+%\randomi=\number\old@random
+%\expandafter\global\expandafter\edef\csname base\nome \endcsname{\number\rnd@cnta}
+%}{}
+%\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)}
+%\ifcase\@probN\or
+%\def\j@n{1}%%% just one variant
+%\or%%% 2 variants
+%\ifthenelse{\isodd{\thevers}}{\def\j@n{1}}{\def\j@n{2}}
+%\or%%% 3 variants
+%\def\j@n{\ifcase\restotrentasei\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\fi}%
+%\or%%% 4 variants
+%\def\j@n{\ifcase\restotrentasei\or 3\or 4\or 1\or 2\or 1\or 2\or 3\or 4\or 3\or 1\or 4\or 2\or 4\or 2\or 3\or 1\or 2\or 3\or 1\or 4\or 1\or 4\or 2\or 3\or 3\or 2\or 1\or 4\or 2\or 3\or 4\or 1\or 4\or 3\or 2\or 1\fi}%
+%\or%%% 5 variants
+%\def\j@n{\ifcase\restotrentasei\or 5\or 1\or 2\or 3\or 4\or 5\or 2\or 3\or 5\or 1\or 4\or 3\or 1\or 4\or 2\or 5\or 4\or 2\or 3\or 5\or 1\or 5\or 1\or 4\or 2\or 3\or 1\or 3\or 5\or 4\or 2\or 3\or 4\or 5\or 2\or 1\fi}%
+%\or%%% 6 variants
+%\def\j@n{\ifcase\restotrentasei\or 2\or 5\or 1\or 3\or 4\or 2\or 6\or 1\or 3\or 6\or 5\or 4\or 2\or 3\or 2\or 5\or 4\or 1\or 6\or 1\or 4\or 3\or 2\or 6\or 5\or 4\or 6\or 2\or 5\or 1\or 3\or 6\or 3\or 5\or 1\or 4\fi}%
+%\or%%% 7 variants
+%\def\j@n{\ifcase\restotrentasei\or 2\or 4\or 1\or 5\or 3\or 6\or 7\or 4\or 1\or 5\or 7\or 6\or 2\or 3\or 7\or 2\or 4\or 6\or 5\or 3\or 1\or 3\or 4\or 7\or 2\or 6\or 1\or 5\or 4\or 5\or 6\or 7\or 3\or 2\or 1\or 5\fi}%
+%\or%%% 8 variants
+%\def\j@n{\ifcase\restotrentasei\or 2\or 8\or 6\or 7\or 4\or 3\or 1\or 5\or 8\or 5\or 1\or 3\or 7\or 6\or 4\or 2\or 7\or 1\or 8\or 6\or 3\or 2\or 5\or 4\or 1\or 3\or 7\or 5\or 6\or 4\or 2\or 8\or 4\or 3\or 1\or 5\fi}%
+%\else
+%\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)}
+%\fi
+%\def\probchosen{\problabel-q:\romannumeral\j@n}
+%\ifes@test
+%\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm}
+%\Acapo
+%\else
+%\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm}
+%\Acapo
+%\fi
+% \ifes@fillin
+% \immediate\closeout\parametri
+% \fi
+%}
+%}
+
+%%%% %%%%% HERE I GET RID OF THE MINIPAGE IN EXERCISES
+%\AtEndOfPackage{
+%\renewenvironment{problem}[1][]{%%% it's like exercise, but with points
+%\es@testfalse
+%%\begin{minipage}{\linewidth} %%% new 2016/02/19
+%\renewcommand{\punti}{#1}
+%\ifes@solutionsonly\else\examenddef\fi
+%\begin{exercise}
+%\ifes@prova
+%\else
+%\ifes@solutions
+%\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+%\fi
+%\fi
+%}
+%{
+%\end{exercise}
+%%\end{minipage}%%% new 2016/02/19
+%\ifes@param
+%\immediate\closeout\params
+%\fi}
+%
+%\renewenvironment{problem*}[1][]{\es@testfalse
+%%\begin{minipage}{\linewidth} %%% new 2016/02/19
+%\renewcommand{\punti}{#1}
+%\ifes@solutionsonly\else\examenddef\fi
+%\begin{exercise*}
+%\ifes@prova
+%\else
+%\ifes@solutions
+%\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+%\fi
+%\fi
+%}
+%{
+%\end{exercise*}
+%%\end{minipage}%%% new 2016/02/19
+%\ifes@param
+%\immediate\closeout\params
+%\fi }
+%}
+%\makeatletter
+
+
+
+
+%\AtEndOfPackage{
+%\newcount\old@rando
+%\renewcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln
+%\old@rando=\number\randomi
+ %\randomi=\thenomefile
+ %\@shfctr=1\relax
+ %\whiledo{\@shfctr < 101}%
+ %{%
+ %\setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3}
+ %\ifnum\@shfA=\@shfB
+ %\else
+ %\edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}%
+ %\let\@tmpA=\@@tmpA
+ %\edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}%
+ %\let\@tmpB=\@@tmpB
+ %\expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}%
+ %\expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}%
+ %\fi
+ %\advance\@shfctr by 1\relax
+ %\ifthenelse{\equal{#1}{}}{}{
+ %\@shfA=0%
+ %\loop
+ %\advance\@shfA by1
+ %\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname}
+ %\ifnum\@shfA<#3 \repeat
+%}
+ %}%
+%\randomi=\number\old@rando
+%}
+
+%\newcommand{\shufflees}[3][]{% %%% this command has been adapted from probsoln
+%%\old@rando=\number\randomi
+%% \randomi=404
+ %\@shfctr=1\relax
+ %\whiledo{\@shfctr < 101}%
+ %{%
+ %\setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3}
+ %\ifnum\@shfA=\@shfB
+ %\else
+ %\edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}%
+ %\let\@tmpA=\@@tmpA
+ %\edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}%
+ %\let\@tmpB=\@@tmpB
+ %\expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}%
+ %\expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}%
+ %\fi
+ %\advance\@shfctr by 1\relax
+ %\ifthenelse{\equal{#1}{}}{}{
+ %\@shfA=0%
+ %\loop
+ %\advance\@shfA by1
+ %\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname}
+ %\ifnum\@shfA<#3 \repeat
+%}
+ %}%
+%%\randomi=\number\old@rando
+%}
+
+%\renewcommand{\esercizidb}[1]{
+ %\icount=0
+%\input{#1.tex}%
+%\i@sh=0
+%\loop
+%\advance\i@sh by1
+%\expandafter\edef\csname ftemp\romannumeral\i@sh \endcsname {\romannumeral\i@sh}
+%\ifnum\i@sh <\number\icount
+%\repeat
+%\shufflees{ftemp}{\icount}
+%\setcounter{n@par}{1}
+%\io=\icount
+%\loop
+%\ifes@test
+%\begin{minipage}{.95\linewidth}
+%\fi
+%\ifes@shuffleQuestions
+%\csname prbl\csname ftemp\romannumeral\io\endcsname\endcsname
+%\else
+%\csname prbl\romannumeral\io \endcsname
+%\fi
+%\def\probchosen{\problabel-\probnumber}
+%\csname @probi-\problabel-\probnumber \endcsname
+%\ifes@test
+ %\vspace{5mm}\end{minipage}
+ %\Acapo
+%\vspace{4mm}
+ %\fi
+ %\advance\io by-1
+ %\ifnum\io > 0 \repeat
+ %\par}
+ %}
+%\makeatother
diff --git a/macros/latex/contrib/esami/esami.sty b/macros/latex/contrib/esami/esami.sty
new file mode 100644
index 0000000000..8d1e7e445e
--- /dev/null
+++ b/macros/latex/contrib/esami/esami.sty
@@ -0,0 +1,2172 @@
+%%%
+%% This is file `esami.sty',
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% esami.sty package, 2018-02-10 %%
+%% Copyright (C) 2008-2018 G. Messineo e S. Vassallo %%
+%% %%
+%% This program can be redistributed and/or modified %%
+%% under the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%% CHANGELOG %%%%%%%
+% Version 1.0
+% First release to CTAN
+%Version 1.1 2013/12/09
+%Inserted the dependance on the package \texttt{environ} to remove some errors in the \LaTeX\ compilation.
+%Removed the dependance on the package \texttt{icomma} in the italian localization file es-italian.lng because
+%of the introduction of new features in the package \texttt{babel} for the Italian langaguage (macro \texttt{IntelligentComma}).
+% Version 2.0
+% 2015/02/25
+%Eliminated the dependance on \pkgname{pstricks}. Modified the use of \emph{fill-in} questions.
+%Inserted the possibility to extract %more than one variant from a file. Now it is possible to view the solutions in tests.
+%Modified the visualization of decimal places in command \cmd{\FPsv}. Modified the definition of \cmd{\FPval} to allow the use of decimal places.
+%Modified the algorithm of choice of a variant of an exercise, now completely deterministic.
+% Added the command \cmd{\Acapo}. Added the serbian localization (latin alphabet).
+%The compilation produces a new file with the list of the chosen exercises.
+% Version 2.1
+% 2016/07/25
+%Modified es-german.lng and es-spanish.lng for an error in the input of the solutions. Introduced the macro randestrai.
+%Introduced the macro FPsignpol. Introduced a control on the total points of the exercises. Solved the incompatibility
+%with babel for the Spanish language. Removed the incompatibility between the command \fillin and the commands \sempli and \semplix.
+% Version 2.2
+% 2017/07/01
+%Introduced the possibility to have two different seeds for exercises choice and for scrambling. Sligtly modified the command \estrai so that can be used
+%to extract parameters from a list. Improved the documentation.
+% Version 2.3
+% 2017/09/18
+%Corrected a misprint in the code
+% Version 2.4
+% 2018/02/10
+% Documentation corrected.
+% Version 2.5
+% 2018/05/06
+%Corrected a misprint in the code. Improved the selection of random exercises.
+
+\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami}
+ [2018/05/06 v2.5 An Exam Construction Package]
+
+% +=============================+
+% | THE OPTIONS |
+% +=============================+
+\newif\ifes@language \es@languagefalse
+\DeclareOption{italian}{\InputIfFileExists{es-\CurrentOption.lng}%
+ { \es@languagetrue \typeout{esami: Verrà usata la lingua italiana}}%
+ {\typeout{esami: Il file es-\CurrentOption.lng non esiste.}}}
+\DeclareOption{UKenglish}{\InputIfFileExists{es-\CurrentOption.lng}%
+ {\typeout{esami: English Language will be used} \es@languagetrue}%
+ {\typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{USenglish}{\InputIfFileExists{es-\CurrentOption.lng}%
+ {\typeout{esami: English Language will be used} \es@languagetrue}%
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{english}{\InputIfFileExists{es-UK\CurrentOption.lng}%
+ { \typeout{esami: English Language will be used}\es@languagetrue}%
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{french}{\InputIfFileExists{es-\CurrentOption.lng}%
+ { \typeout{esami: La langue française sera utilisée}\es@languagetrue}
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{spanish}{\InputIfFileExists{es-\CurrentOption.lng}%
+ { \typeout{esami:Se utilizará el idioma español}\es@languagetrue}
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{german}{\InputIfFileExists{es-\CurrentOption.lng}%
+ { \typeout{esami:Deutsch als Sprache soll angewandt werden}\es@languagetrue}
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+\DeclareOption{greek}{\InputIfFileExists{es-\CurrentOption.lng}%
+ { \typeout{esami:Greek language will be used}\es@languagetrue}
+ { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}}
+
+
+\newif\ifes@twocolumns
+\es@twocolumnsfalse
+\DeclareOption{twocolumns}{\es@twocolumnstrue}%%% for tests on 2 columns
+\DeclareOption{sansserif}{\renewcommand{\familydefault}{\sfdefault}}%%% sans serif font
+\DeclareOption{solutionsonly}{\es@solutionsonlytrue \es@solutionstrue}%%% only solutions (false by default)
+\newif\ifes@solutionsonly \es@solutionsonlyfalse
+\DeclareOption{allowrandomize}{\es@randomizeChoicestrue}%%% MCQ with shuffled answers (default)
+\DeclareOption{norandomize}{\es@randomizeChoicesfalse}%%% MCQ not shuffled
+\newif\ifes@randomizeChoices \es@randomizeChoicestrue
+\newif\ifes@fissa \es@fissatrue
+\newif\ifes@shuffleQuestions \es@shuffleQuestionstrue%%% the exercises are shuffled by default
+\DeclareOption{shuffle}{\es@fissatrue \es@shuffleQuestionstrue}
+\DeclareOption{shufflerandom}{\es@shuffleQuestionstrue \es@fissafalse}%% the exercises are randomly shuffled
+\DeclareOption{noshuffle}{\es@shuffleQuestionsfalse}
+%%% 2013-06-03 eliminata opzione
+\newif\ifes@fillin \es@fillinfalse
+\DeclareOption{fillb}{\es@fillintrue}
+\newif\ifes@pointsonright \es@pointsonrightfalse%%% the box with the points on the right side (from eqexam)
+\DeclareOption{pointsonright}{\es@pointsonrighttrue \AtEndOfPackage{\PointsOnRight}}
+\newif\ifes@solutions \es@solutionsfalse
+\DeclareOption{solutions}{\es@solutionstrue
+\AtEndDocument{
+\immediate\closeout\loe
+\immediate\closeout\parametri
+\immediate\closeout\sols %
+\stringasol} %%%%
+}%%% for solutions
+\DeclareOption{nosolutions}{\es@solutionsfalse}%%% no solutions (default)
+\newif\ifes@noquizsolutions \es@noquizsolutionstrue
+\DeclareOption{noquizsolutions}{\es@noquizsolutionstrue}
+\DeclareOption{quizsolutions}{\es@noquizsolutionsfalse}
+\DeclareOption*{\InputIfFileExists{esami-\CurrentOption.cfg}{}%%% reads a configuration file
+ {\PackageError{esami}{\es@cfgerrormessageshort}
+ {\es@cfgerrormessagelong}
+ }}
+\newif\ifes@autopst \es@autopstfalse%%% Do I need auto-pst?
+\newif\ifes@pst \es@pstfalse%%% Do I need pstricks?
+\DeclareOption{autopstoff}{\es@psttrue \es@autopstfalse}%%% autopstpdf inactive (default) %
+\DeclareOption{autopston}{\es@psttrue \es@autopsttrue }%%%% autopstpdf active
+\newif\ifes@prova \es@provafalse
+\DeclareOption{prova}{\es@solutionstrue \es@provatrue \es@randomizeChoicesfalse \es@noquizsolutionsfalse}%%% for the file "totale-versioni"
+\DeclareOption{correzione}{\es@correzionetrue \es@solutionsfalse}%%% to print all the exercises with solutions only
+\newif\ifes@correzione \es@correzionefalse
+\newif\ifes@param \es@paramfalse%%% to print the parametric version in "totale-versioni"
+\newif\ifes@test \es@testfalse%%% for tests
+
+%========================================================%
+% Parametric version %
+%========================================================%
+
+\newwrite\parametri
+
+\DeclareOption{param}{\es@paramtrue \AtBeginDocument{\newwrite\params}}
+
+\ProcessOptions\relax
+
+% +=============================+
+% | PACKAGES |
+% +=============================+
+
+\usepackage{graphicx}
+\usepackage{enumerate}
+\usepackage{fp}
+\usepackage{currfile}
+\usepackage{array}
+\usepackage{environ}
+\usepackage{ifthen}
+\usepackage{xargs}
+\usepackage{multicol}
+\usepackage{amssymb}
+
+
+\ifes@pst
+\usepackage{pstricks,pstricks-add}
+\ifes@autopst
+\usepackage[crop=off,dvips={}]{auto-pst-pdf}
+ \else
+\usepackage[off]{auto-pst-pdf}
+ \fi
+ \else
+ \@ifpackageloaded{xcolor}{}{\usepackage{xcolor}}
+\fi
+\input random
+
+%========================================================%
+% Error Messages %
+%========================================================%
+
+\def\testversioni{\ifthenelse{\not\equal{\numcompiti}{} } {\relax} %
+ { \immediate\write16{\es@numcompitierror}
+ {\endlinechar=-1 \global\read16 to\numcompiti}}}
+ \ifthenelse{\equal{\jobname}{\detokenize{master}}}{%%
+ {%
+ \PackageError{esami} %
+ {\es@mastererror}
+ {}}}
+ \ifthenelse{\equal{\jobname}{\detokenize{master-sol}}}{%%
+ {%
+ \PackageError{esami} %
+ {\es@mastererror}
+ {}}}
+
+\ifes@language \else \InputIfFileExists{es-italian.lng}%
+ { \typeout{esami: No language chosen: Italian language will be used.}}{NO LANGUAGE!!!}\fi
+%========================================================%
+% DIMENSIONS %
+%========================================================%
+
+% We want the page full of text
+
+\setlength\topmargin{-90pt}
+\setlength\textheight\paperheight
+\addtolength\textheight{-80pt}
+\setlength\textwidth\paperwidth
+\addtolength\textwidth{-70pt}
+\setlength\oddsidemargin{-60pt}
+\setlength\footskip{28pt}
+\setlength\marginparwidth{0pt}
+\setlength\marginparsep{0pt}
+
+\newskip\aboveanswersSkip%%% the space between question and answers
+\newlength\es@tmplength
+\newdimen\es@tmpdima{}
+\newsavebox{\es@tmpbox}{}
+\newbox{\es@pointbox}
+\newlength{\es@pointboxtotalheight}%%% the height of the point box
+\newsavebox{\workareasb}
+\newlength\mylabelsep
+
+%========================================================%
+% exercise %
+%========================================================%
+
+\newcommand{\priorexskip}[1]{\def\es@priorexskip{\vspace{#1}}}%%% space above and below the text of the exercise
+\let\es@postexerciseHook\relax
+\newcommand{\esexerskip}[1]{\def\es@exerskip{\vskip#1}}
+
+%========================================================%
+% test %
+%========================================================%
+
+\def\rowsep#1{\gdef\@rowsep{[#1]}\gdef\@rowskip{#1}}
+ \rowsep{\rowsep@default}
+\def\rowsepDefault#1{\def\rowsep@default{#1}}
+
+%========================================================%
+% risposta %
+%========================================================%
+
+\newlength{\es@rig}%%%% lines in "risposta"
+
+%========================================================%
+% SPACES %
+%========================================================%
+
+\setlength{\parindent}{0pt}
+\def\solutionsAfterSkip{\par\bigskip}
+\priorexskip{\medskipamount}
+\esexerskip{\medskipamount}
+\let\afterlabelhskip=\space
+\def\Acapo{\par}
+%========================================================%
+% test %
+%========================================================%
+
+\rowsepDefault{4pt}
+\addtolength{\tabcolsep}{2pt} \addtolength{\arraycolsep}{2pt}
+\def\sq@priorhook{\medskip\noindent}
+\setlength\aboveanswersSkip{6pt}
+
+% +=============================+
+% | COUNTERS |
+% +=============================+
+
+\newcount\tmp@cnt%%% temporary counter
+\newcount\tmp@a%%% temporary counter
+\newcount\rnd@cnta%%% temporary counter in selectrandomly
+\newcount\tmp@cntb%%% temporary counter in \estrai
+\newcount\rnd@cnts%%% temporary counter in RandS
+\newcount\rnd@cnt%%% temporary counter in \FPsetpar
+\newcount\end@al%%% temporary counter in \estraialfa
+\newcount\beg@al%%% temporary counter in \estraialfa
+\newcounter{nomefile}%%% counter for year-month-day
+\newcount\tmp@quest %%% the number of the exercise
+\newcount\@probselN %%% in \selectrandomlyn
+\newcount\@shfctr \newcount\@shfA \newcount\@shfB %%% In "\shuffle"
+\newcount\icount %%% counter to shuffle exercises
+\newcount\io
+\newcount\inizio
+\newcount\old@rando
+\FPeval\seme{round(\thenomefile+1-trunc(\thenomefile/(2^31-1):0)*(2^31-1):0)}
+%\FPset\semeex\seme
+\def\semeex{\seme}
+\inizio=1
+%%%%
+\newcounter{vers}%%% the number of the version
+\setcounter{vers}{0}
+\newcounter{n@par}%%% it counts the number of parameters
+\newcount\loopCnt%%% the number of attempts in \FPsetpar
+\newcounter{fp@contatore}%%% used in \FPsetpar
+\newcount\old@randomii%%% used to change seed shuffling exercise
+\newcount\old@randomi%%% used to change seed in \FPsetpar
+\newcount\old@random%%% used to change seed in \selectrandomly %%%NUOVO
+\newcount\sh@max%%% used to choose the exercises
+\newcount\@probN%%% number of exercises in \selectrandomly
+\newcount\j@m%%% temporary counter in \newproblem
+\newcount\i@sh
+\newcount\j@sh
+\newcounter{shuf@lop}
+\newcounter{temp@cnt}
+\newcounter{questionno}%%% the number of the question in test
+\newcount\@esquestiondepth \@esquestiondepth=0
+\newcounter{esquestionnoi}
+\renewcommand{\theesquestionnoi}{\arabic{esquestionnoi}}
+\newcounter{esquestionnoii}
+\renewcommand{\theesquestionnoii}{\alph{esquestionnoii}}
+\newcounter{esquestionnoiii}
+\renewcommand{\theesquestionnoiii}{\roman{esquestionnoiii}}
+%\newdimen\punteggio %% NEW 2016/04/11 to check the total score of exercises
+%\setlength{\punteggio}{0pt}
+\newcommand\checkpoints\relax
+\def\es@primo{1433}
+
+
+%========================================================%
+% test %
+%========================================================%
+
+\newcounter{sq@quizno} \setcounter{sq@quizno}{0}%%% the number of the answer in a MCQ
+\renewcommand\thesq@quizno{\alph{sq@quizno}}
+\def\@shortquizCnt{0}
+\newcount\es@tabColCnt%%% The number of columns of answers in MCQ
+
+%========================================================%
+% esercizio %
+%========================================================%
+
+\newcounter{ex@no}%%% The number of the exercise
+\setcounter{ex@no}{0}
+\@addtoreset{ex@no}{section}
+\newcounter{ex@partno}%%% The parts of an exercise
+\renewcommand\theex@partno{\alph{ex@partno}}
+
+%========================================================%
+% risposta %
+%========================================================%
+
+\newcounter{risp@righe}%%% the number of lines in a long answer (environment "risposta")
+
+%========================================================%
+% matching %
+%========================================================%
+
+\newcounter{match@plu}
+\newcounter{match@plo}
+\newcounter{match@q}
+
+%========================================================%
+% aebrandom %
+%========================================================%
+
+\newcount\aeb@numChoices
+\newcount\aeb@ranChoice
+
+% +=============================+
+% | LABELS |
+% +=============================+
+
+%========================================================%
+% questions %
+%========================================================%
+
+\newcommand{\labelesquestionnoi}{\bfseries\theesquestionnoi.}
+\newcommand{\labelesquestionnoii}{\bfseries(\theesquestionnoii)}
+\newcommand{\labelesquestionnoiii}{\bfseries(\theesquestionnoiii)}
+
+%========================================================%
+% test %
+%========================================================%
+
+\newcommand\sq@label{}
+\newcommand\sqlabel{\sq@label}
+\def\linkContentFormat{\alph{sq@quizno}}
+\def\linkContentWrapper{(\hfil\linkContentFormat\hfil)}
+
+%========================================================%
+% exercise %
+%========================================================%
+
+\newcommand\exlabel{\es@exercisename}
+\newcommand\exlabelsol{\exlabel}
+\newcommand\exlabelformat{{\scshape\exlabel\ \theex@no.}}
+\newcommand\exlabelformatwp{{\scshape\exlabel\ \theex@no.}}
+\newcommand{\exsolafter}{\es@exsolafterDefault}
+\newcommand{\es@exsolafterDefault}{\textit{\es@solutionname}: }
+\newcommand{\esexlisttabheader}
+{(\hfil\theex@partno\hfil)%
+}
+\newcommand{\ex@header}
+{\hbox{\if\exerstar*\exlabelformatwp\else%
+ \exlabelformat\fi}%
+}
+
+% +=============================+
+% | COMMANDS |
+% +=============================+
+
+%========================================================%
+% Maths %
+%========================================================%
+
+%\ifes@param
+%\newcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations
+%\newcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)}
+%\immediate\write\params{%%% writes on a file
+% \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3}
+% \string}\string\newline}}
+%\else
+\newcommand{\FPsv}[2][0]{\FPeval{\fp@tmpa}{clip(round(#2:#1))}\numprint{\fp@tmpa}}%%% It does operations with #1 decimals and with the "param" option it shows operations
+\newcommandx{\FPval}[3][2=0]{\FPeval{#1}{clip(round(#3:#2))}}%% it works like \FPsv with the option param, like \FPeval otherwise
+%\fi
+%========================================================%
+% fractions %
+%========================================================%
+
+\newcommand{\@sempli}[2]{%%%% simplification (private command)
+ \FPeval\segnofrac{round(#1:0)*round(#2:0)}
+ \FPeval\fp@tmp{round(abs(#1):0)}\FPset\fp@n{\fp@tmp}%
+ \FPeval\fp@tmp{round(abs(#2):0)}%
+ \FPifzero{\fp@tmp}\PackageError{esami}{\es@zerodenerror{#1}{#2}}\fi
+ \FPset\fp@d{\fp@tmp}%
+ \FPeval\fp@num{max(\fp@n,\fp@d)}\FPeval\fp@den{min(\fp@n,\fp@d)}\FPset\fp@resto{\fp@den}\whiledo{\fp@resto>0}%
+ {\FPset\fp@restoold{\fp@resto}\FPeval\fp@resto{round((\fp@num-trunc((\fp@num)/\fp@den:0)*(\fp@den)):0)}%
+ \FPset\fp@num{\fp@den}\FPset\fp@den{\fp@resto}}\FPeval\fp@num{round((\fp@n/\fp@restoold):0)}\FPeval\fp@den{round((\fp@d/\fp@restoold):0)}%
+ \FPifneg\segnofrac{-}\else{}\fi\ifthenelse{\fp@den=1}{\ifthenelse{\fp@num=1}{1}{\fp@num}}{\frac{\fp@num}{\fp@den}}%
+ }
+
+\newcommand{\sempli}[2]{%%% simplification (user command)
+ \FPeval\fp@tmp{round(abs(#1):0)}%
+ \FPifzero{\fp@tmp}\PackageError{esami}{\es@zeronumerrorshort{#1}{#2}}
+ {\es@zeronumerrorlong{#1}{#2}}\fi
+ \FPeval\fp@temp{round(abs(#2):0)}%
+ \FPifeq{\fp@tmp}{\fp@temp}\PackageWarning{esami}{\es@fraconewarn{#1}{#2}}\fi
+ \@sempli{#1}{#2}%
+ }
+
+\newcommand{\semplix}[2]{%%% simplification (coefficients)
+ \FPeval\fp@tmp{round(abs(#1):0)}%
+ \FPifzero{\fp@tmp}\PackageError{esami}{\es@zeronumerrorshort{#1}{#2}}
+ {\es@zeronumerrorlong{#1}{#2}}\fi
+ \FPeval\t@mpa{round(#1:0)}\FPeval\t@mpb{round(#2:0)}%
+ \ifthenelse{\t@mpa=\t@mpb}{}%
+ {\ifthenelse{\t@mpa=-\t@mpb}{-}%
+ {\@sempli{#1}{#2}}%
+ }
+ }
+
+\newcommand{\sempliz}[2]{%%% simplifications (zero)
+ \FPeval\t@mpa{round(#1:0)}%
+ \ifthenelse{\t@mpa=0}{0}%
+ {\@sempli{#1}{#2}}%
+ }
+
+\newcommand{\esempli}[2]{%%% simplification (exponents)
+ \FPeval\fp@tmp{round(abs(#1):0)}%
+ \FPifzero{\fp@tmp}\PackageError{esami}{\es@zeronumerrorshort{#1}{#2}}
+ {\es@zeronumerrorlong{#1}{#2}}\fi
+ \FPeval\t@mpa{round(#1:0)}\FPeval\t@mpb{round(#2:0)}%
+ \ifthenelse{\t@mpa=\t@mpb}{}%
+ {\ifthenelse{\t@mpa=-\t@mpb}{-1}%
+ {\@sempli{#1}{#2}}%
+ }
+ }
+
+%========================================================%
+% Radicals (simplification) %
+%========================================================%
+
+\newcommand\simpsqrt[2]{
+ \FPset\tmp@sqi{2}%
+ \FPset\sq@factor{1}%
+ \FPset\tmp@factor{1}%
+ \FPeval\sq@segno{round(#2:0)}%
+ \FPeval\sq@rad{round(abs(#2):0)}%
+ \FPeval\sq@ind{round(#1:0)}%
+ \FPeval\tmp@sqpw{round(\tmp@sqi^(\sq@ind):0)}%
+ \FPeval\tmp@sqj{round(\sq@rad+1:0)}%
+ \ifthenelse{\equal\sq@rad{0}}{0}{%
+ \whiledo{\tmp@sqpw<\tmp@sqj}{\FPeval\tmp@rad{\sq@rad/\tmp@sqpw}%
+ \FPeval\sq@resto{round((\sq@rad-trunc((\sq@rad)/\tmp@sqpw:0)*(\tmp@sqpw)):0)}%
+ \ifthenelse{\equal{\sq@resto}{0}}{\FPset\tmp@factor{\sq@factor}\FPeval\sq@factor{round(\tmp@factor*\tmp@sqi:0)}\FPeval\sq@rad{round(\tmp@rad:0)}%
+ \FPset\tmp@sqi{1}}{}\FPset\tmp@sqii{\tmp@sqi}\FPeval\tmp@sqi{round(\tmp@sqii+1:0)}\FPeval\tmp@sqpw{round(\tmp@sqi^(\sq@ind):0)}}%
+ \ifthenelse{\isodd{\sq@ind}}{%
+ \ifthenelse{\equal{\sq@factor}{1}} {\ifthenelse{\equal{\sq@rad}{1}}{\ifthenelse{\sq@segno<0}{-1}{1}}
+ {\ifthenelse{\sq@segno<0}{-\sqrt[\sq@ind]{\sq@rad}}{\sqrt[\sq@ind]{\sq@rad}}}}%
+ {\ifthenelse{\equal{\sq@rad}{1}}{\ifthenelse{\sq@segno<0}{-\sq@factor}{\sq@factor} }
+ {\ifthenelse{\sq@segno<0}{-\sq@factor\sqrt[\sq@ind]{\sq@rad}}{\sq@factor\sqrt[\sq@ind]{\sq@rad} }}}}%
+ {\ifthenelse{\sq@segno<0}{\PackageError{esami}{\es@radicalerror}}{\ifthenelse{\equal{\sq@factor}{1}} {\ifthenelse{\equal{\sq@rad}{1}}{1}
+ {\ifthenelse{\sq@ind=2}{\sqrt{\sq@rad}}{\sqrt[\sq@ind]{\sq@rad}}} }%
+ {\ifthenelse{\equal{\sq@rad}{1}}{\sq@factor}{\ifthenelse{\sq@ind=2}{\sq@factor\sqrt{\sq@rad}}{\sq@factor\sqrt[\sq@ind]{\sq@rad}}} }}}}%
+ }
+
+%========================================================%
+% Coefficients of polynomial %
+%========================================================%
+
+\newcommand{\FPsignpol}[2] %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11
+{\FPval\tempsign{#1}
+\ifthenelse{\equal{#2}{}}{\ifnum \tempsign<0 {\sempli{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\sempli{\tempsign}{1}#2}\else{}\fi\fi}
+{\ifnum \tempsign<0 {\semplix{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\semplix{\tempsign}{1}#2}\else{}\fi\fi}
+} %%% nuovo 2016/12/11 per termine noto
+
+
+%========================================================%
+% Commands adapted from exerquiz %
+%========================================================%
+
+\providecommand\PBS[1]{\let\temp=\\#1\let\\=\temp}
+\def\es@lw@l{\es@l@l\ }
+\def\es@l@l{\normalsize\normalfont(d)}
+\newcommand\PTs{\def\es@star{x}\@PTs}
+\def\@PTs#1{%
+%\addtolength{\punteggio}{#1 pt} %% NEW 2016/04/11 to check the total score of exercises
+%\global\punteggio=\punteggio
+ \gdef\es@PTs{#1}\ifx\es@PTs\@empty\gdef\es@PTs{1}\fi
+ \global\let\esPTs=\es@PTs\global\let\es@PTs=\@empty
+ \if\es@star*\else\PTs@Hook\fi
+}
+\def\es@PTs{0}
+\newcommand\PTsHook[1]{\def\PTs@Hook{#1}}%%% hooks for \PTs
+\let\qMark@Hook\@empty
+\newcommand{\post@questionsHook}{}
+\newcommand{\punti}{}
+%%=========================================================================%
+%% Modified commands for parametric version in "totale-versioni" %
+%%=========================================================================%
+%%%%
+%\ifes@param
+%\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations
+%\renewcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)}
+%\immediate\write\params{%%% writes on a file
+% \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3}
+% \string}\string\newline}}
+%\renewcommand{\FPsignpol}[2]{+(#1)#2} %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11
+%\renewcommand{\simpsqrt}[2]{\sqrt[#1]{(#2)}}%%% \simpsqrt shows operations
+%\renewcommand{\sempli}[2]{%%% all simplifications become \frac
+% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+% \renewcommand{\semplix}[2]{%
+% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+% \renewcommand{\sempliz}[2]{%
+% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+% \renewcommand{\esempli}[2]{%
+% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+% \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})} %
+% \ifes@test
+% \immediate\closeout\params
+% \fi
+% }
+%\fi
+
+
+
+%========================================================%
+% Commands adapted from eqexam %
+%========================================================%
+
+%%%%% Points in a box on the right %%%%%%
+
+\ifes@pointsonright
+\def\examenddef
+{%
+\bgroup
+\raisebox{-30pt}[0pt][0pt]{%
+ \hspace*{-\parindent} %
+ {\es@rightmarginbox
+ }} %
+\egroup}
+\else
+\def\examenddef{}
+\fi
+
+\def\PointsOnRight{%
+ \let\marginpoints=\es@rightmarginbox}
+\newcommand\marginpointsboxtext{\small \emph{\punti\ifthenelse{\equal{\punti}{1}}{ \es@pointname}{ \es@pointsname}}}
+\def\es@rightmarginbox{%
+ \makebox[0pt][l]{%
+ \setlength\tabcolsep{0pt}%
+ \hspace*{\textwidth}\hspace*{\marginparsep}%
+ \raisebox{-.5\height}[0pt][0pt]{%
+ \parbox{40pt}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height20pt width0pt\hfill\\\hline
+ \makebox[40pt]{%
+ \marginpointsboxtext}\\\hline%
+ \end{tabular}%
+ }%
+ }\hfil
+ }%
+}
+\setbox\es@pointbox=\hbox{%
+ \parbox{35pt}{%
+ \tabcolsep=0pt\relax
+ \begin{tabular}{|c|}\hline
+ \vrule height15pt width0pt\\
+ \hline
+ \makebox[40pt]{%
+ \marginpointsboxtext}\\
+ \hline
+ \end{tabular}%
+ }%
+}
+
+%%%%%%% Fill in %%%%%%
+\newcommand\fillinproblem{\es@fillintrue%
+\ifes@solutions
+\immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+\fi
+}
+\ifes@solutions
+\def\fill@ans@color#1{\bfseries\color{red}{#1}}%%% with solutions answers are in red by default
+ \else
+\def\fill@ans@color#1{\phantom{#1}}%%% without solutions option -> no answers
+ \fi
+\newcommand{\fillin}[3][u]{%%% #1= the box (u=underlined, e=empty, b= boxed) #2= space for the answer, #3= the correct answer
+\space
+ \ifx#1u\let\fillin@Fmt=\underbar%%% by default underlined space
+ \else\ifx#1e\let\fillin@Fmt=\relax%%% empty space
+ \else\ifx#1b\let\fillin@Fmt=\fbox%%% box
+ \fi\fi\fi
+ \fillin@Fmt{\parbox[b][.8\height][b]{#2}{%
+ \strut\hfil\fill@ans@color{#3}\hfil}%
+ \ifes@test
+ \ifes@prova
+ \else
+\ifes@solutions%%% to write the string of solutions
+\immediate\write\sols{\string\item\space\string\makeatletter\space\string\input\string{qf\nome q\romannumeral\tmp@quest e\thevers.parametri\string}\string\makeatother}
+\immediate\write\sols{\unexpanded{#3}}
+\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen}
+\fi
+\fi
+\fi
+ }
+ }
+
+%%%%% Other commands %%%%%%
+\newcommand\stepverssols{\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}}}
+\newcommand\closeverssols{\immediate\write\sols{\string\end{minipage}}}
+
+\newcommand\stepvers{\stepcounter{vers}\ifes@solutions\stepverssols
+\immediate\write\loe{\versionname\space n. \thevers}\fi}
+ \newcommand\closevers{\newpage\setcounter{page}{1}\setcounter{ex@no}{0}\ifes@solutions\closeverssols
+ \immediate\write\loe{\space}
+ \immediate\write\loe{\space}
+ \fi}
+
+\def\mydate#1/#2/#3\@empty{\setcounter{nomefile}{\two@digits{#1}\two@digits{#2}\two@digits{#3}}}%%% it gives to the counter "nomefile" a value determined by the date
+\PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})}}%%% The name of the points
+\newcommand{\proofingsymbol}[1]{\def\@proofingsymbol{{#1}\hspace{-.3em}\es@segnala}}%%% this defines the symbol for the exact answer in MCQ and the label for the string of solutions
+\proofingsymbol{$\blacktriangleright$}%%% the proofing symbol that can be changed in document
+\newenvironment{gobbleenv}{\Collect@Body \@gobble}{}%%% this environment eats its content
+
+\AtBeginDocument{%%% the date and the date component of the seed and some code for solutions
+ \def\longdate{\expandafter\es@longdate\@date\@empty}
+ \def\shortdate{\expandafter\es@shortdate\@date\@empty}
+ \expandafter\mydate\@date\@empty
+ \ifes@prova
+ \else
+\ifes@solutions
+\newwrite\sols
+\immediate\openout\sols=\jobname.sol.tex
+\newwrite\loe
+\immediate\openout\loe=\jobname.loe
+ \fi
+ \fi}
+\newcommand\es@segnala{%%% this command gives the reference of the exact answer in the string of solutions
+ \if\es@listType1\addtocounter{sq@quizno}{-1}\refstepcounter{sq@quizno}\fi
+\ifes@prova \else \label{\probchosen} \immediate\write\sols{ \string\item\string\ref{\probchosen}}
+\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen} \fi
+ }
+\newcommand{\prior@questionsHook}{}
+
+%========================================================%
+% definitions of Fpsetpar %
+%========================================================%
+\def\maxLoopLimit{10}%
+\ifes@param
+\newcommandx{\FPsetpar}[5][1=\seme,5={}]{%%% the parameters are not assigned
+ \expandafter\def\csname#2\endcsname{#2}%%% in the parametric version, the parameter appears with its name and not with its value
+ \immediate\write\params{%%% writes on a file
+ \string\textbf\string{\string\noindent\space \es@parametermessage{#2}{#3}{#4}
+ \space \ifx#5\@empty\else $#2\neq #5$.\fi\space \es@seedmessage{#1}
+ \string}\string\newline}}
+ \else
+\newcommandx{\FPsetpar}[5][1=\seme,5={}]{%
+\ifnum#3>#4\PackageError{esami}{\es@fpsetparerrshort{#2}}{\es@fpsetparerrlong{#2}}\fi%% NEW 2015
+\@ifundefined{nome}{\setcounter{fp@contatore}{-2}}{
+\@ifundefined{base\nome}{\setcounter{fp@contatore}{-2}}{\setcounter{fp@contatore}{-\csname base\nome \endcsname}}}
+\FPval{randomico}{\thevers+\then@par+\thequestionno+#1}
+\old@randomi=\number\randomi%%% it saves the old seed
+\stepcounter{n@par}%
+\setcounter{fp@contatore}{-\value{vers}}%
+\randomi=\randomico%
+\ifnum#3>0 \addtocounter{fp@contatore}{-#3} \else \addtocounter{fp@contatore}{#3}\fi
+\whiledo{\value{fp@contatore}<\value{questionno}}{\nextrandom\stepcounter{fp@contatore}}%
+\setrannum{\tmp@a}{#3}{#4}%
+\def\rand@ne{#5}%%% checks the parameter (adapted from rangen)
+\ifx\rand@ne\@empty\else\loopCnt=0\relax%
+\@whilenum\loopCnt<\maxLoopLimit\do{%
+\rnd@cnt=1\relax%
+\@for\ne@@tmp:=\rand@ne\do{%
+\ifnum\tmp@a=\ne@@tmp\relax%
+\multiply\rnd@cnt0\relax%
+\else%
+\multiply\rnd@cnt1\relax%
+\fi%
+}%
+\ifnum\rnd@cnt=1\relax%%% all conditions are satisfied
+\loopCnt=\maxLoopLimit%
+\else%
+\advance\loopCnt1\relax%
+\ifnum\loopCnt=\maxLoopLimit%
+\PackageError{esami}{\es@fpsetparerrorshort}{\es@fpsetparerrorshort}%
+\else%
+\setrannum{\tmp@a}{#3}{#4}%
+\fi%
+\fi%
+}%
+\fi%
+\FPeval{#2}{round(\number\tmp@a:0)}%
+\ifes@fillin%
+\immediate\write\parametri{\string\FPeval\string{#2\string}\string{round(\number\tmp@a:0)\string}}%
+\fi%
+\randomi=\number\old@randomi%%% restores the seed
+}%
+\fi
+
+%%%% Command for random sign (taken from rangen) %%%%%
+\newcommand{\RandS}{%
+\setrannum{\rnd@cnts}{0}{1}
+\ifnum\number\rnd@cnts>0
++
+\else
+-
+\fi}%
+
+%=========================================================================%
+% Modified commands for parametric version in "totale-versioni" %
+%=========================================================================%
+%%%
+\ifes@param
+\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations
+\renewcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)}
+\immediate\write\params{%%% writes on a file
+ \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3}
+ \string}\string\newline}}
+\renewcommand{\FPsignpol}[2]{+(#1)#2} %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11
+\renewcommand{\simpsqrt}[2]{\sqrt[#1]{(#2)}}%%% \simpsqrt shows operations
+\renewcommand{\sempli}[2]{%%% all simplifications become \frac
+ \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+ \renewcommand{\semplix}[2]{%
+ \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+ \renewcommand{\sempliz}[2]{%
+ \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+ \renewcommand{\esempli}[2]{%
+ \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}}
+ \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})} %
+ \ifes@test
+ \immediate\closeout\params
+ \fi
+ }
+\fi
+
+% +===================================+
+% | OTHER ENVIRONMENTS AND EXERCISES |
+% +===================================+
+
+%========================================================%
+% Tabella %
+%========================================================%
+
+\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
+\newcolumntype{^}{>{\currentrowstyle}}
+\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}#1\ignorespaces}
+\ifes@solutions
+\colorlet{tab@ans@color}{red}
+\newcolumntype{C}[1]{>{\color{tab@ans@color}}#1}%%% the column of the solutions is red (option solution)
+\else
+\def\cancella#1\finqui{\phantom{#1}}
+\newcolumntype{C}[1]{>{\cancella}#1<{\finqui}}%%% the column of the solutions is empty (exam)
+\fi
+\newenvironment{tabella}[3][2]{\bigskip%%% open answers in columns #1=n. of visible columns (+1 invisible), #2={r,c,l} alignment of visible columns, #3={r,c,l} alignment of invisible column
+\renewcommand\arraystretch{2}
+\begin{tabular}{$#2*{#1}{|^C#3}} }{
+\end{tabular} \renewcommand\arraystretch{1}}
+
+%========================================================%
+% Risposta %
+%========================================================%
+
+\ifes@solutions
+\newenvironment{risposta}[2][l]{\relax}{}
+\else
+\newenvironment{risposta}[2][b]{% #1={b,l} box or lines, #2= heigth of box or number of lines
+\setlength{\es@rig}{#2cm minus 12pt}
+ \ifx#1b \fbox{\parbox[b][\es@rig]{\textwidth}{\vfill\hfill }}
+ \else
+ \ifx#1l \setcounter{risp@righe}{-#2}\stepcounter{risp@righe}
+{\whiledo{\therisp@righe < #2}
+{ \par \vspace{.2cm} \dotfill \stepcounter{risp@righe}}}\else \fi\fi}
+{}
+\fi
+
+%========================================================%
+% matching (from an idea of examdesign) %
+%========================================================%
+
+\newcommand{\pair}[2]{%%% pairing of items
+\stepcounter{match@q}
+\expandafter\gdef\csname match@qst\thematch@q\endcsname{#1}
+\expandafter\gdef\csname match@ans\thematch@q\endcsname{#2}
+\expandafter\edef\csname match@num\thematch@q\endcsname{\thematch@q}
+}
+\ifes@solutions
+\def\match@ans@color#1{\bfseries\color{red}{#1}}%%% visible solutions in red (solutions)
+\else
+\def\match@ans@color#1{\phantom{#1}}%%% invisible solutions (exam)
+\fi
+\newcommand{\matching}{%%% it generates the 2 columns
+\@getitemsr \@getitemsl
+\vspace{5mm}
+\setcounter{match@q}{0}
+}
+\def\@getitemsl{%%% left column and shuffle of items
+\i@sh=\thematch@q
+\loop
+\expandafter\let \csname flag\number\i@sh\endcsname a%
+\advance\i@sh by-1
+\ifnum\i@sh > 0 \repeat
+\i@sh=\thematch@q
+\loop
+\setrannum{\j@sh}{1}{\thematch@q}
+\expandafter\ifx \csname flag\number\j@sh\endcsname a%
+\expandafter\let \csname flag\number\j@sh\endcsname b%%% Sets the flag.
+\expandafter\edef\csname match@qsti\number\i@sh\endcsname{\noexpand\csname match@qstii\number\j@sh\endcsname}
+\setcounter{match@plu}{\thematch@q}
+\addtocounter{match@plu}{-\csname match@numii\number\j@sh\endcsname}
+\addtocounter{match@plu}{1}
+\setcounter{match@plo}{\thematch@q}
+\addtocounter{match@plo}{- \number\i@sh}
+\addtocounter{match@plo}{1}
+\expandafter\edef\csname match@numi\number\i@sh\endcsname{(\Alph{match@plu})}
+\vspace{2ex}
+
+\begin{tabular}{p{.05\textwidth}p{.40\textwidth}p{.01\textwidth}p{.40\textwidth}}
+\underbar{\makebox[.5cm]{\match@ans@color{\csname match@numi\number\i@sh\endcsname}}} & \csname match@qsti\number\i@sh\endcsname&&(\Alph{match@plo})\hspace{3mm}\csname match@ansi\number\i@sh\endcsname%\tabularnewline
+\end{tabular}
+ \advance\i@sh by-1
+ \ifnum\i@sh > 0 \fi
+ \fi
+ \ifnum\i@sh > 0
+\repeat
+}
+\def\@getitemsr{%%% right column and shuffle of tems
+\i@sh=\thematch@q
+\loop
+\expandafter\let \csname flago\number\i@sh\endcsname c%
+\advance\i@sh by-1
+\ifnum\i@sh > 0 \repeat
+\i@sh=\thematch@q
+\loop
+\setrannum{\j@sh}{1}{\thematch@q}
+\expandafter\ifx \csname flago\number\j@sh\endcsname c%
+\expandafter\let \csname flago\number\j@sh\endcsname d%
+\expandafter\edef\csname match@qstii\number\i@sh\expandafter\endcsname{\noexpand\csname match@qst\number\j@sh\endcsname}
+\expandafter\edef\csname match@ansi\number\i@sh\expandafter\endcsname{\noexpand\csname match@ans\number\j@sh\endcsname}
+\expandafter\edef\csname match@numii\number\i@sh\endcsname{\csname match@num\number\i@sh\endcsname}
+\advance\i@sh by-1
+\ifnum\i@sh > 0 \fi
+\fi
+\ifnum\i@sh > 0
+\repeat
+}
+
+%========================================================%
+% Commands adapted from probsoln %
+%========================================================%
+
+%%%%%% \newproblem %%%%%%%%%%%%%
+
+\newif\iffirstpass
+\ifes@prova
+\newcommand{\newproblem}[1]{%%% \newproblem for the file "totale-versioni"
+\advance\tmp@quest by1
+\iffirstpass
+\global\advance\@probN by 1
+\else
+\let\nome\currfilebase
+\global\def\problabel{e:\thevers-file:\nome}
+\global\def\probnumber{q:\romannumeral\tmp@quest}
+ \ifes@fillin
+ \immediate\openout\parametri=qf\nome q\number\j@n e\thevers.parametri.tex
+ \fi
+\expandafter\global\expandafter\newcommand\csname \probnumber \endcsname{#1}
+ \fi
+}
+\else
+ \ifes@correzione
+ \newcommand{\newproblem}[1]{%%% \newproblem for the "correzione" option
+\advance\tmp@quest by1
+ \iffirstpass
+ \global\advance\@probN by 1
+ \else
+ \let\nome\currfilebase
+ \global\def\problabel{e:\thevers-file:\nome}
+\global\def\probnumber{q:\romannumeral\tmp@quest}
+ \ifes@fillin
+ \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+ \fi
+\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
+ \expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber \endcsname{#1}
+ \fi
+ }
+ \else
+\newcommand{\newproblem}[1]{%%% \newproblem for the exam
+\advance\tmp@quest by1
+\iffirstpass
+\global\advance\@probN by 1
+\else
+\let\nome\currfilebase
+\global\def\problabel{e:\thevers-file:\nome}
+\global\def\probnumber{q:\romannumeral\tmp@quest}
+\ifes@fillin
+\ifes@solutions%%% to write the string of solutions
+\immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+\fi
+\fi
+
+\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
+\expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber\endcsname{#1}%%% it assigns a unique name to exercise
+\fi
+}
+\fi
+\fi
+
+\newcommand{\newfillinproblem}[1]{ \newproblem{\fillinproblem #1}}
+
+%%%%%%%% \selectrandomly %%%%%%%
+
+\newcommand{\selectrandomly}[1]{%
+\global\@probN=0\relax
+\firstpasstrue
+\tmp@quest=0
+\input{#1}%%%%%
+\firstpassfalse%%% now prints the question
+\tmp@quest=0
+\input{#1}
+\@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16
+\randomi=\semeex
+\setrannum{\rnd@cnta}{1}{\@probN}
+\randomi=\number\old@random
+\expandafter\global\expandafter\edef\csname base\nome \endcsname{\number\rnd@cnta}
+}{}
+\old@rando=\number\randomi
+ \randomi=\semeex
+\ifthenelse{\number\semeex=\number\seme}{
+\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)}}{
+\FPeval\restotrentasei{round(1+\thenomefile+1+base\nome-trunc((1+\thenomefile+base\nome)/36:0)*36:0)}
+}
+\randomi=\number\old@rando %%% AGGIUNTO 2018/04/28 per giro sbagliato
+\ifcase\@probN\or
+\def\j@n{1}%%% just one variant
+\or%%% 2 variants
+\ifthenelse{\isodd{\restotrentasei}}{\def\j@n{1}}{\def\j@n{2}}
+\or%%% 3 variants
+\def\j@n{\ifcase\restotrentasei\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\fi}%
+\or%%% 4 variants
+\def\j@n{\ifcase\restotrentasei\or 3\or 4\or 1\or 2\or 1\or 2\or 3\or 4\or 3\or 1\or 4\or 2\or 4\or 2\or 3\or 1\or 2\or 3\or 1\or 4\or 2\or 3\or 4\or 1\or 3\or 2\or 1\or 4\or 1\or 4\or 2\or 3\or 4\or 3\or 2\or 1\fi}%
+\or%%% 5 variants
+\def\j@n{\ifcase\restotrentasei\or 5\or 1\or 2\or 3\or 4\or 5\or 2\or 3\or 5\or 1\or 4\or 3\or 1\or 4\or 2\or 5\or 4\or 2\or 3\or 5\or 1\or 5\or 1\or 4\or 2\or 3\or 1\or 3\or 5\or 4\or 2\or 3\or 4\or 5\or 2\or 1\fi}%
+\or%%% 6 variants
+\def\j@n{\ifcase\restotrentasei\or 2\or 5\or 1\or 3\or 4\or 2\or 6\or 1\or 3\or 6\or 5\or 4\or 2\or 3\or 2\or 5\or 4\or 1\or 6\or 1\or 4\or 3\or 2\or 6\or 5\or 4\or 6\or 2\or 5\or 1\or 3\or 6\or 3\or 5\or 1\or 4\fi}%
+\or%%% 7 variants
+\def\j@n{\ifcase\restotrentasei\or 2\or 4\or 1\or 5\or 3\or 6\or 7\or 4\or 1\or 5\or 7\or 6\or 2\or 3\or 7\or 2\or 4\or 6\or 5\or 3\or 1\or 3\or 4\or 7\or 2\or 6\or 1\or 5\or 4\or 5\or 6\or 7\or 3\or 2\or 1\or 5\fi}%
+\or%%% 8 variants
+\def\j@n{\ifcase\restotrentasei\or 2\or 8\or 6\or 7\or 4\or 3\or 1\or 5\or 8\or 5\or 1\or 3\or 7\or 6\or 4\or 2\or 7\or 1\or 8\or 6\or 3\or 2\or 5\or 4\or 1\or 3\or 7\or 5\or 6\or 4\or 2\or 8\or 4\or 3\or 1\or 5\fi}%
+\else
+\ifthenelse{\number\semeex=\number\seme}{
+\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)}}
+{\FPeval\j@n{round(\es@primo+base\nome+1-trunc((\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)}}
+\fi
+\def\probchosen{\problabel-q:\romannumeral\j@n}
+\ifes@test
+\begin{minipage}{.95\linewidth}\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm}\end{minipage}
+\Acapo
+\else
+\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm}
+\Acapo
+\fi
+ \ifes@fillin
+ \immediate\closeout\parametri
+ \fi
+}
+
+%%%% \selectallproblems %%%%%
+
+\newcommand{\selectallproblems}[2][]{%% %%% it selects all problems for "totale-versioni", with the option "random" the problems are in random order
+\global\@probN=0\relax
+\firstpasstrue
+\tmp@quest=0
+\input{\cartella/#2}%
+\firstpassfalse
+\tmp@quest=0
+\input{\cartella/#2}%
+\ifthenelse{\equal{#1}{random}}{\i@sh=0
+\loop
+\advance\i@sh by1
+\expandafter\edef\csname ftmp\romannumeral\i@sh \endcsname {\romannumeral\i@sh}
+\ifnum\i@sh <\number\tmp@quest
+\repeat
+\shuffle{ftmp}{\tmp@quest}}{}
+\global\j@m=1\relax
+\whiledo{\j@m < \@probN \TE@or \j@m = \@probN}{
+ \ifes@prova
+ \ifes@param%
+ \immediate\openout\params=params %%% the file in which the parameters are written
+ \fi
+ \def\probchosen{\problabel-q:\romannumeral\j@m}
+\csname q:\romannumeral\j@m \endcsname%
+ \else
+ \def\probchosen{\problabel-q:\romannumeral\j@m}
+ \ifthenelse{\equal{#1}{random}}{
+ \csname @probi-\problabel-q:\csname ftmp\romannumeral\j@m\endcsname \endcsname
+ }{
+\csname @probi-\problabel-q:\romannumeral\j@m \endcsname
+ }%
+ \fi
+\par\vspace{2mm}
+ \ifes@param%
+\input{params}
+ \fi
+\global\advance\j@m by 1\relax
+}}
+
+%%% working with datasets of exercises (you can choose more than one exercise from a file)
+
+\newif\ifes@db %% to work with datasets
+\es@dbfalse
+
+\newwrite\dbtemp
+\newenvironment{esdb}[1]{
+\gdef\dbname{#1}
+\immediate\openout\dbtemp=\dbname.tex
+\es@dbtrue%
+}{
+\immediate\closeout\dbtemp
+\esercizidb{\dbname}
+\es@dbfalse%
+}
+
+\newcommand{\selectrandomlyn}[2]{
+\global\@probN=0\relax
+\firstpasstrue
+\tmp@quest=0
+\input{\cartella/#2}%
+\ifthenelse{\equal{#1}{all}}{\@probselN=\number\tmp@quest}{
+\ifnum\tmp@quest<#1 \relax
+ \PackageWarning{esami}{\es@selectnwarn{#1}{#2}}
+ \@probselN=\number\tmp@quest %
+ \else
+ \@probselN=#1
+ \fi}
+ \i@sh=0
+\loop
+\advance\i@sh by1
+\expandafter\edef\csname ftmp\romannumeral\i@sh \endcsname {\romannumeral\i@sh}
+\ifnum\i@sh <\number\tmp@quest
+\repeat
+\shuffle{ftmp}{\tmp@quest}
+\firstpassfalse%
+\tmp@quest=0
+\input{\cartella/#2}
+ \i@sh=0
+\loop
+\advance\i@sh by1
+\global\def\probnumber{q:\csname ftmp\romannumeral\i@sh\endcsname}
+\expandafter\immediate\write\dbtemp\expandafter{\string\defitem\string{%
+\string\gdef\string\problabel{\problabel}\space
+\string\gdef\string\probnumber{\probnumber}\space
+\string}}
+\ifnum\i@sh <\number\@probselN
+\repeat
+}
+
+\def\defitem{%
+ \advance\icount by1
+ %%% It defines a macro called "\prbl n" where "n" is the number of the item.
+ \expandafter\def \csname prbl\romannumeral\icount \endcsname
+}
+
+\newcommand{\esercizidb}[1]{ %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them
+ \icount=0
+\input{#1.tex}%
+\i@sh=0
+\loop
+\advance\i@sh by1
+\expandafter\edef\csname ftemp\romannumeral\i@sh \endcsname {\romannumeral\i@sh}
+\ifnum\i@sh <\number\icount
+\repeat
+%\shuffle{ftemp}{\icount}
+\shufflees{ftemp}{\icount} %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them
+\setcounter{n@par}{1}
+\io=\icount
+\loop
+\ifes@test
+\begin{minipage}{.95\linewidth}
+\fi
+\ifes@shuffleQuestions
+\csname prbl\csname ftemp\romannumeral\io\endcsname\endcsname
+\else
+\csname prbl\romannumeral\io \endcsname
+\fi
+\def\probchosen{\problabel-\probnumber}
+\csname @probi-\problabel-\probnumber \endcsname
+\ifes@test
+ \vspace{5mm}\end{minipage}
+ \Acapo
+\vspace{4mm}
+ \fi
+ \advance\io by-1
+ \ifnum\io > 0 \repeat
+ \par}
+
+% +=============================+
+% | ENVIRONMENTS |
+% +=============================+
+
+%========================================================%
+% TEST %
+%========================================================%
+
+%%%%% Test %%%%%
+
+ \newenvironment{test}[1][]{%%% test for MCQ, ecc.
+ \es@testtrue
+ \renewcommand{\punti}{#1}
+ \examenddef\begin{shortquiz}
+ \ifes@twocolumns
+ \begin{multicols}{2}
+ \fi
+ }{
+ \ifes@twocolumns
+ \end{multicols}
+ \fi
+ % \ifdim\punteggio=\punti pt %% NEW 2016/04/11 to check the total score of exercises
+% \else
+% \PackageError{esami}{\es@pointerrorshort} {\es@pointerrorlong}
+% \fi
+% \global\punteggio=0pt
+\checkpoints
+ \end{shortquiz}
+}
+
+%%%%% questions (the environment in which you put the MCQ) %%%%%%
+
+\newenvironment{questions}
+{%
+\stepcounter{questionno}
+ \ifnum\@esquestiondepth>\tw@\@toodeep\else\advance\@esquestiondepth\@ne\fi
+ \def\@quesctr{esquestionno\romannumeral\the\@esquestiondepth}%
+ \begin{list}{\qMark@Hook\prior@questionsHook\gdef\esPTs{1}%
+ \makebox[\labelwidth][r]{\normalfont\bfseries\csname label\@quesctr\endcsname}%
+ \post@questionsHook}%
+ {\usecounter{\@quesctr}%
+ \settowidth{\labelwidth}{\normalfont\bfseries00.\ }%
+ \setlength{\topsep}{3pt}\setlength{\parsep}{0pt}%
+ \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \settowidth{\labelsep}{\ }}
+ \ifes@prova
+ \else
+ \ifes@solutions
+ \immediate\write\sols{\string\begin{enumerate}}
+ \fi
+ \fi%
+}{\end{list}
+\ifes@prova
+\else
+\ifes@solutions
+\immediate\write\sols{\string\par\string\end{enumerate}\string\vspace{3ex}}
+\fi
+\fi
+}
+
+%%%%%%% shortquiz (where to put the environment questions) %%%%
+
+\newenvironment{shortquiz}
+{\es@testtrue%
+ \goodbreak
+ \@shortquiz
+}{
+\setcounter{sq@quizno}{0}%
+ \par\aftershortquizskip}
+\def\@shortquiz{
+ \let\@Ans\Ans@sq@l
+ \setcounter{questionno}{0}%
+ \let\answers\answers@sq
+ \let\endanswers\endanswers@sq
+ \let\solution\solution@sq
+ \let\endsolution\endsolution@sq
+ \sq@priorhook\sqlabel\space
+ \ignorespaces
+}
+\def\aftershortquizskip{\medskip}
+\def\answers@sq{\stepcounter{questionno}%
+ \answers@@sq
+ }
+\def\answers@@sq#1{%
+ \gdef\aeb@numCols{#1}%
+\ifx#11\gdef\es@listType{1}\expandafter\answers@sq@list\else
+ \gdef\es@listType{0}\expandafter\answers@@sq@tabular\fi{#1}%
+}
+\newcommand\Ans@list[2][0]{\gdef\es@pPTs{#1}%
+ \xdef\Ans@choice{#2}\item\relax\if\es@listType1%
+ \addtocounter{sq@quizno}{-1}\refstepcounter{sq@quizno}\fi}
+\newenvironment{answers@sq@list}[1]
+{%
+ \let\endanswers=\endanswers@sq@list
+ \vskip\aboveanswersSkip
+ \begin{list}{\strut\@Ans}
+ {%
+ \settowidth{\labelwidth}{\es@lw@l}%
+ \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
+ \setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}%
+ \setlength{\listparindent}{\parindent}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \setlength{\labelsep}{\mylabelsep}%
+ \def\Ans{\Ans@list}%
+ }%
+}%
+{\end{list}\setcounter{sq@quizno}{0}}
+\newcommand\Ans@tabular[2][0]{\gdef\es@pPTs{#1}%
+ \xdef\Ans@choice{#2}\leavevmode\@Ans
+}
+\def\answers@@sq@tabular#1{%
+ \vskip\aboveanswersSkip\noindent\tabcolsep=0pt
+ \es@tmpdima=\linewidth \divide \es@tmpdima by#1 %
+ \def\Ans{\Ans@tabular}%
+ \begin{tabular}{*{#1}{p{\es@tmpdima}}}}%
+\def\endanswers@sq{\end{tabular}\setcounter{sq@quizno}{0}}%
+\def\Ans@sq@l{%
+ \leavevmode\if\es@listType1\stepcounter{sq@quizno}%
+ \else\refstepcounter{sq@quizno}\fi\PBS\raggedright
+ \settowidth{\es@tmplength}{\es@l@l}\sbox{\es@tmpbox}{\es@lw@l}%
+ \es@tmpdima=\wd\es@tmpbox
+ \def\link@@Content{\linkContentWrapper}%
+ \hangindent=\es@tmplength\hangafter=1\relax
+ {\makebox[\es@tmpdima]{\link@@Content}}%
+ \Ans@proofing{\es@tmpdima}%
+\ \ignorespaces}
+\def\Ans@proofing#1{%
+ \ifes@solutions\if\Ans@choice1\relax
+ \llap{\@proofingsymbol\,\hskip#1\relax}%
+ \fi\fi
+}
+\newcommand\answers@q
+{%
+ \setdefault@Ans
+ \stepcounter{questionno}%
+ \answers@@q
+}
+\def\answers@@q#1%
+{%
+ \gdef\aeb@numCols{#1}%
+ \ifx#11\gdef\es@listType{1}\expandafter\answers@q@list\else
+ \gdef\es@listType{0}\expandafter\answers@q@tabular\fi{#1}%
+}
+\newenvironment{answers@q@list}%[1]
+{%
+ \let\endanswers=\endanswers@q@list
+ \vskip\aboveanswersSkip
+ \begin{list}{\strut\@Ans}%\
+ {%
+ \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
+ \setlength{\listparindent}{\parindent}
+ \setlength{\leftmargin}{\labelwidth}%
+ \setlength{\labelsep}{0pt}
+ \def\Ans{\Ans@list}%
+ }%
+}{\end{list}\setcounter{sq@quizno}{0}%
+ \setdefault@Ans
+}
+\def\answers@q@tabular#1{%
+ \vskip\aboveanswersSkip\noindent\tabcolsep=0pt
+ \es@tmpdima=\linewidth \advance\es@tmpdima-\leftskip
+ \divide\es@tmpdima by#1
+ \def\Ans{\Ans@tabular}%
+ \let\endanswers=\endanswers@q@tabular
+ \begin{tabular}{*{#1}{p{\es@tmpdima}}}%
+}
+\def\endanswers@q@tabular
+{%
+ \end{tabular}\setcounter{sq@quizno}{0}%
+ \setdefault@Ans
+}
+
+\define@key{bchoice}{nCols}{\def\bChoiceNumCols{#1}}
+\@for\i:=1,2,3,4,5,6,7,8,9,10 \do{\edef\temp@expand@def{%
+ \noexpand\define@key{bchoice}{\i}[\i]{%
+ \noexpand\def\noexpand\bChoiceNumCols{\i}}%
+ }\temp@expand@def
+}
+\def\bChoiceNumCols{\aeb@numCols}
+\define@key{bchoice}{random}[true]{%
+ \csname if#1\endcsname\es@randomizeChoicestrue
+ \else\es@randomizeChoicesfalse\fi
+}
+\def\bChoices{\@ifnextchar[{\@ansChoices}{\@ansChoices[\aeb@numCols]}}
+\def\@ansChoices[#1]%
+{%
+ \setkeys{bchoice}{#1}%
+ \global\es@tabColCnt=0
+ \ifnum\aeb@numCols=1 % list mode
+ \def\es@next{\@layoutListAns}%
+ \else % tabular mode
+ \def\es@next{\@layoutTabularAns{\bChoiceNumCols}}%
+ \fi
+ \es@next
+}
+\let\eChoices\relax
+\def\@layoutListAns{\@ifnextchar\Ans{\@getListAns}%
+ {\@lookforendansChoices{\@layoutListAns}}%
+}
+\long\def\@getListAns\Ans#1\eAns{%
+ \Ans#1\vspace{\@rowskip}%
+ \@layoutListAns
+}
+\long\def\@lookforendansChoices#1{%
+ \@ifnextchar\eChoices{\rowsep{\rowsep@default}%
+ \expandafter\@findendans\@gobble}{\expandafter#1\@gobble}%
+}
+\def\@layoutTabularAns#1{%
+ \let\es@tabSep=\@empty
+ \xdef\numShortCols{#1}%
+ \ifnum#1>\aeb@numCols \xdef\numShortCols{\aeb@numCols}\fi
+ \@@layoutTabularAns
+}
+\def\@@layoutTabularAns{%
+ \@ifnextchar\Ans{\@getTabAns}%
+ {\@lookforendansChoices{\@@layoutTabularAns}}%
+}
+\long\def\@getTabAns\Ans#1\eAns{%
+ \global\advance\es@tabColCnt1
+ \let\@save@tabSep=\es@tabSep
+ \ifnum\es@tabColCnt=\numShortCols
+ \global\es@tabColCnt=0
+ \xdef\es@tabSep{\noexpand\\\noalign{\kern\@rowskip\relax}}%
+ \else
+ \gdef\es@tabSep{&}%
+ \fi
+ \@ifnextchar\eChoices{\@save@tabSep\Ans#1\rowsep{\rowsep@default}
+ \expandafter\@findendans\@gobble}%
+ {\@save@tabSep\Ans#1\@@layoutTabularAns}%
+}
+\def\@findendans{\@ifnextchar\end{}{\expandafter\@findendans\@gobble}}
+
+\ifes@noquizsolutions
+\def\solution@sq{\gobbleenv}
+\def\endsolution@sq{\endgobbleenv}
+\else
+\def\solution@sq{
+ \par\smallskip\noindent
+ \textit{\es@solutionname}:\
+}
+
+\def\endsolution@sq
+{}
+\fi
+%========================================================%
+% EXERCISE AND SIMILAR %
+%========================================================%
+
+%%%% Exercise (adapted from exerquiz) %%%%
+
+\newenvironment{exercise}
+{\es@testfalse%%% you can't use it in test
+ \par\es@priorexskip\noindent
+ \def\es@argi{ex@no}
+ \if\es@exerstarEnv*\def\exerstar{*}\else\def\exerstar{x}\fi
+ \if\exerstar*%
+\def\exerstar{*}\fi
+\@exercise
+}{\es@postexerciseHook\par\global\es@exerciseheadingtrue\es@exerskip}
+\newif\ifes@exerciseheading \es@exerciseheadingtrue
+\def\@exercise
+{%
+ \if\es@argi0\else\refstepcounter{\es@argi}\fi
+ \if\exerstar*% exercise with parts
+ \else
+ \ifes@solutions
+ \else
+ \gdef\es@writeexheader{%
+ \set@display@protect
+ \set@typeset@protect
+ }
+ \fi
+ \fi
+ \ifvmode\ifdim\lastskip>\z@
+ \vskip-\lastskip
+ \fi\fi
+ \if\exerstar*%
+ \let\solution=\solnexer@woparts
+ \let\endsolution=\endsolnexer@woparts
+ \let\parts=\exercise@parts
+ \let\endparts\endexercise@parts
+ \else
+ \let\solution=\solnexer@woparts
+ \let\endsolution=\endsolnexer@woparts
+ \let\parts=\relax
+ \let\endparts=\relax
+ \fi
+ \ifes@exerciseheading
+\ex@header
+ \afterlabelhskip\ignorespaces
+ \fi
+}
+\long\def\setsolnspace#1{%
+ \def\newsolnspace{#1}%
+ \let\solnhspace\newsolnspace
+}
+\let\solnhspace\space
+\def\solnexer@woparts{\def\bLeaveVspace{x}%
+ \def\next{\@ifnextchar[{\solnexer@@woparts}%
+ {\solnexer@@woparts[\null]}}%
+ \next}
+\let\esPriorVspace\@gobble
+\def\solnexer@@woparts[#1]{%
+ \ifx#1\null
+ \else
+ \gdef\sameVspace{#1}%
+ \ifes@solutions\else
+ \let\bLeaveVspace=\@empty
+ \def\leavevspace{%
+ \par\esPriorVspace{#1}%
+ {\nobreak\parbox[b][#1][t]{\linewidth}{\vfill}}%
+ }%
+ \fi
+ \fi
+ \solnexer@@@woparts
+}
+\def\solutionsafterSkip{\smallskip}
+\def\solnexer@@@woparts
+{%
+ \ifx\bLeaveVspace\@empty\leavevspace\fi
+ \def\es@next{%
+ \ifes@solutions
+ \ifx\exsolafter\@empty\else
+ \par\solutionsafterSkip
+ \noindent\exsolafter\space\ignorespaces\fi
+ \else
+ \global\es@solutionsfalse\expandafter\gobbleenv
+ \fi
+ }%
+ \es@next}
+\def\endsolnexerhook{}
+\def\endsolnexerhookaux{}
+\def\endsolnexer@woparts
+{%
+ \ifes@solutions
+ \else
+ \endgobbleenv
+ \endsolnexerhookaux
+ \fi
+\endsolnexerhook}
+\let\es@exerstarEnv\relax
+\newenvironment{exercise*}{\def\es@exerstarEnv{*}\exercise}
+{\endexercise}
+\def\exercise@parts{\@@par\ifdim\parskip>\z@\vskip-\parskip\fi
+ \let\endparts=\endexercise@parts@list\exercise@parts@list%}
+ }
+\def\es@extralabelsep{0pt}
+\newenvironment{exercise@parts@list}
+{\settowidth{\es@tmplength}{\normalfont(d)}%
+\begin{list}{\normalfont
+ \makebox[\es@tmplength]{\esexlisttabheader}%
+}{%
+ \usecounter{ex@partno}%
+ \setlength{\topsep}{3pt}%
+ \setlength{\partopsep}{0pt plus 1pt minus 1pt}%
+ \setlength{\parsep}{0pt}\setlength{\itemindent}{0pt}%
+ \setlength{\listparindent}{\parindent}%
+ \settowidth{\labelsep}{\normalfont\ }%
+ \addtolength{\labelsep}{\es@extralabelsep}%
+ \settowidth{\labelwidth}{\normalfont(d)}%
+ \setlength{\leftmargin}{\labelwidth}%
+ \addtolength{\leftmargin}{\labelsep}%
+ }%
+}{\end{list}}
+
+
+%%%%% Problem %%%%%%%%
+
+\newenvironment{problem}[1][]{%%% it's like exercise, but with points
+\es@testfalse
+\renewcommand{\punti}{#1}
+\ifes@solutionsonly\else\examenddef\fi
+\begin{exercise}
+\ifes@prova
+\else
+\ifes@solutions
+\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+\fi
+\fi
+}
+{
+\end{exercise}
+\ifes@param
+\immediate\closeout\params
+\fi}
+
+\newenvironment{problem*}[1][]{\es@testfalse
+\renewcommand{\punti}{#1}
+\ifes@solutionsonly\else\examenddef\fi
+\begin{exercise*}
+\ifes@prova
+\else
+\ifes@solutions
+\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+\fi
+\fi
+}
+{
+\checkpoints
+\end{exercise*}
+\ifes@param
+\immediate\closeout\params
+\fi }
+
+%%%%%%%% Problem in minipage
+
+\newenvironment{problemmp}[1][]{%%% it's like exercise, but with points
+\es@testfalse
+\begin{minipage}{\linewidth} %%% new 2016/02/19
+\renewcommand{\punti}{#1}
+\ifes@solutionsonly\else\examenddef\fi
+\begin{exercise}
+\ifes@prova
+\else
+\ifes@solutions
+\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+\fi
+\fi
+}
+{
+\end{exercise}
+\end{minipage}%%% new 2016/02/19
+\ifes@param
+\immediate\closeout\params
+\fi}
+
+\newenvironment{problemmp*}[1][]{\es@testfalse
+\begin{minipage}{\linewidth} %%% new 2016/02/19
+\renewcommand{\punti}{#1}
+\ifes@solutionsonly\else\examenddef\fi
+\begin{exercise*}
+\ifes@prova
+\else
+\ifes@solutions
+\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen}
+\fi
+\fi
+}
+{
+%\ifdim\punteggio=\punti pt
+% \else
+% \PackageError{esami}{\es@pointerrorshort}
+% {\es@pointerrorlong}
+% \fi
+% \global\punteggio=0pt %% NEW 2016/04/11 to check the total score of exercises
+\checkpoints
+\end{exercise*}
+\end{minipage}%%% new 2016/02/19
+\ifes@param
+\immediate\closeout\params
+\fi }
+
+%%%%%%%% Domanda %%%%%%%%
+%%%% (it can be used to hide the text of the exercise and print only the solution) %%%
+
+\ifes@solutionsonly
+ \newenvironment{domanda}{\gobbleenv}{\endgobbleenv}%
+ \else
+ \newenvironment{domanda}{}{}
+ \fi
+
+%%%%%%%%%%%%% workarea (adapted from exerquiz) %%%%%
+
+\newenvironment{workarea}[2][\linewidth]%%% #1=width #2=heigth
+{%
+ \edef\workareadepth{#2}%
+ \begin{lrbox}{\workareasb}\setlength{\es@tmplength}{#1}
+ \begin{minipage}[b][\workareadepth][t]{\es@tmplength}\vspace*{3pt}%
+}
+{%
+ \end{minipage}\end{lrbox}%
+ \par\ifes@solutions%
+ \else
+ \vspace{-\baselineskip}
+ \noindent\strut\smash{\usebox{\workareasb}}%
+ \fi
+}
+
+%==========================================%
+% Format %
+%==========================================%
+
+%%% Sections %%%
+
+\renewcommand\section{\setcounter{ex@no}{0}
+\@startsection
+{section}{1}{0mm}
+{-\baselineskip}
+{0.5\baselineskip}
+{\sffamily\Large\centering}}
+
+%%% Subsections %%%
+
+\renewcommand\subsection{
+\@startsection
+{subsection}{1}{0mm}
+{-\baselineskip}
+{1\baselineskip}
+{\sffamily\centering}}
+
+% +===================================+
+% | PERMUTATIONS, SHUFFLE, ECC. |
+% +===================================+
+
+%========================================================%
+% Permutations %
+%========================================================%
+
+%% These values are used in pseudorandom permutations: they must be calculated for any version
+
+\newcommand{\permuta}{
+\FPeval\restosei{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/6:0)*6:0)}%%% for 2 or 3 exercises permutations
+\FPeval\restoventiquattro{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/24:0)*24:0)}%%%% for 4 exercises permutations
+\FPeval\restotrenta{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/30:0)*30:0)} %%%% for 5,6,7,8 exercises permutations
+}
+\ifes@prova
+\def\restosei{4}%%% for 2 or 3 exercises permutations
+\def\restoventiquattro{21}%%%% for 4 exercises permutations
+\def\restotrenta{17} %%%% for 5,6,7,8 exercises permutations
+\fi
+
+%%% pseudorandom versions (permutations of 1 esercise!!)
+\def\sceglii#1#2{\expandafter\def\csname #2i\endcsname{#1}}
+\def\prendii#1#2{\sceglii{#1}{#2}}
+%%% pseudorandom versions (permutations of 2 esercises)
+\def\scegliii#1#2#3{\expandafter\def\csname #3i\endcsname{#1}\expandafter\def\csname #3ii\endcsname{#2}}
+\def\prendiii#1#2#3{\ifthenelse{\isodd{\thevers}}{\scegliii{#2}{#1}{#3}}{\scegliii{#1}{#2}{#3}}}
+%%% pseudorandom versions (permutations of 3 esercises)
+\def\scegliiii#1#2#3#4{\expandafter\def\csname #4i\endcsname{#1}\expandafter\def\csname #4ii\endcsname{#2}%
+\expandafter\def\csname #4iii\endcsname{#3}}
+\def\prendiiii#1#2#3#4{\ifcase\restosei\or%
+\scegliiii{#3}{#2}{#1}{#4}\or%
+\scegliiii{#2}{#1}{#3}{#4}\or%
+\scegliiii{#1}{#3}{#2}{#4}\or%
+\scegliiii{#3}{#1}{#2}{#4}\or%
+\scegliiii{#1}{#2}{#3}{#4}\or%
+\scegliiii{#2}{#3}{#1}{#4}
+\fi}
+%%% pseudorandom versions (permutations of 4 esercises)
+\def\scegliiv#1#2#3#4#5{\expandafter\def\csname #5i\endcsname{#1}\expandafter\def\csname #5ii\endcsname{#2}%%
+\expandafter\def\csname #5iii\endcsname{#3}\expandafter\def\csname #5iv\endcsname{#4}}
+\def\prendiiv#1#2#3#4#5{\ifcase\restoventiquattro\or%
+\scegliiv{#3}{#4}{#1}{#2}{#5}\or%
+\scegliiv{#1}{#2}{#3}{#4}{#5}\or%
+\scegliiv{#3}{#1}{#4}{#2}{#5}\or%
+\scegliiv{#4}{#2}{#3}{#1}{#5}\or%
+\scegliiv{#2}{#3}{#1}{#4}{#5}\or%
+\scegliiv{#1}{#4}{#2}{#3}{#5}\or%
+\scegliiv{#2}{#3}{#4}{#1}{#5}\or%
+\scegliiv{#3}{#2}{#1}{#4}{#5}\or%
+\scegliiv{#2}{#1}{#3}{#4}{#5}\or%
+\scegliiv{#3}{#4}{#2}{#1}{#5}\or%
+\scegliiv{#4}{#1}{#3}{#2}{#5}\or%
+\scegliiv{#1}{#2}{#4}{#3}{#5}\or%
+\scegliiv{#4}{#3}{#1}{#2}{#5}\or%
+\scegliiv{#3}{#1}{#2}{#4}{#5}\or%
+\scegliiv{#2}{#1}{#4}{#3}{#5}\or%
+\scegliiv{#4}{#3}{#2}{#1}{#5}\or%
+\scegliiv{#2}{#4}{#1}{#3}{#5}\or%
+\scegliiv{#1}{#3}{#2}{#4}{#5}\or%
+\scegliiv{#2}{#4}{#3}{#1}{#5}\or%
+\scegliiv{#4}{#1}{#2}{#3}{#5}\or%
+\scegliiv{#1}{#4}{#3}{#2}{#5}\or%
+\scegliiv{#3}{#2}{#4}{#1}{#5}\or%
+\scegliiv{#4}{#2}{#1}{#3}{#5}\or%
+\scegliiv{#1}{#3}{#4}{#2}{#5}\fi}
+%%% pseudorandom versions (permutations of 5 esercises)
+\def\scegliv#1#2#3#4#5#6{\expandafter\def\csname #6i\endcsname{#1}\expandafter\def\csname #6ii\endcsname{#2}%%
+\expandafter\def\csname #6iii\endcsname{#3}\expandafter\def\csname #6iv\endcsname{#4}\expandafter\def\csname #6v\endcsname{#5}}
+\def\prendiv#1#2#3#4#5#6{\ifcase\restotrenta\or
+\scegliv{#1}{#5}{#3}{#2}{#4}{#6}\or%
+\scegliv{#2}{#3}{#5}{#1}{#4}{#6}\or%
+\scegliv{#1}{#4}{#5}{#3}{#2}{#6}\or%
+\scegliv{#5}{#3}{#1}{#4}{#2}{#6}\or%
+\scegliv{#3}{#1}{#4}{#5}{#2}{#6}\or%
+\scegliv{#4}{#2}{#3}{#5}{#1}{#6}\or%
+\scegliv{#5}{#1}{#2}{#4}{#3}{#6}\or%
+\scegliv{#2}{#5}{#1}{#3}{#4}{#6}\or%
+\scegliv{#1}{#3}{#5}{#4}{#2}{#6}\or%
+\scegliv{#3}{#4}{#1}{#2}{#5}{#6}\or%
+\scegliv{#4}{#5}{#1}{#3}{#2}{#6}\or%
+\scegliv{#5}{#3}{#4}{#1}{#2}{#6}\or%
+\scegliv{#3}{#1}{#4}{#2}{#5}{#6}\or%
+\scegliv{#4}{#1}{#5}{#3}{#2}{#6}\or%
+\scegliv{#1}{#4}{#3}{#2}{#5}{#6}\or%
+\scegliv{#2}{#5}{#1}{#4}{#3}{#6}\or%
+\scegliv{#5}{#2}{#4}{#1}{#3}{#6}\or%
+\scegliv{#4}{#5}{#3}{#1}{#2}{#6}\or%
+\scegliv{#1}{#5}{#2}{#3}{#4}{#6}\or%
+\scegliv{#5}{#4}{#3}{#2}{#1}{#6}\or%
+\scegliv{#3}{#2}{#4}{#1}{#5}{#6}\or%
+\scegliv{#1}{#2}{#4}{#3}{#5}{#6}\or%
+\scegliv{#4}{#2}{#1}{#3}{#5}{#6}\or%
+\scegliv{#3}{#4}{#2}{#5}{#1}{#6}\or%
+\scegliv{#2}{#3}{#5}{#4}{#1}{#6}\or%
+\scegliv{#3}{#1}{#2}{#5}{#4}{#6}\or%
+\scegliv{#5}{#2}{#4}{#3}{#1}{#6}\or%
+\scegliv{#2}{#4}{#3}{#1}{#5}{#6}\or%
+\scegliv{#4}{#3}{#2}{#5}{#1}{#6}\or%
+\scegliv{#2}{#1}{#5}{#4}{#3}{#6}\fi}
+%%% pseudorandom versions (permutations of 6 esercises)
+\def\sceglivi#1#2#3#4#5#6#7{\expandafter\def\csname #7i\endcsname{#1}\expandafter\def\csname #7ii\endcsname{#2}%%
+\expandafter\def\csname #7iii\endcsname{#3}\expandafter\def\csname #7iv\endcsname{#4}\expandafter\def\csname #7v\endcsname{#5}%%
+\expandafter\def\csname #7vi\endcsname{#6}}
+\def\prendivi#1#2#3#4#5#6#7{\ifcase\restotrenta\or%
+\sceglivi{#6}{#2}{#1}{#4}{#5}{#3}{#7}\or%
+\sceglivi{#2}{#6}{#4}{#3}{#5}{#1}{#7}\or%
+\sceglivi{#3}{#4}{#5}{#6}{#1}{#2}{#7}\or%
+\sceglivi{#1}{#3}{#6}{#4}{#2}{#5}{#7}\or%
+\sceglivi{#4}{#2}{#3}{#1}{#6}{#5}{#7}\or%
+\sceglivi{#6}{#4}{#2}{#1}{#5}{#3}{#7}\or%
+\sceglivi{#5}{#3}{#2}{#4}{#1}{#6}{#7}\or%
+\sceglivi{#2}{#5}{#4}{#1}{#3}{#6}{#7}\or%
+\sceglivi{#3}{#1}{#6}{#2}{#4}{#5}{#7}\or%
+\sceglivi{#2}{#1}{#3}{#5}{#4}{#6}{#7}\or%
+\sceglivi{#5}{#2}{#3}{#4}{#1}{#6}{#7}\or%
+\sceglivi{#1}{#3}{#6}{#5}{#4}{#2}{#7}\or%
+\sceglivi{#6}{#1}{#5}{#4}{#3}{#2}{#7}\or%
+\sceglivi{#3}{#2}{#5}{#4}{#1}{#6}{#7}\or%
+\sceglivi{#1}{#4}{#3}{#2}{#6}{#5}{#7}\or%
+\sceglivi{#4}{#6}{#2}{#5}{#1}{#3}{#7}\or%
+\sceglivi{#6}{#3}{#5}{#1}{#4}{#2}{#7}\or%
+\sceglivi{#3}{#5}{#6}{#4}{#2}{#1}{#7}\or%
+\sceglivi{#4}{#1}{#2}{#6}{#3}{#5}{#7}\or%
+\sceglivi{#1}{#6}{#5}{#4}{#2}{#3}{#7}\or%
+\sceglivi{#5}{#4}{#6}{#3}{#1}{#2}{#7}\or%
+\sceglivi{#6}{#5}{#1}{#3}{#2}{#4}{#7}\or%
+\sceglivi{#5}{#1}{#4}{#3}{#2}{#6}{#7}\or%
+\sceglivi{#2}{#3}{#4}{#6}{#5}{#1}{#7}\or%
+\sceglivi{#4}{#2}{#6}{#1}{#3}{#5}{#7}\or%
+\sceglivi{#3}{#4}{#6}{#5}{#1}{#2}{#7}\or%
+\sceglivi{#1}{#3}{#2}{#6}{#4}{#5}{#7}\or%
+\sceglivi{#4}{#3}{#1}{#5}{#6}{#2}{#7}\or%
+\sceglivi{#5}{#6}{#1}{#3}{#2}{#4}{#7}\or%
+\sceglivi{#2}{#6}{#3}{#4}{#5}{#1}{#7}\fi}
+%%% pseudorandom versions (permutations of 7 esercises)
+\def\sceglivii#1#2#3#4#5#6#7#8{\expandafter\def\csname #8i\endcsname{#1}\expandafter\def\csname #8ii\endcsname{#2}%%
+\expandafter\def\csname #8iii\endcsname{#3}\expandafter\def\csname #8iv\endcsname{#4}\expandafter\def\csname #8v\endcsname{#5}%%
+\expandafter\def\csname #8vi\endcsname{#6}\expandafter\def\csname #8vii\endcsname{#7}}
+\def\prendivii#1#2#3#4#5#6#7#8{\ifcase\restotrenta\or%
+\sceglivii{#5}{#7}{#1}{#4}{#6}{#3}{#2}{#8}\or%
+\sceglivii{#6}{#3}{#4}{#2}{#1}{#5}{#7}{#8}\or%
+\sceglivii{#2}{#5}{#1}{#6}{#7}{#4}{#3}{#8}\or%
+\sceglivii{#1}{#2}{#7}{#5}{#3}{#4}{#6}{#8}\or%
+\sceglivii{#5}{#6}{#4}{#1}{#7}{#3}{#2}{#8}\or%
+\sceglivii{#6}{#4}{#1}{#5}{#3}{#2}{#7}{#8}\or%
+\sceglivii{#4}{#1}{#5}{#7}{#6}{#2}{#3}{#8}\or%
+\sceglivii{#7}{#2}{#4}{#6}{#5}{#3}{#1}{#8}\or%
+\sceglivii{#3}{#4}{#7}{#2}{#6}{#1}{#5}{#8}\or%
+\sceglivii{#4}{#5}{#6}{#7}{#3}{#2}{#1}{#8}\or%
+\sceglivii{#5}{#7}{#4}{#3}{#2}{#1}{#6}{#8}\or%
+\sceglivii{#3}{#6}{#7}{#4}{#1}{#2}{#5}{#8}\or%
+\sceglivii{#1}{#2}{#6}{#7}{#5}{#3}{#4}{#8}\or%
+\sceglivii{#6}{#1}{#4}{#3}{#7}{#2}{#5}{#8}\or%
+\sceglivii{#3}{#4}{#5}{#1}{#6}{#7}{#2}{#8}\or%
+\sceglivii{#7}{#6}{#1}{#4}{#3}{#5}{#2}{#8}\or%
+\sceglivii{#5}{#1}{#4}{#3}{#2}{#6}{#7}{#8}\or%
+\sceglivii{#6}{#5}{#2}{#1}{#3}{#7}{#4}{#8}\or%
+\sceglivii{#2}{#4}{#7}{#3}{#5}{#1}{#6}{#8}\or%
+\sceglivii{#7}{#3}{#6}{#5}{#2}{#4}{#1}{#8}\or%
+\sceglivii{#4}{#2}{#3}{#6}{#5}{#7}{#1}{#8}\or%
+\sceglivii{#5}{#6}{#1}{#2}{#3}{#4}{#7}{#8}\or%
+\sceglivii{#4}{#5}{#6}{#3}{#1}{#7}{#2}{#8}\or%
+\sceglivii{#1}{#3}{#5}{#4}{#2}{#7}{#6}{#8}\or%
+\sceglivii{#2}{#3}{#7}{#5}{#6}{#1}{#4}{#8}\or%
+\sceglivii{#1}{#6}{#4}{#2}{#7}{#5}{#3}{#8}\or%
+\sceglivii{#7}{#5}{#2}{#4}{#1}{#3}{#6}{#8}\or%
+\sceglivii{#2}{#7}{#3}{#1}{#6}{#5}{#4}{#8}\or%
+\sceglivii{#1}{#3}{#4}{#2}{#7}{#6}{#5}{#8}\or%
+\sceglivii{#3}{#5}{#1}{#6}{#2}{#4}{#7}{#8}\fi}
+%%% pseudorandom versions (permutations of 8 esercises)
+\def\scegliviii#1#2#3#4#5#6#7#8#9{\expandafter\def\csname #9i\endcsname{#1}\expandafter\def\csname #9ii\endcsname{#2}%%
+\expandafter\def\csname #9iii\endcsname{#3}\expandafter\def\csname #9iv\endcsname{#4}\expandafter\def\csname #9v\endcsname{#5}%%
+\expandafter\def\csname #9vi\endcsname{#6}\expandafter\def\csname #9vii\endcsname{#7}\expandafter\def\csname #9viii\endcsname{#8}}
+\def\prendiviii#1#2#3#4#5#6#7#8#9{\ifcase\restotrenta\or%
+\scegliviii{#2}{#8}{#6}{#7}{#4}{#3}{#1}{#5}{#9}\or%
+\scegliviii{#8}{#5}{#1}{#3}{#7}{#6}{#4}{#2}{#9}\or%
+\scegliviii{#7}{#1}{#8}{#6}{#3}{#2}{#5}{#4}{#9}\or%
+\scegliviii{#6}{#3}{#7}{#5}{#1}{#4}{#2}{#8}{#9}\or%
+\scegliviii{#4}{#1}{#2}{#3}{#5}{#7}{#8}{#6}{#9}\or%
+\scegliviii{#3}{#8}{#7}{#1}{#6}{#4}{#5}{#2}{#9}\or%
+\scegliviii{#5}{#3}{#8}{#6}{#1}{#7}{#2}{#4}{#9}\or%
+\scegliviii{#8}{#6}{#3}{#4}{#7}{#2}{#5}{#1}{#9}\or%
+\scegliviii{#6}{#4}{#8}{#7}{#5}{#1}{#3}{#2}{#9}\or%
+\scegliviii{#3}{#2}{#7}{#5}{#4}{#6}{#1}{#8}{#9}\or%
+\scegliviii{#4}{#3}{#6}{#7}{#8}{#1}{#2}{#5}{#9}\or%
+\scegliviii{#3}{#7}{#5}{#2}{#4}{#8}{#6}{#1}{#9}\or%
+\scegliviii{#4}{#8}{#7}{#3}{#2}{#1}{#6}{#5}{#9}\or%
+\scegliviii{#7}{#2}{#4}{#8}{#5}{#6}{#1}{#3}{#9}\or%
+\scegliviii{#1}{#7}{#2}{#3}{#4}{#5}{#6}{#8}{#9}\or%
+\scegliviii{#7}{#1}{#8}{#5}{#2}{#4}{#3}{#6}{#9}\or%
+\scegliviii{#8}{#3}{#5}{#4}{#1}{#2}{#6}{#7}{#9}\or%
+\scegliviii{#5}{#1}{#8}{#3}{#4}{#6}{#7}{#2}{#9}\or%
+\scegliviii{#4}{#7}{#2}{#5}{#1}{#8}{#6}{#3}{#9}\or%
+\scegliviii{#5}{#3}{#1}{#6}{#2}{#4}{#8}{#7}{#9}\or%
+\scegliviii{#2}{#1}{#7}{#3}{#4}{#8}{#5}{#6}{#9}\or%
+\scegliviii{#1}{#8}{#6}{#4}{#5}{#2}{#3}{#7}{#9}\or%
+\scegliviii{#3}{#1}{#8}{#5}{#4}{#7}{#6}{#2}{#9}\or%
+\scegliviii{#5}{#4}{#3}{#2}{#6}{#7}{#8}{#1}{#9}\or%
+\scegliviii{#6}{#5}{#4}{#1}{#3}{#2}{#7}{#8}{#9}\or%
+\scegliviii{#1}{#6}{#2}{#8}{#3}{#5}{#7}{#4}{#9}\or%
+\scegliviii{#2}{#7}{#8}{#1}{#4}{#3}{#5}{#6}{#9}\or%
+\scegliviii{#5}{#8}{#3}{#4}{#7}{#6}{#1}{#2}{#9}\or%
+\scegliviii{#7}{#4}{#2}{#5}{#1}{#6}{#8}{#3}{#9}\or%
+\scegliviii{#2}{#3}{#7}{#1}{#6}{#5}{#4}{#8}{#9}\fi}
+
+%========================================================%
+% Shuffle %
+%========================================================%
+
+\newcommand\shuf@ch{}%%% the exercise list
+\renewcommand{\theshuf@lop}{\roman{shuf@lop}}%
+\newcommand\shuf@ifch[3]{% #2=the input item
+\ifthenelse{\not\equal{\shuf@ch}{#1}}{\stepcounter{shuf@lop}\expandafter\edef\csname #2\theshuf@lop\endcsname{#3}}{}%
+}
+\newcommand\esami@item[2]{%%% #1=the list #2=name of the input item
+ \edef\es@Lista{\zap@space#1 \@empty}%
+ \@for\shuf@ch:=\es@Lista\do{%
+ \shuf@ifch{}{#2}{\shuf@ch}%
+}
+}
+\newcommand{\sh@chex}[2]{%%% #1=the list #2=name of the input item
+\setcounter{shuf@lop}{0}%
+\renewcommand{\theshuf@lop}{\roman{shuf@lop}}%
+\esami@item{#1}{#2}%
+\renewcommand{\theshuf@lop}{\arabic{shuf@lop}}%
+}
+
+%%% the command \es@randestrai choices in the list #2 leaving out #1 elements. #3=name input file, #4=name output file, #5=total number of file
+\newcommand{\es@randestrai}[5][0]{\sh@max=#1\sh@chex{#2}{#3}\rand@getitems{#5}{#4}[#3]}%
+\newcommand{\randes@trai}[3][0]{%%% it extracts objects from the list #2 leaving out #1 elements. The objects will be named #3i, #3ii, ecc.
+\es@randestrai[#1]{#2}{tmp@in}{#3}{\theshuf@lop}
+}
+%%% \randestrai is the user command to randomly extract objects from the list #2 leaving out #1 elements.
+%%% \randestraialfa extracts #1 random objects from the list #2 preserving order and naming them #3i,#3ii, ecc.
+
+\ifes@param%%% for parametric version
+\newcommand{\randestrai}[3][0]{
+\randes@trai[#1]{#2}{tmp@out}
+ \tmp@cntb=\value{shuf@lop}
+ \advance\tmp@cntb by -#1
+ \loop
+ \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{#3\romannumeral\tmp@cntb}%
+ \advance\tmp@cntb by-1
+ \ifnum\tmp@cntb>0
+ \repeat
+\immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file
+ \immediate\closeout\params
+}
+\newcommand{\estraialfa}[3]{
+\beg@al=#1
+\loop
+\expandafter\edef\csname #3\romannumeral\beg@al \endcsname{(#3\romannumeral\beg@al)}
+\advance\beg@al by-1
+\ifnum\beg@al>0
+\repeat
+\immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file
+}
+\else
+\newcommand{\randestrai}[3][0]{
+\randes@trai[#1]{#2}{tmp@out}
+ \tmp@cntb=\value{shuf@lop}
+ \advance\tmp@cntb by -#1
+ \loop
+ \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{\csname tmp@out\romannumeral\tmp@cntb\endcsname}%
+ \advance\tmp@cntb by-1
+ \ifnum\tmp@cntb>0
+ \repeat
+ }%
+ \newcommand{\estraialfa}[3]{\sh@chex{#2}{al@f}%
+\end@al=\value{shuf@lop}%
+\beg@al=#1%
+\loop%
+\advance\beg@al by-1%
+\FPsetpar{tmpalf}{\beg@al}{\end@al}[\beg@al]%
+\advance\beg@al by1 %
+\expandafter\edef\csname #3\romannumeral\beg@al \endcsname{\csname al@f\romannumeral\tmpalf \endcsname}
+\ifes@fillin%
+\ifes@solutions
+\immediate\write\parametri{\string\def\expandafter\unexpanded\expandafter{\csname #3\romannumeral\beg@al\endcsname}{\csname al@f\romannumeral\tmpalf \endcsname}}%
+\fi%
+\fi
+%
+\advance\beg@al by-1%
+\end@al=\tmpalf%
+\advance\end@al by-1%
+\ifnum\beg@al>0%
+\repeat%
+}
+\fi
+
+%%% the command \es@estrai choices in list #2 leaving out #1 elements. #3=name input file, #4=name output file, #5=counter name
+\newcommand{\es@estrai}[5][0]{\sh@max=#1\sh@chex{#2}{#3}\@getitems{#3}{#5}{#4}}
+
+\newcommand{\es@trai}[3][0]{%%% it extracts objects from the list #2 leaving out #1 elements. The objects will be named #3i, #3ii, ecc.
+\es@estrai[#1]{#2}{tmp@in}{#3}{\theshuf@lop}
+}
+%%% \estrai is the user command to extract objects from the list #2 leaving out #1 elements.
+%%% \estraialfa extracts #1 random objects from the list #2 preserving order and naming them #3i,#3ii, ecc.
+
+\ifes@param%%% for parametric version
+\newcommand{\estrai}[3][0]{
+\es@trai[#1]{#2}{tmp@out}
+ \tmp@cntb=\value{shuf@lop}
+ \advance\tmp@cntb by -#1
+ \loop
+ \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{#3\romannumeral\tmp@cntb}%
+ \advance\tmp@cntb by-1
+ \ifnum\tmp@cntb>0
+ \repeat
+\immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file
+ \immediate\closeout\params
+}
+\else
+\newcommand{\estrai}[3][0]{
+\es@trai[#1]{#2}{tmp@out}
+ \tmp@cntb=\value{shuf@lop}
+ \advance\tmp@cntb by -#1
+ \loop
+ \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{\csname tmp@out\romannumeral\tmp@cntb\endcsname}%
+ \ifes@fillin%
+\ifes@solutions
+\immediate\write\parametri{\string\def\expandafter\unexpanded\expandafter{\csname #3\romannumeral\tmp@cntb\endcsname}{\csname tmp@out\romannumeral\tmp@cntb\endcsname}}%
+\fi%
+\fi
+ \advance\tmp@cntb by-1
+ \ifnum\tmp@cntb>0
+ \repeat
+ }%
+\fi
+
+%%% \esestrai is the user command to extract exercises from the list #2 leaving out #1 elements.
+
+\newcommand{\estraies}[2][0]{\es@trai[#1]{#2}{tmp@out}
+ \tmp@cnt=\value{shuf@lop}
+ \advance\tmp@cnt by -#1
+ \loop
+ \selectrandomly{\cartella/\csname tmp@out\romannumeral\tmp@cnt\endcsname}
+ \advance\tmp@cnt by-1
+ \ifnum\tmp@cnt>0
+ \repeat}%
+%%% New user command to (randomly) extract exercises from the list #2 leaving out #1 elements. NEW 2015.09.14
+\newcommand{\randestraies}[2][0]{\randes@trai[#1]{#2}{tmp@out}
+ \tmp@cnt=\value{shuf@lop}
+ \advance\tmp@cnt by -#1
+ \loop
+ \selectrandomly{\cartella/\csname tmp@out\romannumeral\tmp@cnt\endcsname}
+ \advance\tmp@cnt by-1
+ \ifnum\tmp@cnt>0
+ \repeat}%
+
+%%% \esercizi is the command that selects and shuffles the exercises from the list #1
+
+\newcommand{\esercizi}[1]{\sh@max=0\sh@chex{#1}{exe}\sh@mixex}
+
+\newcommandx{\rand@getitems}[3][3=item]{%%% randomly shuffles #1 elements named #2i, #2ii, ecc. and renames them #3i, #3ii, ecc.
+ \i@sh=#1
+ \loop%
+ \expandafter\let \csname flag\number\i@sh\endcsname a%
+ \advance\i@sh by-1%
+ \ifnum\i@sh > 0 \repeat%
+ \i@sh=#1
+ \loop%
+ \setrannum{\j@sh}{1}{#1}%
+ \expandafter\ifx \csname flag\number\j@sh\endcsname a%
+ \expandafter\let \csname flag\number\j@sh\endcsname b
+ \FPeval\n@tmp{round(#1-\number\i@sh+1:0)}%
+ \expandafter\edef\csname #2\romannumeral\n@tmp\endcsname{\csname #3\romannumeral\j@sh\endcsname}%
+ \advance\i@sh by-1%
+ \fi%
+ \ifnum\i@sh>0 \repeat
+}
+\ifes@fissa%%% with n<8 exercises the shuffle is pseudorandom and it's random otherwise
+\def\@getitems#1#2#3{
+\ifcase#2\or\prendii{\csname #1i\endcsname}{#3}%
+\or\prendiii{\csname #1i\endcsname}{\csname #1ii\endcsname}{#3}%
+\or\prendiiii{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{#3}%
+\or\prendiiv{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{\csname #1iv\endcsname}{#3}%
+\or\prendiv{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{\csname #1iv\endcsname}{\csname #1v\endcsname}{#3}%
+\or\prendivi{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{\csname #1iv\endcsname}{\csname #1v\endcsname}{\csname #1vi\endcsname}{#3}%
+\or\prendivii{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{\csname #1iv\endcsname}{\csname #1v\endcsname}{\csname #1vi\endcsname}{\csname #1vii\endcsname}{#3}%
+\or\prendiviii{\csname #1i\endcsname}{\csname #1ii\endcsname}{\csname #1iii\endcsname}{\csname #1iv\endcsname}{\csname #1v\endcsname}{\csname #1vi\endcsname}{\csname #1vii\endcsname}{\csname #1viii\endcsname}{#3}%
+\else
+\old@randomii=\number\randomi
+\nextrandom
+\rand@getitems{#2}{#3}[#1]%
+\randomi\number\old@randomii
+\fi%
+}%
+\else
+\def\@getitems#1#2#3{%%% random shuffle
+\rand@getitems{#2}{#3}[#1]%
+}
+\fi
+\def\cartella{\currfiledir}
+\ifthenelse{\equal{\cartella}{}}{\def\cartella{.}}{}
+\ifes@shuffleQuestions
+\newcommand{\sh@mixex}{%%% shuffled exercises
+\@getitems{exe}{\theshuf@lop}{file}%
+ \tmp@cnt=\value{shuf@lop}
+ \loop
+ \selectrandomly{\cartella/\csname file\romannumeral\tmp@cnt\endcsname}
+ \advance\tmp@cnt by-1
+ \ifnum\tmp@cnt>0
+ \repeat
+}%
+\else
+\newcommand{\sh@mixex}{%%% the exercises are not shuffled
+ \tmp@cnt=1%
+ \loop%
+ \selectrandomly{\cartella/\csname exe\romannumeral\tmp@cnt\endcsname}
+ \ifnum\tmp@cnt<\value{shuf@lop}
+\advance\tmp@cnt by1
+ \repeat
+}
+\fi
+
+
+%%% another shuffling macro %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them
+
+\newcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln
+ \old@rando=\number\randomi
+ \randomi=\semeex
+ \@shfctr=1\relax
+ \whiledo{\@shfctr < 101}%
+ {%
+ \setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3}
+ \ifnum\@shfA=\@shfB
+ \else
+ \edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}%
+ \let\@tmpA=\@@tmpA
+ \edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}%
+ \let\@tmpB=\@@tmpB
+ \expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}%
+ \expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}%
+ \fi
+ \advance\@shfctr by 1\relax
+ \ifthenelse{\equal{#1}{}}{}{
+ \@shfA=0%
+ \loop
+ \advance\@shfA by1
+ \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname}
+ \ifnum\@shfA<#3 \repeat
+}
+ }%
+ \randomi=\number\old@rando
+}
+
+ \newcommand{\shufflees}[3][]{% %%% this command has been adapted from probsoln %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them
+ %\old@rando=\number\randomi
+ % \randomi=404
+ \@shfctr=1\relax
+ \whiledo{\@shfctr < 101}%
+ {%
+ \setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3}
+ \ifnum\@shfA=\@shfB
+ \else
+ \edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}%
+ \let\@tmpA=\@@tmpA
+ \edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}%
+ \let\@tmpB=\@@tmpB
+ \expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}%
+ \expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}%
+ \fi
+ \advance\@shfctr by 1\relax
+ \ifthenelse{\equal{#1}{}}{}{
+ \@shfA=0%
+ \loop
+ \advance\@shfA by1
+ \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname}
+ \ifnum\@shfA<#3 \repeat
+ }
+ }%
+ %\randomi=\number\old@rando
+ }
+
+
+%========================================================%
+% Random (adapted from aebrandom) %
+%========================================================%
+
+\ifes@randomizeChoices
+\def\@ansChoices[#1]%
+{%
+ \ifes@randomizeChoices
+ \setkeys{bchoice}{#1,random=true}%
+ \else
+ \setkeys{bchoice}{#1}%
+ \fi
+ \global\es@tabColCnt=0
+ \ifes@randomizeChoices\expandafter\@@bChoices
+ \else\expandafter\@@ansChoices\fi
+}
+\def\@@ansChoices{%
+ \ifnum\aeb@numCols=1% % list mode
+ \def\es@next{\@layoutListAns}%
+ \else% % tabular mode
+ \edef\es@next{\noexpand\@layoutTabularAns{\bChoiceNumCols}}%
+ \fi
+ \es@next
+}
+\newtoks\aeb@hold\aeb@hold={}
+\def\@@bChoices{\gdef\@temphold{}\gdef\@tempholdrandom{}%
+ \gdef\@tempholdfreeze{}\aeb@searchfortoken{\@getAns}%
+}
+\def\aeb@searchfortoken#1{%
+ \@ifnextchar\Ans{\advance\aeb@numChoices1\relax#1}
+ {\@ifnextchar\eFreeze{\expandafter\@getFreezeAns\@gobble}
+ {\@ifnextchar\par{\def\@@temp{\aeb@searchfortoken{#1}}%
+ \expandafter\@@temp\@gobble}{\@eChoices}}}%
+}
+\long\def\@getAns\Ans#1\eAns{%
+ \g@addto@macro\@temphold{{\Ans#1\eAns}}%
+ \aeb@searchfortoken{\@getAns}%
+}
+\def\@getFreezeAns{\aeb@searchfortoken{\@@getFreezeAns}}
+\long\def\@@getFreezeAns\Ans#1\eAns{%
+ \g@addto@macro\@tempholdfreeze{\Ans#1\eAns}%
+ \aeb@searchfortoken{\@@getFreezeAns}%
+}
+\long\def\@eChoices#1\eChoices{%
+ \aeb@randomizeChoices{\the\aeb@numChoices}%
+}
+\def\aeb@randomizeChoices#1{%
+ \setrannum{\aeb@ranChoice}{1}{#1}
+ \count0=0 \aeb@hold=\expandafter{\@temphold}\def\@temphold{}%
+ \expandafter\@tfor\expandafter
+ \@temp\expandafter:\expandafter=\the\aeb@hold \do {%
+ \advance\count0by1
+ \ifnum\count0=\aeb@ranChoice
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@tempholdrandom\@temp}%
+ \edef\@tempholdrandom{\the\aeb@hold}%
+ \else
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@temphold\expandafter{\@temp}}%
+ \edef\@temphold{\the\aeb@hold}%
+ \fi
+ }%
+ \aeb@numChoices=#1
+ \advance\aeb@numChoices-1
+ \ifnum\aeb@numChoices=0\relax\def\@next{\aeb@finishedRandomizing}\else
+ \def\@next{\aeb@randomizeChoices{\the\aeb@numChoices}}\fi
+ \@next
+}
+\def\aeb@finishedRandomizing{%
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@tempholdrandom\@tempholdfreeze}%
+ \gdef\@temphold{}\gdef\@tempholdrandom{}\gdef\@tempholdfreeze{}%
+ \edef\finished@Randomizing{%
+ \noexpand\@@ansChoices
+ \the\aeb@hold
+ \noexpand\eChoices}%
+ \finished@Randomizing
+}
+\fi
+\endinput