| 1 |
%% Package `esami' to use with LaTeX 2e |
| 2 |
%% Copyright (C) 2008-2023 G. Messineo e S. Vassallo |
| 3 |
%% |
| 4 |
%% This is file `esami-xyz.cfg', |
| 5 |
%% |
| 6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 7 |
%% esami-xyz.cfg, 2023-07-21 %% |
| 8 |
%% Copyright (C) 2008-2023 G. Messineo e S. Vassallo %% |
| 9 |
%% %% |
| 10 |
%% This program can be redistributed and/or modified %% |
| 11 |
%% under the terms of the LaTeX Project Public License %% |
| 12 |
%% Distributed from CTAN archives in directory %% |
| 13 |
%% macros/latex/base/lppl.txt; either version 1 of the %% |
| 14 |
%% License, or (at your option) any later version. %% |
| 15 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 16 |
|
| 17 |
%%% other packages |
| 18 |
\AtEndOfPackage{ |
| 19 |
\usepackage{amsmath} |
| 20 |
%========================================================% |
| 21 |
% Some shortcuts and Italian maths % |
| 22 |
%========================================================% |
| 23 |
|
| 24 |
\DeclareMathOperator{\sen}{sen} |
| 25 |
\DeclareMathOperator{\tg}{tg} |
| 26 |
\DeclareMathOperator{\arcsen}{arcsen} |
| 27 |
\DeclareMathOperator{\arctg}{arctg} |
| 28 |
\providecommand*{\dif}{\mathop{}\!\mathrm{d}} |
| 29 |
\providecommand{\dlim}{\displaystyle \lim} |
| 30 |
\providecommand{\dsum}{\displaystyle \sum} |
| 31 |
\providecommand{\me}{\mathrm{e}} |
| 32 |
\providecommand{\D}{\displaystyle} |
| 33 |
|
| 34 |
\newenvironment{sistema}{%%% Taken from somewhere in GUIT forum to write equations systems |
| 35 |
\left\lbrace\begin{array}{@{}l@{}}}% |
| 36 |
{\end{array}\right.% |
| 37 |
} |
| 38 |
|
| 39 |
\DeclareRobustCommand{\annu}[2]{_{%%% the annuity command |
| 40 |
\def\arraystretch{0} |
| 41 |
\setlength\arraycolsep{1pt} |
| 42 |
\setlength\arrayrulewidth{.2pt} |
| 43 |
\begin{array}[b]{c c} |
| 44 |
\setlength\arraycolsep{1.5pt} |
| 45 |
\begin{array} |
| 46 |
[b]{r|}\hline |
| 47 |
\\[\arraycolsep] |
| 48 |
\scriptstyle #1 |
| 49 |
\end{array}&\scriptstyle#2% |
| 50 |
\end{array}% |
| 51 |
}} |
| 52 |
|
| 53 |
\newcommand{\vect}[1]{\boldsymbol{#1}} |
| 54 |
|
| 55 |
%%% We prefer var greek math %%% |
| 56 |
|
| 57 |
\newcommand{\eps}{\varepsilon} |
| 58 |
\newcommand{\oldtheta}{\theta} \renewcommand{\theta}{\vartheta} |
| 59 |
\newcommand{\oldepsilon}{\epsilon} \renewcommand{\epsilon}{\varepsilon} |
| 60 |
\newcommand{\oldrho}{\rho} \renewcommand{\rho}{\varrho} |
| 61 |
\newcommand{\oldphi}{\phi} \renewcommand{\phi}{\varphi} |
| 62 |
|
| 63 |
%%%%%%%%%%%%%%%%%%%%%%%%% |
| 64 |
} |
| 65 |
|
| 66 |
% +=============================+ |
| 67 |
% | THE HEADING | |
| 68 |
% +=============================+ |
| 69 |
|
| 70 |
\@ifpackagewith{esami}{prova}{% |
| 71 |
\def\testa{\relax}} |
| 72 |
{% |
| 73 |
\def\testa{ |
| 74 |
{\bfseries\sffamily\small |
| 75 |
\begin{center} |
| 76 |
\begin{tabular}{|lp{.33\textwidth}|lp{.3\textwidth}|lp{.3\textwidth}|} |
| 77 |
\hline |
| 78 |
\multicolumn{1}{|p{.33\textwidth}|}{\examname \newline \Data}&\multicolumn{1}{|p{.3\textwidth}|}{\profname } &\multicolumn{1}{|p{.3\textwidth}|}{\studsignname}\\[4ex] |
| 79 |
\hline |
| 80 |
\multicolumn{1}{|p{.33\textwidth}|}{\studlastname:}&\multicolumn{1}{|p{.3\textwidth}|}{\studfirstname:}&\multicolumn{1}{|p{.3\textwidth}|}{\studid:}\\[4ex] |
| 81 |
\hline |
| 82 |
\end{tabular}\\[3ex] |
| 83 |
\end{center}} |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
% +=============================+ |
| 88 |
% | THE FOOTER | |
| 89 |
% +=============================+ |
| 90 |
|
| 91 |
\ifes@solutions%%%solutions |
| 92 |
\def\ps@esame{\let\@oddhead\@empty\def\@oddfoot{\hfil \textbf{\versionname\ |
| 93 |
n. \thevers} -- %% |
| 94 |
\textbf{\solutionsname} -- %% |
| 95 |
\pagename\ \thepage |
| 96 |
\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty} |
| 97 |
\else%%% no solutions |
| 98 |
\def\ps@esame{ |
| 99 |
\let\@oddhead\@empty\def\@oddfoot%% |
| 100 |
{\hfil \textbf{\versionname\ n. \thevers\ |
| 101 |
-- \pagename\ \thepage}\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty} |
| 102 |
\fi |
| 103 |
|
| 104 |
% +=============================+ |
| 105 |
% | THE SOLUTION STRING | |
| 106 |
% +=============================+ |
| 107 |
|
| 108 |
\def\ps@soltest{\let\@oddhead\@empty\def\@oddfoot{\hfil %\textbf{\versionname\ n. \thevers} -- %% |
| 109 |
\textbf{\solutionsname} -- \pagename\ \thepage |
| 110 |
\hfil}\let\@evenhead\@empty\let\@evenfoot\@empty} |
| 111 |
|
| 112 |
\ifes@solutions |
| 113 |
\newcommand{\stringasol}{\newpage% |
| 114 |
\vspace{.8cm} |
| 115 |
\pagestyle{soltest} |
| 116 |
\input{\jobname.sol.tex} % |
| 117 |
} |
| 118 |
\else |
| 119 |
\newcommand{\stringasol}{\relax} |
| 120 |
\fi |
| 121 |
|
| 122 |
|
| 123 |
% +=============================+ |
| 124 |
% | SOME INTRUCTIONS | |
| 125 |
% +=============================+ |
| 126 |
|
| 127 |
\def\istruzionii{{ |
| 128 |
\sffamily \textbf{INSTRUCTIONS} |
| 129 |
\begin{itemize} |
| 130 |
\item Write here your instructions |
| 131 |
\item two |
| 132 |
\item three |
| 133 |
\end{itemize}}} |
| 134 |
|
| 135 |
\def\istruzioniii{\setlength{\fboxsep}{1.5ex}\setlength{\fboxrule}{1.2pt}{\sffamily |
| 136 |
\framebox{\parbox{\textwidth}{\textbf{Some other instructions.}}}}\\[3ex]} |
| 137 |
|
| 138 |
%\AtBeginDocument{ |
| 139 |
%\renewcommand\stepverssols{\immediate\write\sols{{\string\large\string\textbf{\es@solutionname\ \versionname\ n. \thevers}}} |
| 140 |
%} |
| 141 |
%\renewcommand\closeverssols{ |
| 142 |
%\immediate\write\sols{\string\vspace{5ex}}} |
| 143 |
% } |
| 144 |
|
| 145 |
%%% THIS CODE IS TO CHECK the total score of exercises |
| 146 |
|
| 147 |
|
| 148 |
\AtEndOfPackage{ |
| 149 |
\newdimen\punteggio %% NEW 2016/04/11 to check the total score of exercises |
| 150 |
\setlength{\punteggio}{0pt} |
| 151 |
\def\@PTs#1{% |
| 152 |
\addtolength{\punteggio}{#1 pt} %% NEW 2016/04/11 to check the total score of exercises |
| 153 |
\global\punteggio=\punteggio |
| 154 |
\gdef\es@PTs{#1}\ifx\es@PTs\@empty\gdef\es@PTs{1}\fi |
| 155 |
\global\let\esPTs=\es@PTs\global\let\es@PTs=\@empty |
| 156 |
\if\es@star*\else\PTs@Hook\fi |
| 157 |
} |
| 158 |
\renewcommand{\checkpoints}{% |
| 159 |
\ifdim\punteggio=\punti pt %% NEW 2016/04/11 to check the total score of exercises |
| 160 |
\else |
| 161 |
\PackageError{esami}{\es@pointerrorshort} {\es@pointerrorlong} |
| 162 |
\fi |
| 163 |
\global\punteggio=0pt% |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
|
| 168 |
%%%% %%%%% HERE I GET RID OF THE MINIPAGE IN MULTIPLE CHOICE QUESTIONS |
| 169 |
%\AtEndOfPackage{ |
| 170 |
%\renewcommand{\selectrandomly}[1]{% |
| 171 |
%\global\@probN=0\relax |
| 172 |
%\firstpasstrue |
| 173 |
%\tmp@quest=0 |
| 174 |
%\input{#1}%%%%% |
| 175 |
%\firstpassfalse%%% now prints the question |
| 176 |
%\tmp@quest=0 |
| 177 |
%\input{#1} |
| 178 |
%\@ifundefined{base\nome}{\old@random=\number\randomi %%% 2015/01/16 |
| 179 |
%\setrannum{\rnd@cnta}{1}{\@probN} |
| 180 |
%\randomi=\number\old@random |
| 181 |
%\expandafter\global\expandafter\edef\csname base\nome \endcsname{\number\rnd@cnta} |
| 182 |
%}{} |
| 183 |
%\FPeval\restotrentasei{round(\thevers+\thenomefile+1+base\nome-trunc((\thevers+\thenomefile+base\nome)/36:0)*36:0)} |
| 184 |
%\ifcase\@probN\or |
| 185 |
%\def\j@n{1}%%% just one variant |
| 186 |
%\or%%% 2 variants |
| 187 |
%\ifthenelse{\isodd{\thevers}}{\def\j@n{1}}{\def\j@n{2}} |
| 188 |
%\or%%% 3 variants |
| 189 |
%\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}% |
| 190 |
%\or%%% 4 variants |
| 191 |
%\def\j@n{\ifcase\restotrentasei\or 3\or 4\or 1\or 2\or 1\or 2\or 3\or 4\or 3\or 1\or 4\or 2\or 4\or 2\or 3\or 1\or 2\or 3\or 1\or 4\or 1\or 4\or 2\or 3\or 3\or 2\or 1\or 4\or 2\or 3\or 4\or 1\or 4\or 3\or 2\or 1\fi}% |
| 192 |
%\or%%% 5 variants |
| 193 |
%\def\j@n{\ifcase\restotrentasei\or 5\or 1\or 2\or 3\or 4\or 5\or 2\or 3\or 5\or 1\or 4\or 3\or 1\or 4\or 2\or 5\or 4\or 2\or 3\or 5\or 1\or 5\or 1\or 4\or 2\or 3\or 1\or 3\or 5\or 4\or 2\or 3\or 4\or 5\or 2\or 1\fi}% |
| 194 |
%\or%%% 6 variants |
| 195 |
%\def\j@n{\ifcase\restotrentasei\or 2\or 5\or 1\or 3\or 4\or 2\or 6\or 1\or 3\or 6\or 5\or 4\or 2\or 3\or 2\or 5\or 4\or 1\or 6\or 1\or 4\or 3\or 2\or 6\or 5\or 4\or 6\or 2\or 5\or 1\or 3\or 6\or 3\or 5\or 1\or 4\fi}% |
| 196 |
%\or%%% 7 variants |
| 197 |
%\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}% |
| 198 |
%\or%%% 8 variants |
| 199 |
%\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}% |
| 200 |
%\else |
| 201 |
%\FPeval\j@n{round(\thevers*\es@primo+base\nome+1-trunc((\thevers*\es@primo+base\nome)/\number\@probN:0)*\number\@probN:0)} |
| 202 |
%\fi |
| 203 |
%\def\probchosen{\problabel-q:\romannumeral\j@n} |
| 204 |
%\ifes@test |
| 205 |
%\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm} |
| 206 |
%\Acapo |
| 207 |
%\else |
| 208 |
%\csname @probi-\problabel-q:\romannumeral\j@n \endcsname \vspace{5mm} |
| 209 |
%\Acapo |
| 210 |
%\fi |
| 211 |
% \ifes@fillin |
| 212 |
% \immediate\closeout\parametri |
| 213 |
% \fi |
| 214 |
%} |
| 215 |
%} |
| 216 |
|
| 217 |
%%%% %%%%% HERE I GET RID OF THE MINIPAGE IN EXERCISES |
| 218 |
%\AtEndOfPackage{ |
| 219 |
%\renewenvironment{problem}[1][]{%%% it's like exercise, but with points |
| 220 |
%\es@testfalse |
| 221 |
%%\begin{minipage}{\linewidth} %%% new 2016/02/19 |
| 222 |
%\renewcommand{\punti}{#1} |
| 223 |
%\ifes@solutionsonly\else\examenddef\fi |
| 224 |
%\begin{exercise} |
| 225 |
%\ifes@prova |
| 226 |
%\else |
| 227 |
%\ifes@solutions |
| 228 |
%\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} |
| 229 |
%\fi |
| 230 |
%\fi |
| 231 |
%} |
| 232 |
%{ |
| 233 |
%\end{exercise} |
| 234 |
%%\end{minipage}%%% new 2016/02/19 |
| 235 |
%\ifes@param |
| 236 |
%\immediate\closeout\params |
| 237 |
%\fi} |
| 238 |
% |
| 239 |
%\renewenvironment{problem*}[1][]{\es@testfalse |
| 240 |
%%\begin{minipage}{\linewidth} %%% new 2016/02/19 |
| 241 |
%\renewcommand{\punti}{#1} |
| 242 |
%\ifes@solutionsonly\else\examenddef\fi |
| 243 |
%\begin{exercise*} |
| 244 |
%\ifes@prova |
| 245 |
%\else |
| 246 |
%\ifes@solutions |
| 247 |
%\immediate\write\loe{\es@exercisename\space \theex@no:\space \probchosen} |
| 248 |
%\fi |
| 249 |
%\fi |
| 250 |
%} |
| 251 |
%{ |
| 252 |
%\end{exercise*} |
| 253 |
%%\end{minipage}%%% new 2016/02/19 |
| 254 |
%\ifes@param |
| 255 |
%\immediate\closeout\params |
| 256 |
%\fi } |
| 257 |
%} |
| 258 |
%\makeatletter |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
%\AtEndOfPackage{ |
| 264 |
%\newcount\old@rando |
| 265 |
%\renewcommand{\shuffle}[3][]{% %%% this command has been adapted from probsoln |
| 266 |
%\old@rando=\number\randomi |
| 267 |
%\randomi=\thenomefile |
| 268 |
%\@shfctr=1\relax |
| 269 |
%\whiledo{\@shfctr < 101}% |
| 270 |
%{% |
| 271 |
%\setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3} |
| 272 |
%\ifnum\@shfA=\@shfB |
| 273 |
%\else |
| 274 |
%\edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}% |
| 275 |
%\let\@tmpA=\@@tmpA |
| 276 |
%\edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}% |
| 277 |
%\let\@tmpB=\@@tmpB |
| 278 |
%\expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}% |
| 279 |
%\expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}% |
| 280 |
%\fi |
| 281 |
%\advance\@shfctr by 1\relax |
| 282 |
%\ifthenelse{\equal{#1}{}}{}{ |
| 283 |
%\@shfA=0% |
| 284 |
%\loop |
| 285 |
%\advance\@shfA by1 |
| 286 |
%\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname} |
| 287 |
%\ifnum\@shfA<#3 \repeat |
| 288 |
%} |
| 289 |
%}% |
| 290 |
%\randomi=\number\old@rando |
| 291 |
%} |
| 292 |
|
| 293 |
%\newcommand{\shufflees}[3][]{% %%% this command has been adapted from probsoln |
| 294 |
%%\old@rando=\number\randomi |
| 295 |
%% \randomi=404 |
| 296 |
%\@shfctr=1\relax |
| 297 |
%\whiledo{\@shfctr < 101}% |
| 298 |
%{% |
| 299 |
%\setrannum{\@shfA}{1}{#3}\setrannum{\@shfB}{1}{#3} |
| 300 |
%\ifnum\@shfA=\@shfB |
| 301 |
%\else |
| 302 |
%\edef\@@tmpA{\csname#2\romannumeral\@shfA\endcsname}% |
| 303 |
%\let\@tmpA=\@@tmpA |
| 304 |
%\edef\@@tmpB{\csname#2\romannumeral\@shfB\endcsname}% |
| 305 |
%\let\@tmpB=\@@tmpB |
| 306 |
%\expandafter\xdef\csname#2\romannumeral\@shfA\endcsname{\@tmpB}% |
| 307 |
%\expandafter\xdef\csname#2\romannumeral\@shfB\endcsname{\@tmpA}% |
| 308 |
%\fi |
| 309 |
%\advance\@shfctr by 1\relax |
| 310 |
%\ifthenelse{\equal{#1}{}}{}{ |
| 311 |
%\@shfA=0% |
| 312 |
%\loop |
| 313 |
%\advance\@shfA by1 |
| 314 |
%\expandafter\xdef\csname#1\romannumeral\@shfA\endcsname{\csname#2\romannumeral\@shfA\endcsname} |
| 315 |
%\ifnum\@shfA<#3 \repeat |
| 316 |
%} |
| 317 |
%}% |
| 318 |
%%\randomi=\number\old@rando |
| 319 |
%} |
| 320 |
|
| 321 |
%\renewcommand{\esercizidb}[1]{ |
| 322 |
%\icount=0 |
| 323 |
%\input{#1.tex}% |
| 324 |
%\i@sh=0 |
| 325 |
%\loop |
| 326 |
%\advance\i@sh by1 |
| 327 |
%\expandafter\edef\csname ftemp\romannumeral\i@sh \endcsname {\romannumeral\i@sh} |
| 328 |
%\ifnum\i@sh <\number\icount |
| 329 |
%\repeat |
| 330 |
%\shufflees{ftemp}{\icount} |
| 331 |
%\setcounter{n@par}{1} |
| 332 |
%\io=\icount |
| 333 |
%\loop |
| 334 |
%\ifes@test |
| 335 |
%\begin{minipage}{.95\linewidth} |
| 336 |
%\fi |
| 337 |
%\ifes@shuffleQuestions |
| 338 |
%\csname prbl\csname ftemp\romannumeral\io\endcsname\endcsname |
| 339 |
%\else |
| 340 |
%\csname prbl\romannumeral\io \endcsname |
| 341 |
%\fi |
| 342 |
%\def\probchosen{\problabel-\probnumber} |
| 343 |
%\csname @probi-\problabel-\probnumber \endcsname |
| 344 |
%\ifes@test |
| 345 |
%\vspace{5mm}\end{minipage} |
| 346 |
%\Acapo |
| 347 |
%\vspace{4mm} |
| 348 |
%\fi |
| 349 |
%\advance\io by-1 |
| 350 |
%\ifnum\io > 0 \repeat |
| 351 |
%\par} |
| 352 |
%} |
| 353 |
%\makeatother |