From ef63475b97ba5f335f4b642c65af6f39982a00d2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 30 Jul 2016 23:11:21 +0000 Subject: esami (27jul16) git-svn-id: svn://tug.org/texlive/trunk@41774 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/esami/es-UKenglish.lng | 3 + Master/texmf-dist/tex/latex/esami/es-USenglish.lng | 3 + Master/texmf-dist/tex/latex/esami/es-french.lng | 4 +- Master/texmf-dist/tex/latex/esami/es-german.lng | 6 +- Master/texmf-dist/tex/latex/esami/es-greek.lng | 3 + Master/texmf-dist/tex/latex/esami/es-italian.lng | 19 +- Master/texmf-dist/tex/latex/esami/es-serbian.lng | 3 + Master/texmf-dist/tex/latex/esami/es-spanish.lng | 29 ++- Master/texmf-dist/tex/latex/esami/esami.sty | 264 ++++++++++++--------- 9 files changed, 197 insertions(+), 137 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng index 9b459da0bac..5a1bc74a972 100644 --- a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng @@ -36,6 +36,9 @@ \def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} \def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} +\def\es@pointerrorshort{Wrong score} +\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{\ifcase#3\or diff --git a/Master/texmf-dist/tex/latex/esami/es-USenglish.lng b/Master/texmf-dist/tex/latex/esami/es-USenglish.lng index d0194ca57ac..cae0480af23 100644 --- a/Master/texmf-dist/tex/latex/esami/es-USenglish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-USenglish.lng @@ -36,6 +36,9 @@ \def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} \def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} +\def\es@pointerrorshort{Wrong score} +\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{\ifcase#2\or diff --git a/Master/texmf-dist/tex/latex/esami/es-french.lng b/Master/texmf-dist/tex/latex/esami/es-french.lng index 0d575ce1e53..c5dd6428685 100644 --- a/Master/texmf-dist/tex/latex/esami/es-french.lng +++ b/Master/texmf-dist/tex/latex/esami/es-french.lng @@ -36,6 +36,9 @@ \def\es@fpsetparerrshort#1{Ce n'est pas possible de définir #1} \def\es@fpsetparerrlong#1{Dans la definition de le paramètre #1 l'extreme inferieur est plus grand que l'extreme superior} +\def\es@pointerrorshort{Score incorrect} +\def\es@pointerrorlong{Dans la version \thevers\space le score total \the\punteggio\space est différent du score prévu \punti \MessageBreak} + %% The date \def\es@longdate#1/#2/#3\@empty{#3\space \ifcase#2\or @@ -47,7 +50,6 @@ %%% 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} diff --git a/Master/texmf-dist/tex/latex/esami/es-german.lng b/Master/texmf-dist/tex/latex/esami/es-german.lng index 7362e88e144..8ea804d3446 100644 --- a/Master/texmf-dist/tex/latex/esami/es-german.lng +++ b/Master/texmf-dist/tex/latex/esami/es-german.lng @@ -8,7 +8,8 @@ \def\es@pointname{Punkt} \def\es@pointsname{Punkte} \def\es@exercisename{Aufgabe} -\def\es@solutionname{L\"{o}sung} +\def\es@solutionname{\unexpanded{L\"{o}sung}}% modified for input error + %%% Labels (xyz.cfg) @@ -39,6 +40,9 @@ Drücken Sie "x" um zu beenden und bennen Sie die Datei um. } \def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} \def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} +\def\es@pointerrorshort{Falsche Punktzahl} +\def\es@pointerrorlong{In der Version \thevers\space die Gesamtpunktzahl \the\punteggio\space unterscheidet sich von der erwarteten Punktzahl \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{#3\space\ifcase#2\or diff --git a/Master/texmf-dist/tex/latex/esami/es-greek.lng b/Master/texmf-dist/tex/latex/esami/es-greek.lng index be730de4800..6d1b78022eb 100644 --- a/Master/texmf-dist/tex/latex/esami/es-greek.lng +++ b/Master/texmf-dist/tex/latex/esami/es-greek.lng @@ -39,6 +39,9 @@ \def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} \def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} +\def\es@pointerrorshort{Wrong score} +\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{\ifcase#3\or diff --git a/Master/texmf-dist/tex/latex/esami/es-italian.lng b/Master/texmf-dist/tex/latex/esami/es-italian.lng index 4b485b95346..a8b2a626d47 100644 --- a/Master/texmf-dist/tex/latex/esami/es-italian.lng +++ b/Master/texmf-dist/tex/latex/esami/es-italian.lng @@ -38,6 +38,9 @@ \def\es@fpsetparerrshort#1{Non si può definire il parametro #1} \def\es@fpsetparerrlong#1{Nella definizione del parametro #1 l'estremo inferiore è maggiore dell'estremo superiore} +\def\es@pointerrorshort{Punteggio sbagliato} +\def\es@pointerrorlong{Nella versione \thevers\space il punteggio totale \the\punteggio\space è diverso dal punteggio previsto \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{#3\space%%% the date @@ -53,21 +56,23 @@ %%% Useful Language dependent packages \AtEndOfPackage{ -\usepackage{babel} -\NoIntelligentComma +\usepackage[italian]{babel} +%\NoIntelligentComma \usepackage{geometry} \geometry{a4paper,lmargin=6mm,rmargin=22mm,tmargin=10mm,bmargin=18mm,marginparsep=2mm,footskip=1cm} \usepackage{icomma} \usepackage{eurosym} -\usepackage[np,autolanguage]{numprint} -\newcommand*\npstyleitalian{% +%\usepackage[np,autolanguage]{numprint} +\usepackage[np]{numprint} +%\newcommand*\npstyleitalian{% \npthousandsep{\,}% -\npdecimalsign{,}% +%\npdecimalsign{,}% \npproductsign{\ensuremath{\cdot}}% \npunitseparator{~}% \npthousandthpartsep{} -} - \npfourdigitnosep +\npfourdigitnosep +%} + % \npaddtolanguage{italian}{italian} \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 index 2aed64dc0c3..67e37ac0934 100644 --- a/Master/texmf-dist/tex/latex/esami/es-serbian.lng +++ b/Master/texmf-dist/tex/latex/esami/es-serbian.lng @@ -39,6 +39,9 @@ pretpostavlja vrednosti #1 \string}\string\newline} \def\es@fpsetparerrshort#1{It's impossible to define the parameter #1} \def\es@fpsetparerrlong#1{In the definition of the parameter #1 the lower bound is greater than upper bound} +\def\es@pointerrorshort{Wrong score} +\def\es@pointerrorlong{In version \thevers\space the total score \the\punteggio\space is different from the expected score \punti \MessageBreak} + %%% The date \def\es@longdate#1/#2/#3\@empty{#3\space\ifcase#2\or diff --git a/Master/texmf-dist/tex/latex/esami/es-spanish.lng b/Master/texmf-dist/tex/latex/esami/es-spanish.lng index 1ac5434df8e..6d9852ba872 100644 --- a/Master/texmf-dist/tex/latex/esami/es-spanish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-spanish.lng @@ -1,4 +1,4 @@ -%%% Spanish translation by María Hernández Cifre +%%% Spanish translation by María Hernández Cifre %%% Labels (esami.sty) @@ -8,7 +8,7 @@ \def\es@pointname{punto} \def\es@pointsname{puntos} \def\es@exercisename{Ejercicio} -\def\es@solutionname{Soluci\'on} +\def\es@solutionname{\unexpanded{Soluci\'on}} %%% Labels (xyz.cfg) @@ -17,27 +17,30 @@ \def\studlastname{Apellido} \def\studfirstname{Nombre} \def\studid{Identificaci\'on del alumno} -\def\versionname{Versi\'on} +\def\versionname{\unexpanded{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@cfgerrormessageshort{La opci\'{o}n \CurrentOption\space no existe} +\def\es@cfgerrormessagelong{El paquete esami necesita una opción para la configuración del fichero} +\def\es@numcompitierror{Es necesario especificar el número de versiones!} \def\es@mastererror{AVISO: NO SE PUEDE COMPILAR EL FICHERO PRINCIPAL:\MessageBreak PRESIONE 'x' PARA SALIR Y RENOMBRE EL FICHERO} -\def\es@zerodenerror#1#2{El denominador de la fracción #1/#2 en el ejercicio \nome \space es 0} -\def\es@zeronumerrorshort#1#2{La fracción #1/#2 en el ejercicio \nome \space vale 0} -\def\es@zeronumerrorlong#1#2{Si la fracción puede ser 0, debe utilizar el comando "sempliz"} -\def\es@fraconewarn#1#2{La fracción #1/#2 en el ejercicio \nome \space vale 1} +\def\es@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@fpsetparerrorshort{No se verifican todas las condiciones después de \maxLoopLimit\space intentos} \def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Las expresiones $#2i$, $#2ii$ \string\dots\space toman los valores #1 \string}\string\newline} -\def\es@fpsetparerrshort#1{No es posible definir el parámetro #1} -\def\es@fpsetparerrlong#1{En la definición del parámetro #1 la cota inferior es mayor de la cota superior} +\def\es@fpsetparerrshort#1{No es posible definir el parámetro #1} +\def\es@fpsetparerrlong#1{En la definición del parámetro #1 la cota inferior es mayor de la cota superior} + +\def\es@pointerrorshort{Wrong score} +\def\es@pointerrorlong{En la versión \thevers\space la puntuación total score \the\punteggio\space es diferente de la puntuación prevista \punti \MessageBreak} %%% The date diff --git a/Master/texmf-dist/tex/latex/esami/esami.sty b/Master/texmf-dist/tex/latex/esami/esami.sty index d198f79e5bc..257a2ff4647 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, 2015-02-25 %% -%% Copyright (C) 2008-2015 G. Messineo e S. Vassallo %% +%% esami.sty package, 2016-07-25 %% +%% Copyright (C) 2008-2016 G. Messineo e S. Vassallo %% %% %% %% This program can be redistributed and/or modified %% %% under the terms of the LaTeX Project Public License %% @@ -27,14 +27,18 @@ %Modified the algorithm of choice of a variant of an exercise, now completely deterministic. % Added the command \cmd{\Acapo}. Added the serbian localization (latin alphabet). %The compilation produces a new file with the list of the chosen exercises. +% Version 2.1 +% 2016/07/25 +%Modified es-german.lng and es-spanish.lng for an error in the input of the solutions. Introduced the macro randestrai. +%Introduced the macro FPsignpol. Introduced a control on the total points of the exercises. Solved the incompatibility +%with babel for the Spanish language. Removed the incompatibility between the command \fillin and the commands \sempli and \semplix. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami} - [2015/02/25 v2.0 An Exam Construction Package] + [2016/07/25 v2.1 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}}% @@ -86,12 +90,11 @@ \AtEndDocument{ \immediate\closeout\loe \immediate\closeout\parametri -\immediate\closeout\sols -%%%%% 2013-06-03 % +\immediate\closeout\sols % \stringasol} %%%% }%%% for solutions \DeclareOption{nosolutions}{\es@solutionsfalse}%%% no solutions (default) -\newif\ifes@noquizsolutions \es@noquizsolutionstrue % NEW 2014 +\newif\ifes@noquizsolutions \es@noquizsolutionstrue \DeclareOption{noquizsolutions}{\es@noquizsolutionstrue} \DeclareOption{quizsolutions}{\es@noquizsolutionsfalse} \DeclareOption*{\InputIfFileExists{esami-\CurrentOption.cfg}{}%%% reads a configuration file @@ -99,9 +102,9 @@ {\es@cfgerrormessagelong} }} \newif\ifes@autopst \es@autopstfalse%%% Do I need auto-pst? -\newif\ifes@pst \es@pstfalse%%% Do I need pstricks? %%% NEW for tikz 2014.3.3 +\newif\ifes@pst \es@pstfalse%%% Do I need pstricks? \DeclareOption{autopstoff}{\es@psttrue \es@autopstfalse}%%% autopstpdf inactive (default) % -\DeclareOption{autopston}{\es@psttrue \es@autopsttrue }%%%% autopstpdf active %%% NEW for tikz 2014.3.3 +\DeclareOption{autopston}{\es@psttrue \es@autopsttrue }%%%% autopstpdf active \newif\ifes@prova \es@provafalse \DeclareOption{prova}{\es@solutionstrue \es@provatrue \es@randomizeChoicesfalse \es@noquizsolutionsfalse}%%% for the file "totale-versioni" \DeclareOption{correzione}{\es@correzionetrue \es@solutionsfalse}%%% to print all the exercises with solutions only @@ -249,7 +252,7 @@ \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\icount %%% counter to shuffle exercises \newcount\io \newcount\inizio \inizio=1 @@ -277,8 +280,11 @@ \renewcommand{\theesquestionnoii}{\alph{esquestionnoii}} \newcounter{esquestionnoiii} \renewcommand{\theesquestionnoiii}{\roman{esquestionnoiii}} +%\newdimen\punteggio %% NEW 2016/04/11 to check the total score of exercises +%\setlength{\punteggio}{0pt} +\newcommand\checkpoints\relax +\def\es@primo{1433} -\def\es@primo{1237} %========================================================% % test % @@ -367,16 +373,16 @@ % Maths % %========================================================% -\ifes@param -\newcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations -\newcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)} -\immediate\write\params{%%% writes on a file - \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3} - \string}\string\newline}} -\else +%\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 +%\fi %========================================================% % fractions % %========================================================% @@ -458,6 +464,15 @@ {\ifthenelse{\equal{\sq@rad}{1}}{\sq@factor}{\ifthenelse{\sq@ind=2}{\sq@factor\sqrt{\sq@rad}}{\sq@factor\sqrt[\sq@ind]{\sq@rad}}} }}}}% } +%========================================================% +% Coefficients of polynomial % +%========================================================% + +\newcommand{\FPsignpol}[2] %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11 +{\FPval\tempsign{#1} +\ifnum \tempsign<0 {\semplix{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\semplix{\tempsign}{1}#2}\else{}\fi\fi +} + %========================================================% % Commands adapted from exerquiz % %========================================================% @@ -467,6 +482,8 @@ \def\es@l@l{\normalsize\normalfont(d)} \newcommand\PTs{\def\es@star{x}\@PTs} \def\@PTs#1{% +%\addtolength{\punteggio}{#1 pt} %% NEW 2016/04/11 to check the total score of exercises +%\global\punteggio=\punteggio \gdef\es@PTs{#1}\ifx\es@PTs\@empty\gdef\es@PTs{1}\fi \global\let\esPTs=\es@PTs\global\let\es@PTs=\@empty \if\es@star*\else\PTs@Hook\fi @@ -476,6 +493,34 @@ \let\qMark@Hook\@empty \newcommand{\post@questionsHook}{} \newcommand{\punti}{} +%%=========================================================================% +%% Modified commands for parametric version in "totale-versioni" % +%%=========================================================================% +%%%% +%\ifes@param +%\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations +%\renewcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)} +%\immediate\write\params{%%% writes on a file +% \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3} +% \string}\string\newline}} +%\renewcommand{\FPsignpol}[2]{+(#1)#2} %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11 +%\renewcommand{\simpsqrt}[2]{\sqrt[#1]{(#2)}}%%% \simpsqrt shows operations +%\renewcommand{\sempli}[2]{%%% all simplifications become \frac +% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} +% \renewcommand{\semplix}[2]{% +% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} +% \renewcommand{\sempliz}[2]{% +% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} +% \renewcommand{\esempli}[2]{% +% \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} +% \PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})} % +% \ifes@test +% \immediate\closeout\params +% \fi +% } +%\fi + + %========================================================% % Commands adapted from eqexam % @@ -529,7 +574,6 @@ } %%%%%%% 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 @@ -562,13 +606,12 @@ } %%%%% Other commands %%%%%% +\newcommand\stepverssols{\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}}} +\newcommand\closeverssols{\immediate\write\sols{\string\end{minipage}}} -\newcommand\stepvers{\stepcounter{vers}\ifes@solutions -\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth} -{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}} +\newcommand\stepvers{\stepcounter{vers}\ifes@solutions\stepverssols \immediate\write\loe{\versionname\space n. \thevers}\fi} -\newcommand\closevers{\newpage\setcounter{page}{1}\setcounter{ex@no}{0}\ifes@solutions\immediate\write\sols{\string\end{minipage} - \string\vspace{5ex}} + \newcommand\closevers{\newpage\setcounter{page}{1}\setcounter{ex@no}{0}\ifes@solutions\closeverssols \immediate\write\loe{\space} \immediate\write\loe{\space} \fi} @@ -620,7 +663,7 @@ \stepcounter{n@par}% \setcounter{fp@contatore}{-\value{vers}}% \randomi=\randomico% -\addtocounter{fp@contatore}{-#3}% +\ifnum#3>0 \addtocounter{fp@contatore}{-#3} \else \addtocounter{fp@contatore}{#3}\fi \whiledo{\value{fp@contatore}<\value{questionno}}{\nextrandom\stepcounter{fp@contatore}}% \setrannum{\tmp@a}{#3}{#4}% \def\rand@ne{#5}%%% checks the parameter (adapted from rangen) @@ -653,80 +696,6 @@ \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={}]{% -%\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}{% @@ -737,8 +706,17 @@ - \fi}% -%%% Modified commands for parametric version in "totale-versioni" +%=========================================================================% +% Modified commands for parametric version in "totale-versioni" % +%=========================================================================% +%%% \ifes@param +\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations +\renewcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)} +\immediate\write\params{%%% writes on a file + \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3} + \string}\string\newline}} +\renewcommand{\FPsignpol}[2]{+(#1)#2} %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11 \renewcommand{\simpsqrt}[2]{\sqrt[#1]{(#2)}}%%% \simpsqrt shows operations \renewcommand{\sempli}[2]{%%% all simplifications become \frac \ifthenelse{\equal{#2}{1}}{(#1)}{\frac{#1}{#2}}} @@ -927,7 +905,6 @@ \fi \fi -%%%% NEW fillin 2013-06-03 \newcommand{\newfillinproblem}[1]{ \newproblem{\fillinproblem #1}} %%%%%%%% \selectrandomly %%%%%%% @@ -1018,7 +995,6 @@ \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 @@ -1071,13 +1047,10 @@ \def\defitem{% \advance\icount by1 - %%% IT defines a macro called "\prbl n" where "n" is the number of the item. + %%% 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}% @@ -1110,8 +1083,6 @@ \ifnum\io > 0 \repeat \par} - - % +=============================+ % | ENVIRONMENTS | % +=============================+ @@ -1133,6 +1104,12 @@ \ifes@twocolumns \end{multicols} \fi + % \ifdim\punteggio=\punti pt %% NEW 2016/04/11 to check the total score of exercises +% \else +% \PackageError{esami}{\es@pointerrorshort} {\es@pointerrorlong} +% \fi +% \global\punteggio=0pt +\checkpoints \end{shortquiz} } @@ -1339,7 +1316,7 @@ } \def\@findendans{\@ifnextchar\end{}{\expandafter\@findendans\@gobble}} -\ifes@noquizsolutions %%%% NEW 2014 solutions for test +\ifes@noquizsolutions \def\solution@sq{\gobbleenv} \def\endsolution@sq{\endgobbleenv} \else @@ -1505,11 +1482,60 @@ \fi } { +\checkpoints \end{exercise*} \ifes@param \immediate\closeout\params \fi } +%%%%%%%% Problem in minipage + +\newenvironment{problemmp}[1][]{%%% it's like exercise, but with points +\es@testfalse +\begin{minipage}{\linewidth} %%% new 2016/02/19 +\renewcommand{\punti}{#1} +\ifes@solutionsonly\else\examenddef\fi +\begin{exercise} +\ifes@prova +\else +\ifes@solutions +\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} +\fi +\fi +} +{ +\end{exercise} +\end{minipage}%%% new 2016/02/19 +\ifes@param +\immediate\closeout\params +\fi} + +\newenvironment{problemmp*}[1][]{\es@testfalse +\begin{minipage}{\linewidth} %%% new 2016/02/19 +\renewcommand{\punti}{#1} +\ifes@solutionsonly\else\examenddef\fi +\begin{exercise*} +\ifes@prova +\else +\ifes@solutions +\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} +\fi +\fi +} +{ +%\ifdim\punteggio=\punti pt +% \else +% \PackageError{esami}{\es@pointerrorshort} +% {\es@pointerrorlong} +% \fi +% \global\punteggio=0pt %% NEW 2016/04/11 to check the total score of exercises +\checkpoints +\end{exercise*} +\end{minipage}%%% new 2016/02/19 +\ifes@param +\immediate\closeout\params +\fi } + %%%%%%%% Domanda %%%%%%%% %%%% (it can be used to hide the text of the exercise and print only the solution) %%% @@ -1768,7 +1794,7 @@ \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 +\newcommand\esami@item[2]{%%% #1=the list #2=name of the input item \edef\es@Lista{\zap@space#1 \@empty}% \@for\shuf@ch:=\es@Lista\do{% \shuf@ifch{}{#2}{\shuf@ch}% @@ -1777,7 +1803,7 @@ \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}% +\esami@item{#1}{#2}% \renewcommand{\theshuf@lop}{\arabic{shuf@lop}}% } @@ -1873,9 +1899,18 @@ }% \fi -%%% \esestrai is the user command to extract exercises from the list #2 leaving out #1 elements. +%%% \esestrai is the user command to extract exercises from the list #2 leaving out #1 elements. -\newcommand{\estraies}[2][0]{\randes@trai[#1]{#2}{tmp@out} +\newcommand{\estraies}[2][0]{\es@trai[#1]{#2}{tmp@out} + \tmp@cnt=\value{shuf@lop} + \advance\tmp@cnt by -#1 + \loop + \selectrandomly{\cartella/\csname tmp@out\romannumeral\tmp@cnt\endcsname} + \advance\tmp@cnt by-1 + \ifnum\tmp@cnt>0 + \repeat}% +%%% New user command to (randomly) extract exercises from the list #2 leaving out #1 elements. NEW 2015.09.14 +\newcommand{\randestraies}[2][0]{\randes@trai[#1]{#2}{tmp@out} \tmp@cnt=\value{shuf@lop} \advance\tmp@cnt by -#1 \loop @@ -1950,7 +1985,6 @@ } \fi -%%%% new 2013-06-05 %%% another shuffling macro \newcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln \@shfctr=1\relax -- cgit v1.2.3