From 57d4d64524ef6e9e6589a8f2744a981649606ea0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 6 Jul 2017 21:26:59 +0000 Subject: esami (6jul17) git-svn-id: svn://tug.org/texlive/trunk@44758 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/esami/es-UKenglish.lng | 9 +- Master/texmf-dist/tex/latex/esami/es-french.lng | 7 +- Master/texmf-dist/tex/latex/esami/esami.sty | 101 +++++++++++++++++---- 3 files changed, 92 insertions(+), 25 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng index 5a1bc74a972..692f17c0618 100644 --- a/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng +++ b/Master/texmf-dist/tex/latex/esami/es-UKenglish.lng @@ -1,7 +1,5 @@ %%% 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} @@ -17,11 +15,15 @@ \def\versionname{Version} \def\pagename{Page} \def\solutionsname{Solutions} +\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Expressions $#2i$, $#2ii$ \string\dots\space + assume the values #1 \string}\string\newline} %%% Error Messages \def\es@cfgerrormessageshort{The option \CurrentOption\space does not exists} \def\es@cfgerrormessagelong{Package esami needs an option for the configuration file} +\def\es@parametermessage#1#2#3{The parameter $#1$ is between $#2$ and $#3$.} +\def\es@seedmessage#1{The seed is equal to $#1$.} \def\es@numcompitierror{It's necessary to specify the number of versions!} \def\es@mastererror{WARNING: YOU CANNOT COMPILE THE MASTER FILE:\MessageBreak PRESS 'x' TO EXIT AND RENAME THE FILE} @@ -31,8 +33,7 @@ \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} diff --git a/Master/texmf-dist/tex/latex/esami/es-french.lng b/Master/texmf-dist/tex/latex/esami/es-french.lng index c5dd6428685..10c379665c0 100644 --- a/Master/texmf-dist/tex/latex/esami/es-french.lng +++ b/Master/texmf-dist/tex/latex/esami/es-french.lng @@ -17,6 +17,8 @@ \def\versionname{Version} \def\pagename{Page} \def\solutionsname{Solutions} +\def\es@EstraiMessage#1#2{\string\textbf\string{\string\noindent\space Les expressions $#2i$, $#2ii$ \string\dots\space + prennent les valeurs #1 \string}\string\newline} %%% Error Messages @@ -26,13 +28,11 @@ \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@zeronumerrorshort#1#2{La fraction #1/#2 dans l'exercise \nome \space est \'{e}gal à 0} \def\es@zeronumerrorlong#1#2{Si vous voulez qu'une fraction peut être 0, utilisez la commande "sempliz"} \def\es@fraconewarn#1#2{La fraction #1/#2 dans l'exercice \nome \space est \'{e}gal à 1} \def\es@radicalerror{Le radicande dans l'exercice \nome \space est n\'{e}gatif} \def\es@fpsetparerrorshort{Les conditions ne sont pas satisfaites apr\`{e}s \maxLoopLimit\space tentatives} -\def\es@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} @@ -56,4 +56,3 @@ \usepackage{eurosym} \usepackage[np,autolanguage]{numprint} } - diff --git a/Master/texmf-dist/tex/latex/esami/esami.sty b/Master/texmf-dist/tex/latex/esami/esami.sty index 257a2ff4647..61b17698d51 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, 2016-07-25 %% -%% Copyright (C) 2008-2016 G. Messineo e S. Vassallo %% +%% esami.sty package, 2017-07-01 %% +%% Copyright (C) 2008-2017 G. Messineo e S. Vassallo %% %% %% %% This program can be redistributed and/or modified %% %% under the terms of the LaTeX Project Public License %% @@ -32,9 +32,11 @@ %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. +% 2017/07/01 +%Introduced the possibility to have two different seeds for exercises choice and for scrambling. Sligtly modified teh command \estrai so that can be used to extract parameters from a list. Improved the documentation. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami} - [2016/07/25 v2.1 An Exam Construction Package] + [2017/07/01 v2.2 An Exam Construction Package] % +=============================+ % | THE OPTIONS | @@ -255,6 +257,10 @@ \newcount\icount %%% counter to shuffle exercises \newcount\io \newcount\inizio +\newcount\old@rando +\FPeval\seme{round(\thenomefile+1-trunc(\thenomefile/(2^31-1):0)*(2^31-1):0)} +%\FPset\semeex\seme +\def\semeex{\seme} \inizio=1 %%%% \newcounter{vers}%%% the number of the version @@ -470,8 +476,10 @@ \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 -} +\ifthenelse{\equal{#2}{}}{\ifnum \tempsign<0 {\sempli{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\sempli{\tempsign}{1}#2}\else{}\fi\fi} +{\ifnum \tempsign<0 {\semplix{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\semplix{\tempsign}{1}#2}\else{}\fi\fi} +} %%% nuovo 2016/12/11 per termine noto + %========================================================% % Commands adapted from exerquiz % @@ -918,15 +926,21 @@ \tmp@quest=0 \input{#1} \@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16 +\randomi=\semeex \setrannum{\rnd@cnta}{1}{\@probN} \randomi=\number\old@random \expandafter\global\expandafter\edef\csname base\nome \endcsname{\number\rnd@cnta} }{} -\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)} +\old@rando=\number\randomi + \randomi=\semeex +\ifthenelse{\number\semeex=\number\seme}{ +\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)}}{ +\FPeval\restotrentasei{round(1+\thenomefile+1+base\nome-trunc((1+\thenomefile+base\nome)/36:0)*36:0)} +} \ifcase\@probN\or \def\j@n{1}%%% just one variant \or%%% 2 variants -\ifthenelse{\isodd{\thevers}}{\def\j@n{1}}{\def\j@n{2}} +\ifthenelse{\isodd{\restotrentasei}}{\def\j@n{1}}{\def\j@n{2}} \or%%% 3 variants \def\j@n{\ifcase\restotrentasei\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\or 3\or 2\or 1\or 2\or 1\or 3\or 1\or 3\or 2\or 3\or 1\or 2\or 1\or 2\or 3\or 2\or 3\or 1\fi}% \or%%% 4 variants @@ -940,7 +954,9 @@ \or%%% 8 variants \def\j@n{\ifcase\restotrentasei\or 2\or 8\or 6\or 7\or 4\or 3\or 1\or 5\or 8\or 5\or 1\or 3\or 7\or 6\or 4\or 2\or 7\or 1\or 8\or 6\or 3\or 2\or 5\or 4\or 1\or 3\or 7\or 5\or 6\or 4\or 2\or 8\or 4\or 3\or 1\or 5\fi}% \else -\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)} +\ifthenelse{\number\semeex=\number\seme}{ +\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)}} +{\FPeval\j@n{round(\es@primo+base\nome+1-trunc((\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)}} \fi \def\probchosen{\problabel-q:\romannumeral\j@n} \ifes@test @@ -961,10 +977,10 @@ \global\@probN=0\relax \firstpasstrue \tmp@quest=0 -\input{#2}% +\input{\cartella/#2}% \firstpassfalse \tmp@quest=0 -\input{#2}% +\input{\cartella/#2}% \ifthenelse{\equal{#1}{random}}{\i@sh=0 \loop \advance\i@sh by1 @@ -1015,7 +1031,7 @@ \global\@probN=0\relax \firstpasstrue \tmp@quest=0 -\input{#2}% +\input{\cartella/#2}% \ifthenelse{\equal{#1}{all}}{\@probselN=\number\tmp@quest}{ \ifnum\tmp@quest<#1 \relax \PackageWarning{esami}{\es@selectnwarn{#1}{#2}} @@ -1032,7 +1048,7 @@ \shuffle{ftmp}{\tmp@quest} \firstpassfalse% \tmp@quest=0 -\input{#2} +\input{\cartella/#2} \i@sh=0 \loop \advance\i@sh by1 @@ -1051,7 +1067,7 @@ \expandafter\def \csname prbl\romannumeral\icount \endcsname } -\newcommand{\esercizidb}[1]{ +\newcommand{\esercizidb}[1]{ %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them \icount=0 \input{#1.tex}% \i@sh=0 @@ -1060,7 +1076,8 @@ \expandafter\edef\csname ftemp\romannumeral\i@sh \endcsname {\romannumeral\i@sh} \ifnum\i@sh <\number\icount \repeat -\shuffle{ftemp}{\icount} +%\shuffle{ftemp}{\icount} +\shufflees{ftemp}{\icount} %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them \setcounter{n@par}{1} \io=\icount \loop @@ -1599,6 +1616,11 @@ \FPeval\restoventiquattro{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/24:0)*24:0)}%%%% for 4 exercises permutations \FPeval\restotrenta{round(\thevers+\thenomefile+1-trunc((\thevers+\thenomefile)/30:0)*30:0)} %%%% for 5,6,7,8 exercises permutations } +\ifes@prova +\def\restosei{4}%%% for 2 or 3 exercises permutations +\def\restoventiquattro{21}%%%% for 4 exercises permutations +\def\restotrenta{17} %%%% for 5,6,7,8 exercises permutations +\fi %%% pseudorandom versions (permutations of 1 esercise!!) \def\sceglii#1#2{\expandafter\def\csname #2i\endcsname{#1}} @@ -1855,7 +1877,13 @@ \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}% +\expandafter\edef\csname #3\romannumeral\beg@al \endcsname{\csname al@f\romannumeral\tmpalf \endcsname} +\ifes@fillin% +\ifes@solutions +\immediate\write\parametri{\string\def\expandafter\unexpanded\expandafter{\csname #3\romannumeral\beg@al\endcsname}{\csname al@f\romannumeral\tmpalf \endcsname}}% +\fi% +\fi +% \advance\beg@al by-1% \end@al=\tmpalf% \advance\end@al by-1% @@ -1880,6 +1908,11 @@ \advance\tmp@cntb by -#1 \loop \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{#3\romannumeral\tmp@cntb}% +\ifes@fillin% +\ifes@solutions +\immediate\write\parametri{\string\def\expandafter\unexpanded\expandafter{\csname #3\romannumeral\beg@al\endcsname}{\csname al@f\romannumeral\tmpalf \endcsname}}% +\fi% +\fi \advance\tmp@cntb by-1 \ifnum\tmp@cntb>0 \repeat @@ -1985,8 +2018,12 @@ } \fi -%%% another shuffling macro + +%%% another shuffling macro %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them + \newcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln + \old@rando=\number\randomi + \randomi=\semeex \@shfctr=1\relax \whiledo{\@shfctr < 101}% {% @@ -2009,7 +2046,37 @@ \ifnum\@shfA<#3 \repeat } }% -} + \randomi=\number\old@rando +} + + \newcommand{\shufflees}[3][]{% %%% this command has been adapted from probsoln %%% NEW 2017/02/16 for different seeds shuffling exercises and choosing them + %\old@rando=\number\randomi + % \randomi=404 + \@shfctr=1\relax + \whiledo{\@shfctr < 101}% + {% + \setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3} + \ifnum\@shfA=\@shfB + \else + \edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}% + \let\@tmpA=\@@tmpA + \edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}% + \let\@tmpB=\@@tmpB + \expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}% + \expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}% + \fi + \advance\@shfctr by 1\relax + \ifthenelse{\equal{#1}{}}{}{ + \@shfA=0% + \loop + \advance\@shfA by1 + \expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname} + \ifnum\@shfA<#3 \repeat + } + }% + %\randomi=\number\old@rando + } + %========================================================% % Random (adapted from aebrandom) % -- cgit v1.2.3