From 050e4ce3134f192d97181d2bb1d8fb3cacce2a0b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 Apr 2013 22:35:45 +0000 Subject: esami (25apr13) git-svn-id: svn://tug.org/texlive/trunk@30109 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/esami/README | 83 + .../doc/latex/esami/doc/esami-doc-en.pdf | Bin 0 -> 435921 bytes .../doc/latex/esami/doc/esami-doc-en.tex | 713 ++++++++ .../doc/latex/esami/doc/esami-doc-it.pdf | Bin 0 -> 439855 bytes .../doc/latex/esami/doc/esami-doc-it.tex | 717 ++++++++ Master/texmf-dist/doc/latex/esami/doc/esami.bib | 55 + .../doc/latex/esami/doc/examples/master-sol.tex | 70 + .../doc/latex/esami/doc/examples/master.tex | 69 + .../doc/latex/esami/doc/examples/problem1.tex | 32 + .../latex/esami/doc/examples/problem2-tabella.tex | 35 + .../latex/esami/doc/examples/problem3-matching.tex | 32 + .../latex/esami/doc/examples/problem4-fillin.tex | 25 + .../doc/latex/esami/doc/examples/test1.tex | 17 + .../doc/latex/esami/doc/examples/test11.tex | 19 + .../doc/latex/esami/doc/examples/test12.tex | 42 + .../doc/latex/esami/doc/examples/test13.tex | 57 + .../doc/latex/esami/doc/examples/test14.tex | 71 + .../doc/latex/esami/doc/examples/test2.tex | 42 + .../doc/latex/esami/doc/examples/test3.tex | 57 + .../doc/latex/esami/doc/examples/test4.tex | 71 + .../doc/latex/esami/doc/examples/test5-fillin.tex | 22 + .../doc/latex/esami/doc/examples/testA.pdf | Bin 0 -> 222803 bytes .../doc/latex/esami/doc/examples/testA.tex | 77 + .../latex/esami/doc/examples/totale-versioni.tex | 47 + Master/texmf-dist/doc/latex/esami/es-UKenglish.lng | 60 + Master/texmf-dist/doc/latex/esami/es-USenglish.lng | 54 + Master/texmf-dist/doc/latex/esami/es-french.lng | 55 + Master/texmf-dist/doc/latex/esami/es-german.lng | 54 + Master/texmf-dist/doc/latex/esami/es-greek.lng | 63 + Master/texmf-dist/doc/latex/esami/es-italian.lng | 65 + Master/texmf-dist/doc/latex/esami/es-spanish.lng | 66 + Master/texmf-dist/doc/latex/esami/esami-xyz.cfg | 88 + Master/texmf-dist/tex/latex/esami/esami.sty | 1823 ++++++++++++++++++++ 33 files changed, 4681 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/esami/README create mode 100644 Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.pdf create mode 100644 Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.pdf create mode 100644 Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/esami.bib create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/master-sol.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/master.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/problem1.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/problem2-tabella.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/problem3-matching.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/problem4-fillin.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test1.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test11.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test12.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test13.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test14.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test2.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test3.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test4.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/test5-fillin.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/testA.pdf create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/testA.tex create mode 100644 Master/texmf-dist/doc/latex/esami/doc/examples/totale-versioni.tex create mode 100644 Master/texmf-dist/doc/latex/esami/es-UKenglish.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-USenglish.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-french.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-german.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-greek.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-italian.lng create mode 100644 Master/texmf-dist/doc/latex/esami/es-spanish.lng create mode 100644 Master/texmf-dist/doc/latex/esami/esami-xyz.cfg create mode 100644 Master/texmf-dist/tex/latex/esami/esami.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/esami/README b/Master/texmf-dist/doc/latex/esami/README new file mode 100644 index 00000000000..c2a04a70759 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/README @@ -0,0 +1,83 @@ + The esami package + For generation of texts and solutions of exams in LaTeX + + +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--2013 Grazia Messineo & Salvatore Vassallo +Licence: LPPL + +FILES IN DISTRIBUTION +===================== + + BASE DISTRIBUTION: + + README This file. + esami.sty The main file + xyz.cfg A template of configuration file + es-*.lng Localisation files + + DOCUMENTATION: + + doc-esami-en.pdf User manual in English + doc-esami-it.pdf User manual in Italian + doc-esami-*.tex Sources for documentation + + 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 + test11.tex + test12.tex + test13.tex + test14.tex + test2.tex + test3.tex + test4.tex + test5-fillin.tex + + Exercises with open answers + problem1.tex + problem2-tabella.tex + problem3-matching.tex + problem4-fillin.tex + + Examples of an exam built using above exercises + testA.pdf + testA.tex + +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: + + /tex/latex/esami/ + esami.sty The main file + xyz.cfg A template of configuration file + es-*.lng Localisation files + + + /doc/latex/booktabs/ + 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/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.pdf b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.pdf new file mode 100644 index 00000000000..50f4ea70ac2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.pdf differ diff --git a/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.tex b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.tex new file mode 100644 index 00000000000..d7d835c16ce --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-en.tex @@ -0,0 +1,713 @@ +%\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{textcomp} +\usepackage{lmodern} +\usepackage{comandi} +\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 + +% +%\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}{2012/03/08}{First version released to CTAN} + +\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 1.0} +\def\filedate{2013/03/08} + + + \title{Package esami\thanks{This document + refers to the package \textsf{esami}~\fileversion, with date \filedate.}} + \author{Grazia Messineo \\ Salvatore Vassallo } +\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{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 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: +\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{pstricks}, \pkgname{pstricks-add} e \pkgname{auto-pst-pdf}: for graphics (our choice was \pkgname{pstricks} instead of other similar packages because we are used to it); +\end{enumerate} +Moreover following packages are optional, but recommended: +\begin{enumerate} +\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. +\end{enumerate} +All these packages are available both in \TeX Live and in Mik\TeX. %%%FLAVIO + +\section{Installation} + +The package contains the file {\tt esami.sty}, some configuration files {\tt *.cfg}, 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[]{article} +\usepackage[]{esami} +\end{verbatim} +Options are discussed in section \ref{sec:opzioni}. +\begin{verbatim} +\def\numcompiti{10} +\date{2013/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} +\date{\Data} \pagestyle{esame} +%% \immediate\openout\sols=\thenomefile.sol.tex +\end{verbatim} + Command \cmd{\pagestyle} is defined in a configuration file (see section \ref{sec:cfg}) and defines headers and footers. The commented command is used in the solutions file to generate another file which contains the string of the correct answers to MCQ. +\begin{verbatim} +\whiledo{\thevers<\numcompiti}{\stepcounter{vers} +\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}. +\begin{verbatim} +%%\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth} +\string\large\string\textbf{Solution of Version n. \thevers}} +\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 commented command generates the string of the correct answers in the solutions file. +\begin{verbatim} +\begin{test}[points] +\begin{questions} +\esercizi{test1,test2,test3,test4} +\end{questions} +\end{test} +%%\immediate\write\sols{\string\par\string\end\string{enumerate\string}\string\end{minipage} +%% \string\vspace{1.5cm}} +\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. As before, the commented commands are used in the solutions file to generate the string of the correct answers. +\begin{verbatim} + \esercizi{problema1, problema2} +\end{verbatim} +chooses between two exercises with open answer. +\begin{verbatim} +\setcounter{page}{1} +} +%%\immediate\closeout\sols +%%\stringasol +\end{document} +\end{verbatim} +It ends the routine for the compilation and closes the string of correct answers in the solution file. + + +\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{solutionsonly}: it generates a file with the solutions only if the environment \envname{domanda} is used; + \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 \optname{fillb}: this option is necessary in order to have the correct answers in the string of solutions if there are exercises of \verb|fillin| type; + \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 package \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:lngsec: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\{ .... \}} (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}[] + ... + \end{test} +\end{verbatim} +\DescribeMacro{points} +The optional parameter \oarg{points} must be an integer number greater or equal to 1, which is 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 by 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 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} (see \ref{estraies}).\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. + +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} +\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. + +\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. +\subsection{Other kinds of exercise}\label{sec:altri_esercizi} +We have defined other new kinds of exercise: +\paragraph{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}. + +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}). +\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. +\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. + +\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}\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) 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}\marg{operation}}}:\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 + con \cmd{\FPsv}. +\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} + \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 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}. +\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 \oarg{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{\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}\marg{name} works as the command \cmd{\estrai}, but only on a list of exercises. Once the elements nave 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), 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. +\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. + +\bibliographystyle{plain} +\bibliography{esami} + +\end{document} + diff --git a/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.pdf b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.pdf new file mode 100644 index 00000000000..952db57699d Binary files /dev/null and b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.pdf differ diff --git a/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.tex b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.tex new file mode 100644 index 00000000000..a619e7748fa --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/esami-doc-it.tex @@ -0,0 +1,717 @@ +%\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{textcomp} +\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 + +% +%\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}{2012/03/08}{Prima versione rilasciata al CTAN} + +%\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 1.0} +\def\filedate{2013/03/08} + + + \title{Il pacchetto esami\thanks{Questo documento + corrisponde al pacchetto \textsf{esami}~\fileversion, con data \filedate.}} + \author{Grazia Messineo \\ Salvatore Vassallo } +\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 \LaTeX. + +Lo sviluppo del pacchetto è iniziato nel 2008 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: +\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{pstricks}, \pkgname{pstricks-add} e \pkgname{auto-pst-pdf}: per i grafici. +\end{enumerate} +Inoltre i seguenti pacchetti sono opzionali, ma raccomandati: +\begin{enumerate} + \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. +\end{enumerate} +Tutti i pacchetti sono disponibili sia in \TeX Live che in Mik\TeX. + +\section{Installazione} Il pacchetto è composto dal file {\tt esami.sty}, da alcuni file di configurazione {\tt *.cfg}, 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 \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[]{esami} +\end{verbatim} +Le opzioni sono discusse nella sezione \ref{sec:opzioni} +\begin{verbatim} +\def\numcompiti{10} +\date{2013/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 \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} +%% \immediate\openout\sols=\thenomefile.sol.tex +\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 si usa nel file delle soluzioni per generare il file che contiene la stringa delle soluzioni. +\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)} +\randomi=\seme +\end{verbatim} +genera il seme per i processi di randomizzazione e lo assegna anche a \cmd{\randomi} +\begin{verbatim} +%%\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth} + \string\large\string\textbf{Soluzione Versione n. \thevers}} +\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 l'istruzione commentata serve nel file soluzioni per la stringa delle soluzioni. +\begin{verbatim} +\begin{test}[punti] +\begin{questions} +\esercizi{test1,test2,test3,test4} +\end{questions} +\end{test} +%%\immediate\write\sols{\string\par\string\end\string{enumerate\string}\string\end{minipage} +%% \string\vspace{1.5cm}} +\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. Come sopra i comandi commentati servono per il file soluzioni per generare la stringa delle soluzioni. +\begin{verbatim} +\esercizi{problema1, problema2} +\end{verbatim} + sceglie tra due esercizi a risposta aperta. +\begin{verbatim} +\closevers +} +%%\immediate\closeout\sols +%%\stringasol +\end{document} +\end{verbatim} +Termina la routine di compilazione, e, nel file delle soluzioni, chiude il file della stringa delle risposte. + + +\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 predefiniti 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 (default). + \item {\color{blue}{\optname{solutions}}}: genera il file delle soluzioni. + \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 iniziale, 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}}}: da usare se nel compito ci sono esercizi di tipo \texttt{fillin}, per poter inserire le risposte corrette nella stringa delle soluzioni. + \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: utile soprattutto se si usano le due colonne. + \item {\color{blue}{\optname{autopston}}} e {\color{blue}{\optname{autopstoff}}}: caricano il pacchetto \pkgname{auto-pst-pdf} e permettono di compilare il file direttamente con 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} (\TeX Live) o \texttt{write18} (MiK\TeX) nell'esecuzione di pdflatex.}. +\item {\color{blue}{\optname{language}}}: legge il file di localizzazione es-language.lng (si veda \ref{sec:lngsec: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\{ .... \}} (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}. +\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} può essere solo un numero intero maggiore o uguale a 1, che 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'' dal 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 per il caricamento di esercizi}. + +È possibile sia inserire tutti gli esercizi con un unico comando, sia usare +più comandi \cmd{\esercizi} o \cmd{\estraies} (si veda \ref{estraies}).\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. + +Nel file degli esercizi, la sintassi da usare all'interno di +\cmd{\newproblem} è la seguente: +\begin{verbatim} \item \PTs{punteggio} +...testo... \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} + \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 +\item {\color{blue}{\cmd{\eFreeze}}} introduce (se si vuole) una o più risposte che non saranno in ordine casuale. +\end{itemize} +\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} +} + +\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. + +\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] +.... 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] + .... 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. +\subsection{Altre tipologie di esercizi}\label{sec:altri_esercizi} +Sono state definite alcune nuove tipologie di esercizio: +\paragraph{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}. + +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. + +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}). +\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. +\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. + +\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 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} +%\section{Il pacchetto comandi} +%\subsection{Introduzione} +% Il pacchetto \texttt{comandi} contiene alcune macro per la formattazione del testo matematico e per l'esecuzione dei calcoli (sia all'interno degli esami che in altri file). Alcuni di questi comandi sono disponibili nel pacchetto \verb|esami| senza bisogno di caricare il pacchetto +% +% Per utilizzarlo all'interno di un documento occorre scrivere: +% +%\begin{verbatim} +% \usepackage{comandi} +%\end{verbatim} +% Il pacchetto non prevede opzioni. +\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 \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) 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}\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}. +\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} + \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 $-$. +\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 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}. + \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 \oarg{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{\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}\marg{nome} 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}. + +\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), 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. +\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 modulo dell'esame (comando \verb!\modulo!), +il numero di compiti da generare (comando \cmd{\numcompiti}), +%se si tratta di prova completa o parziale (comando \verb|\compito|) +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\}\textbackslash}, 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. + + +\bibliographystyle{plain} +\bibliography{esami} + \end{document} diff --git a/Master/texmf-dist/doc/latex/esami/doc/esami.bib b/Master/texmf-dist/doc/latex/esami/doc/esami.bib new file mode 100644 index 00000000000..6691945e3fe --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/esami.bib @@ -0,0 +1,55 @@ +% This file was created with JabRef 2.9.2. +% Encoding: Cp1252 + +@MISC{examdesign, + author = {Jason Alexander}, + title = {The package \pkgname{examdesign}}, + howpublished = {\url{CTAN:/tex-archive/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} +} + diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/master-sol.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/master-sol.tex new file mode 100644 index 00000000000..4c25293999a --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/master-sol.tex @@ -0,0 +1,70 @@ +\documentclass[a4paper,UKenglish]{article} +\usepackage[shuffle,xyz,pointsonright,autopstoff,twocolumns,solutions]{esami}%%%%% TEMA +\usepackage{lmodern,textcomp} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} + +% +=============================+ +% | DEFINITIONS | +% +=============================+ + +\def\examname{The name of the exam} +\def\numcompiti{6}%%% The number of the versions +\date{2013/3/22}%%% THE DATE IN THE FORMAT YYYY/MM/DD +\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% + +\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} +\proofingsymbol{$\blacktriangleright$}%%% or something else +\esercizi{ +test1, +test2, +test3, +test4, +test5-fillin} +\end{questions} +\begin{questions} +\esercizi{test11, +test12, +test13, +test14, +} +\end{questions} +\end{test} +\newpage + +\section*{Part two} +\istruzioniii%%% Some other instructons + +\esercizi{problem1,problem2-tabella} +\newpage +\esercizi{problem3-matching,problem4-fillin} +\closevers +} +\end{document} diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/master.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/master.tex new file mode 100644 index 00000000000..7a838e4ac2a --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/master.tex @@ -0,0 +1,69 @@ +\documentclass[UKenglish,a4paper]{article} +\usepackage[shuffle,xyz,pointsonright,autopston,twocolumns,solutions]{esami}%%%%% TEMA +\usepackage{lmodern,textcomp} +\usepackage{babel} + +% +=============================+ +% | DEFINITIONS | +% +=============================+ + +\def\examname{The name of the exam} +\def\numcompiti{6}%%% The number of versions +\date{2013/3/22}%%% THE DATE IN THE FORMAT AAAA/M/D +\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% + +\begin{document} +\testversioni +\pagestyle{esame} +\whiledo{\thevers<\numcompiti}{\stepvers +% +=============================+ +% | THE SEED | +% +=============================+ + +\FPeval\seme{round((\thenomefile+(3*\thevers)):0)} +%%% OR OTHER SUCH AS +%\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 + +% +=============================+ +% | STUFF DEFINED IN CFG FILE | +% +=============================+ + +\testa%%% the heading +\istruzionii%%% some instructions + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\section*{Part One} +\begin{test}[8] +\begin{questions} +\proofingsymbol{$\blacktriangleright$}%%% or some other symbol +\esercizi{ +test1, +test2, +test3, +test4, +test5-fillin} +\end{questions} +\begin{questions} +\esercizi{test11, +test12, +test13, +test14, +} +\end{questions} +\end{test} +\newpage + +\section*{Part two} +\istruzioniii%%% Some other instructons + +\esercizi{problem1,problem2-tabella} +\newpage +\esercizi{problem3-matching,problem4-fillin} +\closevers +} +\end{document} diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/problem1.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/problem1.tex new file mode 100644 index 00000000000..a584624325d --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/problem1.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/Master/texmf-dist/doc/latex/esami/doc/examples/problem2-tabella.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/problem2-tabella.tex new file mode 100644 index 00000000000..8929d2c84d7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/problem3-matching.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/problem3-matching.tex new file mode 100644 index 00000000000..ede6dddc74e --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/problem4-fillin.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/problem4-fillin.tex new file mode 100644 index 00000000000..6ddbeb1f866 --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/test1.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test1.tex new file mode 100644 index 00000000000..6a1704deed3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/test1.tex @@ -0,0 +1,17 @@ +\newproblem{ +\FPsetpar{a}{2}{5} +\item \PTs{1} exercise 1a + \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 + \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/Master/texmf-dist/doc/latex/esami/doc/examples/test11.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test11.tex new file mode 100644 index 00000000000..06b577138fb --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/test12.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test12.tex new file mode 100644 index 00000000000..44f012d7e2c --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/test13.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test13.tex new file mode 100644 index 00000000000..4b8a8f0cd98 --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/test14.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test14.tex new file mode 100644 index 00000000000..af009d1df08 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/test14.tex @@ -0,0 +1,71 @@ +\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}} + +\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}} + + +\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}} + + +\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}} + +\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}} diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/test2.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test2.tex new file mode 100644 index 00000000000..04e7dd49fe5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/test2.tex @@ -0,0 +1,42 @@ +\newproblem{ +\FPsetpar{a}{2}{5} +\FPsetpar{b}{2}{5} +\FPsetpar{c}{2}{8} + +\item \PTs{1} exercise 2a $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 2b $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 2c $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/Master/texmf-dist/doc/latex/esami/doc/examples/test3.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test3.tex new file mode 100644 index 00000000000..d73607c29d9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/test3.tex @@ -0,0 +1,57 @@ +\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}} + +\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}} + + +\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}} + + +\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}} diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/test4.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test4.tex new file mode 100644 index 00000000000..ea78990cbd0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/esami/doc/examples/test5-fillin.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/test5-fillin.tex new file mode 100644 index 00000000000..9b6afd0e1e7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/test5-fillin.tex @@ -0,0 +1,22 @@ +\newproblem{ +\FPsetpar{a}{2}{5} +\FPsetpar{b}{3}{5} +%\FPsetpar{c}{\a}{8} +\item \PTs{1} + $a=\a$, $b=\b$%, $c=\c$ + +Evaluate $\a+\b=$\fillin{1cm}{$\FPsv{a+b}$} + } + +\newproblem{ +\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[u]{1cm}{$\FPsv[2]{b/k}$} + } diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/testA.pdf b/Master/texmf-dist/doc/latex/esami/doc/examples/testA.pdf new file mode 100644 index 00000000000..328a5014083 Binary files /dev/null and b/Master/texmf-dist/doc/latex/esami/doc/examples/testA.pdf differ diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/testA.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/testA.tex new file mode 100644 index 00000000000..46d31de17a8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/testA.tex @@ -0,0 +1,77 @@ +\documentclass[a4paper,UKenglish]{article} +\usepackage[shufflerandom,xyz,pointsonright,autopstoff,twocolumns,fillb,solutionsonly]{esami}%%%%% TEMA +\usepackage{lmodern,textcomp} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +% +=============================+ +% | DEFINITIONS | +% +=============================+ + +\def\examname{The name of the exam} +\def\numcompiti{4}%%% The number of the versions +\date{2013/3/22}%%% THE DATE IN THE FORMAT AAAA/M/D +\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% + +\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} +\today + + +\begin{test}[8] +\begin{questions} +\proofingsymbol{$\blacktriangleright$}%%% or something else +\esercizi{ +test1, +test2, +test3, +test4,%} +test5-fillin} +\end{questions} +\begin{questions} +\esercizi{test11, +test12, +test13, +test14, +} +\end{questions} +\end{test} +\newpage + +\part{One} +\section*{Part two} +\istruzioniii%%% Some other instructons + +\esercizi{problem1,problem2-tabella,problem3-matching,problem4-fillin} +\newpage +%\esercizi{problem3-matching,problem4-fillin} +\closevers +\newpage % + % +\setcounter{page}{1} %%% dvi +} +\end{document} diff --git a/Master/texmf-dist/doc/latex/esami/doc/examples/totale-versioni.tex b/Master/texmf-dist/doc/latex/esami/doc/examples/totale-versioni.tex new file mode 100644 index 00000000000..b787932f616 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/doc/examples/totale-versioni.tex @@ -0,0 +1,47 @@ +\documentclass[UKenglish]{article} +\usepackage[xyz,prova,pointsonright,autopstoff,param]{esami}%%% numeric version +%%\usepackage[mg,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{test11} +\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/Master/texmf-dist/doc/latex/esami/es-UKenglish.lng b/Master/texmf-dist/doc/latex/esami/es-UKenglish.lng new file mode 100644 index 00000000000..4ff77e3ecb5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-UKenglish.lng @@ -0,0 +1,60 @@ +%%% 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} + +%%% 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/Master/texmf-dist/doc/latex/esami/es-USenglish.lng b/Master/texmf-dist/doc/latex/esami/es-USenglish.lng new file mode 100644 index 00000000000..f66b0be2389 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-USenglish.lng @@ -0,0 +1,54 @@ +%%% 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} + + +%%% 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/Master/texmf-dist/doc/latex/esami/es-french.lng b/Master/texmf-dist/doc/latex/esami/es-french.lng new file mode 100644 index 00000000000..cd3ba18bc4e --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-french.lng @@ -0,0 +1,55 @@ +%%% 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} + +%%% 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'exercice \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@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Les expressions $#2i$, $#2ii$ \string\dots\space + prennent les valeurs #1 \string}\string\newline} + +%% 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{ +\catcode`\:=12 %%% for compatibility babel/fp +\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/Master/texmf-dist/doc/latex/esami/es-german.lng b/Master/texmf-dist/doc/latex/esami/es-german.lng new file mode 100644 index 00000000000..92d46829705 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-german.lng @@ -0,0 +1,54 @@ +%%% 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{L\"{o}sung} + +%%% 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} + +%%% 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/Master/texmf-dist/doc/latex/esami/es-greek.lng b/Master/texmf-dist/doc/latex/esami/es-greek.lng new file mode 100644 index 00000000000..97a2cda12a0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-greek.lng @@ -0,0 +1,63 @@ +%%% 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} + +%%% 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/Master/texmf-dist/doc/latex/esami/es-italian.lng b/Master/texmf-dist/doc/latex/esami/es-italian.lng new file mode 100644 index 00000000000..ab4ba64b484 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-italian.lng @@ -0,0 +1,65 @@ +%%% 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@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} + +%%% 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{geometry} +\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm} +\usepackage{icomma} +\usepackage{eurosym} +\usepackage[np,autolanguage]{numprint} +\newcommand*\npstyleitalian{% +\npthousandsep{\,}% +\npdecimalsign{,}% +\npproductsign{\ensuremath{\cdot}}% +\npunitseparator{~}% + \npthousandthpartsep{} +} +} diff --git a/Master/texmf-dist/doc/latex/esami/es-spanish.lng b/Master/texmf-dist/doc/latex/esami/es-spanish.lng new file mode 100644 index 00000000000..d0543ab483a --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/es-spanish.lng @@ -0,0 +1,66 @@ +%%% 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{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{Versi\'on} +\def\pagename{P\'agina} +\def\solutionsname{Soluciones} + +%%% Error Messages + +\def\es@cfgerrormessageshort{La opció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} + +%%% 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/Master/texmf-dist/doc/latex/esami/esami-xyz.cfg b/Master/texmf-dist/doc/latex/esami/esami-xyz.cfg new file mode 100644 index 00000000000..c7ed8b63de9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/esami/esami-xyz.cfg @@ -0,0 +1,88 @@ +%% Package `esami' to use with LaTeX 2e +%% Copyright (C) 2008-2013 G. Messineo e S. Vassallo +%% +%% This is file `esami-xyz.cfg', +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% esami-xyz.cfg, 2013-03-20 %% +%% Copyright (C) 2008-2013 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% +=============================+ +% | 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 + \item three +\end{itemize}}} + +\def\istruzioniii{\setlength{\fboxsep}{1.5ex}\setlength{\fboxrule}{1.2pt}{\sffamily +\framebox{\parbox{\textwidth}{\textbf{Some other instructions.}}}}\\[3ex]} diff --git a/Master/texmf-dist/tex/latex/esami/esami.sty b/Master/texmf-dist/tex/latex/esami/esami.sty new file mode 100644 index 00000000000..c9dd1e51bc7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/esami/esami.sty @@ -0,0 +1,1823 @@ +%%% +%% This is file `esami.sty', +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% esami.sty package, 2013-03-08 %% +%% Copyright (C) 2008-2013 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 + +\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami} + [2012/03/08 v1.0 An Exam Construction Package] + +% +=============================+ +% | THE OPTIONS | +% +=============================+ + +\newif\ifes@language \es@languagefalse +\DeclareOption{italian}{\InputIfFileExists{es-\CurrentOption.lng}% + { \es@languagetrue \typeout{esami: Verr\`{a} 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\c{c}aise sera utilis\'{e}e}\es@languagetrue} + { \typeout{esami: The file es-\CurrentOption.lng does not exists.}}} +\DeclareOption{spanish}{\InputIfFileExists{es-\CurrentOption.lng}% + { \typeout{esami:Se utilizar\'{a} el idioma espa\~{n}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} +\DeclareOption{fillb}{\es@fillintrue}%%% option to use if in tests there are fill-in questions +\newif\ifes@fillin \es@fillinfalse +\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\sols % +\stringasol} +}%%% for solutions +\DeclareOption{nosolutions}{\es@solutionsfalse}%%% no solutions (default) +\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? +\DeclareOption{autopstoff}{\es@autopstfalse}%%% autopstpdf inactive (default) +\DeclareOption{autopston}{\es@autopsttrue }%%%% autopstpdf active +\newif\ifes@prova \es@provafalse +\DeclareOption{prova}{\es@solutionstrue \es@provatrue \es@randomizeChoicesfalse}%%% 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 + \renewcommand*{\selectallproblems}[1]{%%% the definition of \selectallproblem to print parametric version + \global\@probN=0\relax + \firstpasstrue + \setcounter{tmp@quest}{0} + \input{#1} + \firstpassfalse + \setcounter{tmp@quest}{0} + \input{#1} + \global\tmp@cnt=1\relax + \whiledo{\tmp@cnt < \@probN \TE@or \tmp@cnt = \@probN}{% + \immediate\openout\params=params%%% the file on which the parameters are written + \csname @prob@f\nome q\number\tmp@cnt\endcsname + \par\vspace{2mm} + \ifes@test + \immediate\closeout\params + \input{params} \fi%%% writes the parameters at the end of the exercise + \global\advance\tmp@cnt by 1\relax + } + } +\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations +\renewcommand{\FPval}[2]{\expandafter\def\csname#1\endcsname{(#2)}} +\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}}} + \renewcommandx{\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 + %\expandafter\immediate\write\params{%%% write on a file + \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}}% + \immediate\closeout\params% + \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})} % + } +} +} +\ProcessOptions\relax + +% +=============================+ +% | PACKAGES | +% +=============================+ + +\usepackage{graphicx} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{enumerate} +\usepackage{fp} +\usepackage{currfile} +\usepackage{array} +\usepackage{ifthen} +\usepackage{xargs} +\usepackage{multicol} +\usepackage{pstricks,pstricks-add} +\ifes@autopst +\usepackage[crop=off,dvips={}]{auto-pst-pdf} + \else +\usepackage[off]{auto-pst-pdf} + \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} + +%========================================================% +% 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 + +%========================================================% +% 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 +\newcounter{tmp@quest}%%% the number of the exercise +\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@randomi%%% used to change seed in \FPsetpar +\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}} + +%========================================================% +% 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 % +%========================================================% + +\newcommand{\FPsv}[2][0]{\FPeval\fp@tmpa{round(#2:#1)}\numprint{\fp@tmpa}}%%% It does operations with #1 decimals and with the "param" option it shows operations +\newcommand{\FPval}[2]{\FPeval#1{round(#2:0)}}%% it works like \FPsv with the option param, like \FPeval otherwise + +%========================================================% +% 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}}} }}}}% + } + +%========================================================% +% 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{% + \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}{} + +%========================================================% +% 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 %%%%%% + +\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@solutions%%% to write the string of solutions +\immediate\write\sols{\string\item\space\string\makeatletter\space\string\input\string{qf\nome q\thetmp@quest e\thevers.parametri\string}\string\makeatother} +\immediate\write\sols{\unexpanded{#3}} +\fi +\fi + } + } + +%%%%% Other commands %%%%%% + +\long\def\Collect@Body#1{%%%%% This command is taken from the environ package %%%% + \@envbody{\expandafter#1\expandafter{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\noexpand\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% + \begingroup + \expandafter\let\csname\@currenvir\endcsname\Collect@@Body + \edef\process@envbody{% + \expandafter\noexpand\csname\@currenvir\endcsname}% + \process@envbody +} + +\newcommand\stepvers{\stepcounter{vers}\ifes@solutions +\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}\fi} +\newcommand\closevers{\newpage\setcounter{page}{1}\ifes@solutions\immediate\write\sols{\string\end{minipage} + \string\vspace{5ex}}\fi} + +\def\mydate#1/#2/#3\@empty{\setcounter{nomefile}{\two@digits{#3}\two@digits{#2}\two@digits{#1}}}%%% 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@solutions +\newwrite\sols +\immediate\openout\sols=\jobname.sol.tex + \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{af\nome q\number\j@n e\thevers} \immediate\write\sols{\string\item\string\ref{af\nome q\number\j@n e\thevers}}\fi + } +\newcommand{\prior@questionsHook}{} + +%========================================================% +% definizioni di Fpsetpar % +%========================================================% + +\def\maxLoopLimit{10}% +\newcommandx{\FPsetpar}[5][1=\seme,5={}]{% +\old@randomi=\number\randomi%%% it saves the old seed +\stepcounter{n@par}% +\setcounter{fp@contatore}{-\value{vers}}% +\randomi=#1% +\advance\randomi\value{n@par}% +\addtocounter{fp@contatore}{-#3}% +\advance\randomi\value{vers}% +\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% +%\expandafter +\immediate\write\parametri{\string\FPeval\string{#2\string}\string{round(\number\tmp@a:0)\string}}% +\fi% +\randomi=\number\old@randomi%%% restores the seed +}% + +%%%%%% Alternative definitions of \FPsetpar with different randomization process (we left them for archive purposes) %%%% + +%\newcommandx{\FPsetpar}[5][1=\seme,5={}]{% +%\stepcounter{n@par} +%\FPeval\diff{round(#4-#3+1:0)} +%\pdfsetrandomseed #1 +%\setcounter{fp@contatore}{-\value{vers}}% +%\tmp@cnt=\pdfuniformdeviate \diff +%\FPeval\tmp@seed{round(#1+\then@par:0)} +%\pdfsetrandomseed \tmp@seed %%% aggiunta 2010.04.19 +%\addtocounter{fp@contatore}{-#3} +%\FPeval\tmp@seed{round(tmp@seed+\thevers:0)} +%\pdfsetrandomseed \tmp@seed%%% aggiunta 2010.04.19 +%\whiledo{\value{fp@contatore}<\value{questionno}} +%{\tmp@cnt=\pdfuniformdeviate \diff \stepcounter{fp@contatore}} +%\FPeval{fp@tmp}{round((1-1/\diff)*\number\tmp@cnt+#3:0)} +% \def\rand@ne{#5} +% \ifx\rand@ne\@empty\else\loopCnt=0\relax +% \@whilenum\loopCnt<\maxLoopLimit\do{% +% \rnd@cnt=1\relax +% \@for\ne@@tmp:=\rand@ne\do{% +% \ifnum\fp@tmp=\ne@@tmp\relax +% \multiply\rnd@cnt0\relax +% \else +% \multiply\rnd@cnt1\relax +% \fi +% } +% \ifnum\rnd@cnt=1\relax +% \loopCnt=\maxLoopLimit +% \else +% \advance\loopCnt1\relax +% \ifnum\loopCnt=\maxLoopLimit +% \PackageWarning{esami}{Non sono state soddisfatte tutte le condizioni +% dopo \maxLoopLimit\space tentativi} +% \else +% \tmp@cnt=\pdfuniformdeviate \diff +% \FPeval{fp@tmp}{round((1-1/\diff)*\number\tmp@cnt+#3:0)} +% \fi +% \fi +% }% +% \fi +%\FPeval{#2}{round((1-1/\diff)*\number\tmp@cnt+#3:0)}} +% +%\newcommand{\FPsetpar}[4][\seme]{% +%\gdef\#2min{#3} +% \gdef\#2max{#4} +%\old@randomi=\number\randomi +%\stepcounter{n@par} +%\setcounter{fp@contatore}{-\value{vers}} +%\setrannum{\tmp@cnt}{#3}{#4} +%\randomi=#1 +%\advance\randomi\value{n@par} +%\addtocounter{fp@contatore}{-#3} +%\advance\randomi\value{vers} +%\whiledo{\value{fp@contatore}<\value{questionno}}{\nextrandom\stepcounter{fp@contatore}}%{\nextrandom\setrannum{\tmp@cnt}{#3}{#4} \stepcounter{fp@contatore}} +%\setrannum{\tmp@cnt}{#3}{#4} +%%\def\s@ss{#2} +%\FPeval{#2}{round(\number\tmp@cnt:0)} +%\ifes@fillin +% \expandafter\immediate\write\parametri{\string\FPeval\string{#2\string}\string{round(\number\tmp@cnt:0)\string}} +% \fi +% \randomi=\number\old@randomi +%} +% +%\newcommand{\FPsetpar}[4][\seme]{% +%\setcounter{fp@contatore}{-\value{vers}} +%\FPeval\dud{round(#1:0)} +%\FPseed=\dud +%\whiledo{\value{fp@contatore}<\value{questionno}}{ +%\FPrandom\tmp@cnt +%\FPeval{#2}{trunc((#4+1-#3)*tmp@cnt+#3:0)} +%\stepcounter{fp@contatore} +%} +%} + +%%%% Command for random sign (taken from rangen) %%%%% +\newcommand{\RandS}{% +\setrannum{\rnd@cnts}{0}{1} +\ifnum\number\rnd@cnts>0 ++ +\else +- +\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" +\stepcounter{tmp@quest} +\iffirstpass +\global\advance\@probN by 1 +\else +\let\nome\currfilebase + \ifes@fillin + \immediate\openout\parametri=qf\nome q\number\j@n e\thevers.parametri.tex + \fi +\expandafter\global\expandafter\newcommand\csname @prob@f\nome q\thetmp@quest \endcsname{#1}%%% it assigns a name to exercise + \fi +} +\else + \ifes@correzione + \newcommand{\newproblem}[1]{%%% \newproblem for the "correzione" option + \stepcounter{tmp@quest} + \iffirstpass + \global\advance\@probN by 1 + \else + \let\nome\currfilebase + \ifes@fillin + \immediate\openout\parametri=qf\nome q\thetmp@quest e\thevers.parametri.tex + \fi +\expandafter\global\expandafter\newcommand\csname @prob@f\nome q\thetmp@quest e\thevers \endcsname{\unexpanded{#1}} + \expandafter\global\expandafter\newcommand\csname @prob@f\nome q\thetmp@quest \endcsname{#1} + \fi + } + \else +\newcommand{\newproblem}[1]{%%% \newproblem for the exam +\stepcounter{tmp@quest} +\iffirstpass +\global\advance\@probN by 1 +\else +\let\nome\currfilebase + \ifes@fillin + \immediate\openout\parametri=qf\nome q\thetmp@quest e\thevers.parametri.tex + \fi +\expandafter\global\expandafter\newcommand\csname @prob@f\nome q\thetmp@quest e\thevers \endcsname{\unexpanded{#1}} +\expandafter\global\expandafter\newcommand\csname @probi@f\nome q\thetmp@quest e\thevers \endcsname{#1}%%% it assigns a unique name to exercise +\fi +} +\fi +\fi + +%%%%%%%% \selectrandomly %%%%%%% + +\newcommand{\selectrandomly}[1]{% +\global\@probN=0\relax +\firstpasstrue +\setcounter{tmp@quest}{0} +\input{#1}%%%%% +\FPeval\restotrentasei{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/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%%% if there are more than 8 variants, the choice is random +\setrannum{\rnd@cnta}{1}{\@probN} +\def\j@n{\number\rnd@cnta} +\fi +\firstpassfalse%%% now prints the question +\setcounter{tmp@quest}{0} +\input{#1} +\ifes@test +\begin{minipage}{.95\linewidth}\csname @probi@f\nome q\number\j@n e\thevers\endcsname \vspace{5mm}\end{minipage} +\else +\csname @probi@f\nome q\number\j@n e\thevers\endcsname \vspace{5mm} +\fi + \ifes@fillin + \immediate\closeout\parametri + \fi +} + +%%%% \selectallproblems %%%%% + +\newcommand*{\selectallproblems}[1]{%%% it selects all the problems of a file and prints them for "totale-versioni" +\global\@probN=0\relax +\firstpasstrue +\setcounter{tmp@quest}{0} +\input{#1}% +\firstpassfalse +\setcounter{tmp@quest}{0} +\input{#1}% +\global\j@m=1\relax +\whiledo{\j@m < \@probN \TE@or \j@m = \@probN}{% +\csname @prob@f\nome q\number\j@m +\endcsname \vspace{4mm} +\global\advance\j@m by 1\relax +}} + +% +=============================+ +% | 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 + \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@solutions + \immediate\write\sols{\string\begin{enumerate}} + \fi% +}{\end{list} +\ifes@solutions +\immediate\write\sols{\string\par\string\end{enumerate}\string\vspace{3ex}} +\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 + \sq@priorhook\sqlabel\space + \ignorespaces +} +\def\aftershortquizskip{\medskip} +\def\aeb@endshortquiz{\setcounter{sq@quizno}{0}% + \par\aftershortquizskip +} +\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}{0pt}% + \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}} + +%========================================================% +% 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@param \immediate\closeout\params \input{params}\fi \end{exercise} } +\newenvironment{problem*}[1][]{\es@testfalse +\renewcommand{\punti}{#1} +\ifes@solutionsonly\else\examenddef\fi +\begin{exercise*} +} +{ \ifes@param \immediate\closeout\params \input{params}\fi \end{exercise*} } + + +%%%%%%%% 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 +} + +%%% 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{#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{#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{#3}{#4}{#2}{#5}{#1}{#6}\or% +\scegliv{#3}{#1}{#4}{#2}{#5}{#6}\or% +\scegliv{#1}{#5}{#2}{#3}{#4}{#6}\or% +\scegliv{#5}{#4}{#3}{#2}{#1}{#6}\or% +\scegliv{#1}{#4}{#5}{#3}{#2}{#6}\or% +\scegliv{#5}{#3}{#1}{#4}{#2}{#6}\or% +\scegliv{#1}{#2}{#4}{#3}{#5}{#6}\or% +\scegliv{#3}{#2}{#4}{#1}{#5}{#6}\or% +\scegliv{#4}{#2}{#1}{#3}{#5}{#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{#3}{#1}{#4}{#5}{#6}{#2}{#7}\or% +\sceglivi{#1}{#6}{#2}{#4}{#5}{#3}{#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}{#1}{#3}{#4}{#2}{#6}{#7}\or% +\sceglivi{#1}{#3}{#6}{#5}{#4}{#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}{#1}{#5}{#3}{#2}{#4}{#7}\or% +\sceglivi{#6}{#1}{#5}{#4}{#3}{#2}{#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{#1}{#5}{#2}{#6}{#7}{#4}{#3}{#8}\or% +\sceglivii{#6}{#3}{#4}{#2}{#1}{#5}{#7}{#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{#3}{#6}{#7}{#4}{#1}{#2}{#5}{#8}\or% +\sceglivii{#5}{#7}{#4}{#3}{#2}{#1}{#6}{#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{#5}{#1}{#4}{#3}{#2}{#6}{#7}{#8}\or% +\sceglivii{#7}{#6}{#1}{#4}{#3}{#5}{#2}{#8}\or% +\sceglivii{#2}{#4}{#7}{#3}{#5}{#1}{#6}{#8}\or% +\sceglivii{#6}{#5}{#2}{#1}{#3}{#7}{#4}{#8}\or% +\sceglivii{#7}{#3}{#6}{#5}{#2}{#4}{#1}{#8}\or% +\sceglivii{#4}{#2}{#3}{#6}{#5}{#7}{#1}{#8}\or% +\sceglivii{#1}{#3}{#4}{#2}{#7}{#6}{#5}{#8}\or% +\sceglivii{#4}{#5}{#6}{#3}{#1}{#7}{#2}{#8}\or% +\sceglivii{#5}{#6}{#1}{#2}{#3}{#4}{#7}{#8}\or% +\sceglivii{#1}{#3}{#5}{#4}{#2}{#7}{#6}{#8}\or% +\sceglivii{#2}{#7}{#3}{#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{#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{#1}{#3}{#7}{#5}{#6}{#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}{#3}{#8}{#7}{#5}{#1}{#4}{#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{#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{#1}{#5}{#3}{#4}{#8}{#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{#1}{#2}{#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{#6}{#5}{#4}{#1}{#3}{#2}{#7}{#8}{#9}\or% +\scegliviii{#5}{#4}{#3}{#2}{#6}{#7}{#8}{#1}{#9}\or% +\scegliviii{#1}{#6}{#2}{#8}{#3}{#5}{#7}{#4}{#9}\or% +\scegliviii{#5}{#8}{#3}{#4}{#7}{#6}{#1}{#2}{#9}\or% +\scegliviii{#2}{#7}{#8}{#1}{#4}{#3}{#5}{#6}{#9}\or% +\scegliviii{#4}{#8}{#7}{#3}{#2}{#1}{#6}{#5}{#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\es@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}}% +\es@item{#1}{#2}% +\renewcommand{\theshuf@lop}{\arabic{shuf@lop}}% +} + +%%% the command \es@estrai choices in list #1: #2=name input file, #3=name output file, #4=counter name +\newcommand{\es@estrai}[4]{\sh@max=0\sh@chex{#1}{#2}\@getitems{#2}{#4}{#3}} + +%%% 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{\es@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} +} +%%% \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 +} +\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{\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}% + \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}% +\advance\beg@al by-1% +\end@al=\tmpalf% +\advance\end@al by-1% +\ifnum\beg@al>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}% + +%%% \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\rand@getitems{#2}{#3}[#1]% +\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=\value{shuf@lop} + \loop% + \selectrandomly{\cartella/\csname exe\romannumeral\tmp@cnt\endcsname} + \advance\tmp@cnt by-1 + \ifnum\tmp@cnt>0 + \repeat +} +\fi + +%========================================================% +% 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 + +%========================================================% +% 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} + +\endinput -- cgit v1.2.3