summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/bubblesort/README.md18
-rw-r--r--macros/latex/contrib/bubblesort/bubblesort.dtx448
-rw-r--r--macros/latex/contrib/bubblesort/bubblesort.ins39
-rw-r--r--macros/latex/contrib/bubblesort/bubblesort.pdfbin0 -> 222477 bytes
-rw-r--r--macros/latex/contrib/draftwatermark/draftwatermark.dtx48
-rw-r--r--macros/latex/contrib/draftwatermark/draftwatermark.pdfbin264359 -> 264619 bytes
-rw-r--r--macros/latex/contrib/verifiche/Esempio.pdfbin0 -> 174217 bytes
-rw-r--r--macros/latex/contrib/verifiche/Esempio.tex150
-rw-r--r--macros/latex/contrib/verifiche/README.md30
-rw-r--r--macros/latex/contrib/verifiche/verifiche.dtx1295
-rw-r--r--macros/latex/contrib/verifiche/verifiche.ins41
-rw-r--r--macros/latex/contrib/verifiche/verifiche.pdfbin0 -> 504635 bytes
12 files changed, 2051 insertions, 18 deletions
diff --git a/macros/latex/contrib/bubblesort/README.md b/macros/latex/contrib/bubblesort/README.md
new file mode 100644
index 0000000000..44d4ce4c60
--- /dev/null
+++ b/macros/latex/contrib/bubblesort/README.md
@@ -0,0 +1,18 @@
+----------------------------------------------------------------
+ The bubblesort package
+ ====================
+
+ This package sorts a list of TeX items {item 1}...{item k}
+ in "increasing" order where "increasing" is determined by a
+ comparator macro. By default it sorts real numbers with the
+ usual meaning of "increasing" but some other examples are
+ discussed in the documentation. A second macro is included
+ which sorts one list and applies the same permutation to a
+ second list.
+
+
+E-mail: taylor.2@nd.edu
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
diff --git a/macros/latex/contrib/bubblesort/bubblesort.dtx b/macros/latex/contrib/bubblesort/bubblesort.dtx
new file mode 100644
index 0000000000..a96fe27fb6
--- /dev/null
+++ b/macros/latex/contrib/bubblesort/bubblesort.dtx
@@ -0,0 +1,448 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2019 by Laurence R Taylor
+% -----------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{bubblesort}
+\usepackage{graphicx}
+\usepackage{hyperref}
+\hypersetup{
+ colorlinks=true,
+ linkcolor=blue,
+ filecolor=magenta,
+ urlcolor=cyan,
+}
+\DisableCrossrefs
+\CodelineNumbered
+\RecordChanges
+\begin{document}
+\DocInput{bubblesort.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{293}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \hfuzz=200pt
+% \changes{v1.0}{?2019?/?07?/?17?}{Initial version}
+% \title{bubblesort}
+% \author{Laurence R Taylor}
+% \date{2020/06/24}
+% \maketitle
+% \begin{abstract}
+% This package is a \LaTeX\ port of the sorting function \href{https://en.wikipedia.org/wiki/Bubble_sort}{bubble sort}.
+% Bubble sort is usually coded using arrays but it can be done without them and
+% since \LaTeX\ does not support arrays natively, bubble sort seemed like a good routine to port.
+% It's lack of speed is not really a problem with the data sizes likely to be encountered in most \LaTeX\ applications.
+%
+% The objects to be sorted are either a stack or a list.
+% A \emph{stack} is a sequence of legal \TeX\ code items enclosed in brace pairs, \vskip0pt%
+% \begin{center}|{|\emph{item 1}|}{|\emph{item 2}|}|\dots|{|\emph{item n}|}|\end{center}
+% while a \emph{list} is a macro which expands to a stack. Fragile commands in an \emph{item} may not work as expected.
+% To sort the items one needs a notion of when one \emph{item} is ``less than'' another.
+%
+% The macro |\bubblesort| does the bubble sort. It takes three arguments: |\bubblesort[#1]{#2}{#3}|.
+% The optional argument is a comparator macro telling when one item is smaller than another.
+% If empty it assumes the stack is a stack of integers or real numbers
+% and sorts it using the usual $<$. Argument |#2| is the stack or list to be sorted and
+% argument |#3| a macro which will contain the sorted list in increasing order.
+%
+% The only dependency is |etoolbox.sty|.
+% \end{abstract}
+% \section{Introduction}
+% \makeatletter
+% \newcounter{LineAA}
+% \def\Label#1{\hypertarget{@bubblesort@ref#1}\relax\setcounter{LineAA}{\value{CodelineNo}}\stepcounter{LineAA}
+% {\immediate\write\@auxout{\string\gdef\string\@bubblesort@ref#1{\number\value{LineAA}}}}}
+% \def\codeRef#1{\ifcsdef{@bubblesort@ref#1}{\hyperlink{@bubblesort@ref#1}{\csname @bubblesort@ref#1\endcsname}}{\textbf{??}}}
+% \def\LabelLine#1{\Label{#1}\nointerlineskip\begin{macrocode}}
+% \newbox\ff\setbox\ff=\hbox{\scalebox{0.75}{\hbox{\Large\tt doublebubblesort}}}
+% \newbox\fff\setbox\fff=\hbox{\scalebox{0.75}{\hbox{\Large\tt doublebubblesortB}}}
+% \newbox\mm\setbox\mm=\hbox{\rotatebox{114}{\vrule depth0.8pt height 0pt width 9pt}}
+% \makeatother
+% \newbox\ff\setbox\ff=\hbox{\scalebox{0.75}{\hbox{\Large\tt doublebubblesort}}}
+% \newbox\fff\setbox\fff=\hbox{\scalebox{0.75}{\hbox{\Large\tt doublebubblesortB}}}
+% \newbox\mm\setbox\mm=\hbox{\rotatebox{114}{\vrule depth0.8pt height 0pt width 9pt}}
+% There are two macros provided which implement the standard bubble sort algorithms
+% on stacks or lists. See section \ref{SandL} for a discussion of stacks or lists.
+% \subsection{\texorpdfstring{\copy\mm\tt bubblesort}{bubblesort}}
+% |\bubblesort[#1]{#2}{#3}|: Argument |#2| is the stack or list to be sorted. Argument |#3| contains the sorted list
+% after evaluation. Argument |#2| can be the same as argument |#3|. Argument |#3| can also be blank in which
+% case the output string is inserted into the input stream.
+% Optional argument |#1| is a comparator macro.
+% \subsubsection{Comparator macros}
+% A comparator macro can have any legal \TeX\ name. It must have two arguments.
+% When in use the comparator macro is evaluated on consecutive pairs of elements in the stack.
+% If argument |#2| is ``smaller'' than argument |#1| the macro sets |\bubblesortflag| to |1| and sets it
+% to |-1| otherwise.
+% Two examples are supplied: |\realSort| on line \codeRef{realSort}\ of the code below and
+% |\alphSort| on line \codeRef{alphSort}.
+%
+% \subsection{\texorpdfstring{\copy\mm\tt doublebubblesort}{bubblesort}}|\doublebubblesort[#1]{#2}{#3}{#4}{#5}|:
+%
+% The macro |\doublebubblesort| sorts two stack/lists. Arguments |#1|, |#2| and |#3| are identical to the corresponding
+% arguments for |\bubblesort|. Argument |#4| is another stack or list of the same length or longer than stack/list |#2|.
+% When expanded |\doublebubblesort| sorts |#2| just the same as |\bubblesort| would. However, every move made on
+% stack |#2| is also done on stack |#4|. Argument |#5| is the name for the output of the result of this ``sort'' on |#4|.
+% As usual |#5| can be blank or |#4| and |#5| can be the same macro. |#3| and |#5| can also be the same macro, in
+% which case it contains the result of the sort on argument |#4|, \emph{except} if both |#3| and |#5| are blank, |#3|
+% is put into the input stream followed by |#5|.
+%
+% An example to keep in mind is the following. One way to mimic a hash in \LaTeX\ is to have a list of keys and a second
+% list of values with the value associated to a key being determined by position in the values list. If the key list is sorted it
+% will be necessary to do the same interchanges on the values list to maintain the correspondence.
+% See subsection \ref{permute} for another example using |\doublebubblsort|.
+% \section{Stacks and lists}\label{SandL}
+% The lists here closely resemble Knuth's lists in the
+% \href{http://www.ctex.org/documents/shredder/src/texbook.pdf}{\TeX book}, page 378, Appendix D,
+% except they lack Knuth's initial |\\| prepended to each item. As discussed by Knuth, the |\\| can be used to process
+% each item in the list.
+% Sort algorithms require knowledge of pairs of items from the list
+% so macros which only know about one item are not needed.
+%
+%
+% Other implementations of lists use a reserved character as a separator.
+% Separators like commas or semicolons or whatever have the drawback that then the separator can not be used in the item text
+% without additional coding.
+%
+% \TeX's brace-pair mechanism is quite robust. It handles nested brace pairs just fine. One word of \textcolor{red}{warning}:
+% an empty brace pair |{}| is used as an end of list indicator. They are added to the stack/list arguments
+% when needed and are not present at the end of lists produced by macros in this package so they rarely trouble the user.
+% It does mean that
+% \textcolor{red}{there can be no empty (or even |{white space}|) brace pairs in the input list.}
+% Given how \TeX\ discards white space, |{white space}| is probably not what is wanted anyway. Using |{{white space}}| will probably
+% yield results closer to what was intended and this works.
+% \section{Examples}
+% Here are a few examples if things that can be done with sorts.
+% \subsection{\texorpdfstring{\copy\mm\tt refs}{refs}}
+% Given a stack of references defined from |\label| such as |{ref 1}{ref 2}|\dots|{ref n}| which expand to integers or real numbers
+% try to define
+% \begin{center}
+% \color{red}|\def\refs#1{\bubblesort[\refSort]{#1}{\answers}}|\hskip1in\null \\where |\refSort#1#2{\realSort{\ref{#1}}{\ref{#2}}}|. \color{black}
+% \end{center}
+% The above does not work because |\ref| is protected and does not expand to just the number.
+% Instead, the package |refcount.sty| supplies |\getrefnumber| which is expandable and does what is needed.
+% Add |\usepackage{refcount}| to the preamble and define
+% \begin{verbatim}
+% \def\refSort#1#2{%
+% \edef\aa{\getrefnumber{#1} pt}\edef\bb{\getrefnumber{#2} pt}%
+% \ifdimless{\bb}{\aa}{\bubblesortflag=1}{\bubblesortflag=-1}%
+% }
+% \end{verbatim}
+% Then|\def\refs#1{\bubblesort[\refSort]{#1}{\ans}}| sorts the numbers in increasing order and puts the answer in |\ans|.
+%
+% \subsection{Use {\texorpdfstring{\copy\mm\tt refs}{refs}}\ twice}
+% Since |\bubblesort| is a stable sorting algorithm, it can be usefully used more than once on the same data.
+% Suppose |\refSort| is defined as above and there is a list |\def\LL{{ref 1}{ref 2}|\dots|{ref n}}|.
+% Then |\bubblesort[\refSort]{\LL}{\LL}| sorts the numbers in increasing order.
+%
+% But some of them may be from definitions, others from theorems, or lemmas, etc.
+% Suppose |\refName#1| is a macro such that |\refName{ref k}| returns |Definition|, |Theorem|, |Lemma|, etc..
+% Then
+% \begin{center}
+% |\bubblesort[\refSort]{\LL}{\LL} \bubblesort[\alphSort]{\LL}{\LL}|
+% \end{center}
+% \noindent returns
+% |\def\LL{{ref k_1}{ref k_2}|\dots|{ref k_n}}|
+% where the first set of references are |Definition|'s, the second set of references are |Lemma|'s and
+% the third set of references are |Theorem|'s.
+% The set of numbers for the |Definition|'s are increasing,
+% the set of numbers for the |Lemma|'s are increasing and
+% the set of numbers for the |Theorem|'s are increasing.
+% With more complicated coding, the names can be added and the lists compactified to get something line
+% |Theorems 1-3 and 5, Lemma 9 and Definitions 6, 8 and 12|.
+%
+% \subsection{\texorpdfstring{\copy\mm\tt permute}{permute}}\label{permute}
+% Use |\doublebubblesort| to apply a permutation to a stack/list.
+% A \emph{permutation} is an ordered stack/list of symbols which also has a natural order.
+% Popular symbol sets are positive integers and lowercase letters. The comparator macro needs
+% to sort a list of symbols with no repetitions back to its natural order.
+% A permutation $\pi$ can be given by listing the values of $\pi$ when applied to the symbols
+% in their natural order. For example $\pi$|={{5}{1}{2}{3}{4}}| means $\pi$|(1)=5|, $\pi$|(2)=1|, $\pi$|(3)=2|, $\pi$|(4)=3|, $\pi$|(5)=4|.
+%
+% At the end of line 2 of the displayed code below, |\ott| contains the symbols in their natural order
+% so |\permute| does not need to be told the symbols in advance.
+% At the end of line 3, |\ott| contains the inverse to the original permutation.
+% At the end of line 4, |#4| contains the permuted version of |#3|.
+%
+% \null\hskip0.13\textwidth \vbox{\begin{verbatim}
+% \newcommand{\permute}[4][\realSort]{%
+% \bubblesort[#1]{#2}{\ott}%
+% \doublebubblesort[#1]{#2}{\ott}{\ott}{\ott}%
+% \doublebubblesort[#1]{\ott}{\ott}{#3}{#4}%
+% }
+% \end{verbatim}}
+% If |\def\LL{{${a_1}$}{${a_2}$}{${a_3}$}{${a_4}$}{${a_5}$}}| then\\
+% |\permute{{5}{1}{2}{3}{4}}{\LL}{}| yields
+%
+% {${\tt a}_5$}\, {${\tt a}_1$}\, {${\tt a}_2$}\, {${\tt a}_3$}\, {${\tt a}_4$}\ , which is
+% {${\tt a}_{\pi(1)}$}\, {${\tt a}_{\pi(2)}$}\, {${\tt a}_{\pi(3)}$}\, {${\tt a}_{\pi(4)}$}\, {${\tt a}_{\pi(5)}$}\ as desired.
+% \bigskip
+%
+% |\permute| can also be used to multiply permutations:
+% \begin{itemize}
+% \item |\permute{\pi_1}{\pi_2}{\ans}| yields |\pi_2|$\circ$|\pi_1|
+% \item |\permute{\pi_2}{\pi_1}{\ans}| yields |\pi_1|$\circ$|\pi_2|.
+% \end{itemize}
+%
+% \section{Implementation}\label{implementation}
+% Line numbers refer to the line numbers printed next to the code beginning with |\NeedsTeXFormat| \hyperlink{NeedsTeXFormat}{here}.
+% There are only four public macros, |\bubblesort| on line \codeRef{bubblesort}
+% and |\doublebubblesort| on line \codeRef{doublebubblesort} and comparator macros |\realSort| on line \codeRef{realSort}\ and
+% |\alphSort| on line \codeRef{alphSort}.
+% Private macros begin with |\@bubblesort@| to minimize the chance of name conflicts with other packages.
+% This makes reading the code somewhat tedious so
+% in the descriptions of the code below, the initial |\@bubblesort@| will be replaced by |*|.
+%
+% \subsection{\texorpdfstring{\copy\mm\tt bubblesort}{bubblesort}}
+% |\bubblesort[#1]{#2}{#3}|:
+% The implementation of |\bubblesort| begins by defining an empty |*rightList| and putting the stack/list to be sorted, |#2|, into |*workingList|.
+% Note |#2| is now safe - unless |#2| equals |#3|, |#2| will never change.
+% Then |\bubblesort| removes the leftmost item in |*workingList|
+% and saves it in |*testItem|. Then it moves on to |\@bubblesort@S| which does the recursion.
+%
+% First, |\bubblesort@S| (line \codeRef{bubblesortS}) sets an |etoolbox| boolean, |did a flip|, to false and sets |*leftList| to empty.
+% Then the macro removes the leftmost element in |*workingList| and saves it in |*nextItem|.
+% Then it enters the |while| loop (line \codeRef{while}).
+% The exit condition is that |*nextItem| is empty.
+% Then the comparator macro is evaluated on the ordered pair $\bigl($|*testItem| , |*nextItem|$\bigr)$.
+% The smaller of the pair is append to |*leftList| on the right and the larger is set to |*testItem|.
+% The loop continues until |*workingList| is empty. At this point |*testItem| contains the largest element in the
+% original |*workingList| and it is added to |*rightList| at the left end.
+% Hence |*leftList| followed by |*rightList| is the original list.
+% Next |*leftList| is put into |*workingList| and then the leftmost element is removed and put into |*testItem|.
+% Finally the |while| loop is reentered.
+%
+% After $k$ iterations of the |while| loop, |*rightList| has $k$ elements which are the $k$ largest elements in the original list in increasing order.
+% When the boolean |did a flip| is false, |*leftList| is also ordered so |*leftList| followed by |*rightList| is the original list sorted
+% and the |while| loop exits.
+% The sorted list and macro |#3| from |\bubblesort| are passed on to |\@bubblesort@output| which outputs the list as requested
+% and |\bubblesort| is finished.
+%
+% \noindent\textbf{Remark:} The reader who has worked through the discussion above will have noticed that this implementation of bubble sort
+% uses about four times the storage as the |C| version which sorts the array in place.
+% Stacks used in \LaTeX, are probably small enough that this is not a problem.
+%
+% Sorting a thousand item list of integers in reverse order (which is the worse case scenario) took less than sixty-five seconds running
+% |TexShop| |4.44| on a Mac 2013 Powerbook using timing code from
+% \href{https://tex.stackexchange.com/questions/456316/what-is-the-latex-equivalent-of-context-testfeatureonce-to-benchmark-performanc/456322#456322}{tex.stackexchange}. It put no strain on \TeX's memory allocations.
+%
+% \bigskip
+% \subsection{\texorpdfstring{\copy\mm\tt doublebubblesort}{doublebubblesort}}
+% |\doublebubblesort[#1]{#2}{#3}{#4}{#5}|:
+% The |\doublebubblesort| (line \codeRef{doublebubblesort}), |\@doublebubblesort@S| (line \codeRef{doublebubblesortS}),
+% macros work much like |\bubblesort|, |\@bubblesort@S|.
+% The code in the |double|'d version contains the identical code from |\bubblesort|, |\@bubblesort@S| except that |A| is added
+% to the end of each of the internal macros. There is also a parallel copy of macros with |B| added and everything done with the
+% |A| variables is mimicked with the |B| variables.
+%
+% \bigskip
+% \subsection{The remaining macros}
+% The macro |\@bubblesort@output#1#2| (line \codeRef{output}) is just to shorten the code
+% since there are three places a stack or a list is output (lines \codeRef{outputA}, \codeRef{outputB} and \codeRef{outputC}).
+%
+% The macro |\@bubblesort@EoS| is the End-of-Stack indicator.
+%
+% The remaining macros do the removing items from a list and inserting items at either end of a list.
+% The shift macro is \\
+% \null\hskip1in|\@bubblesort@shift#1#2\@bubblesort@EoS#3#4| (line \codeRef{shiftM})\\
+% which is used as \\|\expandafter\@bubblesort@shift{stack/list}\@bubblesort@EoS{\itemA}{\itemB}| which
+% puts the leftmost item in the stack/list into |\itemA| and the rest of the stack/list into |\itemB|.
+%
+% The macros |\@bubblesort@rightappendItem| (line \codeRef{rAi}) \\and
+% |\@bubblesort@lefttappendItem| (line \codeRef{lAi}) are identical to Knuth's
+% |\rightappenditem| and |\leftappenditem| except that there are no prepended |\\|'s.
+%
+% \StopEventually{}
+% \color{white}
+% \setcounter{CodelineNo}{15}
+% \begin{macro}{blank}\color{black}\textbf{Start of code:}
+% \hypertarget{NeedsTeXFormat}{}
+% The rest of the file from the end of this paragraph onward is a copy of the file
+% generated by \TeX ing the |bubblesort.ins| file except that the standard set of comments
+% at the start of an |ins| generated file are omitted. And of course the line numbers on the left here are
+% not present in the |\bubblesort.sty| file.
+% The comments portion takes 15 lines.
+% Most editors show line numbers and allow line number navigation so it has been arranged that
+% the line numbers in the typeset |bubblesort.dtx| file below match the line numbers
+% in the |ins|-generated |bubblesort.sty| file.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\ProvidesPackage{bubblesort}
+ [2020/07/01 v1.0 implements a bubble sort]
+
+\RequirePackage{etoolbox}
+
+\makeatletter
+
+\newcount\bubblesortflag
+\newbool{did a flip}
+\def\@bubblesort@EoS{}% End-of-Stack indicator
+
+% \end{macrocode} \LabelLine{realSort}
+\def\realSort#1#2{%
+\ifdimless{#2 pt}{#1 pt}{\bubblesortflag=1}{\bubblesortflag=-1}}
+% \end{macrocode} \LabelLine{alphSort}
+\def\alphSort#1#2{\ifnumequal{\pdfstrcmp{#1}{#2}}{1}%
+{\bubblesortflag=1}{\bubblesortflag=-1}}
+% \end{macrocode} \LabelLine{bubblesort}
+\newcommand{\bubblesort}[3][\realSort]{%
+%% #1 comparator macro, #2 input stack/list, #3 answer list: #2=#3 OK
+\def\@bubblesort@rightList{}%
+\expandafter\@bubblesort@shiftOne#2{}{}{}\@bubblesort@EoS{%
+\@bubblesort@testItem}{\@bubblesort@workingList}%
+\expandafter\@bubblesort@S{#3}{#1}%
+}
+% \end{macrocode} \LabelLine{bubblesortS}
+\def\@bubblesort@S#1#2{% #1 is name for answer --- #2 is comparator macro
+\boolfalse{did a flip}\def\@bubblesort@leftList{}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingList{}{}\@bubblesort@EoS{%
+\@bubblesort@nextItem}{\@bubblesort@workingList}%
+% \end{macrocode} \Label{while}\nointerlineskip\begin{macrocode}
+\whileboolexpr{not test{\ifdefvoid{\@bubblesort@nextItem}}}{%
+#2{\@bubblesort@testItem}{\@bubblesort@nextItem}\relax%
+\ifnumequal{\bubblesortflag}{1}{% flip
+\booltrue{did a flip}%
+\expandafter\@bubblesort@rightappendItem\expandafter{\@bubblesort@nextItem}%
+\to\@bubblesort@leftList%
+}{%
+\expandafter\@bubblesort@rightappendItem\expandafter{\@bubblesort@testItem}%
+\to\@bubblesort@leftList%
+\expandafter\def\expandafter\@bubblesort@testItem\expandafter{\@bubblesort@nextItem}%
+}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingList\@bubblesort@EoS{%
+\@bubblesort@nextItem}{\@bubblesort@workingList}%
+}%
+\expandafter\leftappendItem\expandafter{\@bubblesort@testItem}\to\@bubblesort@rightList%
+\ifbool{did a flip}{%
+\expandafter\def\expandafter\@bubblesort@workingList\expandafter%
+{\@bubblesort@leftList{}{}{}}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingList\@bubblesort@EoS{%
+\@bubblesort@testItem}{\@bubblesort@workingList}%
+\def\@bubblesort@leftList{}%
+\@bubblesort@S{#1}{#2}}%
+% \end{macrocode} \Label{outputA}\nointerlineskip\begin{macrocode}
+{\@bubblesort@output{#1}{\@bubblesort@leftList\@bubblesort@rightList}%
+}}
+% \end{macrocode} \Label{output}\nointerlineskip\begin{macrocode}
+\def\@bubblesort@output#1#2{% #1 name of output list or empty --- #2 sorted stack
+\ifstrempty{#1}%
+{#2}{\expandafter\edef\expandafter#1\expandafter{#2}}%
+}
+% \end{macrocode} \Label{doublebubblesort}\nointerlineskip\begin{macrocode}
+\newcommand{\doublebubblesort}[5][\realSort]{%
+%% #1 comparator macro
+%% #2 input stack/list --- #3 output for #2 stack/list; #2=#3 OK
+%% #4 second stack/list --- #5 answer list for #4; #4=#5 OK
+\def\@bubblesort@rightListA{}\def\@bubblesort@rightListB{}%
+\expandafter\@bubblesort@shiftOne#2{}{}{}\@bubblesort@EoS{%
+\@bubblesort@testItemA}{\@bubblesort@workingListA}%
+\expandafter\@bubblesort@shiftOne#4{}{}{}\@bubblesort@EoS{%
+\@bubblesort@testItemB}{\@bubblesort@workingListB}%
+\expandafter\@doublebubblesort@S{#3}{#5}{#1}%
+}
+% \end{macrocode} \Label{doublebubblesortS}\nointerlineskip\begin{macrocode}
+\def\@doublebubblesort@S#1#2#3{%
+%% #1 output for sorted stack/list --- #2 output for ``sorted'' stack/list
+%% #3 comparator macro
+\boolfalse{did a flip}\def\@bubblesort@leftListA{}\def\@bubblesort@leftListB{}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListA{}{}%
+\@bubblesort@EoS{\@bubblesort@nextItemA}{\@bubblesort@workingListA}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListB{}{}%
+\@bubblesort@EoS{\@bubblesort@nextItemB}{\@bubblesort@workingListB}%
+\whileboolexpr{not test{\ifdefvoid{\@bubblesort@nextItemA}}}{%
+#3{\@bubblesort@testItemA}{\@bubblesort@nextItemA}\relax%
+\ifnumequal{\bubblesortflag}{1}{% flip
+\booltrue{did a flip}%
+\expandafter\@bubblesort@rightappendItem\expandafter{%
+\@bubblesort@nextItemA}\to\@bubblesort@leftListA%
+\expandafter\@bubblesort@rightappendItem\expandafter{%
+\@bubblesort@nextItemB}\to\@bubblesort@leftListB%
+}{%
+\expandafter\@bubblesort@rightappendItem\expandafter{%
+\@bubblesort@testItemA}\to\@bubblesort@leftListA%
+\expandafter\@bubblesort@rightappendItem\expandafter{%
+\@bubblesort@testItemB}\to\@bubblesort@leftListB%
+\expandafter\def\expandafter\@bubblesort@testItemA\expandafter{%
+\@bubblesort@nextItemA}%
+\expandafter\def\expandafter\@bubblesort@testItemB\expandafter{%
+\@bubblesort@nextItemB}%
+}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListA\@bubblesort@EoS{%
+\@bubblesort@nextItemA}{\@bubblesort@workingListA}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListB\@bubblesort@EoS{%
+\@bubblesort@nextItemB}{\@bubblesort@workingListB}%
+}%
+\expandafter\leftappendItem\expandafter{\@bubblesort@testItemA}\to%
+\@bubblesort@rightListA%
+\expandafter\leftappendItem\expandafter{\@bubblesort@testItemB}\to%
+\@bubblesort@rightListB%
+\ifbool{did a flip}{%
+\expandafter\def\expandafter\@bubblesort@workingListA\expandafter{%
+\@bubblesort@leftListA{}{}{}}%
+\expandafter\def\expandafter\@bubblesort@workingListB\expandafter{%
+\@bubblesort@leftListB{}{}{}}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListA\@bubblesort@EoS{%
+\@bubblesort@testItemA}{\@bubblesort@workingListA}%
+\expandafter\@bubblesort@shiftOne\@bubblesort@workingListB\@bubblesort@EoS{%
+\@bubblesort@testItemB}{\@bubblesort@workingListB}%
+\def\@bubblesort@leftListA{}%
+\def\@bubblesort@leftListB{}%
+\expandafter\@doublebubblesort@S{#1}{#2}{#3}}%
+% \end{macrocode} \Label{outputB}\nointerlineskip\begin{macrocode}
+{\@bubblesort@output{#1}{\@bubblesort@leftListA\@bubblesort@rightListA}%
+% \end{macrocode} \Label{outputC}\nointerlineskip\begin{macrocode}
+\@bubblesort@output{#2}{\@bubblesort@leftListB\@bubblesort@rightListB}}%
+}
+
+% \end{macrocode} \Label{shiftM}\nointerlineskip\begin{macrocode}
+\def\@bubblesort@shiftOne#1#2\@bubblesort@EoS#3#4{%
+\expandafter\gdef\expandafter#3\expandafter{#1}%
+\expandafter\gdef\expandafter#4\expandafter{#2}%
+}
+
+\newtoks\ta\newtoks\tb
+% \end{macrocode} \Label{rAi}\nointerlineskip\begin{macrocode}
+\long\def\@bubblesort@rightappendItem#1\to#2{\ta={{#1}}\tb=\expandafter{#2}%
+\edef#2{\the\tb\the\ta}}
+% \end{macrocode} \Label{lAi}\nointerlineskip\begin{macrocode}
+\long\def\leftappendItem#1\to#2{\ta={{#1}}\tb=\expandafter{#2}%
+\edef#2{\the\ta\the\tb}}
+\makeatother
+\endinput
+% \end{macrocode}
+% \end{macro}
+% \Finale
diff --git a/macros/latex/contrib/bubblesort/bubblesort.ins b/macros/latex/contrib/bubblesort/bubblesort.ins
new file mode 100644
index 0000000000..6f3f61ef1b
--- /dev/null
+++ b/macros/latex/contrib/bubblesort/bubblesort.ins
@@ -0,0 +1,39 @@
+%% http://texdoc.net/texmf-dist/doc/latex/dtxtut/dtxtut.pdf
+%% Copyright (C) 2019 by Laurence R Taylor
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+\input docstrip.tex
+\keepsilent
+\usedir{}
+\preamble
+This is a generated file. Copyright (C) 2020 by Laurence R Taylor
+This file may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3c of this license or (at your option) any later
+version. The latest version of this license is in:
+ http://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+\endpreamble
+\askforoverwritefalse
+\generate{\file{bubblesort.sty}{\from{bubblesort.dtx}{package}}}
+\Msg{*********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* following file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space bubblesort.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file bubblesort.dtx} \Msg{* through LaTeX.}
+\Msg{*}
+\Msg{*********************************************************}
+\endbatchfile \ No newline at end of file
diff --git a/macros/latex/contrib/bubblesort/bubblesort.pdf b/macros/latex/contrib/bubblesort/bubblesort.pdf
new file mode 100644
index 0000000000..9a4723d66c
--- /dev/null
+++ b/macros/latex/contrib/bubblesort/bubblesort.pdf
Binary files differ
diff --git a/macros/latex/contrib/draftwatermark/draftwatermark.dtx b/macros/latex/contrib/draftwatermark/draftwatermark.dtx
index ab5cb3b948..b759f29eb7 100644
--- a/macros/latex/contrib/draftwatermark/draftwatermark.dtx
+++ b/macros/latex/contrib/draftwatermark/draftwatermark.dtx
@@ -31,6 +31,7 @@
\setcounter{IndexColumns}{2}
\setlength{\IndexMin}{3cm}
+\DoNotIndex{\\}
\DoNotIndex{\begin, \end, \begingroup, \endgroup}
\DoNotIndex{\csname, \endcsname}
\DoNotIndex{\if, \else, \fi}
@@ -54,7 +55,7 @@
\ProcessKeyvalOptions, \ProvidesPackage}
\DoNotIndex{\relax, \RequirePackage, \rotatebox}
\DoNotIndex{\savebox, \sbox, \scalebox, \section, \selectfont, \setkeys,
- \setlength, \sffamily}
+ \setlength, \sffamily, \shortstack}
\DoNotIndex{\thepage, \title}
\DoNotIndex{\usebox, \usepackage}
\DoNotIndex{\vbox, \vspace, \vss}
@@ -69,12 +70,12 @@
%
% \fi
%
-% \CheckSum{288}
+% \CheckSum{291}
%
% \def\filename{draftwatermark.dtx}
-% \def\fileversion{2.1}
-% \def\filedate{2020/05/11}
-% \def\docdate{2020/05/11}
+% \def\fileversion{2.2}
+% \def\filedate{2020/06/29}
+% \def\docdate{2020/06/29}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\texttt {#1}} ^^A typeset an option
@@ -257,6 +258,11 @@
% for the |hanchor| and |vanchor| options. For instance, if the anchor
% specification is |lt|, then the top left corner of the watermark is
% placed at the position specified by the |hpos| and |vpos| options.
+% \item \verb!alignment=l|c|r!\\
+% Default is |c|.\\
+% Defines the alignment for the watermark text in case it contains line
+% breaks. Specifically, |l| aligns left, |c| aligns at the center and
+% |r| aligns right.
% \item |colormodel=<color model>|\\
% Defaults to |gray|.\\
% Defines the color model for the specification of the color of the
@@ -344,17 +350,19 @@
% a plain string. Conversely, it may include formatting marks, such as
% line break commands (e.g., |\\|) or commands to select font variants
% (e.g., |\bfseries|). In fact, it is also possible to use a command to
-% include an image as the text. A word of caution is necessary, though. To
-% use \LaTeX\ commands in the watermark text, please configure the latter
-% via the |\DraftwatermarkOptions| command. Trying to do so by passing
-% options to the \Lpack{draftwatermark} package via the |\usepackage|
-% mechanism may fail due to how \LaTeX\ parses option strings. Also note
-% that the text may need to be surrounded by braces.
+% include an image as the text. In case line breaks are present, the text
+% is left, right, center aligned according to the |alignment| option. A
+% word of caution is necessary, though. To use \LaTeX\ commands in the
+% watermark text, please configure the latter via the
+% |\DraftwatermarkOptions| command. Trying to do so by passing options to
+% the \Lpack{draftwatermark} package via the |\usepackage| mechanism may
+% fail due to how \LaTeX\ parses option strings. Also note that the text
+% may need to be surrounded by braces.
%
% If the watermark text includes line breaks, \Lpack{draftwatermark} will
-% use a default interline space set to 1.2 times the font size. Consider
-% that multiline texts with alignment, taking up their natural width can
-% easily be obtained with the |\shortstack| command.
+% use a very thin interline space, according to the fact that the
+% multi-line text is managed by surrounding the it with a \LaTeX\
+% |shortstack| command.
%
% Also, note that the watermark typesetting happens inside a \TeX\
% group, to make sure that any parameter setting you do in the |text|
@@ -497,7 +505,8 @@
\documentclass{article}
\usepackage[named]{xcolor}
\usepackage[T1]{fontenc}
-\usepackage[firstpageonly, color={[gray]{0.5}}]{draftwatermark}
+\usepackage[firstpageonly, color={[gray]{0.5}},
+ text=DRAFT\\COPY]{draftwatermark}
\usepackage{mathptmx}
\usepackage{lipsum}
\title{Sample document for the draftwatermark package}
@@ -539,6 +548,7 @@
\usepackage{lipsum}
\SetWatermarkLightness{0.5}
+\SetWatermarkText{DRAFT\\COPY}
\title{Sample document for the draftwatermark package}
\author{}
@@ -711,7 +721,8 @@
% \item[2.0 - 2020/03/08] Configuration management overhaul; introduction
% of a legacy interface for compatibility.
% \item[2.1 - 2020/05/11] Allow anchor information to be re-evaluated on
-% every page
+% every page.
+% \item[2.2 - 2020/06/29] Make line breaks in watermark text work.
% \end{description}
%
% \StopEventually {}
@@ -726,7 +737,7 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{draftwatermark}%
- [2020/05/11 2.1 Put a gray textual watermark on document pages]
+ [2020/06/29 2.2 Put a gray textual watermark on document pages]
% \end{macrocode}
%
@@ -757,6 +768,7 @@
\DeclareStringOption[0.8]{colorspec}
\DeclareStringOption[c]{hanchor}
\DeclareStringOption[m]{vanchor}
+\DeclareStringOption[c]{alignment}
\DeclareStringOption[\DraftwatermarkStdMark]{markcmd}
\define@key{draftwatermark}{pos}{%
\draftwatermark@processpos #1\@nil}
@@ -900,7 +912,7 @@
\fi
\setlength{\@tempdima}{\draftwatermark@fontsize}%
\fontsize{\@tempdima}{1.2\@tempdima}\selectfont
- \draftwatermark@text
+ \shortstack[\draftwatermark@alignment]{\draftwatermark@text}%
\endgroup}}}
% \end{macrocode}
diff --git a/macros/latex/contrib/draftwatermark/draftwatermark.pdf b/macros/latex/contrib/draftwatermark/draftwatermark.pdf
index 059d0262dc..e872276964 100644
--- a/macros/latex/contrib/draftwatermark/draftwatermark.pdf
+++ b/macros/latex/contrib/draftwatermark/draftwatermark.pdf
Binary files differ
diff --git a/macros/latex/contrib/verifiche/Esempio.pdf b/macros/latex/contrib/verifiche/Esempio.pdf
new file mode 100644
index 0000000000..509d6e67be
--- /dev/null
+++ b/macros/latex/contrib/verifiche/Esempio.pdf
Binary files differ
diff --git a/macros/latex/contrib/verifiche/Esempio.tex b/macros/latex/contrib/verifiche/Esempio.tex
new file mode 100644
index 0000000000..b84e48eef6
--- /dev/null
+++ b/macros/latex/contrib/verifiche/Esempio.tex
@@ -0,0 +1,150 @@
+% compile 2 times
+\documentclass[a4paper]{article}
+\usepackage[solutions
+ ]{verifiche}
+\usepackage[margin=3cm]{geometry}
+\usepackage{lipsum}
+
+\begin{document}
+%\renewcommand{\institutefont}{\huge}
+\renewcommand{\closedquestionitem}{$\bigcirc$}
+
+\institute{Scuola superiore di Paperopoli}
+\asyear[Anno accademico]{2019/2020}
+\duration[Tempo:]{1 ora}
+\testtype{Compito di fisica}
+\instruction{Risolvere il seguente esercizio nel più breve tempo possibile.\\}
+\printheading
+
+\begin{esercizio}
+Risolvere il seguente problema.
+
+Un mattone pesa \SI{1}{kg} più mezzo mattone. Quanto pesa un mattone?
+\end{esercizio}
+
+\begin{soluzione}
+Il mattone pesa \SI{2}{kg}.
+\end{soluzione}
+
+\begin{esercizio}[pt=2]\label{es:ferropiuma}%
+Pesa di più un chilogrammo di ferro o un chilogrammo di piume?
+\end{esercizio}
+
+\begin{esercizio}[diff=1]
+Pesa di più un chilogrammo di ferro sulla Terra o un chilogrammo di piume su Giove?
+\end{esercizio}
+
+\renewcommand{\diffsymb}{$\bullet$}
+\begin{esercizio}[diff=2, pt=5]\label{es:grav}%
+Scrivere la legge di gravitazione universale e commentarla.
+\end{esercizio}
+
+\begin{esercizio}[label=Esercizio]
+Calcolare:
+\[
+\int_{-\infty}^{+\infty} e^{-x^2}\, dx
+\]
+\end{esercizio}
+
+\begin{esercizio}
+Rispondere alle seguenti domande:
+\begin{enumerate}[(a)]
+\item \partialpt{2} Descrivere la legge di Boyle
+\item \partialpt{3} Rappresentarla graficamente
+\end{enumerate}
+\end{esercizio}
+
+\begin{esercizio}[partialpt, diff=3]\label{es:meccanica}
+Rispondere alle seguenti domande:
+\begin{enumerate}[(i)]
+\item\partialpt{2}Descrivere l'energia meccanica di un sistema gravitazionale a due corpi isolato.
+\item\partialpt{3}Enunciare il teorema del viriale.
+\end{enumerate}
+\end{esercizio}
+
+\begin{esercizio*}[label=Domanda, pt=2, diff=1]
+Calcolare
+\[
+\frac{d}{dx}\left[ x^2\right]
+\]
+\end{esercizio*}
+
+\begin{soluzione}
+Questa è la soluzione dell'esercizio \ref{es:ferropiuma} a pagina \pageref{es:ferropiuma}.
+\end{soluzione}
+
+
+\begin{esercizio}
+La branca della fisica che si occupa dello studio di \emph{come} si muovono i corpi è detta: \inlinesol{cinematica.}
+\end{esercizio}
+
+\begin{esercizio}
+La \completetext{Terra} è il pianeta su cui viviamo e la sua unica \completetext{stella} è il Sole.
+Il pianeta \completetext{Giove} è il secondo corpo celeste, per dimensione, dopo il Sole.
+\end{esercizio}
+
+\begin{esercizio}
+Indicare se le seguenti affermazioni sono vere o false.\par
+\begin{tabular}{p{.7\textwidth}l}
+Tutti gli ateniesi mentono, ed io sono ateniese & \truefalse{}\\[.5em]
+Il Sole è un pianeta del Sistema solare & \truefalse{F}\\[.5em]
+Io sono vera & \truefalse{V}
+\end{tabular}
+\end{esercizio}
+
+\begin{esercizio}
+Quali delle seguenti equazioni descrive il moto rettilineo uniforme?\par
+\begin{closedquestion}
+\item $a=\SI{5}{\m\per\s\squared}$
+\item[\checked] $x(t) = v t + x_0$
+\item $x(t) = t^3$
+\item $t = a^2$
+\end{closedquestion}
+\end{esercizio}
+
+\begin{esercizio}
+\lipsum[2]\\[1em]
+\openquestion[height=5cm]{\lipsum[1]}
+\end{esercizio}
+
+\begin{esercizio}
+\lipsum[2]\\[1em]
+\openquestion[type=squares, width=8cm, height=6cm, linecolor=orange]{\lipsum[2]}
+\end{esercizio}
+
+
+\begin{esercizio}
+Trovare gli errori nel seguente testo e correggerli.
+
+\renewcommand{\baselinestretch}{2.0}
+\sffamily
+I numeri preceduti dal segno "$+$" o dal segno "$-$" si dicono \finderror{numeri razionali}{numeri relativi} in ragione del segno che li precede.
+Nel prodotto di due numeri con segno, la moltiplicazione di due numeri opposti è un numero \finderror{positivo}{negativo}.
+A differenza dei numeri assoluti, la differenza tra due \finderror{numeri razionali}{numeri relativi} con segno \finderror{non è sempre possibile}{è sempre possibile} (ad esempio $5 - 7$).
+\renewcommand{\baselinestretch}{1.0}
+\end{esercizio}
+\baselinestretch
+
+\begin{esercizio}
+\textandimage{Dato il seguente grafico indicare sul grafico i punti di massimo globale.}{
+\begin{tikzpicture}
+\draw[latex-latex] (3,0) node[right] {$x$} -- (0,0) -- (0,3) node[above]{$y$};
+\draw plot[domain=0:3, samples=100] (\x, {2.5*exp(-\x^2)});
+\inlinesol{\draw[fill, red] (0,2.5) circle (2pt);}
+\end{tikzpicture}
+}
+\end{esercizio}
+
+
+\vfill
+\begin{center}
+\begin{tabular}{l|c|c|c}
+Esercizio & \ref{es:ferropiuma} & \ref{es:grav} & \ref{es:meccanica} \\\hline
+Punteggio totale & \ref{ptes@2} & \ref{ptes@4} & \ref{ptes@7}\\\hline
+Punteggio & & & \\
+\end{tabular}
+\end{center}
+
+\end{document}
+
+
diff --git a/macros/latex/contrib/verifiche/README.md b/macros/latex/contrib/verifiche/README.md
new file mode 100644
index 0000000000..348e4c9b58
--- /dev/null
+++ b/macros/latex/contrib/verifiche/README.md
@@ -0,0 +1,30 @@
+# Package Verifiche
+
+## Abstract
+The purpose of the package is to mange the exercises for a test, their points, the difficulty level and their solutions.
+Some typical format of exercises are already implemented:
+1. Plain exercise
+2. Complete the Text - exercise
+3. True or false
+4. Closed questions
+5. Open questtions
+6. Find the Error - exercise
+
+## Installation
+To install the package run:
+- `latex verifiche.ins`
+- `pdflatex verifiche.dtx`
+- `makeindex -s gind.ist -o verifiche.ind verifiche.idx`
+- `makeindex -s gglo.ist -o verifiche.gls verifiche.glo`
+- `pdflatex verifiche.dtx`
+- copy verifiche.sty and verifiche.pdf to the correct places in the texmf
+tree (e.g. \tex\latex\verifiche).
+
+## Example
+Run `pdflatex Esempio.tex` to see some examples.
+
+
+### To do
+- swhich into english and if "babel" is implemented use the selected language.
+- remove the marginpar command and use only a box.
+
diff --git a/macros/latex/contrib/verifiche/verifiche.dtx b/macros/latex/contrib/verifiche/verifiche.dtx
new file mode 100644
index 0000000000..8bad537777
--- /dev/null
+++ b/macros/latex/contrib/verifiche/verifiche.dtx
@@ -0,0 +1,1295 @@
+% \iffalse meta-comment
+%
+% Copyright (LPPL) 2020 by Francesco Raccanello
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3 of this license or any later version.
+% The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{verifiche} [2020/07/01 v2.2 .dtx verifiche file]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[italian]{babel}
+\usepackage{listings}
+\lstset{
+ language=[LaTeX]TeX,
+ morekeywords={\institute, \asyear, \testtype, \instruction, \duration, \printheading,
+ \institutefont, \asyearfont, \testtypefont, \instructiondelimiter, \instrunctionfont,
+ \durationfont, \eserciziolabel, \solutionfont, \diffsymb, \closedquestionitem,
+ \inlinesol, \completetext, \truefalse, \openquestion, \linedopenquestion, \squaredopenquestion, \checked, \finderror, \textandimage, \partialpt},
+ keywordstyle=\color{blue},
+ escapeinside={*@}{@*},
+ inputencoding=utf8,
+ basicstyle=\small\ttfamily}
+\usepackage{xparse}
+\usepackage{tcolorbox}
+\tcbuselibrary{listingsutf8, skins}
+\tcbset{listing engine=listings}
+\usepackage[solutions]{verifiche}
+\newcounter{id}
+\newtcblisting{esempio}{listing outside text, righthand width=.3\textwidth,lower separated=true, skin=bicolor, colbacklower=red!50!white}
+\newcommand{\esempiodicodice}[1]{\begin{esempio}#1\end{esempio}}
+\NewDocumentCommand{\example}{+v m}{%
+ \stepcounter{id}%
+ \begin{minipage}{.6\textwidth}%
+ \begin{tcolorbox}[equal height group=\theid, title={Esempio di codice}, sharp corners=east, leftupper=.5ex, halign=left]%
+ \begin{lstlisting}%
+ ^^J#1^^J
+ \end{lstlisting}
+ \end{tcolorbox}
+ \end{minipage}
+ \begin{minipage}{.4\textwidth}
+ \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black, equal height group=\theid, title={Esempio visivo}, sharp corners=west, halign=left]
+ #2
+ \end{tcolorbox}
+ \end{minipage}
+}
+%
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{verifiche.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{537}
+% \changes{v1.0}{2020/06/14}{Initial version.}
+% \changes{v2.0}{2020/06/26}{Better performance in exercise environment.}
+% \changes{v2.1}{2020/06/30}{Introduced closedquestionitem to control |item| symbol.}
+% \changes{v2.2}{2020/07/01}{Modify reference to points of an exercise.}
+% \GetFileInfo{verifiche.sty}
+% \DoNotIndex{\newcommand,\newenvironment,\def,\begin,\end,\par}
+% \DoNotIndex{\DeclareOption,\ExecuteOptions,\ProcessOptions,\RequirePackage}
+% \DoNotIndex{\LoadClass,\AtBeginDocument,\SetSymbolFont}
+% \DoNotIndex{\tiny, \scriptsize, \footnotesize, \normalfont, \large, \Large, \Large, \huge, \Huge}
+% \DoNotIndex{\newif,\geometry,\pagestyle,\setISOcompliance,\IntelligentComma}
+% \DoNotIndex{\relax,\let,\phi,\theta,\varphi,\vartheta,\else,\fi,\undefined}
+% \DoNotIndex{\renewcommand,\newlength,\hline,\textbf,\textit,\\,\setlength}
+% \DoNotIndex{\DeclarePairedDelimiter,\MakeUppercase,\MessageBreak,\ClassError}
+% \DoNotIndex{\widthof,\textwidth,\ifdefined,\null,\vspace,\noindent,\hfill}
+% \DoNotIndex{\hrulefill,\makebox,\linewidth,\small,\centering,\lvert,\rvert}
+% \DoNotIndex{\newunicodechar,\ensuremath,\circ,\textsuperscript,\,}
+% \DoNotIndex{\varepsilon,\delta,\Delta,\displaystyle,\mathbb,\arraystretch}
+% \DoNotIndex{\bm,\box,\DeclareFontShape,\DeclareFontFamily,\DeclareMathAccent}
+% \DoNotIndex{\DeclareSymbolFont,\doublespacing,\frac,\mathstrut,\bfseries}
+% \DoNotIndex{\usefont,\symbol,\mathpalette,\sbox,\vbox,\hbox,\box}
+% \DoNotIndex{\m@th,\wd,\resizebox,\height,\nointerlineskip,\mathord}
+% \DoNotIndex{\mathrm,\labelitemi,\blacktriangleright,\textup,\fbox,\parbox}
+% \DoNotIndex{\alph,\newlist,\renewlist,\setlist,\hspace,\iflanguage,\protect}
+% \DoNotIndex{\ifdim,\newcounter,\newsavebox,\savebox,\setcounter,\linenumbers}
+% \DoNotIndex{\thelinenumbers,\addtocounter,\multido,\i,\phantom,\newline}
+% \DoNotIndex{\value,\leavevmode,\leaders,\hss,\kern,\real,\tabcolsep,\space}
+% \DoNotIndex{\doublespacing,\singlespacing,\@nil,\@nnil,\vphantom,\today}
+% \DoNotIndex{\nolinebreak,\null,\textsc,\ifx,\tmp,\mbox,\vfill,\LARGE,\Huge}
+% \DoNotIndex{\enitkv@key,\item,\@ifpackageloaded,\@ifpackagewith}
+% \DoNotIndex{\addvspace, \baselineskip, \bgroup, \cdot, \color, \CurrentOption}
+% \DoNotIndex{\DeclareOptionX, \define@choicekey, \define@key, \draw, \egroup}
+% \DoNotIndex{\ExectureOptionsX, \fill, \foreach, \gdef, \ifmmode, \IfSubStr, \IfValueT}
+% \DoNotIndex{\ignorespaces, \ignorespacesafterend, \item, \itshape, \marginpar, \marginparwidth, \mathit}
+% \DoNotIndex{\NewDocumentCommand, \NewDocumentEnvironment, \newlabel, \nobreak, \node, \nr}
+% \DoNotIndex{\or, \overset, \PackageError, \PackageWarning, \parindent, \pgfmathparse, \pgfmathresult}
+% \DoNotIndex{\ProcessOptionsX, \protected@write, \ref, \refstepcounter, \reversemarginpar, \rule}
+% \DoNotIndex{\scshape, setkeys, \sffamily, \sisetup, \spacedim, \string, \tikz, \underline, \usetikzlibrary}
+% \DoNotIndex{\val, \xout, \y, \usebox}
+%
+%
+% \title{Il pacchetto \textsf{verifiche}
+% \thanks{Questo documento corrisponde al pacchetto \textsf{verifiche}~\fileversion,
+% in data~\filedate.}}
+% \author{Francesco Raccanello\\ \texttt{raccanello.francesco@gmail.com}}
+%
+% \maketitle
+%\begin{abstract}
+%Il presente pacchetto si propone di gestire gli elementi che generalmente compongono
+%una prova scritta per le scuole secondarie di primo e secondo grado.
+%I comandi e gli ambienti implementati permettono di gestire l'intestazione della pagina
+% e alcuni strumenti utili alla stesura di test scolastici.
+% Il pacchetto, inoltre, permette di riportare soluzioni degli esercizi riportandoli, o meno, nello stesso documento in base ad un'apposita opzione.
+%\end{abstract}
+%
+%\tableofcontents
+%\clearpage
+%
+%\section{Introduzione}
+%Il pacchetto \textsf{verifiche} nasce dalla necessità di creare verifiche cartacee per la scuola secondaria di primo e secondo grado.
+%L'intento è di ottenere un supporto che controlli la parte di test, nonché la gestione delle soluzioni all'interno dello stesso documento.\par
+%Riguardo la parte di esercizi, il presente pacchetto si occupa della suddivisione delle domande (numerate o meno) e della gestione del loro punteggio inserendolo a mano, oppure calcolandolo come totale di punteggi parziali (si veda pagina \pageref{sec:esercizio}).
+%Sono presenti comandi o ambienti ad hoc per realizzare quesiti di vero/falso, domande aperte o chiuse,
+%esercizi di "caccia all'errore" e la gestione di testi e immagini affiancate.
+%
+%Per quanto riguarda le soluzioni, ogni elemento di test presenta la possibilità di mostrare la soluzione corretta, qualora venga venga inserita una specifica opzione del pacchetto che attivi la così detta in "modalità \texttt{solutions}" indicata nel seguito anche con "modalità soluzioni".
+%
+%Infine, il codice carica alcuni pacchetti necessari per la gestioni dei comandi implementati, ma anche
+% per rendere fruibili da subito comandi utili soprattutto per la gestione della matematica, le unità di misura,
+% e la parte grafica. Nel seguito si riportano i pacchetti principali:
+%\begin{itemize}
+%\item |enumitem| per la gestione avanzata degli elenchi puntati e numerati (sono attivate le opzioni |shortlabels| e |inline|
+%\item |amsmath|, |amssymb| per la gestione della matematica;
+%\item |siunitx| per la gestione delle unità di misura;
+%\item |graphicx|, |xcolor| e |tikz| per la gestione grafica;
+%\item |famcyhdr| per la gestione delle testatine.
+%\end{itemize}
+%
+%\section{Come usare il pacchetto \textsf{verifiche}}
+%Per usare il pacchetto \textsf{verifiche} è sufficiente copiare il file \texttt{\filename} nella cartella di lavoro
+%o installarlo secondo le procedure relative al proprio sistema operativo.
+%
+%Una volta installato è sufficiente caricare il pacchetto attraverso il comando:\\
+%\begin{center}|\usepackage{verifiche}|\end{center}
+%
+%\section{Le opzioni del pacchetto}
+%Il pacchetto \textsf{verifiche} prevede alcune opzioni per modificare globalmente il proprio comportamento.
+%\begin{center} |\usepackage|\oarg{options}|{verifiche}|\end{center}
+%Queste gestiscono l'aspetto dell'intestazione, la numerazione globale dei quesiti nonché l'attivazione della "modalità soluzioni" per poter visualizzare, nel documento, le soluzioni e variarne il colore del font.
+%
+%\begin{center}
+%\begin{tabular}{ll}
+%\textbf{\meta{options}}& \textbf{Descrizione} \\[.5em]
+%\hline\\
+%|noinstitute| & non stampa il nome dell'istituto (si veda pag. \pageref{par:institute}).\\
+%|nocandidatename| & non stampa la sezione per il nome del candidato\\
+%|noinstruction| & non stampa le istruzioni della prova\\
+%|noduration| & non stampa la durata della prova\\
+%|noasyear| & non stampa l'anno scolastico\\
+%|notesttype| & non stampa il tipo di prova \\
+%|nonumbered| & quesiti non numerati\\
+%|solutions| & stampa le soluzioni degli esercizi (si veda pag.\pageref{sec:solutions})\\
+%|red| & il colore del font delle soluzioni è rosso\\
+%|blue| & il colore del font delle soluzioni è blu\\
+%|color|=\meta{color} & il colore del font delle soluzioni è \meta{color}\\[.5em]
+%\hline
+%\end{tabular}
+%\end{center}
+%Nel seguito si indicherà con "modalità test", il pacchetto caricato senza l'opzione |solutions|, altrimenti questa verrà detta "modalità soluzione" o "modalità solutions".
+%
+%\section{Intestazione}\label{sec:intestazione}
+%Il pacchetto \textsf{verifiche} fornisce alcuni comandi per realizzare una semplice intestazione del documento che prevede il nome dell'istituto, l'anno scolastico il tipo di prova, le istruzioni e la durata della prova.
+%Tutte queste voci vanno dichiarate prima del comando |\printheading| che si occupa della produzione del risultato finale.
+%Le \emph{opzioni} del pacchetto permettono la soprressione della visualizzazione di alcune di queste voci.
+%
+%\vspace{1em}
+%\DescribeMacro{\institute}\label{par:institute}Il nome dell'istituto può essere indicato tramite il comando:
+%
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\institute*@\marg{nome dell'istituto}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%il cui argomento verrà stampato al centro dell'intestazione della pagina con un font largo, senza grazie e di colore grigio scuro e separato dal resto del documento attraverso una riga orizzontale.
+%Il font può essere modificato ridefinendo il comando |\institutefont|.
+%
+%\DescribeMacro{\asyear}\label{par:asyear}L'anno scolastico viene indicato tramite l'apposito comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\asyear*@\oarg{preambolo}\marg{anno scolastico}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%il cui argomento viene riportato, al centro della pagina, anteponendo il \meta{preambolo} (che di default riporta la dicitura ‘‘Anno scolastico’’). Il font ed il posizionamento del testo possono essere cambiati ridefinendo il comando |\asyearfont|.
+%
+%\DescribeMacro{\testtype}\label{par:testtype}La tipologia di prova può essere indicata tramite il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\testtype*@\marg{tipo di compito}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%il cui argomento viene riportato, per default, al centro della pagina. La modifica del font e del posizionamento può essere operato ridefinendo il comando |\testtypefont|.
+%
+%\DescribeMacro{\instruction}\label{par:instruction}Le istruzioni della prova possono essere racchiuse all'interno del comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\instruction*@\marg{istruzioni}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%che provvede a racchiudere tra due delimitatori (di default una riga orizzontale) il testo delle istruzioni. Ridefinendo il comando |\instrunctionfont| è possibile cambiare il font delle istruzioni.
+%
+%\DescribeMacro{\duration}La durata della prova può venir indicata tramite il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\duration*@\oarg{preambolo}\marg{durata}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+% che viene riportata sotto le istruzioni, al centro, anteponendo all'argomento il \meta{preambolo} (che di default riporta la dicitura ‘‘’Tempo della prova:’’). L'aspetto di questo comando può essere modificato ridefinendo il comando |\durationfont|.
+%
+%\vspace{1em}
+%\DescribeMacro{\printheading}\label{par:printheading}L'intestazione, ovvero l'output di tutti i comandi appena definiti, viene riportata nel documento solo in presenza del comando
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\printheading
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%Salvo esplicite opzioni del pacchetto, il comando richiede di definire \emph{tutte} le voci (al limite indicandole con argomento vuoto |{}|), per non generare alcun errore di compilazione.
+%
+%\vspace{1em}
+%Riassumendo, il pacchetto fornisce i seguenti comandi per gestire e la stampa dell'intestazione del documento:
+%
+%\begin{center}
+%\begin{tabular}{lll}
+%\textbf{Comando} & \textbf{Font} & \textbf{Descrizione}\\
+%\hline
+%|\institute| & |\institutefont| & Definisce il nome dell'istituto.\\
+%|\asyear| & |\asyearfont| & Definisce l'anno scolastico.\\
+%|\testtype| & |\testtypefont| & Definisce il tipo di prova.\\
+%|\instruction| & |\instrunctionfont|& Definisce le istruzioni delle prove.\\
+%|\duration| & |\durationfont| & Definisce la durata della prova.\\
+%|\printheading| & & Stampa l'intestazione.\\
+%\hline
+%\end{tabular}
+%\end{center}
+%
+%\section{Comandi ed ambienti per le \textsf{verifiche}}
+%Nel seguito verranno presentati i comandi che permettono di strutturare un test.
+%Il pacchetto fornisce un ambiente di esercizio in cui racchiudere le domande.
+%Vi è la possibilità di predisporre domande chiuse a scelta multipla, prove di vero-falso, ‘‘trova l'errore’’ e domande a risposta aperta (fornendo una base su cui scrivere come un foglio a quadretti o a righe).
+%Ogni comando prevede la possibilità di fornire le soluzioni che vengono visualizzato quando il pacchetto è caricato attivando l'opzione |solutions|.
+%
+%\vspace{1em}
+% \DescribeEnv{esercizio}\label{sec:esercizio}L'ambiente esercizio viene usato per definire il quesito.
+%Esso produce il testo contenuto nel corpo preponendo la dicitura ‘‘Quesito” seguito da un numero.
+%Questo può essere oggetto di riferimenti incrociati trami tramite un'etichetta dichiarata tramite l'usuale comando |\label=|\marg{label} dichiarato dopo l'apertura dell'ambiente |esercizio|.
+%I riferimenti incrociati possono essere richiamati tramite l'usuale comando |\ref|\marg{label}, che produce il numero dell'esercizio e |\pageref|\marg{label} che stampa la pagina del riferimento.
+%L'ambiente prevede, inoltre, alcune opzioni espresse nel formato \texttt{key=val}, eventualmente separate da virgola se presenti in contemporanea.\par
+%\vspace{1em}
+%\begin{tabular}{ll}
+%|label|=\meta{label} & definisce il titolo del quesito\\
+%|diff|=\meta{number} & definisce la difficoltà sotto forma di stelle\\
+%|pt|=\meta{number} & definisce il punteggio della prova\\
+%|partialpt| & somma in automatico i punteggi parziali\\
+%\end{tabular}
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{esercizio}[label=*@\meta{label}@*,diff=*@\meta{number}@*,pt=*@\meta{number}@*,partialpt]
+...
+\end{esercizio}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%Nel seguito si mostrano alcuni dei possibili risultati visivi.
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+{\begin{esercizio}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+%
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}[label=Esercizio]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+{\begin{esercizio}[label=Esercizio]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}[diff=2]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+{\begin{minipage}{.2\linewidth}
+\hfill$\bigstar\bigstar$
+\end{minipage}
+\raisebox{-1.3\baselineskip}{
+\begin{minipage}{.7\linewidth}
+\begin{esercizio}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}
+\end{minipage}}}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}[pt=2]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+{\begin{minipage}{.4\linewidth}
+\underline{\phantom{1cm}}/ 2 pt
+\end{minipage}
+\raisebox{-1.7\baselineskip}{
+\begin{minipage}{.5\linewidth}
+\begin{esercizio}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}
+\end{minipage}}}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}[pt=2, diff=2]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}}
+{\begin{minipage}{.4\linewidth}
+\hfill$\bigstar\bigstar$\newline
+\underline{\phantom{1cm}}/ 2 pt
+\end{minipage}
+\raisebox{-1.3\baselineskip}{
+\begin{minipage}{.5\linewidth}
+\begin{esercizio}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio}
+\end{minipage}}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeMacro{\partialpt}Il comando |\partialpt|, da non confondere con l'opzione omonima |partialpt| dell'ambiente |esercizio|, permette di riportare il punteggio parziale per le domande di un esercizio. Questo viene stampato a margine e racchiuso tra parentesi tonde.\\
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}
+\begin{enumerate}
+\item\partialpt{1} Domanda 1
+\item\partialpt{3} Domanda 2
+\end{enumerate}
+\end{esercizio}}
+{\begin{minipage}[t]{.3\linewidth}
+\vspace{-1.3em}
+\phantom{1cm/ 4 pt\\[.5em]}
+\vspace{.9em}
+(1 pt)\\
+(3 pt)
+\end{minipage}
+\raisebox{\baselineskip}{
+\begin{minipage}[t]{.6\linewidth}
+\begin{esercizio}
+\begin{enumerate}[leftmargin=*]
+\item Domanda 1
+\item Domanda 2
+\end{enumerate}
+\end{esercizio}
+\end{minipage}}
+}
+% \iffalse
+%</example>
+% \fi
+%
+%Quando viene esplicitata l'\emph{opzione} |partialpt| nella definizione dell'ambiente esercizio, il pacchetto si occupa della somma complessiva dei singoli punteggi parziali riportandola come punteggio totale del quesito. In questo caso il documento dev'essere compilato \emph{due volte} per ottenere correttamente il risultato finale.\\
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio}[partialpt]
+\begin{enumerate}
+\item\partialpt{1} Domanda 1
+\item\partialpt{3} Domanda 2
+\end{enumerate}
+\end{esercizio}}
+{\begin{minipage}[t]{.4\linewidth}
+\vspace{-1.3em}
+\underline{\phantom{1cm}}/ 4 pt\\[.5em]
+\vspace{.8em}
+(1 pt)\\
+(3 pt)
+\end{minipage}
+\raisebox{.5\baselineskip}{
+\begin{minipage}[t]{.53\linewidth}
+\begin{esercizio}
+\begin{enumerate}[leftmargin=*]
+\footnotesize
+\item Domanda 1
+\item Domanda 2
+\end{enumerate}
+\end{esercizio}
+\end{minipage}}
+}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%Il punteggio dei quesiti può essere richiamato in qualunque punto del documento attraverso il comando
+%\begin{center} |\ref{ptes@|\meta{n.es}|}|\end{center}
+%dove \meta{n.es} indica il numero dell'esercizio riportato nell'intestazione dello stesso.
+%
+%\vspace{1em}
+%\DescribeEnv{esercizio*}L'ambiente |esercizio| produce sempre quesiti numerati. Se si desidera indicare test non numerati è possibile farlo tramite l'ambiente |esercizio*| che prevede gli stessi argomenti opzionali definiti per l'ambiente precedente.
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{esercizio*}[label=*@\meta{label}@*,diff=*@\meta{number}@*,pt=*@\meta{number}@*,partialpt]
+...
+\end{esercizio*}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{esercizio*}[pt=2]
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio*}}
+{\begin{minipage}{.4\linewidth}
+\underline{\phantom{1cm}}/ 2 pt
+\end{minipage}
+\raisebox{-1.8\baselineskip}{
+\begin{minipage}{.5\linewidth}
+\begin{esercizio*}
+Testo dell'esercizio
+che voglio somministrare
+\end{esercizio*}
+\end{minipage}}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\vspace{1em}
+%\DescribeEnv{soluzione}\label{sec:solutions}L'ambiente |soluzione| racchiude al suo interno tutto il materiale utile ad essere visualizzato solo in presenza dell'\emph{opzione} |solutions| del pacchetto \textsf{verifiche}. Quando il pacchetto è in modalità "test" il contenuto dell'ambiente |soluzione| viene ignorato.
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{soluzione}
+...
+\end{soluzione}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{soluzione}
+Testo della soluzione
+dell'esercizio somministrato
+\end{soluzione}}
+{\begin{soluzione}
+Testo della soluzione
+dell'esercizio somministrato
+\end{soluzione}}
+% \iffalse
+%</example>
+% \fi
+%
+%\DescribeMacro{\inlinesol}Il pacchetto presenta il comando |\inlinesol| per produrre soluzioni in line, ovvero testo che in modalità "test" viene ignorato, ma che invece viene visualizzato nella modalità "soluzioni" (opzione |solutions| del pacchetto).
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\inlinesol*@\marg{testo}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example{Questa e' una \inlinesol{soluzione}
+ in linea}
+{\solfalse Questa e' una \inlinesol{soluzione} in linea.\\
+ \soltrue Questa e' una \inlinesol{soluzione} in linea}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeMacro{\completetext}Gli esercizi di completamento del testo possono venir realizzati tramite il comando:
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\completetext*@\oarg{dim}\marg{testo}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%che produce uno spazio vuoto largo \meta{dim} (che di default è di \SI{4.5}{cm}) e che in modalità "soluzioni" riproduce il \meta{testo}.
+%
+% \iffalse
+%<*example>
+% \fi
+\example{La \completetext[2cm]{soluzione}}{
+\solfalse La \completetext[2cm]{soluzione}\\
+\soltrue La \completetext[2cm]{soluzione}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeMacro{\truefalse}I quesiti con domande vero-falso possono essere realizzati tramite il comando
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\truefalse*@\marg{V/F}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%Il comando produce due riquadri quadrati allineati con le lettere \texttt V e \texttt F; l'argomento obbligatorio richiede di indicare la lettera |V| o |F| al fine di poter realizzare un segno di spunta ($\checkmark$) sulla casella giusta nella modalità |solutions| del pacchetto.
+% \iffalse
+%<*example>
+% \fi
+\example{Vero o Falso? \truefalse{V}}{
+\solfalse Vero o Falso? \truefalse{V}\\
+\soltrue Vero o Falso? \truefalse{V}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeEnv{closedquestion}Le domande a scelta multipla possono essere realizzate tramite l'ambiente |closedquestion|. Ogni opzione deve essere anticipata dal comando \DescribeMacro{\item}|\item| che realizza un quadrato davanti ad ogni voce. Queste poi vengono spaziate orizzontalmente in modo da riempire tutto lo spazio disponibile. Eventuali elenchi verticali possono essere realizzati introducendo a mano una nuova linea (|\\|). La soluzione (o le soluzioni) possono essere segnate tramite il comando \DescribeMacro{\checked}|\checked| posto come argomento opzionale del comando |\item| e che, nella modalità |solutions|, produce un segno di spunta ($\checkmark$) sulla casella selezionata.
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\begin{closedquestion}
+\item Primo
+\item[\checked] Secondo\\
+\item Terzo
+\item Quarto
+\end{closedquestion}}
+{\begin{closedquestion}
+\item Primo
+\item[\checked] Secondo
+\end{closedquestion}\\
+\begin{closedquestion}
+\item Terzo
+\item Quarto
+\end{closedquestion}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeMacro{\openquestion}Il comando produce una base di supporto per la scrittura, ovvero delle linee o dei quadretti. La sintassi del comando è la seguente:
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\openquestion[type=*@\meta{lines/squares}@*, width=*@\meta{dim}@*, height=*@\meta{dim}@*,
+ spacedim=*@\meta{dim}@*, linecolor=*@\meta{color}@*]*@\marg{soluzione}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%La il testo dell'argomento obbligatorio (\meta{soluzione}) viene visualizzato solo in modalità |solutions|.
+%Il comando gestisce alcune opzioni:\\
+%
+%\begin{tabular}{ll}
+%|type|  & accetta due valori: \texttt{lines} e \texttt{squares} (default: |lines|)\\
+%|width| & gestisce la dimensione orizzontale del campo di testo (default: 12 cm)\\
+%|height| & gestisce la dimensione verticale del campo di testo (default: 20 cm)\\
+%|spacedim|& gestisce la dimensione dei quadretti o delle linee (default: 0.5 cm)\\
+%|linecolor| & colore delle linee guida (default: gray)
+%\end{tabular}
+%\vspace{1em}
+%
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\openquestion{
+ Prova del testo della soluzione
+ della domanda aperta
+}}
+{\openquestion[width=4cm, height=2cm]{Prova del testo della soluzione della domanda aperta}}
+% \iffalse
+%</example>
+% \fi
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\openquestion[type=squared]{
+ Prova del testo della soluzione
+ della domanda aperta
+}}
+{\openquestion[type=squares, width=4cm, height=2cm]{Prova del testo della soluzione della domanda aperta}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\DescribeMacro{\finderror}Gli esercizi della tipologia ‘‘trova l'errore’’ possono essere composti tramite il comando
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\finderror*@\marg{testo sbagliato}\marg{testo giusto}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%Il comando visualizza la stringa \meta{testo sbagliato} nella modalità "test", mentre mostra una cancellatura ed il testo corretto nella modalità |solutions|.\\
+%
+%
+% \iffalse
+%<*example>
+% \fi
+\example
+{\finderror{sbagliato}{corretto}}
+{\finderror{sbagliato}{corretto}}
+% \iffalse
+%</example>
+% \fi
+%
+%
+%\vspace{1em}
+%\DescribeMacro{\textandimage}L'impaginazione del testo con affiancato un'immagine viene agevolato dal comando |\textandimage| che ha la seguente sintassi:
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\textandimage*@\oarg{left width}\oarg{right width}\marg{rx material}\marg{dx material}@*
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%Il \meta{rx material} viene affiancato all'\meta{dx material}. La larghezza della colonna sinistra (risp. destra) è controllata tramite l'argomento opzionale \meta{left width} (risp. \meta{right width}).\\
+% \iffalse
+%<*example>
+% \fi
+\example
+{\textandimage[2cm][1cm]{Testo}{
+\tikz{\draw(0,0) circle (.4cm)}}}
+{\phantom{.}\vspace{1em}\textandimage[2cm][1cm]{Testo}{\tikz{\draw(0,0) circle (.4cm)}}}
+% \iffalse
+%</example>
+% \fi
+%
+%\section{Personalizzazione}
+%Il pacchetto prevede un certo numero di comandi definiti al fine di gestire l'aspetto del documento finale.\par
+%Per l'intestazione tutti i font sono definiti secondo lo schema:
+%\begin{center}
+%\meta{comando intestazione}|font|
+%\end{center}
+%ed oltre a gestire l'aspetto del carattere, alcuni di questi, specificano la posizione occupata del testo ed eventuali prefissi.
+
+%\DescribeMacro{\institutefont}Il font dell'istituto, generato dal comando |\institute|, è gestito dal comando |\institutefont|. Per variare le caratteristiche del font è necessario ridefinire il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\institutefont}[1]*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\asyearfont}Il font dell'anno scolastico, generato dal comando |\asyear|, è gestito dal comando |\asyearfont|. Per variare le caratteristiche del font è necessario ridefinire il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\asyearfont}[1]*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\testtypefont}Il font tipo di test, generato dal comando |\testtype|, è gestito dal comando |\testtypefont|. Per variare le caratteristiche del font è necessario ridefinire il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\testtypefont}[1]*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\instrunctionfont}Il font delle istruzioni, generate dal comando |\instrunction|, è gestito dal comando |\instrunctionfont|. Per variare le caratteristiche del font è necessario ridefinire il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\instrunctionfont}[1]*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\instructiondelimiter}Le istruzioni e la durata della prova sono racchiuse tra due delimitatori che normalmente sono due righe orizzontali. Per cambiare, o rimuovere, questi delimitatori è sufficiente ridefinire il seguente comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\instructiondelimiter}*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\eserciziolabel}Gli esercizi vengono inseriti anteponendo al loro testo la dicitura ‘‘Quesito’’ seguito (eventualmente) da un numero. Per cambiare questa dicitura, a livello globale, ovvero per ogni esercizio, è sufficiente ridefinire il comando |\eserciziolabel|.
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\eserciziolabel}*@\marg{Preambolo dell'esercizio}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\diffsymb}L'ambiente esercizi prevede di poter descrivere la difficoltà tramite un simbolo grafico. Di default questo è una stella ($\bigstar$), tuttavia è possibile cambiare il tipo di simbolo ridefinendo il comando |\diffsymb|:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\diffsymb}*@\marg{codice del simbolo}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%\DescribeMacro{\closedquestionitem}Il simbolo delle domande chiuse è controllato dal comando |\closedquestionitem| che di default è un quadrato ($\square$). Per modificare questo simbolo è sufficiente ridefinire il comando:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\closedquestionitem}*@\marg{codice del simbolo}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+
+%
+%\DescribeMacro{\solutionfont}Le soluzioni degli esercizi vengono stampate, quando viene esplicitata l'opzione |solutions| quando viene caricato il pacchetto, con un font più piccolo e in corsivo. Per modificare il font delle soluzioni è sufficiente ridefinire il comando |\solutionfont|:
+%\iffalse
+%<*example>
+%\fi
+\begin{lstlisting}
+\renewcommand{\solutionfont}*@\marg{...}@*
+\end{lstlisting}
+%\iffalse
+%</example>
+%\fi
+%
+%
+% \StopEventually{\clearpage\PrintChanges \clearpage\PrintIndex}
+% \section{Implementation}
+%\subsection{Require packages}
+% The implementation of the \textsf{verifiche} package starts with the required packages:
+% \begin{macrocode}
+\RequirePackage{xparse}
+\RequirePackage{xkeyval}
+\RequirePackage{amsmath}
+\RequirePackage{amssymb}
+\RequirePackage{pgffor}
+\RequirePackage[shortlabels, inline]{enumitem}
+\RequirePackage{siunitx}
+\RequirePackage{graphicx}
+\RequirePackage{xcolor}
+\RequirePackage{tikz}
+\RequirePackage{booktabs}
+\RequirePackage{fancyhdr}
+\RequirePackage[normalem]{ulem}
+\RequirePackage{xstring}
+% \end{macrocode}
+%
+%
+%\subsection{Packages and library options}
+%The package loads |tikz| and some useful library.
+%The |siunitx| package is tuned in order to be used for the Italian math document.
+%\iffalse
+%%Forse si può cancellare questo
+%\fi
+% \begin{macrocode}
+\usetikzlibrary{calc,shapes.geometric,patterns,positioning,angles,quotes}
+\sisetup{
+ output-decimal-marker = {,},
+ exponent-product = \cdot,
+ per-mode=symbol-or-fraction,
+ separate-uncertainty
+}
+% \end{macrocode}
+%Finally the indentation is turned off.
+% \begin{macrocode}
+\setlength\parindent{0pt}
+% \end{macrocode}
+%
+%\subsection{newif}
+%Some conditionals are defined and initiated:
+%\iffalse
+%%newif
+%\fi
+% \begin{macrocode}
+\newif\ifsol
+\newif\ifinstitute\institutetrue
+\newif\ifinstruction\instructiontrue
+\newif\ifduration\durationtrue
+\newif\ifasyear\asyeartrue
+\newif\ifsolutionscolor\solutionscolorfalse
+\newif\ifcandidatename\candidatenametrue
+\newif\iftesttype\testtypetrue
+\newif\ifprintedheading\printedheadingfalse
+\newif\ifexercisesnumbered\exercisesnumberedtrue
+\newif\ifshowmarginexercise\showmarginexercisefalse
+\newif\ifopenquestionlines\openquestionlinesfalse
+\newif\ifopenquestionsquared\openquestionsquaredfalse
+% \end{macrocode}
+%\subsection{Package options declaration}
+%The package provides some options to control the aspect of the document and the mode of the document ("test" mode or "solutions" mode).
+%\iffalse
+%%Package option declaration
+%\fi
+% \begin{macrocode}
+\DeclareOptionX{solutions}[]{\soltrue}
+\DeclareOptionX{noinstitute}[]{\institutefalse}
+\DeclareOptionX{noinstruction}[]{\instructionfalse}
+\DeclareOptionX{noduration}[]{\durationfalse}
+\DeclareOptionX{noasyear}[]{\asyearfalse}
+\DeclareOptionX{nocandidatename}[]{\candidatenamefalse}
+\DeclareOptionX{notesttype}[]{\testtypefalse}
+\DeclareOptionX{nonumbered}[]{\exercisesnumberedfalse}
+\DeclareOptionX{color}[red]{\solutionscolortrue\def\solutionscolor{#1}}
+\DeclareOptionX{red}[]{\ExecuteOptionsX{color=red}}
+\DeclareOptionX{blue}[]{\ExecuteOptionsX{color=blue}}
+\DeclareOptionX*{\PackageWarning{verifiche}{Unknown ‘\CurrentOption’}}
+\ProcessOptionsX
+% \end{macrocode}
+%
+%\subsection{Counters}
+%The package use some predefined counters: the number of the exercise is controlled by |exercisenumber|, while the partial points of an exercise are summed into |partialpoints| (and it's reseted every new exercise) to produce the sum of the partial points for a given exercise.
+%\iffalse
+%%counters
+%\fi
+% \begin{macrocode}
+\newcounter{exercisenumber}
+\newcounter{partialpoints}[exercisenumber]
+% \end{macrocode}
+%\subsection{Macro and environment}
+%\iffalse
+%%macro and environment
+%\fi
+%\paragraph{Global variables}The package defined some global variable, that are used to indicate the institute, the year, the duration of the test, its type, the instructions and the scolar year.
+%\iffalse
+%%global variable
+%\fi
+% \begin{macrocode}
+\newcommand{\institute}[1]{%
+ \gdef\@institute{#1}}
+\newcommand{\duration}[2][Tempo della prova:]{%
+ \gdef\@durationpreamble{#1}\gdef\@duration{#2}}
+\newcommand{\testtype}[1]{%
+ \gdef\@testtype{#1}}
+\newcommand{\instruction}[1]{%
+ \gdef\@instruction{#1}}
+\newcommand{\asyear}[2][Anno scolastico]{%
+ \gdef\@asyearpreamble{#1}\gdef\@asyear{#2}}
+% \end{macrocode}
+%
+%\paragraph{Fonts and aspects}
+%One of the feature of this package is the flexibility about the aspect of the final result. All the main font or typographic elements (like instructions delimiters or the difficulty symbol) are defined as macro.
+%\iffalse
+%%fonts and aspects
+%\fi
+% \begin{macrocode}
+\newcommand{\institutefont}[1]{%
+ \large \sffamily\color{darkgray}#1}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\asyearfont}[1]{%
+ \hspace*{\fill} #1\hspace*{\fill}\\[.5em]}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\testtypefont}[1]{%
+ \hspace*{\fill}\scshape\huge#1\hspace*{\fill}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\instructiondelimiter}{%
+ \rule{\textwidth}{.5pt}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\instrunctionfont}[1]{%
+ \sffamily#1}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\durationfont}[1]{%
+ \hspace*{\fill}\@durationpreamble\space\bfseries #1\hspace*{\fill}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\eserciziolabel}{%
+ Quesito}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\solutionfont}{%
+ \footnotesize\ifsolutionscolor\color{\solutionscolor}\fi\itshape}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\diffsymb}{%
+ $\bigstar$}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\closedquestionitem}{%
+ $\square$}
+% \end{macrocode}
+%
+%\paragraph{Print the heading}The purpose of |\printheading| macro is to typeset the headings of the page, printing the name of the institute (if included), the type of the test (if included) and so on.
+%\iffalse
+%%print headings
+%\fi
+% \begin{macrocode}
+\newcommand{\printheading}{%
+ \ifinstitute\pagestyle{fancy}\fi%
+ {\ifinstitute\chead{\institutefont{\@institute}}\fi}%
+ {\ifcandidatename\vspace*{.25em}Nome e Cognome \underline{\hspace{6cm}}%
+ \hfill Classe \underline{\hspace{1.5cm}} \hfill Data \underline{\hspace{2.5cm}}\\[1em]\fi}%
+ {\ifasyear \asyearfont{\@asyearpreamble\space\@asyear}\fi}%
+ {\iftesttype\testtypefont{\@testtype}\fi}\\%
+ {\ifinstruction\instructiondelimiter\\{\instrunctionfont{\@instruction}}\\%
+ \ifduration{\durationfont\@duration\\}\fi\instructiondelimiter\fi}%
+}
+% \end{macrocode}
+
+%\paragraph{Esercizio.} The main element of the package is the |esericizio| environment.
+%It accepts some options define via |xkeyval| package. The element that are reproduced in the left margin are stored into a box and produce if |showmargin| boolean variable is switch to \textit{true}.\par
+%\iffalse
+%%ambiente esercizio
+%\fi
+% \begin{macrocode}
+\define@key{esercizio}{label}[Quesito]{%
+ \def\tempeserciziolabel{#1}}%
+\define@key{esercizio}{diff}[none]{
+ \def\diffstar{\hfill\foreach \i in {1,..., #1}{\diffsymb}}%
+ \showmarginexercisetrue}%
+\define@key{esercizio}{pt}[none]{
+ \def\pointes{#1}%
+ \def\espoint{\hfill\underline{\hspace{1cm}}/\pointes pt}%
+ \showmarginexercisetrue}%
+\define@key{esercizio}{partialpt}[none]{%
+ \def\sumpartialpt{\underline{\hspace{1cm}}/\ref{ptes@\theexercisenumber} pt}%
+ \showmarginexercisetrue}%
+% \end{macrocode}
+%
+%
+%The part of the exercise (i.e. the title and the margin note) are stored into macro in order to streamline the code.
+% \begin{macrocode}
+\newcommand{\exercisetitle}{%
+ \ifdefined\tempeserciziolabel\tempeserciziolabel%
+ \else \eserciziolabel\fi%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newsavebox{\box@marginexercise}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand{\exercisemargin}{%
+ \sbox{\box@marginexercise}{\parbox[t]{\marginparwidth}{%
+ \ifdefined\diffstar\hfill\diffstar\par\fi% stelle di difficoltà
+ \ifdefined\espoint\hfill\espoint\par\fi%[-\baselineskip] %punteggio
+ \ifdefined\sumpartialpt\hfill\sumpartialpt\fi} %punteggio parziale automatico
+ }%
+ \reversemarginpar\marginpar{\usebox{\box@marginexercise}}%
+}%
+% \end{macrocode}
+%
+% If the exercise admit points, they are stored in the .aux file of the main document in order to be recalled via |\ref| command.
+% \begin{macrocode}
+\newcommand{\savepointsaux}{%
+ \ifdefined\sumpartialpt%
+ \protected@write \@auxout {}{\string\newlabel {ptes@\theexercisenumber}{{\thepartialpoints}{}}}%
+ \fi%
+ \ifdefined\espoint%
+ \protected@write \@auxout {}{\string\newlabel {ptes@\theexercisenumber}{{\pointes}{}}}%
+ \fi%
+}%
+% \end{macrocode}
+
+%\begin{environment}{esercizio}
+%The content of the exercise are managed by the |esercizio| environment.
+%For every |esercizio| the counter |exercisenumber| is increased, the |showmarginexercise| are reset to false (to avoid the generation of spurious margin note if unnecessary) and the keys are set.
+%After that, the code produces the label of the environment, the body and manages the space before e after the environment in the page. If the exercise presents some scores, they are stored via |savepointsaux|.
+% \begin{macrocode}
+\NewDocumentEnvironment{esercizio}{o +b}{%
+ \refstepcounter{exercisenumber}%
+ \showmarginexercisefalse%
+ \IfValueT{#1}{\setkeys{esercizio}{#1}}%
+ \par\addvspace{\baselineskip}%
+ {\noindent\bfseries\exercisetitle\ifexercisesnumbered\space\theexercisenumber\fi}%
+ \ifshowmarginexercise\exercisemargin\fi%
+ \par% newline after label
+ \nobreak\noindent\ignorespaces#2%body of the environment
+}{%
+ \par%
+ \ignorespacesafterend%
+ \savepointsaux%
+}%
+% \end{macrocode}
+%\end{environment}
+%
+%
+%\begin{environment}{esercizio*}
+%The |esercizio*| environment has the same structure of the previous one, except for the code used to show the number of the exercise.
+% \begin{macrocode}
+\NewDocumentEnvironment{esercizio*}{o +b}{%
+ \showmarginexercisefalse%
+ \IfValueT{#1}{\setkeys{esercizio}{#1}}%
+ \par\addvspace{\baselineskip}{\noindent\bfseries\exercisetitle}%
+ \ifshowmarginexercise\exercisemargin\fi%
+ \par% newline after label
+ \nobreak\noindent\ignorespaces#2% body of the environment
+}{%
+ \par%
+ \ignorespacesafterend
+ \savepointsaux%print partial pt sum
+}%
+% \end{macrocode}
+%\end{environment}
+%
+%\begin{macro}{\partialpt}The |partialpt| macro define the content of the margin note where it's used.
+% \begin{macrocode}
+\NewDocumentCommand{\partialpt}{m}{%
+ \leavevmode\reversemarginpar\marginpar{\hfill(#1 pt)\addtocounter{partialpoints}{#1}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\paragraph{Soluzione}
+%\begin{environment}{soluzione}
+%The main element for the "solutions" mode is the |soluzione| environment.
+% \begin{macrocode}
+\NewDocumentEnvironment{soluzione}{+b}{%
+ \ifsol%
+ \par\addvspace{\baselineskip}%
+ {\noindent\bfseries Soluzione}%
+ \par\nobreak\noindent\ignorespaces%
+ \solutionfont #1%
+ \fi%
+}{%
+ \ifsol%
+ \par\ignorespacesafterend
+ \fi%
+}%
+% \end{macrocode}
+%\end{environment}
+%
+%\begin{macro}{\inlinesol}
+%The code inside |\inlinesol| is composed only if in "solutions" mode.
+% \begin{macrocode}
+\newcommand{\inlinesol}[1]{%
+ \ifsol%
+ \bgroup%
+ \ifmmode\mathit{\solutionfont#1}%
+ \else{\solutionfont#1}%
+ \fi%
+ \egroup%
+ \else\ignorespaces%
+ \fi%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\completetext}
+%The |\completetext| print a horizontal line on which write the solution if the "solutions" mode is active.
+% \begin{macrocode}
+\newcommand{\completetext}[2][4.5cm]{%
+ \ifsol%
+ $\overset{\displaystyle\text{\solutionfont#2}}{\underline{\hspace{#1}}}$%
+ \else%
+ $\overset{\relax}{\underline{\hspace{#1}}}$%
+ \fi}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\truefalse}
+%The |\truefalse| is generated via |\tikz| macro.
+% \begin{macrocode}
+\newcommand{\truefalse}[1]{%
+ \tikz[baseline=-.8ex]{%
+ %true part
+ \node[draw, rectangle, minimum size=1.5em] {V};%
+ \ifsol\IfSubStr{#1}{V}{\node[shift={(1pt,1pt)}]{%
+ $\Large\ifsolutionscolor\color{\solutionscolor}\fi\checkmark$}}{};\fi%
+ %false part
+ \node[xshift=1cm, draw, rectangle, minimum size=1.5em]{F};%
+ \ifsol\IfSubStr{#1}{F}{\node[xshift=1cm, shift={(1pt,1pt)}]{%
+ $\Large\ifsolutionscolor\color{\solutionscolor}\fi\checkmark$}}{};\fi%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\finderror}
+%The |\finderror| write the wrong text in "test mode" and than superimpose some mark (thanks to \textsf{ulem} package) and the correct text in "solutions mode".
+% \begin{macrocode}
+\newcommand{\finderror}[2]{%
+ \ifsol%
+ $\overset{\text{{\solutionfont#2}}}{\text{\xout{#1}}}$%
+ \else%
+ #1%
+ \fi%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{environment}{closedquestion}
+%The |closedquestion| environment define a new list whose item elements are preceded by square symbol, and every item is |\hfill| spaced. The |\checked| symbol is controlled and generated (in the "solutions mode") via |\tikz|.
+% \begin{macrocode}
+\newlist{crocette}{itemize*}{1}%
+\setlist[crocette]{label=\closedquestionitem, itemjoin={\hfill}}%
+\newcommand{\checked}{%
+ \ifsol%
+ \closedquestionitem\tikz[remember picture, overlay, baseline=-1ex, xshift=-.7ex]
+ {\node{\ifsolutionscolor\color{\solutionscolor}\fi$\checkmark$};}
+ \else
+ \closedquestionitem
+ \fi}
+\NewDocumentEnvironment{closedquestion}{+b}{%
+ \begin{crocette}#1%
+}{%
+ \end{crocette}
+}
+% \end{macrocode}
+%\end{environment}
+
+%\begin{macro}{\openquestion}
+%The |\openquestion| use key-value options defined as following presented.
+% \begin{macrocode}
+\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]{%
+ \ifcase\nr\relax%
+ % lines
+ \openquestionsquaredfalse\openquestionlinestrue%
+ \or%
+ % squares
+ \openquestionsquaredtrue\openquestionlinesfalse%
+ \fi}%
+ {\PackageError{verifiche}{Errore nell'opzione openquestion}{Inserire lines o squares}}
+% \end{macrocode}
+%
+%The macro starts with an initiation of predefined type of |\openquestion|, than possible options are overloaded.
+%Depending on the |type| of the |\openquestion|, squared or ruled background is composed and in the foreground is reproduce the text of the argument of the command (in the "solutions mode").
+% \begin{macrocode}
+\NewDocumentCommand{\openquestion}{o m}{%
+ \setkeys{openquestion}{type, width, height, linecolor, spacedim} %init
+ \IfValueT{#1}{\setkeys{openquestion}{#1}}%
+ \ifopenquestionsquared% if squared open question
+ \begin{tikzpicture}%
+ \draw[step=\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};
+ \end{tikzpicture}%
+ \else% if lined open question
+ \begin{tikzpicture}%
+ \pgfmathparse{int(\openquestionheight/\spacedim)}%
+ \foreach \y in {1, ..., \pgfmathresult}%
+ \draw[\openquestionlinecolor] (0, -\y*\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};%
+ \end{tikzpicture}%
+ \fi%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\textandimage}
+%The |\textandimage| manages two column material via |minipage| environment.
+% \begin{macrocode}
+\NewDocumentCommand{\textandimage}{O{.7\textwidth} O{.3\textwidth} m m}{%
+ \begin{minipage}{#1}
+ {#3}
+ \end{minipage}
+ \hfill
+ \begin{minipage}{#2}
+ {#4}
+ \end{minipage}
+}
+% \end{macrocode}
+%\end{macro}
+% \Finale
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/verifiche/verifiche.ins b/macros/latex/contrib/verifiche/verifiche.ins
new file mode 100644
index 0000000000..8063f393f6
--- /dev/null
+++ b/macros/latex/contrib/verifiche/verifiche.ins
@@ -0,0 +1,41 @@
+%%
+%% Copyright (C) 2020 i by Francesco Raccanello
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+\input docstrip.tex
+\keepsilent
+\usedir{tex/latex/verifiche}
+\preamble
+This is a generated file.
+Copyright (C) 2020 by Francesco Raccanello
+This file may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3 of this license or (at your option) any later
+version. The latest version of this license is in:
+http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+\endpreamble
+\generate{\file{verifiche.sty}{\from{verifiche.dtx}{package}}}
+\Msg{*********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* following file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space verifiche.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file verifiche.dtx}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*********************************************************}
+\endbatchfile \ No newline at end of file
diff --git a/macros/latex/contrib/verifiche/verifiche.pdf b/macros/latex/contrib/verifiche/verifiche.pdf
new file mode 100644
index 0000000000..25838a476d
--- /dev/null
+++ b/macros/latex/contrib/verifiche/verifiche.pdf
Binary files differ