diff options
author | Karl Berry <karl@freefriends.org> | 2022-06-16 20:26:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-06-16 20:26:53 +0000 |
commit | 06d71f59abdcb8224d67e927c736128820fee886 (patch) | |
tree | a5622b5bcb9f4414f2fdfda8ee3da3e84c30bbcc /Master/texmf-dist/tex/latex/verifiche | |
parent | a3b8e59816f3d95cf22196e6bf3309c6d699a871 (diff) |
verifiche (16jun22)
git-svn-id: svn://tug.org/texlive/trunk@63615 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/verifiche')
-rw-r--r-- | Master/texmf-dist/tex/latex/verifiche/verifiche.sty | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/latex/verifiche/verifiche.sty b/Master/texmf-dist/tex/latex/verifiche/verifiche.sty index 75dc2b2119a..6e45570d9f0 100644 --- a/Master/texmf-dist/tex/latex/verifiche/verifiche.sty +++ b/Master/texmf-dist/tex/latex/verifiche/verifiche.sty @@ -15,7 +15,7 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{verifiche} [2022/03/10 v5.0 .dtx verifiche file] +\ProvidesPackage{verifiche} [2022/06/16 v5.1 .dtx verifiche file] \RequirePackage{xparse} \RequirePackage{xkeyval} \RequirePackage{amsmath} @@ -45,6 +45,7 @@ \newif\ifsolutionscolor\solutionscolorfalse \newif\ifcandidatename\candidatenametrue \newif\iftesttype\testtypetrue +\newif\ifshowinstructiondelimiter\showinstructiondelimiterfalse \newif\ifprintedheading\printedheadingfalse \newif\ifexercisesnumbered\exercisesnumberedtrue \newif\ifshowmarginexercise\showmarginexercisefalse @@ -79,6 +80,9 @@ \setlength{\classrulerlength}{.1\textwidth} \setlength{\daterulerlength}{.15\textwidth} \setlength{\ptrulerlength}{1cm} +\newlength{\verifiche@remainingvspace} +\newlength{\verifiche@remaininghspace} +\newlength{\spacedim} \setlength{\columnseparation}{\fill} %%labels \newcommand{\@verifiche@durationlabeldefault}{Time:}% @@ -120,11 +124,13 @@ \newcommand{\institute}[1]{% \gdef\@institute{#1}} \newcommand{\duration}[2][\@durationlabeldefault]{% - \gdef\@durationpreamble{#1}\gdef\@duration{#2}} + \gdef\@durationpreamble{#1}\gdef\@duration{#2}% + \showinstructiondelimitertrue}% \newcommand{\testtype}[1]{% \gdef\@testtype{#1}} \newcommand{\instruction}[1]{% - \gdef\@instruction{#1}} + \gdef\@instruction{#1}% + \showinstructiondelimitertrue} \newcommand{\asyear}[2][\@asyearlabeldefault]{% \gdef\@asyearpreamble{#1}\gdef\@asyear{#2}} %%fonts and aspects @@ -133,15 +139,15 @@ \newcommand{\institutefont}[1]{% \large \sffamily\color{darkgray}#1} \newcommand{\asyearfont}[1]{% - \hspace*{\fill} #1\hspace*{\fill}\\[.5em]} + \hspace*{\fill} #1\hspace*{\fill}} \newcommand{\testtypefont}[1]{% - \hspace*{\fill}\scshape\huge#1\hspace*{\fill}} + \bgroup\hspace*{\fill}\scshape\huge#1\hspace*{\fill}\egroup} \newcommand{\instructiondelimiter}{% - \rule{\textwidth}{.5pt}} + \hrulefill} \newcommand{\instrunctionfont}[1]{% \sffamily#1} \newcommand{\durationfont}[1]{% - \hspace*{\fill}\@durationpreamble\space\bfseries #1\hspace*{\fill}} + \bgroup\hspace*{\fill}\@durationpreamble\space\bfseries #1\hspace*{\fill}\egroup} \newcommand{\@header@candidatename}{% \noindent\headercandidatenamelabel% \space\underline{\hspace{\candidatenamerulerlength}}} @@ -221,6 +227,17 @@ \ltx@zero #2} \chardef\ltx@zero=0% +%% init vertical/horizontal remaining space +\newcommand{\verifiche@initremainingvspace}{% + \pgfmathsetlength{\verifiche@remainingvspace}{% + floor((\dimexpr\pagegoal-\pagetotal-.5\baselineskip\relax)/\spacedim)*\spacedim% + }% +}% +\newcommand{\verifiche@initremaininghspace}{% +\pgfmathsetlength{\verifiche@remaininghspace}{% + floor(\linewidth/\spacedim)*\spacedim% +}% +}% %%pagestyles \newcommand{\ps@mainverifiche}{% @@ -234,11 +251,13 @@ %%print headings \newcommand{\printheading}{% {\ifdefined\@institute\ifinstitute\thispagestyle{mainverifiche}\fi\else\thispagestyle{plain}\fi}% - {\ifcandidatename\@header\\[1em]\fi}% - {\ifdefined\@asyear\ifasyear \asyearfont{\@asyearpreamble\space\@asyear}\fi\fi}% - {\ifdefined\@testtype\iftesttype\testtypefont{\@testtype}\fi\fi}\\% - {\ifdefined\@instruction\ifinstruction\instructiondelimiter\\{\instrunctionfont{\@instruction}}\\% - \ifdefined\@duration\ifduration{\durationfont\@duration\\}\fi\fi\instructiondelimiter\fi\fi}% + {\ifcandidatename\@header\par\vspace{\baselineskip}\fi}% + {\ifdefined\@asyear\ifasyear\asyearfont{\@asyearpreamble\space\@asyear}\par\vspace{\baselineskip}\fi\fi}% + {\ifdefined\@testtype\iftesttype\testtypefont{\@testtype}\par\fi\fi}% + {\ifshowinstructiondelimiter\instructiondelimiter\par\fi}% + {\ifdefined\@instruction\ifinstruction\instrunctionfont{\@instruction}}\par\fi\fi% + {\ifdefined\@duration\ifduration\durationfont\@duration\par\fi\fi}% + {\ifshowinstructiondelimiter\instructiondelimiter\par\fi}% } %%ambiente esercizio @@ -407,11 +426,11 @@ \end{crocette*}% }% -\define@key{openquestion}{width}[\linewidth]{\def\openquestionwidth{#1}} -\define@key{openquestion}{height}[19cm]{\def\openquestionheight{#1}} -\define@key{openquestion}{spacedim}[0.5cm]{\def\spacedim{#1}} -\define@key{openquestion}{linecolor}[gray]{\def\openquestionlinecolor{#1}} -\define@choicekey*+{openquestion}{type}[\val\nr]{lines, squares}[lines]{% +\define@key{openquestion}{spacedim}[0.5cm]{\setlength{\spacedim}{#1}\verifiche@initremainingvspace\verifiche@initremaininghspace}% +\define@key{openquestion}{height}[\the\verifiche@remainingvspace]{\def\openquestionheight{#1}}% +\define@key{openquestion}{width}[\the\verifiche@remaininghspace]{\def\openquestionwidth{#1}}% +\define@key{openquestion}{linecolor}[gray]{\def\openquestionlinecolor{#1}}% +\define@choicekey*+{openquestion}{type}[\val\nr]{lines, squares}[squares]{% \ifcase\nr\relax% % lines \openquestionsquaredfalse\openquestionlinestrue% @@ -421,33 +440,36 @@ \fi}% {\PackageError{verifiche}{Errore nell'opzione openquestion}{Inserire lines o squares}} \NewDocumentCommand{\openquestion}{o m}{% - \setkeys{openquestion}{type, width, height, linecolor, spacedim} %init + \setkeys{openquestion}{type, spacedim, width, height, linecolor} %init \IfValueT{#1}{\setkeys{openquestion}{#1}}% - \ifopenquestionsquared% if squared open question + \vspace{-\baselineskip}% +\begin{center} +\ifopenquestionsquared% if squared open question \begin{tikzpicture}% - \draw[step=\spacedim, \openquestionlinecolor]% + \draw[step=\the\spacedim, \openquestionlinecolor]% (0,0) grid (\openquestionwidth,-\openquestionheight);% \node[% anchor=base west,% align=left, text width=\openquestionwidth,% inner sep=0cm,% font=\solutionfont,% - execute at begin node=\setlength{\baselineskip}{\spacedim}]% - at (0, -\spacedim){\ifsol#2\fi}; + execute at begin node=\setlength{\baselineskip}{\the\spacedim}]% + at (0, -\the\spacedim){\ifsol#2\fi}; \end{tikzpicture}% \else% if lined open question \begin{tikzpicture}% - \pgfmathparse{int(\openquestionheight/\spacedim)}% + \pgfmathparse{int(\openquestionheight/\the\spacedim)}% \foreach \y in {1, ..., \pgfmathresult}% - \draw[\openquestionlinecolor] (0, -\y*\spacedim) -- +(\openquestionwidth,0);% + \draw[\openquestionlinecolor] (0, -\y*\the\spacedim) -- +(\openquestionwidth,0);% \node[% anchor=base west,align=left,% text width=\openquestionwidth,% inner sep=0cm, font=\solutionfont,% - execute at begin node=\setlength{\baselineskip}{\spacedim}]% - at (0, -\spacedim){\ifsol#2\fi};% + execute at begin node=\setlength{\baselineskip}{\the\spacedim}]% + at (0, -\the\spacedim){\ifsol#2\fi};% \end{tikzpicture}% \fi% + \end{center}% } \NewDocumentCommand{\textandimage}{O{.7\textwidth} O{.3\textwidth} m m}{% \begin{minipage}{#1} |