summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/esami/esami.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/esami/esami.sty')
-rw-r--r--macros/latex/contrib/esami/esami.sty707
1 files changed, 401 insertions, 306 deletions
diff --git a/macros/latex/contrib/esami/esami.sty b/macros/latex/contrib/esami/esami.sty
index 8d1e7e445e..668bef7606 100644
--- a/macros/latex/contrib/esami/esami.sty
+++ b/macros/latex/contrib/esami/esami.sty
@@ -2,8 +2,8 @@
%% This is file `esami.sty',
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% esami.sty package, 2018-02-10 %%
-%% Copyright (C) 2008-2018 G. Messineo e S. Vassallo %%
+%% esami.sty package, 2021-10-11 %%
+%% Copyright (C) 2008-2021 G. Messineo e S. Vassallo %%
%% %%
%% This program can be redistributed and/or modified %%
%% under the terms of the LaTeX Project Public License %%
@@ -45,9 +45,12 @@
% Version 2.5
% 2018/05/06
%Corrected a misprint in the code. Improved the selection of random exercises.
+% Version 2.6
+% 2021/10/11
+%Corrected a misprint in the code. Improved the selection of random exercises.
\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{esami}
- [2018/05/06 v2.5 An Exam Construction Package]
+ [2021/10/11 v2.6 An Exam Construction Package]
% +=============================+
% | THE OPTIONS |
@@ -130,9 +133,7 @@
%========================================================%
\newwrite\parametri
-
\DeclareOption{param}{\es@paramtrue \AtBeginDocument{\newwrite\params}}
-
\ProcessOptions\relax
% +=============================+
@@ -141,7 +142,7 @@
\usepackage{graphicx}
\usepackage{enumerate}
-\usepackage{fp}
+\usepackage[nomessages]{fp}
\usepackage{currfile}
\usepackage{array}
\usepackage{environ}
@@ -152,37 +153,33 @@
\ifes@pst
-\usepackage{pstricks,pstricks-add}
-\ifes@autopst
-\usepackage[crop=off,dvips={}]{auto-pst-pdf}
+ \usepackage{pstricks,pstricks-add}
+ \ifes@autopst
+ \usepackage[crop=off,dvips={}]{auto-pst-pdf}
\else
-\usepackage[off]{auto-pst-pdf}
+ \usepackage[off]{auto-pst-pdf}
\fi
- \else
+\else
\@ifpackageloaded{xcolor}{}{\usepackage{xcolor}}
\fi
+
\input random
%========================================================%
% Error Messages %
%========================================================%
-\def\testversioni{\ifthenelse{\not\equal{\numcompiti}{} } {\relax} %
+\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}
- {}}}
+ \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
-\ifes@language \else \InputIfFileExists{es-italian.lng}%
- { \typeout{esami: No language chosen: Italian language will be used.}}{NO LANGUAGE!!!}\fi
%========================================================%
% DIMENSIONS %
%========================================================%
@@ -264,13 +261,14 @@
\newcounter{nomefile}%%% counter for year-month-day
\newcount\tmp@quest %%% the number of the exercise
\newcount\@probselN %%% in \selectrandomlyn
-\newcount\@shfctr \newcount\@shfA \newcount\@shfB %%% In "\shuffle"
+\newcount\@shfctr %%% In "\shuffle"
+\newcount\@shfA %%% In "\shuffle"
+\newcount\@shfB %%% In "\shuffle"
\newcount\icount %%% counter to shuffle exercises
\newcount\io
\newcount\inizio
\newcount\old@rando
\FPeval\seme{round(\thenomefile+1-trunc(\thenomefile/(2^31-1):0)*(2^31-1):0)}
-%\FPset\semeex\seme
\def\semeex{\seme}
\inizio=1
%%%%
@@ -281,7 +279,7 @@
\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\old@random%%% used to change seed in \selectrandomly
\newcount\sh@max%%% used to choose the exercises
\newcount\@probN%%% number of exercises in \selectrandomly
\newcount\j@m%%% temporary counter in \newproblem
@@ -290,7 +288,8 @@
\newcounter{shuf@lop}
\newcounter{temp@cnt}
\newcounter{questionno}%%% the number of the question in test
-\newcount\@esquestiondepth \@esquestiondepth=0
+\newcount\@esquestiondepth
+ \@esquestiondepth=0
\newcounter{esquestionnoi}
\renewcommand{\theesquestionnoi}{\arabic{esquestionnoi}}
\newcounter{esquestionnoii}
@@ -374,12 +373,15 @@
\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}%
+\newcommand{\esexlisttabheader}{(\hfil\theex@partno\hfil)}
+\newcommand{\ex@header}{\hbox
+{%
+\if
+ \exerstar*\exlabelformatwp%
+\else
+ \exlabelformat
+ \fi
+ }%
}
% +=============================+
@@ -390,36 +392,54 @@
% Maths %
%========================================================%
-%\ifes@param
-%\newcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations
-%\newcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)}
-%\immediate\write\params{%%% writes on a file
-% \string\textbf\string{\string\noindent\space \es@parametermessagea{#1}{#3}
-% \string}\string\newline}}
-%\else
-\newcommand{\FPsv}[2][0]{\FPeval{\fp@tmpa}{clip(round(#2:#1))}\numprint{\fp@tmpa}}%%% It does operations with #1 decimals and with the "param" option it shows operations
-\newcommandx{\FPval}[3][2=0]{\FPeval{#1}{clip(round(#3:#2))}}%% it works like \FPsv with the option param, like \FPeval otherwise
-%\fi
+
+\newcommand{\FPsv}[2][0]
+{%%%% It does operations with #1 decimals and with the "param" option it shows operations
+ \FPeval{\fp@tmpa}{clip(round(#2:#1))}\numprint{\fp@tmpa}\relax
+ }
+\newcommandx{\FPval}[3][2=0]{%% it works like \FPsv with the option param, like \FPeval otherwise
+ \FPeval{#1}{clip(round(#3:#2))%
+ }%
+ }
+
+
%========================================================%
% 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\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
+ \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}}%
+ \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
+ \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}%
@@ -427,37 +447,29 @@
\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
+ \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}}%
- }
+ \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}}%
+ \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}}%
- }
+ \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]{
+\newcommand\simpsqrt[2]{%
\FPset\tmp@sqi{2}%
\FPset\sq@factor{1}%
\FPset\tmp@factor{1}%
@@ -466,20 +478,69 @@
\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}}} }}}}%
- }
+ \ifthenelse{\equal\sq@rad{0}}{0}
+ {%
+ \whiledo{\tmp@sqpw<\tmp@sqj}
+ {%
+ \FPeval\tmp@rad{\sq@rad/\tmp@sqpw}%
+ \FPeval\sq@resto{round((\sq@rad-trunc((\sq@rad)/\tmp@sqpw:0)*(\tmp@sqpw)):0)}%
+ \ifthenelse{\equal\sq@resto{0}}
+ {%
+ \FPset\tmp@factor{\sq@factor}%
+ \FPeval\sq@factor{round(\tmp@factor*\tmp@sqi:0)}%
+ \FPeval\sq@rad{round(\tmp@rad:0)}%
+ \FPset\tmp@sqi{1}
+ }{}
+ \FPset\tmp@sqii{\tmp@sqi}%
+ \FPeval\tmp@sqi{round(\tmp@sqii+1:0)}%
+ \FPeval\tmp@sqpw{round(\tmp@sqi^(\sq@ind):0)}
+ }%
+ \ifthenelse{\isodd{\sq@ind}}
+ {%
+ \ifthenelse{\equal{\sq@factor}{1}}
+ {%
+ \ifthenelse{\equal{\sq@rad}{1}}
+ {%
+ \ifthenelse{\sq@segno<0}{-1}{1}
+ }
+ {%
+ \ifthenelse{\sq@segno<0}{-\sqrt[\sq@ind]{\sq@rad}}
+ {\sqrt[\sq@ind]{\sq@rad}}
+ }
+ }
+ {%
+ \ifthenelse{\equal{\sq@rad}{1}}
+ {%
+ \ifthenelse{\sq@segno<0}{-\sq@factor}{\sq@factor}
+ }
+ {%
+ \ifthenelse{\sq@segno<0}{-\sq@factor\sqrt[\sq@ind]{\sq@rad}}{\sq@factor\sqrt[\sq@ind]{\sq@rad} }
+ }
+ }
+ }%
+ {%
+ \ifthenelse{\sq@segno<0}
+ {\PackageError{esami}{\es@radicalerror}}
+ {\ifthenelse{\equal{\sq@factor}{1}}
+ {%
+ \ifthenelse{\equal{\sq@rad}{1}}
+ {1}
+ {%
+ \ifthenelse{\sq@ind=2}{\sqrt{\sq@rad}}{\sqrt[\sq@ind]{\sq@rad}}
+ }
+ }%
+ {%
+ \ifthenelse{\equal{\sq@rad}{1}}
+ {\sq@factor}
+ {\ifthenelse{\sq@ind=2}
+ {\sq@factor\sqrt{\sq@rad}}
+ {\sq@factor\sqrt[\sq@ind]{\sq@rad}}
+ }
+ }
+ }
+ }
+ }
+ }
%========================================================%
% Coefficients of polynomial %
@@ -487,9 +548,24 @@
\newcommand{\FPsignpol}[2] %%% adapted from code contributed by Hjalmar Basile NEW 2016/04/11
{\FPval\tempsign{#1}
-\ifthenelse{\equal{#2}{}}{\ifnum \tempsign<0 {\sempli{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\sempli{\tempsign}{1}#2}\else{}\fi\fi}
-{\ifnum \tempsign<0 {\semplix{\tempsign}{1}#2}\else \ifnum \tempsign>0{+\semplix{\tempsign}{1}#2}\else{}\fi\fi}
-} %%% nuovo 2016/12/11 per termine noto
+ \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
+ }
+} %% improved for spacing 2021/10/11
%========================================================%
@@ -501,8 +577,6 @@
\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
@@ -512,34 +586,6 @@
\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 %
@@ -595,45 +641,69 @@
%%%%%%% Fill in %%%%%%
\newcommand\fillinproblem{\es@fillintrue%
\ifes@solutions
-\immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+ \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
\fi
}
\ifes@solutions
-\def\fill@ans@color#1{\bfseries\color{red}{#1}}%%% with solutions answers are in red by default
- \else
+ \def\fill@ans@color#1{\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
+ \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
+ \else
+ \ifx#1e\let\fillin@Fmt=\relax%% empty space
+ \else
+ \ifx#1b\let\fillin@Fmt=\fbox%%% box
+ \fi
+ \fi
+ \fi
+\fillin@Fmt{\parbox[b][.8\height][b]{#2}{%
+ \strut\hfil\fill@ans@color{#3}\hfil}%
+ \ifes@test
\ifes@prova
\else
-\ifes@solutions%%% to write the string of solutions
-\immediate\write\sols{\string\item\space\string\makeatletter\space\string\input\string{qf\nome q\romannumeral\tmp@quest e\thevers.parametri\string}\string\makeatother}
-\immediate\write\sols{\unexpanded{#3}}
-\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen}
-\fi
-\fi
-\fi
+ \ifes@solutions%%% to write the string of solutions
+ \immediate\write\sols{%
+ \string\item\space\string\makeatletter\space\string\input\string{qf\nome q\romannumeral\tmp@quest e\thevers.parametri\string}\string\makeatother}
+ \immediate\write\sols{\unexpanded{#3}}
+ \immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen}
+ \fi
+ \fi
+ \fi
}
}
%%%%% Other commands %%%%%%
-\newcommand\stepverssols{\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}}}
-\newcommand\closeverssols{\immediate\write\sols{\string\end{minipage}}}
-
-\newcommand\stepvers{\stepcounter{vers}\ifes@solutions\stepverssols
-\immediate\write\loe{\versionname\space n. \thevers}\fi}
- \newcommand\closevers{\newpage\setcounter{page}{1}\setcounter{ex@no}{0}\ifes@solutions\closeverssols
- \immediate\write\loe{\space}
- \immediate\write\loe{\space}
- \fi}
+\newcommand\stepverssols%
+{%
+\immediate\write\sols
+ {%
+\string\begin{minipage}{.33\string\textwidth}{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}
+ }
+}
+\newcommand\closeverssols%
+{%
+\immediate\write\sols{\string\end{minipage}}
+}
+\newcommand\stepvers
+{%
+\stepcounter{vers}
+ \ifes@solutions\stepverssols
+ \immediate\write\loe{\versionname\space n. \thevers}
+ \fi
+}
+ \newcommand\closevers
+{%
+\newpage\setcounter{page}{1}
+\setcounter{ex@no}{0}
+ \ifes@solutions
+ \closeverssols
+ \immediate\write\loe{\space}
+ \immediate\write\loe{\space}
+ \fi
+}
\def\mydate#1/#2/#3\@empty{\setcounter{nomefile}{\two@digits{#1}\two@digits{#2}\two@digits{#3}}}%%% it gives to the counter "nomefile" a value determined by the date
\PTsHook{\emph{(\esPTs\ \ifthenelse{\equal{\esPTs}{\detokenize{1}}}{\es@pointname}{\es@pointsname})}}%%% The name of the points
@@ -641,24 +711,34 @@
\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
+\AtBeginDocument%% the date and the date component of the seed and some code for solutions
+{%
\def\longdate{\expandafter\es@longdate\@date\@empty}
\def\shortdate{\expandafter\es@shortdate\@date\@empty}
\expandafter\mydate\@date\@empty
- \ifes@prova
- \else
-\ifes@solutions
-\newwrite\sols
-\immediate\openout\sols=\jobname.sol.tex
-\newwrite\loe
-\immediate\openout\loe=\jobname.loe
- \fi
- \fi}
-\newcommand\es@segnala{%%% this command gives the reference of the exact answer in the string of solutions
- \if\es@listType1\addtocounter{sq@quizno}{-1}\refstepcounter{sq@quizno}\fi
-\ifes@prova \else \label{\probchosen} \immediate\write\sols{ \string\item\string\ref{\probchosen}}
-\immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen} \fi
- }
+ \ifes@prova
+ \else
+ \ifes@solutions
+ \newwrite\sols
+ \immediate\openout\sols=\jobname.sol.tex
+ \newwrite\loe
+ \immediate\openout\loe=\jobname.loe
+ \fi
+ \fi
+ }
+\newcommand\es@segnala%%% this command gives the reference of the exact answer in the string of solutions
+{%
+ \if\es@listType1
+ \addtocounter{sq@quizno}{-1}
+ \refstepcounter{sq@quizno}
+ \fi
+ \ifes@prova
+ \else
+ \label{\probchosen}
+ \immediate\write\sols{\string\item\string\ref{\probchosen}}
+ \immediate\write\loe{\es@exercisename\space\theesquestionnoi:\space \probchosen}
+ \fi
+ }
\newcommand{\prior@questionsHook}{}
%========================================================%
@@ -666,55 +746,61 @@
%========================================================%
\def\maxLoopLimit{10}%
\ifes@param
-\newcommandx{\FPsetpar}[5][1=\seme,5={}]{%%% the parameters are not assigned
+\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
+ \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}}
+ \string}\string\newline}}%
\else
\newcommandx{\FPsetpar}[5][1=\seme,5={}]{%
-\ifnum#3>#4\PackageError{esami}{\es@fpsetparerrshort{#2}}{\es@fpsetparerrlong{#2}}\fi%% NEW 2015
-\@ifundefined{nome}{\setcounter{fp@contatore}{-2}}{
-\@ifundefined{base\nome}{\setcounter{fp@contatore}{-2}}{\setcounter{fp@contatore}{-\csname base\nome \endcsname}}}
-\FPval{randomico}{\thevers+\then@par+\thequestionno+#1}
-\old@randomi=\number\randomi%%% it saves the old seed
+\ifnum#3>#4
+ \PackageError{esami}{\es@fpsetparerrshort{#2}}{\es@fpsetparerrlong{#2}}%
+\fi%
+\@ifundefined{nome}{\setcounter{fp@contatore}{-2}}{%
+ \@ifundefined{base\nome}{\setcounter{fp@contatore}{-2}}{\setcounter{fp@contatore}{-\csname base\nome \endcsname}}}%
+\FPeval{randomico}{round(\thevers+\then@par+\thequestionno+#1:0)}%
+\old@randomi=\number\randomi\relax%%% it saves the old seed
\stepcounter{n@par}%
\setcounter{fp@contatore}{-\value{vers}}%
-\randomi=\randomico%
-\ifnum#3>0 \addtocounter{fp@contatore}{-#3} \else \addtocounter{fp@contatore}{#3}\fi
+\randomi=\randomico\relax
+\ifnum#3>0
+ \addtocounter{fp@contatore}{-#3}
+ \else
+ \addtocounter{fp@contatore}{#3}%
+\fi%
\whiledo{\value{fp@contatore}<\value{questionno}}{\nextrandom\stepcounter{fp@contatore}}%
\setrannum{\tmp@a}{#3}{#4}%
\def\rand@ne{#5}%%% checks the parameter (adapted from rangen)
-\ifx\rand@ne\@empty\else\loopCnt=0\relax%
-\@whilenum\loopCnt<\maxLoopLimit\do{%
-\rnd@cnt=1\relax%
-\@for\ne@@tmp:=\rand@ne\do{%
-\ifnum\tmp@a=\ne@@tmp\relax%
-\multiply\rnd@cnt0\relax%
-\else%
-\multiply\rnd@cnt1\relax%
-\fi%
-}%
-\ifnum\rnd@cnt=1\relax%%% all conditions are satisfied
-\loopCnt=\maxLoopLimit%
-\else%
-\advance\loopCnt1\relax%
-\ifnum\loopCnt=\maxLoopLimit%
-\PackageError{esami}{\es@fpsetparerrorshort}{\es@fpsetparerrorshort}%
-\else%
-\setrannum{\tmp@a}{#3}{#4}%
-\fi%
-\fi%
+\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\relax
+ \else%
+ \advance\loopCnt1\relax
+ \ifnum\loopCnt=\maxLoopLimit
+ \PackageError{esami}{\es@fpsetparerrorshort}{\es@fpsetparerrorshort}%
+ \else%
+ \setrannum{\tmp@a}{#3}{#4}%
+ \fi%
+ \fi%
+ }%
+ \fi%
+ \FPeval{#2}{round(\number\tmp@a:0)}%
+ \ifes@fillin
+ \immediate\write\parametri{\string\FPeval\string{#2\string}\string{round(\number\tmp@a:0)\string}}%
+ \fi
+ \randomi=\number\old@randomi%%% restores the seed
}%
\fi%
-\FPeval{#2}{round(\number\tmp@a:0)}%
-\ifes@fillin%
-\immediate\write\parametri{\string\FPeval\string{#2\string}\string{round(\number\tmp@a:0)\string}}%
-\fi%
-\randomi=\number\old@randomi%%% restores the seed
-}%
-\fi
%%%% Command for random sign (taken from rangen) %%%%%
\newcommand{\RandS}{%
@@ -731,25 +817,26 @@
%%%
\ifes@param
\renewcommand{\FPsv}[2][0]{(#2)}%%% \FPsv shows oparations
-\renewcommandx{\FPval}[3][2=0]{\expandafter\def\csname#1\endcsname{(#1)}
+\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}}
+\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})} %
+ \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
+ }
\fi
% +===================================+
@@ -763,33 +850,39 @@
\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
+ \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}}
+\begin{tabular}{$#2*{#1}{|^C#3}} }{\end{tabular} \renewcommand\arraystretch{1}}
%========================================================%
% Risposta %
%========================================================%
\ifes@solutions
-\newenvironment{risposta}[2][l]{\relax}{}
+ \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}
-{}
+ \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
%========================================================%
@@ -803,44 +896,43 @@
\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)
+ \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)
+ \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
+\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
+ \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
+ \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
@@ -871,64 +963,67 @@
\newif\iffirstpass
\ifes@prova
-\newcommand{\newproblem}[1]{%%% \newproblem for the file "totale-versioni"
-\advance\tmp@quest by1
-\iffirstpass
-\global\advance\@probN by 1
-\else
-\let\nome\currfilebase
-\global\def\problabel{e:\thevers-file:\nome}
-\global\def\probnumber{q:\romannumeral\tmp@quest}
- \ifes@fillin
- \immediate\openout\parametri=qf\nome q\number\j@n e\thevers.parametri.tex
- \fi
-\expandafter\global\expandafter\newcommand\csname \probnumber \endcsname{#1}
- \fi
+ \newcommand{\newproblem}[1]%% \newproblem for the file "totale-versioni"
+{%
+ \advance\tmp@quest by1
+ \iffirstpass
+ \global\advance\@probN by 1
+ \else
+ \let\nome\currfilebase
+ \global\def\problabel{e:\thevers-file:\nome}
+ \global\def\probnumber{q:\romannumeral\tmp@quest}
+ \ifes@fillin
+ \immediate\openout\parametri=qf\nome q\number\j@n e\thevers.parametri.tex
+ \fi
+ \expandafter\global\expandafter\newcommand\csname \probnumber \endcsname{#1}
+ \fi
}
\else
\ifes@correzione
- \newcommand{\newproblem}[1]{%%% \newproblem for the "correzione" option
-\advance\tmp@quest by1
- \iffirstpass
- \global\advance\@probN by 1
- \else
- \let\nome\currfilebase
- \global\def\problabel{e:\thevers-file:\nome}
-\global\def\probnumber{q:\romannumeral\tmp@quest}
- \ifes@fillin
- \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
- \fi
-\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
- \expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber \endcsname{#1}
- \fi
- }
- \else
-\newcommand{\newproblem}[1]{%%% \newproblem for the exam
-\advance\tmp@quest by1
-\iffirstpass
-\global\advance\@probN by 1
-\else
-\let\nome\currfilebase
-\global\def\problabel{e:\thevers-file:\nome}
-\global\def\probnumber{q:\romannumeral\tmp@quest}
-\ifes@fillin
-\ifes@solutions%%% to write the string of solutions
-\immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
-\fi
-\fi
-
-\expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
-\expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber\endcsname{#1}%%% it assigns a unique name to exercise
-\fi
-}
-\fi
+ \newcommand{\newproblem}[1]%% \newproblem for the "correzione" option
+ {%
+ \advance\tmp@quest by1
+ \iffirstpass
+ \global\advance\@probN by 1
+ \else
+ \let\nome\currfilebase
+ \global\def\problabel{e:\thevers-file:\nome}
+ \global\def\probnumber{q:\romannumeral\tmp@quest}
+ \ifes@fillin
+ \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+ \fi
+ \expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
+ \expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber \endcsname{#1}
+ \fi
+}
+ \else
+ \newcommand{\newproblem}[1]%% \newproblem for the exam
+ {%
+ \advance\tmp@quest by1
+ \iffirstpass
+ \global\advance\@probN by 1
+ \else
+ \let\nome\currfilebase
+ \global\def\problabel{e:\thevers-file:\nome}
+ \global\def\probnumber{q:\romannumeral\tmp@quest}
+ \ifes@fillin
+ \ifes@solutions%%% to write the string of solutions
+ \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex
+ \fi
+ \fi
+ \expandafter\global\expandafter\newcommand\csname @prob-\problabel-\probnumber \endcsname{\unexpanded{#1}}
+ \expandafter\global\expandafter\newcommand\csname @probi-\problabel-\probnumber\endcsname{#1}%%% it assigns a unique name to exercise
+ \fi
+ }
+ \fi
\fi
\newcommand{\newfillinproblem}[1]{ \newproblem{\fillinproblem #1}}
%%%%%%%% \selectrandomly %%%%%%%
-\newcommand{\selectrandomly}[1]{%
+\newcommand{\selectrandomly}[1]
+{%
\global\@probN=0\relax
\firstpasstrue
\tmp@quest=0
@@ -936,7 +1031,7 @@
\firstpassfalse%%% now prints the question
\tmp@quest=0
\input{#1}
-\@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16
+\@ifundefined{base\nome}{\old@random=\number\randomi
\randomi=\semeex
\setrannum{\rnd@cnta}{1}{\@probN}
\randomi=\number\old@random
@@ -944,10 +1039,9 @@
}{}
\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)}
-}
+\ifthenelse{\number\semeex=\number\seme}
+{\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)}}
+{\FPeval\restotrentasei{round(1+\thenomefile+1+base\nome-trunc((1+\thenomefile+base\nome)/36:0)*36:0)}}
\randomi=\number\old@rando %%% AGGIUNTO 2018/04/28 per giro sbagliato
\ifcase\@probN\or
\def\j@n{1}%%% just one variant
@@ -1015,6 +1109,7 @@
}{
\csname @probi-\problabel-q:\romannumeral\j@m \endcsname
}%
+ \Acapo
\fi
\par\vspace{2mm}
\ifes@param%
@@ -1862,7 +1957,7 @@
\immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file
\immediate\closeout\params
}
-\newcommand{\estraialfa}[3]{
+\newcommand{\estraialfa}[3]{%
\beg@al=#1
\loop
\expandafter\edef\csname #3\romannumeral\beg@al \endcsname{(#3\romannumeral\beg@al)}