From 8284b99c6fa05747925445552dcb2852f3b8201f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 10 Jul 2015 22:38:54 +0000 Subject: esami (10jul15) git-svn-id: svn://tug.org/texlive/trunk@37828 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/esami/esami.sty | 75 ++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/esami/esami.sty b/Master/texmf-dist/tex/latex/esami/esami.sty index f8c6930ea99..d198f79e5bc 100644 --- a/Master/texmf-dist/tex/latex/esami/esami.sty +++ b/Master/texmf-dist/tex/latex/esami/esami.sty @@ -34,7 +34,7 @@ % +=============================+ % | THE OPTIONS | % +=============================+ -\usepackage{etex} +%\usepackage{etex} \newif\ifes@language \es@languagefalse \DeclareOption{italian}{\InputIfFileExists{es-\CurrentOption.lng}% { \es@languagetrue \typeout{esami: VerrĂ  usata la lingua italiana}}% @@ -77,8 +77,8 @@ \DeclareOption{shufflerandom}{\es@shuffleQuestionstrue \es@fissafalse}%% the exercises are randomly shuffled \DeclareOption{noshuffle}{\es@shuffleQuestionsfalse} %%% 2013-06-03 eliminata opzione -\DeclareOption{fillb}{} \newif\ifes@fillin \es@fillinfalse +\DeclareOption{fillb}{\es@fillintrue} \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 @@ -533,8 +533,8 @@ \newcommand\fillinproblem{\es@fillintrue% \ifes@solutions \immediate\openout\parametri=qf\nome q\romannumeral\tmp@quest e\thevers.parametri.tex -\fi} -%%%% +\fi +} \ifes@solutions \def\fill@ans@color#1{\bfseries\color{red}{#1}}%%% with solutions answers are in red by default \else @@ -564,7 +564,8 @@ %%%%% Other commands %%%%%% \newcommand\stepvers{\stepcounter{vers}\ifes@solutions -\immediate\write\sols{\string\begin{minipage}{.33\string\textwidth}\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}} +\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}} @@ -611,7 +612,7 @@ \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 +\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} @@ -913,6 +914,12 @@ \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 @@ -1069,7 +1076,7 @@ } -\def\@getitems#1#2#3{\rand@getitems{#2}{#3}[#1]}% +%\def\@getitems#1#2#3{\rand@getitems{#2}{#3}[#1]}% \newcommand{\esercizidb}[1]{ \icount=0 @@ -1774,20 +1781,17 @@ \renewcommand{\theshuf@lop}{\arabic{shuf@lop}}% } -%%% the command \es@estrai choices in list #1: #2=name input file, #3=name output file, #4=counter name -\newcommand{\es@estrai}[4]{\sh@max=0\sh@chex{#1}{#2}\@getitems{#2}{#4}{#3}} - %%% the command \es@randestrai choices in the list #2 leaving out #1 elements. #3=name input file, #4=name output file, #5=total number of file \newcommand{\es@randestrai}[5][0]{\sh@max=#1\sh@chex{#2}{#3}\rand@getitems{#5}{#4}[#3]}% -\newcommand{\es@trai}[3][0]{%%% it extracts objects from the list #2 leaving out #1 elements. The objects will be named #3i, #3ii, ecc. +\newcommand{\randes@trai}[3][0]{%%% it extracts objects from the list #2 leaving out #1 elements. The objects will be named #3i, #3ii, ecc. \es@randestrai[#1]{#2}{tmp@in}{#3}{\theshuf@lop} } -%%% \estrai is the user command to extract objects from the list #2 leaving out #1 elements. -%%% \estraialfa extracts #1 random objects from the list #2 preserving order and naming them #3i,#3ii, ecc. +%%% \randestrai is the user command to randomly extract objects from the list #2 leaving out #1 elements. +%%% \randestraialfa extracts #1 random objects from the list #2 preserving order and naming them #3i,#3ii, ecc. \ifes@param%%% for parametric version -\newcommand{\estrai}[3][0]{ -\es@trai[#1]{#2}{tmp@out} +\newcommand{\randestrai}[3][0]{ +\randes@trai[#1]{#2}{tmp@out} \tmp@cntb=\value{shuf@lop} \advance\tmp@cntb by -#1 \loop @@ -1808,8 +1812,8 @@ \immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file } \else -\newcommand{\estrai}[3][0]{ -\es@trai[#1]{#2}{tmp@out} +\newcommand{\randestrai}[3][0]{ +\randes@trai[#1]{#2}{tmp@out} \tmp@cntb=\value{shuf@lop} \advance\tmp@cntb by -#1 \loop @@ -1834,9 +1838,44 @@ } \fi +%%% the command \es@estrai choices in list #2 leaving out #1 elements. #3=name input file, #4=name output file, #5=counter name +\newcommand{\es@estrai}[5][0]{\sh@max=#1\sh@chex{#2}{#3}\@getitems{#3}{#5}{#4}} + +\newcommand{\es@trai}[3][0]{%%% it extracts objects from the list #2 leaving out #1 elements. The objects will be named #3i, #3ii, ecc. +\es@estrai[#1]{#2}{tmp@in}{#3}{\theshuf@lop} +} +%%% \estrai is the user command to extract objects from the list #2 leaving out #1 elements. +%%% \estraialfa extracts #1 random objects from the list #2 preserving order and naming them #3i,#3ii, ecc. + +\ifes@param%%% for parametric version +\newcommand{\estrai}[3][0]{ +\es@trai[#1]{#2}{tmp@out} + \tmp@cntb=\value{shuf@lop} + \advance\tmp@cntb by -#1 + \loop + \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{#3\romannumeral\tmp@cntb}% + \advance\tmp@cntb by-1 + \ifnum\tmp@cntb>0 + \repeat +\immediate\write\params{\es@EstraiMessage{#2}{#3}}%%% writes to a file + \immediate\closeout\params +} +\else +\newcommand{\estrai}[3][0]{ +\es@trai[#1]{#2}{tmp@out} + \tmp@cntb=\value{shuf@lop} + \advance\tmp@cntb by -#1 + \loop + \expandafter\edef\csname #3\romannumeral\tmp@cntb\endcsname{\csname tmp@out\romannumeral\tmp@cntb\endcsname}% + \advance\tmp@cntb by-1 + \ifnum\tmp@cntb>0 + \repeat + }% +\fi + %%% \esestrai is the user command to extract exercises from the list #2 leaving out #1 elements. -\newcommand{\estraies}[2][0]{\es@trai[#1]{#2}{tmp@out} +\newcommand{\estraies}[2][0]{\randes@trai[#1]{#2}{tmp@out} \tmp@cnt=\value{shuf@lop} \advance\tmp@cnt by -#1 \loop -- cgit v1.2.3