diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-27 22:45:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-27 22:45:28 +0000 |
commit | 1763513125c2b946a98a96c58651faed9c8f5634 (patch) | |
tree | 0b809d843f9a29eb2a94c42cff845f0b347a6065 /Master/texmf-dist/tex/latex | |
parent | 958e0067544a1527819ac2f103da0983a2792c8d (diff) |
esami (27feb15)
git-svn-id: svn://tug.org/texlive/trunk@36393 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-UKenglish.lng | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-USenglish.lng | 3 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-french.lng | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-german.lng | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-greek.lng | 128 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-italian.lng | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-serbian.lng | 62 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/es-spanish.lng | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/esami/esami.sty | 550 |
9 files changed, 516 insertions, 245 deletions
diff --git a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng index 4ff77e3ecb5..9b459da0bac 100644 --- a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng @@ -33,6 +33,8 @@ \def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries} \def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space assume the values #1 \string}\string\newline} +\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} +\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} %%% The date diff --git a/Master/texmf-dist/tex/latex/esami/es-USenglish.lng b/Master/texmf-dist/tex/latex/esami/es-USenglish.lng index f66b0be2389..d0194ca57ac 100644 --- a/Master/texmf-dist/tex/latex/esami/es-USenglish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-USenglish.lng @@ -33,7 +33,8 @@ \def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries} \def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space assume the values #1 \string}\string\newline} - +\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} +\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} %%% The date diff --git a/Master/texmf-dist/tex/latex/esami/es-french.lng b/Master/texmf-dist/tex/latex/esami/es-french.lng index cd3ba18bc4e..0d575ce1e53 100644 --- a/Master/texmf-dist/tex/latex/esami/es-french.lng +++ b/Master/texmf-dist/tex/latex/esami/es-french.lng @@ -33,6 +33,8 @@ \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} +\def\es@fpsetparerrshort#1{Ce n'est pas possible de définir #1} +\def\es@fpsetparerrlong#1{Dans la definition de le paramètre #1 l'extreme inferieur est plus grand que l'extreme superior} %% The date diff --git a/Master/texmf-dist/tex/latex/esami/es-german.lng b/Master/texmf-dist/tex/latex/esami/es-german.lng index 92d46829705..7362e88e144 100644 --- a/Master/texmf-dist/tex/latex/esami/es-german.lng +++ b/Master/texmf-dist/tex/latex/esami/es-german.lng @@ -36,6 +36,8 @@ Drücken Sie "x" um zu beenden und bennen Sie die Datei um. } \def\es@fpsetparerrorshort{Nicht alle Bedingungen sind nach \maxLoopLimit\space versuchen befriedigt} \def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Die Ausdrücke $#2i$, $#2ii$ \string\dots\space setzten den Wert #1 voraus\string}\string\newline} +\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} +\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} %%% The date diff --git a/Master/texmf-dist/tex/latex/esami/es-greek.lng b/Master/texmf-dist/tex/latex/esami/es-greek.lng index 97a2cda12a0..be730de4800 100644 --- a/Master/texmf-dist/tex/latex/esami/es-greek.lng +++ b/Master/texmf-dist/tex/latex/esami/es-greek.lng @@ -1,63 +1,65 @@ -%%% 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}
-}
+%%% Greek translation by Sotiris Hasapis + + +%%% Labels (esami.sty) + +\def\es@parametermessage#1#2#3{Ç ðáñÜìåôñïò $#1$ åßíáé ìåôáîý $#2$ êáé $#3$.} +\def\es@seedmessage#1{The seed is equal to $#1$.} +\def\es@pointname{âáèìüò} +\def\es@pointsname{âáèìïß} +\def\es@exercisename{¢óêçóç} +\def\es@solutionname{Ëýóç} + +%%% Labels (xyz.cfg) + +\def\profname{ÊáèçãçôÞò \ } +\def\studsignname{ÕðïãñáöÞ ÌáèçôÞ} +\def\studlastname{Åðþíõìï} +\def\studfirstname{¼íïìá} +\def\studid{Áñ.Ôáõôüôçôáò} +\def\versionname{Ýêäïóç} +\def\pagename{Óåëßäá} +\def\solutionsname{Ëýóåéò} + +%%% Error Messages + +\def\es@cfgerrormessageshort{Ç åðéëïãÞ \CurrentOption\space äåí õðÜñ÷åé} +\def\es@cfgerrormessagelong{Ôï ðáêÝôï esami áðáéôåß ìßá ðáñÜìåôñï ãéá ôï áñ÷åßï äéáìüñöùóçò} +\def\es@numcompitierror{Áðáéôåßôáé ï ðñïóäéïñéóìüò ôïõ ðëÞèïõò ôùí åêäüóåùí!} +\def\es@mastererror{WARNING: YOU CANNOT COMPILE THE MASTER FILE:\MessageBreak + PRESS 'x' TO EXIT AND RENAME THE FILE} +\def\es@zerodenerror#1#2{The fraction #1/#2 in exercise \nome \space has the denominator equal to 0} +\def\es@zeronumerrorshort#1#2{The fraction #1/#2 in exercise \nome \space is equal to 0} +\def\es@zeronumerrorlong#1#2{If the fraction can be 0, you must use the "sempliz" command} +\def\es@fraconewarn#1#2{The fraction #1/#2 in exercise \nome \space is equal to 1} +\def\es@radicalerror{The radicand in exercise \nome \space is negative} +\def\es@fpsetparerrorshort{Not all conditions are satisfied after \maxLoopLimit\space tries} +\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space + assume the values #1 \string}\string\newline} +\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} +\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} + +%%% 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/tex/latex/esami/es-italian.lng b/Master/texmf-dist/tex/latex/esami/es-italian.lng index 38037620658..4b485b95346 100644 --- a/Master/texmf-dist/tex/latex/esami/es-italian.lng +++ b/Master/texmf-dist/tex/latex/esami/es-italian.lng @@ -23,6 +23,7 @@ \def\es@cfgerrormessageshort{L'opzione \CurrentOption\space non esiste} \def\es@cfgerrormessagelong{Si deve specificare un'opzione per la configurazione nel pacchetto esami} \def\es@parametermessage#1#2#3{Il parametro $#1$ varia da $#2$ a $#3$.} +\def\es@parametermessagea#1#2{Il parametro $#1$ vale $#2$.} \def\es@seedmessage#1{Il seme vale $#1$.} \def\es@numcompitierror{Si deve specificare il numero delle versioni!} @@ -34,6 +35,8 @@ \def\es@fraconewarn#1#2{La frazione #1/#2 nell'esercizio \nome \space vale 1} \def\es@radicalerror{Il radicando nell'esercizio \nome \space è negativo} \def\es@fpsetparerrorshort{Non sono state soddisfatte tutte le condizioni dopo \maxLoopLimit\space tentativi} +\def\es@fpsetparerrshort#1{Non si può definire il parametro #1} +\def\es@fpsetparerrlong#1{Nella definizione del parametro #1 l'estremo inferiore è maggiore dell'estremo superiore} %%% The date @@ -51,10 +54,10 @@ \AtEndOfPackage{ \usepackage{babel} -\IntelligentComma +\NoIntelligentComma \usepackage{geometry} \geometry{a4paper,lmargin=6mm,rmargin=22mm,tmargin=10mm,bmargin=18mm,marginparsep=2mm,footskip=1cm} -%\usepackage{icomma} +\usepackage{icomma} \usepackage{eurosym} \usepackage[np,autolanguage]{numprint} \newcommand*\npstyleitalian{% @@ -65,4 +68,7 @@ \npthousandthpartsep{} } \npfourdigitnosep + \DeclareRobustCommand{\officialeuro}{% + \ifmmode\expandafter\text\fi + {\fontencoding{U}\fontfamily{eurosym}\selectfont e}}%euro in math } diff --git a/Master/texmf-dist/tex/latex/esami/es-serbian.lng b/Master/texmf-dist/tex/latex/esami/es-serbian.lng new file mode 100644 index 00000000000..2aed64dc0c3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/esami/es-serbian.lng @@ -0,0 +1,62 @@ +%%% Serbian translation by Dusko Latas + +%%% Labels (esami.sty) + +\def\es@parametermessage#1#2#3{Parametar $#1$ je izmeÄ‘u $#2$ i $#3$.} +\def\es@seedmessage#1{Delilac je jednak $#1$.} +\def\es@pointname{poen} +\def\es@pointsname{poena} +\def\es@exercisename{Zadatak} +\def\es@solutionname{Re\v senje} + +%%% Labels (xyz.cfg) + +\def\profname{Prof.\ } +\def\studsignname{Potpis studenta} +\def\studlastname{Prezime} +\def\studfirstname{Ime} +\def\studid{Broj indeksa} +\def\versionname{Verzija} +\def\pagename{Strana} +\def\solutionsname{Re\v senja} + + +%%% Error Messages + +\def\es@cfgerrormessageshort{Opcija \CurrentOption\space ne postoji} +\def\es@cfgerrormessagelong{Paketu esami je potrebno podesiti konfiguracioni fajl} +\def\es@numcompitierror{Neophodno je navesti!} +\def\es@mastererror{UPOZORENjE: NE MOZETE DA KOMPAJLIRATE FAJL:\MessageBreak +PRITISNITE 'x' DA BISTE IZASLI ILI PREIMENUJTE FAJL} +\def\es@zerodenerror#1#2{Razlomak #1/#2 u zadatku \nome \space ima imenilac koji je jednak 0} +\def\es@zeronumerrorshort#1#2{Razlomak #1/#2 u zadatku \nome \space je jednak 0} +\def\es@zeronumerrorlong#1#2{Da bi razlomak mogao da bude 0, morate da korisitie "sempliz" komandu} +\def\es@fraconewarn#1#2{Razlomak #1/#2 u zadatku \nome \space je jednak 1} +\def\es@radicalerror{Potkorena velicina u zadatku \nome \space je negativna} +\def\es@fpsetparerrorshort{Nisu zadovoljeni svi uslovi nakon \maxLoopLimit\space pokusaja} +\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Izrazi $#2i$, $#2ii$ \string\dots\space +pretpostavlja vrednosti #1 \string}\string\newline} +\def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} +\def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} + +%%% The date + +\def\es@longdate#1/#2/#3\@empty{#3\space\ifcase#2\or +januar\or februar\or mart\or april\or maj\or jun\or +jul\or avgust\or septembar\or oktobar\or novembar\or decembar\fi \space #1} +\def\es@shortdate#1/#2/#3\@empty{#3/#2/#1} + + +\AtEndOfPackage{ +\usepackage{geometry} +\geometry{a4paper,lmargin=6mm,rmargin=18mm,tmargin=6mm,bmargin=18mm,marginparsep=2mm,footskip=1cm} +\usepackage{eurosym} +\usepackage[np,autolanguage]{numprint} +\newcommand*\npstyleitalian{% +\npthousandsep{\,}% +\npdecimalsign{,}% +\npproductsign{\ensuremath{\cdot}}% +\npunitseparator{~}% + \npthousandthpartsep{} +} +} diff --git a/Master/texmf-dist/tex/latex/esami/es-spanish.lng b/Master/texmf-dist/tex/latex/esami/es-spanish.lng index d0543ab483a..1ac5434df8e 100644 --- a/Master/texmf-dist/tex/latex/esami/es-spanish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-spanish.lng @@ -36,6 +36,8 @@ \def\es@fpsetparerrorshort{No se verifican todas las condiciones después de \maxLoopLimit\space intentos} \def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Las expresiones $#2i$, $#2ii$ \string\dots\space toman los valores #1 \string}\string\newline} +\def\es@fpsetparerrshort#1{No es posible definir el parámetro #1} +\def\es@fpsetparerrlong#1{En la definición del parámetro #1 la cota inferior es mayor de la cota superior} %%% The date diff --git a/Master/texmf-dist/tex/latex/esami/esami.sty b/Master/texmf-dist/tex/latex/esami/esami.sty index ad26df52236..f8c6930ea99 100644 --- a/Master/texmf-dist/tex/latex/esami/esami.sty +++ b/Master/texmf-dist/tex/latex/esami/esami.sty @@ -2,8 +2,8 @@ %% This is file `esami.sty', %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% esami.sty package, 2013-03-08 %% -%% Copyright (C) 2008-2013 G. Messineo e S. Vassallo %% +%% esami.sty package, 2015-02-25 %% +%% Copyright (C) 2008-2015 G. Messineo e S. Vassallo %% %% %% %% This program can be redistributed and/or modified %% %% under the terms of the LaTeX Project Public License %% @@ -15,18 +15,26 @@ %%%%%% CHANGELOG %%%%%%% % Version 1.0 % First release to CTAN -% Version 1.1 -% Update: Inserted the dependance on the package \texttt{environ} to remove some errors in the \LaTeX\ compilation. -%Removed the dependance on the package \texttt{icomma} in the italian localization file es-italian.lng because of the introduction -%of new features in the package \texttt{babel} for the Italian langaguage (macro \texttt{IntelligentComma}). +%Version 1.1 2013/12/09 +%Inserted the dependance on the package \texttt{environ} to remove some errors in the \LaTeX\ compilation. +%Removed the dependance on the package \texttt{icomma} in the italian localization file es-italian.lng because +%of the introduction of new features in the package \texttt{babel} for the Italian langaguage (macro \texttt{IntelligentComma}). +% Version 2.0 +% 2015/02/25 +%Eliminated the dependance on \pkgname{pstricks}. Modified the use of \emph{fill-in} questions. +%Inserted the possibility to extract %more than one variant from a file. Now it is possible to view the solutions in tests. +%Modified the visualization of decimal places in command \cmd{\FPsv}. Modified the definition of \cmd{\FPval} to allow the use of decimal places. +%Modified the algorithm of choice of a variant of an exercise, now completely deterministic. +% Added the command \cmd{\Acapo}. Added the serbian localization (latin alphabet). +%The compilation produces a new file with the list of the chosen exercises. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami} - [2013/12/09 v1.1 An Exam Construction Package] + [2015/02/25 v2.0 An Exam Construction Package] % +=============================+ % | THE OPTIONS | % +=============================+ - +\usepackage{etex} \newif\ifes@language \es@languagefalse \DeclareOption{italian}{\InputIfFileExists{es-\CurrentOption.lng}% { \es@languagetrue \typeout{esami: Verrà usata la lingua italiana}}% @@ -68,77 +76,47 @@ \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 +%%% 2013-06-03 eliminata opzione +\DeclareOption{fillb}{} \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} +\AtEndDocument{ +\immediate\closeout\loe +\immediate\closeout\parametri +\immediate\closeout\sols +%%%%% 2013-06-03 % +\stringasol} %%%% }%%% for solutions \DeclareOption{nosolutions}{\es@solutionsfalse}%%% no solutions (default) +\newif\ifes@noquizsolutions \es@noquizsolutionstrue % NEW 2014 +\DeclareOption{noquizsolutions}{\es@noquizsolutionstrue} +\DeclareOption{quizsolutions}{\es@noquizsolutionsfalse} \DeclareOption*{\InputIfFileExists{esami-\CurrentOption.cfg}{}%%% reads a configuration file {\PackageError{esami}{\es@cfgerrormessageshort} {\es@cfgerrormessagelong} }} \newif\ifes@autopst \es@autopstfalse%%% Do I need auto-pst? -\DeclareOption{autopstoff}{\es@autopstfalse}%%% autopstpdf inactive (default) -\DeclareOption{autopston}{\es@autopsttrue }%%%% autopstpdf active +\newif\ifes@pst \es@pstfalse%%% Do I need pstricks? %%% NEW for tikz 2014.3.3 +\DeclareOption{autopstoff}{\es@psttrue \es@autopstfalse}%%% autopstpdf inactive (default) % +\DeclareOption{autopston}{\es@psttrue \es@autopsttrue }%%%% autopstpdf active %%% NEW for tikz 2014.3.3 \newif\ifes@prova \es@provafalse -\DeclareOption{prova}{\es@solutionstrue \es@provatrue \es@randomizeChoicesfalse}%%% for the file "totale-versioni" +\DeclareOption{prova}{\es@solutionstrue \es@provatrue \es@randomizeChoicesfalse \es@noquizsolutionsfalse}%%% for the file "totale-versioni" \DeclareOption{correzione}{\es@correzionetrue \es@solutionsfalse}%%% to print all the exercises with solutions only \newif\ifes@correzione \es@correzionefalse \newif\ifes@param \es@paramfalse%%% to print the parametric version in "totale-versioni" \newif\ifes@test \es@testfalse%%% for tests + %========================================================% % Parametric version % %========================================================% \newwrite\parametri -\DeclareOption{param}{\es@paramtrue \AtBeginDocument{\newwrite\params - \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})} % - } -} -} + +\DeclareOption{param}{\es@paramtrue \AtBeginDocument{\newwrite\params}} + \ProcessOptions\relax % +=============================+ @@ -146,23 +124,27 @@ % +=============================+ \usepackage{graphicx} -\usepackage{amsmath} -\usepackage{amssymb} \usepackage{enumerate} \usepackage{fp} \usepackage{currfile} \usepackage{array} -\usepackage{ifthen} \usepackage{environ} +\usepackage{ifthen} \usepackage{xargs} \usepackage{multicol} +\usepackage{amssymb} + + +\ifes@pst \usepackage{pstricks,pstricks-add} \ifes@autopst \usepackage[crop=off,dvips={}]{auto-pst-pdf} \else \usepackage[off]{auto-pst-pdf} \fi - + \else + \@ifpackageloaded{xcolor}{}{\usepackage{xcolor}} +\fi \input random %========================================================% @@ -208,6 +190,7 @@ \newbox{\es@pointbox} \newlength{\es@pointboxtotalheight}%%% the height of the point box \newsavebox{\workareasb} +\newlength\mylabelsep %========================================================% % exercise % @@ -240,7 +223,7 @@ \priorexskip{\medskipamount} \esexerskip{\medskipamount} \let\afterlabelhskip=\space - +\def\Acapo{\par} %========================================================% % test % %========================================================% @@ -263,13 +246,22 @@ \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 +\newcount\tmp@quest %%% the number of the exercise +\newcount\@probselN %%% in \selectrandomlyn +\newcount\@shfctr \newcount\@shfA \newcount\@shfB %%% In "\shuffle" +\newcount\icount %%% contatore per mischiare esercizi +\newcount\io +\newcount\inizio +\inizio=1 +%%%% \newcounter{vers}%%% the number of the version \setcounter{vers}{0} \newcounter{n@par}%%% it counts the number of parameters \newcount\loopCnt%%% the number of attempts in \FPsetpar \newcounter{fp@contatore}%%% used in \FPsetpar +\newcount\old@randomii%%% used to change seed shuffling exercise \newcount\old@randomi%%% used to change seed in \FPsetpar +\newcount\old@random%%% used to change seed in \selectrandomly %%%NUOVO \newcount\sh@max%%% used to choose the exercises \newcount\@probN%%% number of exercises in \selectrandomly \newcount\j@m%%% temporary counter in \newproblem @@ -286,6 +278,8 @@ \newcounter{esquestionnoiii} \renewcommand{\theesquestionnoiii}{\roman{esquestionnoiii}} +\def\es@primo{1237} + %========================================================% % test % %========================================================% @@ -356,7 +350,7 @@ \newcommand\exlabelformat{{\scshape\exlabel\ \theex@no.}} \newcommand\exlabelformatwp{{\scshape\exlabel\ \theex@no.}} \newcommand{\exsolafter}{\es@exsolafterDefault} -\newcommand{\es@exsolafterDefault}{\textit{\es@solutionname}:} +\newcommand{\es@exsolafterDefault}{\textit{\es@solutionname}: } \newcommand{\esexlisttabheader} {(\hfil\theex@partno\hfil)% } @@ -373,9 +367,16 @@ % 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 - +\ifes@param +\newcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations +\newcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)} +\immediate\write\params{%%% writes on a file + \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3} + \string}\string\newline}} +\else +\newcommand{\FPsv}[2][0]{\FPeval{\fp@tmpa}{clip(round(#2:#1))}\numprint{\fp@tmpa}}%%% It does operations with #1 decimals and with the "param" option it shows operations +\newcommandx{\FPval}[3][2=0]{\FPeval{#1}{clip(round(#3:#2))}}%% it works like \FPsv with the option param, like \FPeval otherwise +\fi %========================================================% % fractions % %========================================================% @@ -528,7 +529,12 @@ } %%%%%%% Fill in %%%%%% - +%%%% NEW fillin 2013-06-03 +\newcommand\fillinproblem{\es@fillintrue% +\ifes@solutions +\immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex +\fi} +%%%% \ifes@solutions \def\fill@ans@color#1{\bfseries\color{red}{#1}}%%% with solutions answers are in red by default \else @@ -543,9 +549,13 @@ \fillin@Fmt{\parbox[b][.8\height][b]{#2}{% \strut\hfil\fill@ans@color{#3}\hfil}% \ifes@test + \ifes@prova + \else \ifes@solutions%%% to write the string of solutions -\immediate\write\sols{\string\item\space\string\makeatletter\space\string\input\string{qf\nome q\thetmp@quest e\thevers.parametri\string}\string\makeatother} +\immediate\write\sols{\string\item\space\string\makeatletter\space\string\input\string{qf\nome q\romannumeral\tmp@quest e\thevers.parametri\string}\string\makeatother} \immediate\write\sols{\unexpanded{#3}} +\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen} +\fi \fi \fi } @@ -553,23 +563,16 @@ %%%%% 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 +\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}} +\immediate\write\loe{\versionname\space n. \thevers}\fi} +\newcommand\closevers{\newpage\setcounter{page}{1}\setcounter{ex@no}{0}\ifes@solutions\immediate\write\sols{\string\end{minipage} + \string\vspace{5ex}} + \immediate\write\loe{\space} + \immediate\write\loe{\space} + \fi} + +\def\mydate#1/#2/#3\@empty{\setcounter{nomefile}{\two@digits{#1}\two@digits{#2}\two@digits{#3}}}%%% it gives to the counter "nomefile" a value determined by the date \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})}}%%% The name of the points \newcommand{\proofingsymbol}[1]{\def\@proofingsymbol{{#1}\hspace{-.3em}\es@segnala}}%%% this defines the symbol for the exact answer in MCQ and the label for the string of solutions \proofingsymbol{$\blacktriangleright$}%%% the proofing symbol that can be changed in document @@ -579,29 +582,44 @@ \def\longdate{\expandafter\es@longdate\@date\@empty} \def\shortdate{\expandafter\es@shortdate\@date\@empty} \expandafter\mydate\@date\@empty + \ifes@prova + \else \ifes@solutions \newwrite\sols \immediate\openout\sols=\jobname.sol.tex +\newwrite\loe +\immediate\openout\loe=\jobname.loe + \fi \fi} \newcommand\es@segnala{%%% this command gives the reference of the exact answer in the string of solutions \if\es@listType1\addtocounter{sq@quizno}{-1}\refstepcounter{sq@quizno}\fi -\ifes@prova \else \label{af\nome q\number\j@n e\thevers} \immediate\write\sols{\string\item\string\ref{af\nome q\number\j@n e\thevers}}\fi +\ifes@prova \else \label{\probchosen} \immediate\write\sols{ \string\item\string\ref{\probchosen}} +\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen} \fi } \newcommand{\prior@questionsHook}{} %========================================================% -% definizioni di Fpsetpar % +% definitions of Fpsetpar % %========================================================% - \def\maxLoopLimit{10}% +\ifes@param +\newcommandx{\FPsetpar}[5][1=\seme,5={}]{%%% the parameters are not assigned + \expandafter\def\csname#2\endcsname{#2}%%% in the parametric version, the parameter appears with its name and not with its value + \immediate\write\params{%%% writes on a file + \string\textbf\string{\string\noindent\space \es@parametermessage{#2}{#3}{#4} + \space \ifx#5\@empty\else $#2\neq #5$.\fi\space \es@seedmessage{#1} + \string}\string\newline}} + \else \newcommandx{\FPsetpar}[5][1=\seme,5={}]{% +\ifnum#3<#4\else\PackageError{esami}{\es@fpsetparerrshort{#2}}{\es@fpsetparerrlong{#2}}\fi%% NEW 2015 +\@ifundefined{nome}{\setcounter{fp@contatore}{-2}}{ +\@ifundefined{base\nome}{\setcounter{fp@contatore}{-2}}{\setcounter{fp@contatore}{-\csname base\nome \endcsname}}} +\FPval{randomico}{\thevers+\then@par+\thequestionno+#1} \old@randomi=\number\randomi%%% it saves the old seed \stepcounter{n@par}% \setcounter{fp@contatore}{-\value{vers}}% -\randomi=#1% -\advance\randomi\value{n@par}% +\randomi=\randomico% \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) @@ -629,12 +647,11 @@ \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 }% - +\fi %%%%%% Alternative definitions of \FPsetpar with different randomization process (we left them for archive purposes) %%%% %\newcommandx{\FPsetpar}[5][1=\seme,5={}]{% @@ -719,6 +736,24 @@ - \fi}% +%%% Modified commands for parametric version in "totale-versioni" +\ifes@param +\renewcommand{\simpsqrt}[2]{\sqrt[#1]{(#2)}}%%% \simpsqrt shows operations +\renewcommand{\sempli}[2]{%%% all simplifications become \frac + \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} + \renewcommand{\semplix}[2]{% + \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} + \renewcommand{\sempliz}[2]{% + \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} + \renewcommand{\esempli}[2]{% + \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} + \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})} % + \ifes@test + \immediate\closeout\params + \fi + } +\fi + % +===================================+ % | OTHER ENVIRONMENTS AND EXERCISES | % +===================================+ @@ -839,57 +874,71 @@ \newif\iffirstpass \ifes@prova \newcommand{\newproblem}[1]{%%% \newproblem for the file "totale-versioni" -\stepcounter{tmp@quest} +\advance\tmp@quest by1 \iffirstpass \global\advance\@probN by 1 \else \let\nome\currfilebase +\global\def\problabel{e:\thevers-file:\nome} +\global\def\probnumber{q:\romannumeral\tmp@quest} \ifes@fillin \immediate\openout\parametri=qf\nome q\number\j@n e\thevers.parametri.tex \fi -\expandafter\global\expandafter\newcommand\csname @prob@f\nome q\thetmp@quest \endcsname{#1}%%% it assigns a name to exercise +\expandafter\global\expandafter\newcommand\csname \probnumber \endcsname{#1} \fi } \else \ifes@correzione \newcommand{\newproblem}[1]{%%% \newproblem for the "correzione" option - \stepcounter{tmp@quest} +\advance\tmp@quest by1 \iffirstpass \global\advance\@probN by 1 \else \let\nome\currfilebase + \global\def\problabel{e:\thevers-file:\nome} +\global\def\probnumber{q:\romannumeral\tmp@quest} \ifes@fillin - \immediate\openout\parametri=qf\nome q\thetmp@quest e\thevers.parametri.tex + \immediate\openout\parametri=qf\nome q\romannumeral\tmp@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} +\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}} + \expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber \endcsname{#1} \fi } \else \newcommand{\newproblem}[1]{%%% \newproblem for the exam -\stepcounter{tmp@quest} +\advance\tmp@quest by1 \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 +\global\def\problabel{e:\thevers-file:\nome} +\global\def\probnumber{q:\romannumeral\tmp@quest} +\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}} +\expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber\endcsname{#1}%%% it assigns a unique name to exercise \fi } \fi \fi +%%%% NEW fillin 2013-06-03 +\newcommand{\newfillinproblem}[1]{ \newproblem{\fillinproblem #1}} + %%%%%%%% \selectrandomly %%%%%%% \newcommand{\selectrandomly}[1]{% \global\@probN=0\relax \firstpasstrue -\setcounter{tmp@quest}{0} +\tmp@quest=0 \input{#1}%%%%% -\FPeval\restotrentasei{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/36:0)*36:0)} +\firstpassfalse%%% now prints the question +\tmp@quest=0 +\input{#1} +\@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16 +\setrannum{\rnd@cnta}{1}{\@probN} +\randomi=\number\old@random +\expandafter\global\expandafter\edef\csname base\nome \endcsname{\number\rnd@cnta} +}{} +\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)} \ifcase\@probN\or \def\j@n{1}%%% just one variant \or%%% 2 variants @@ -906,17 +955,16 @@ \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} +\else +\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)} \fi -\firstpassfalse%%% now prints the question -\setcounter{tmp@quest}{0} -\input{#1} +\def\probchosen{\problabel-q:\romannumeral\j@n} \ifes@test -\begin{minipage}{.95\linewidth}\csname @probi@f\nome q\number\j@n e\thevers\endcsname \vspace{5mm}\end{minipage} +\begin{minipage}{.95\linewidth}\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm}\end{minipage} +\Acapo \else -\csname @probi@f\nome q\number\j@n e\thevers\endcsname \vspace{5mm} +\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm} +\Acapo \fi \ifes@fillin \immediate\closeout\parametri @@ -925,21 +973,138 @@ %%%% \selectallproblems %%%%% -\newcommand*{\selectallproblems}[1]{%%% it selects all the problems of a file and prints them for "totale-versioni" +\newcommand{\selectallproblems}[2][]{%% %%% it selects all problems for "totale-versioni", with the option "random" the problems are in random order \global\@probN=0\relax \firstpasstrue -\setcounter{tmp@quest}{0} -\input{#1}% +\tmp@quest=0 +\input{#2}% \firstpassfalse -\setcounter{tmp@quest}{0} -\input{#1}% +\tmp@quest=0 +\input{#2}% +\ifthenelse{\equal{#1}{random}}{\i@sh=0 +\loop +\advance\i@sh by1 +\expandafter\edef\csname ftmp\romannumeral\i@sh \endcsname {\romannumeral\i@sh} +\ifnum\i@sh <\number\tmp@quest +\repeat +\shuffle{ftmp}{\tmp@quest}}{} \global\j@m=1\relax -\whiledo{\j@m < \@probN \TE@or \j@m = \@probN}{% -\csname @prob@f\nome q\number\j@m -\endcsname \vspace{4mm} +\whiledo{\j@m < \@probN \TE@or \j@m = \@probN}{ + \ifes@prova + \ifes@param% + \immediate\openout\params=params %%% the file in which the parameters are written + \fi + \def\probchosen{\problabel-q:\romannumeral\j@m} +\csname q:\romannumeral\j@m \endcsname% + \else + \def\probchosen{\problabel-q:\romannumeral\j@m} + \ifthenelse{\equal{#1}{random}}{ + \csname @probi-\problabel-q:\csname ftmp\romannumeral\j@m\endcsname \endcsname + }{ +\csname @probi-\problabel-q:\romannumeral\j@m \endcsname + }% + \fi +\par\vspace{2mm} + \ifes@param% +\input{params} + \fi \global\advance\j@m by 1\relax }} +%%%%%%%%%%%% NEW 2013-06-05 +%%% working with datasets of exercises (you can choose more than one exercise from a file) + +\newif\ifes@db %% to work with datasets +\es@dbfalse + +\newwrite\dbtemp +\newenvironment{esdb}[1]{ +\gdef\dbname{#1} +\immediate\openout\dbtemp=\dbname.tex +\es@dbtrue% +}{ +\immediate\closeout\dbtemp +\esercizidb{\dbname} +\es@dbfalse% +} + +\newcommand{\selectrandomlyn}[2]{ +\global\@probN=0\relax +\firstpasstrue +\tmp@quest=0 +\input{#2}% +\ifthenelse{\equal{#1}{all}}{\@probselN=\number\tmp@quest}{ +\ifnum\tmp@quest<#1 \relax + \PackageWarning{esami}{\es@selectnwarn{#1}{#2}} + \@probselN=\number\tmp@quest % + \else + \@probselN=#1 + \fi} + \i@sh=0 +\loop +\advance\i@sh by1 +\expandafter\edef\csname ftmp\romannumeral\i@sh \endcsname {\romannumeral\i@sh} +\ifnum\i@sh <\number\tmp@quest +\repeat +\shuffle{ftmp}{\tmp@quest} +\firstpassfalse% +\tmp@quest=0 +\input{#2} + \i@sh=0 +\loop +\advance\i@sh by1 +\global\def\probnumber{q:\csname ftmp\romannumeral\i@sh\endcsname} +\expandafter\immediate\write\dbtemp\expandafter{\string\defitem\string{% +\string\gdef\string\problabel{\problabel}\space +\string\gdef\string\probnumber{\probnumber}\space +\string}} +\ifnum\i@sh <\number\@probselN +\repeat +} + +\def\defitem{% + \advance\icount by1 + %%% IT defines a macro called "\prbl n" where "n" is the number of the item. + \expandafter\def \csname prbl\romannumeral\icount \endcsname +} + + +\def\@getitems#1#2#3{\rand@getitems{#2}{#3}[#1]}% + +\newcommand{\esercizidb}[1]{ + \icount=0 +\input{#1.tex}% +\i@sh=0 +\loop +\advance\i@sh by1 +\expandafter\edef\csname ftemp\romannumeral\i@sh \endcsname {\romannumeral\i@sh} +\ifnum\i@sh <\number\icount +\repeat +\shuffle{ftemp}{\icount} +\setcounter{n@par}{1} +\io=\icount +\loop +\ifes@test +\begin{minipage}{.95\linewidth} +\fi +\ifes@shuffleQuestions +\csname prbl\csname ftemp\romannumeral\io\endcsname\endcsname +\else +\csname prbl\romannumeral\io \endcsname +\fi +\def\probchosen{\problabel-\probnumber} +\csname @probi-\problabel-\probnumber \endcsname +\ifes@test + \vspace{5mm}\end{minipage} + \Acapo +\vspace{4mm} + \fi + \advance\io by-1 + \ifnum\io > 0 \repeat + \par} + + + % +=============================+ % | ENVIRONMENTS | % +=============================+ @@ -980,13 +1145,19 @@ \setlength{\itemindent}{0pt}\setlength{\itemsep}{3pt}% \setlength{\leftmargin}{\labelwidth}% \settowidth{\labelsep}{\ }} + \ifes@prova + \else \ifes@solutions \immediate\write\sols{\string\begin{enumerate}} + \fi \fi% }{\end{list} +\ifes@prova +\else \ifes@solutions \immediate\write\sols{\string\par\string\end{enumerate}\string\vspace{3ex}} \fi +\fi } %%%%%%% shortquiz (where to put the environment questions) %%%% @@ -1003,13 +1174,12 @@ \setcounter{questionno}{0}% \let\answers\answers@sq \let\endanswers\endanswers@sq + \let\solution\solution@sq + \let\endsolution\endsolution@sq \sq@priorhook\sqlabel\space \ignorespaces } \def\aftershortquizskip{\medskip} -\def\aeb@endshortquiz{\setcounter{sq@quizno}{0}% - \par\aftershortquizskip -} \def\answers@sq{\stepcounter{questionno}% \answers@@sq } @@ -1032,7 +1202,7 @@ \setlength{\topsep}{0pt}\setlength{\partopsep}{0pt}% \setlength{\listparindent}{\parindent}% \setlength{\leftmargin}{\labelwidth}% - \setlength{\labelsep}{0pt}% + \setlength{\labelsep}{\mylabelsep}% \def\Ans{\Ans@list}% }% }% @@ -1162,6 +1332,18 @@ } \def\@findendans{\@ifnextchar\end{}{\expandafter\@findendans\@gobble}} +\ifes@noquizsolutions %%%% NEW 2014 solutions for test +\def\solution@sq{\gobbleenv} +\def\endsolution@sq{\endgobbleenv} +\else +\def\solution@sq{ + \par\smallskip\noindent + \textit{\es@solutionname}:\ +} + +\def\endsolution@sq +{} +\fi %========================================================% % EXERCISE AND SIMILAR % %========================================================% @@ -1290,15 +1472,36 @@ \es@testfalse \renewcommand{\punti}{#1} \ifes@solutionsonly\else\examenddef\fi -\begin{exercise}} -{ \ifes@param \immediate\closeout\params \input{params}\fi \end{exercise} } +\begin{exercise} +\ifes@prova +\else +\ifes@solutions +\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} +\fi +\fi +} +{ +\end{exercise} +\ifes@param +\immediate\closeout\params +\fi} + \newenvironment{problem*}[1][]{\es@testfalse \renewcommand{\punti}{#1} \ifes@solutionsonly\else\examenddef\fi \begin{exercise*} +\ifes@prova +\else +\ifes@solutions +\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} +\fi +\fi } -{ \ifes@param \immediate\closeout\params \input{params}\fi \end{exercise*} } - +{ +\end{exercise*} +\ifes@param +\immediate\closeout\params +\fi } %%%%%%%% Domanda %%%%%%%% %%%% (it can be used to hide the text of the exercise and print only the solution) %%% @@ -1357,13 +1560,14 @@ %========================================================% %% 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!!!!!!!!) +%%% 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) @@ -1672,7 +1876,11 @@ \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]% +\else +\old@randomii=\number\randomi +\nextrandom +\rand@getitems{#2}{#3}[#1]% +\randomi\number\old@randomii \fi% }% \else @@ -1694,15 +1902,42 @@ }% \else \newcommand{\sh@mixex}{%%% the exercises are not shuffled - \tmp@cnt=\value{shuf@lop} + \tmp@cnt=1% \loop% \selectrandomly{\cartella/\csname exe\romannumeral\tmp@cnt\endcsname} - \advance\tmp@cnt by-1 - \ifnum\tmp@cnt>0 + \ifnum\tmp@cnt<\value{shuf@lop} +\advance\tmp@cnt by1 \repeat } \fi +%%%% new 2013-06-05 +%%% another shuffling macro +\newcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln + \@shfctr=1\relax + \whiledo{\@shfctr < 101}% + {% + \setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3} + \ifnum\@shfA=\@shfB + \else + \edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}% + \let\@tmpA=\@@tmpA + \edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}% + \let\@tmpB=\@@tmpB + \expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}% + \expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}% + \fi + \advance\@shfctr by 1\relax + \ifthenelse{\equal{#1}{}}{}{ + \@shfA=0% + \loop + \advance\@shfA by1 + \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname} + \ifnum\@shfA<#3 \repeat +} + }% +} + %========================================================% % Random (adapted from aebrandom) % %========================================================% @@ -1782,47 +2017,4 @@ \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 |