summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/exesheet
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-26 03:01:46 +0000
committerNorbert Preining <norbert@preining.info>2023-10-26 03:01:46 +0000
commit721b0492f150d59f61b504ab803c7ef1a9a67a0b (patch)
tree95c682efcdefd7abd304cc7fb6ffe1d843d818a8 /macros/latex/contrib/exesheet
parent241082cbe6f4fe8c38e91c38418ca828ac8d2f7c (diff)
CTAN sync 202310260301
Diffstat (limited to 'macros/latex/contrib/exesheet')
-rw-r--r--macros/latex/contrib/exesheet/exesheet.dtx364
-rw-r--r--macros/latex/contrib/exesheet/exesheet.pdfbin294607 -> 296915 bytes
2 files changed, 209 insertions, 155 deletions
diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx
index 2baac97fae..443bef2991 100644
--- a/macros/latex/contrib/exesheet/exesheet.dtx
+++ b/macros/latex/contrib/exesheet/exesheet.dtx
@@ -23,7 +23,7 @@
%<class>\ProvidesClass{exesheet}
%<package>\ProvidesPackage{exesheet}
%<*class|package>
-[2023/09/05 v2.2 .dtx exesheet file]
+[2023/10/25 v2.3 .dtx exesheet file]
%</class|package>
%<*driver>
\documentclass{ltxdoc}
@@ -83,7 +83,7 @@
%</driver>
% \fi
%
-% \CheckSum{1141}
+% \CheckSum{1200}
%
% \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
@@ -149,6 +149,16 @@
% tasks environments
% - the answerspace option is set to false when answers are displayed}
%
+% \changes{v2.3}{2023/10/24}{
+% - new implementation of marking scheme checking:
+% checking is done in points or totalpoints instead of exercise command,
+% - correct ref macro for tablenuma using ref implementation in tasks,
+% available since 2020/08/19
+% - new commands question* and answer* for executing code when
+% questions are displayed but not answers, or the contrary
+% - using basic languages (with lower case first letter) instead of aliases
+% in translations commands}
+%
% \GetFileInfo{exesheet.dtx}
%
% \maketitle
@@ -244,7 +254,7 @@
% You can redefine it using |\renewcommand|.
% A better approach is to use macros from the \textsf{translations}
% package by Clemens Niederberger (which allows dynamic language switching), \eg
-% |\DeclareTranslation{Swedish}{exesheet-exercise}{\"Ovning}}|.
+% |\DeclareTranslation{swedish}{exesheet-exercise}{\"Ovning}}|.
%
% \smallskip
% \DescribeMacro{\labelexercise}
@@ -386,7 +396,7 @@
% \DescribeEnv{enumerate} \DescribeMacro{\item}
% Enumeration lists are used to represent questions and sub-questions
% within exercises. To provide clear emphasis,
-% labels are formatted in bold.
+% labels are typeset in bold.
% Additionally, these labels are aligned to the left, positioned at the start of the line
% without indentation, and the vertical spacing between items
% is increased compared to standard \LaTeX{} lists.
@@ -423,12 +433,15 @@
%
% Lists created with the \texttt{itemize} environment retain their default
% configuration
-% \footnote{The \texttt{french} option of the \textsf{babel} package
+% \footnote{However, the \texttt{french} option of the \textsf{babel} package
% changes the behavior of \texttt{itemize} lists and employs long dashes
% as labels for each list level.
% This behavior can cause issues when mathematical content follows the dash
% symbol, as it might be mistaken for the minus sign.
-% Thus the default \texttt{itemize} list style is reinstated.}.
+% Thus, with the option \texttt{setlist=true}, the default \LaTeX{}
+% \texttt{itemize} list style is
+% reinstated. The \texttt{\bs frenchsetup} command (from the
+% \textsf{babel-french} package) can achieve several other settings.}.
%
% \medskip
% \DescribeMacro{[setlist=\meta{bool}]}
@@ -751,14 +764,18 @@
% we can also employ the simpler |\question|\marg{ques} and |\answer|\marg{ans} macros.
% The visibility of \meta{ques} and \meta{ans} content is
% regulated by the same previous \texttt{output=\meta{opt}} key option.
-% This approach might be more fitting for brief questions and answers, such as when
-% you wish to display the answer immediately after each question item.
+% This approach might be more fitting when
+% you wish to display answers immediately after each question item.
% The title ``\correctionname'' won't appear at the start
% of each answer with the |\answer| macro.
% The answers are also formatted using |\correctionstyle|
% if \texttt{output=both}.
% However these commands do not support \texttt{verbatim} text within them,
-% unlike the \texttt{questions} and \texttt{answers} environments which do.
+% unlike the \texttt{questions} and \texttt{answers} environments.
+%
+% \DescribeMacro{\question*}\DescribeMacro{\answer*}
+% When a code must be executed only when questions are displayed but not
+% answers, or the contrary, you have the starred versions \eg |\question*{\pagebreak}|.
%
% \bigskip
% \DescribeMacro{\answerspace}
@@ -781,7 +798,7 @@
% Of course the |\answerspace| macro is not meant to be used within \texttt{answers}
% environments.
%
-% \section{Marginal notes for marking scheme}
+% \section{Marking scheme commands}
%
% The \textsf{exesheet} package enables the display of a detailed marking
% scheme in the margins, along with optional comments and explanations about answers.
@@ -1094,7 +1111,7 @@
% \DescribeMacro{[checkpts=\meta{bool}]}
% The marking scheme can be checked out
% \footnote{Thanks to Denis Bitouzé for his suggestion about this feature.}
-% using the key-val option \texttt{checkpts=true};
+% using the key-val option \texttt{checkpts=true} (or just \texttt{checkpts});
% the default value is \texttt{false}.
%
% \medskip
@@ -1109,20 +1126,21 @@
% \end{center}
% Both comma notation (\eg 4,5) and decimal point format (\eg 4.5)
% may be accepted, depending on your chosen language.
-% The validation occurs at the beginning of the subsequent exercise.
-% No warning messages will be presented at this level if no points are specified
-% for the questions.
+% The control is made at the beginning of the subsequent exercise,
+% inside |\points|, |\totalexe| or |totalpoints| macros.
+% No deep checking will be processed at this level if no points are displayed
+% for the questions inside the exercise (with \texttt{display=none} option).
%
% \medskip
% \DescribeMacro{\totalsheet}
-% At the end of the sheet, the last exercise is checked,
+% At the end of the document, the last exercise is checked,
% followed by a global examination of the entire sheet.
-% This last task requires knowledge of the total points for the sheet. To achieve this, use
-% the |\totalsheet|\marg{total} macro in the preamble;
+% This last task requires knowledge of the total points for the sheet, which must be given
+% by the |\totalsheet|\marg{points} macro in the preamble;
% otherwise, a warning message will be displayed.
-% If subtotals have been assigned to exercises, the overall comparison
+% If subtotals have been assigned to exercises and \emph{displayed}, the overall comparison
% is made between the sum of these subtotals and the total points recorded
-% using the |\totalsheet| macro.
+% using |\totalsheet|.
% If not, the evaluation encompasses the sum of points for each individual question.
% A subsequent warning message indicates the outcome of this last verification.
% Finally, a message indicates whether all scale controls have been successfully
@@ -1322,7 +1340,7 @@
\@ifpackageloaded{geometry}{}{\RequirePackage{geometry}}
\RequirePackage{xcolor}
\RequirePackage[shortlabels]{enumitem}
-\RequirePackage{tasks}
+\RequirePackage{tasks}[2020/08/19]
\RequirePackage{versions}
\RequirePackage{fancybox}
\RequirePackage{translations}
@@ -1353,65 +1371,65 @@
\DeclareTranslationFallback{exesheet-pts}{pts}
\DeclareTranslationFallback{exesheet-pt}{pt}
-\DeclareTranslation{English}{exesheet-exercise}{Exercise}
-\DeclareTranslation{English}{exesheet-subpart}{Part}
-\DeclareTranslation{English}{exesheet-annex}{Annex}
-\DeclareTranslation{English}{exesheet-ex}{Ex}
-\DeclareTranslation{English}{exesheet-points}{points}
-\DeclareTranslation{English}{exesheet-point}{point}
-\DeclareTranslation{English}{exesheet-correction}{Correction}
-\DeclareTranslation{English}{exesheet-pts}{pts}
-\DeclareTranslation{English}{exesheet-pt}{pt}
-
-\DeclareTranslation{French}{exesheet-exercise}{Exercice}
-\DeclareTranslation{French}{exesheet-subpart}{Partie}
-\DeclareTranslation{French}{exesheet-annex}{Annexe}
-\DeclareTranslation{French}{exesheet-ex}{Ex}
-\DeclareTranslation{French}{exesheet-points}{points}
-\DeclareTranslation{French}{exesheet-point}{point}
-\DeclareTranslation{French}{exesheet-correction}{Correction}
-\DeclareTranslation{French}{exesheet-pts}{pts}
-\DeclareTranslation{French}{exesheet-pt}{pt}
-
-\DeclareTranslation{German}{exesheet-exercise}{\"Ubung}
-\DeclareTranslation{German}{exesheet-subpart}{Teil}
-\DeclareTranslation{German}{exesheet-annex}{Anhang}
-\DeclareTranslation{German}{exesheet-ex}{\"Ub}
-\DeclareTranslation{German}{exesheet-points}{Punkte}
-\DeclareTranslation{German}{exesheet-point}{Punkt}
-\DeclareTranslation{German}{exesheet-correction}{Verbesserung}
-\DeclareTranslation{German}{exesheet-pts}{P.}
-\DeclareTranslation{German}{exesheet-pt}{P.}
-
-\DeclareTranslation{Spanish}{exesheet-exercise}{Ejercicio}
-\DeclareTranslation{Spanish}{exesheet-subpart}{Parte}
-\DeclareTranslation{Spanish}{exesheet-annex}{Anexo}
-\DeclareTranslation{Spanish}{exesheet-ex}{Ej}
-\DeclareTranslation{Spanish}{exesheet-points}{puntos}
-\DeclareTranslation{Spanish}{exesheet-point}{punto}
-\DeclareTranslation{Spanish}{exesheet-correction}{Correcci\'on}
-\DeclareTranslation{Spanish}{exesheet-pts}{ptos}
-\DeclareTranslation{Spanish}{exesheet-pt}{pto}
-
-\DeclareTranslation{Italian}{exesheet-exercise}{Esercizio}
-\DeclareTranslation{Italian}{exesheet-subpart}{Parte}
-\DeclareTranslation{Italian}{exesheet-annex}{Annesso}
-\DeclareTranslation{Italian}{exesheet-ex}{Es}
-\DeclareTranslation{Italian}{exesheet-points}{punti}
-\DeclareTranslation{Italian}{exesheet-point}{punto}
-\DeclareTranslation{Italian}{exesheet-correction}{Correzione}
-\DeclareTranslation{Italian}{exesheet-pts}{pti}
-\DeclareTranslation{Italian}{exesheet-pt}{pt}
-
-\DeclareTranslation{Portuges}{exesheet-exercise}{Exerc\'icio}
-\DeclareTranslation{Portuges}{exesheet-subpart}{Parte}
-\DeclareTranslation{Portuges}{exesheet-annex}{Anexo}
-\DeclareTranslation{Portuges}{exesheet-ex}{Ex}
-\DeclareTranslation{Portuges}{exesheet-points}{pontos}
-\DeclareTranslation{Portuges}{exesheet-point}{ponto}
-\DeclareTranslation{Portuges}{exesheet-correction}{Corre\c c\~ao}
-\DeclareTranslation{Portuges}{exesheet-pts}{pts}
-\DeclareTranslation{Portuges}{exesheet-pt}{pt}
+\DeclareTranslation{english}{exesheet-exercise}{Exercise}
+\DeclareTranslation{english}{exesheet-subpart}{Part}
+\DeclareTranslation{english}{exesheet-annex}{Annex}
+\DeclareTranslation{english}{exesheet-ex}{Ex}
+\DeclareTranslation{english}{exesheet-points}{points}
+\DeclareTranslation{english}{exesheet-point}{point}
+\DeclareTranslation{english}{exesheet-correction}{Correction}
+\DeclareTranslation{english}{exesheet-pts}{pts}
+\DeclareTranslation{english}{exesheet-pt}{pt}
+
+\DeclareTranslation{french}{exesheet-exercise}{Exercice}
+\DeclareTranslation{french}{exesheet-subpart}{Partie}
+\DeclareTranslation{french}{exesheet-annex}{Annexe}
+\DeclareTranslation{french}{exesheet-ex}{Ex}
+\DeclareTranslation{french}{exesheet-points}{points}
+\DeclareTranslation{french}{exesheet-point}{point}
+\DeclareTranslation{french}{exesheet-correction}{Correction}
+\DeclareTranslation{french}{exesheet-pts}{pts}
+\DeclareTranslation{french}{exesheet-pt}{pt}
+
+\DeclareTranslation{german}{exesheet-exercise}{\"Ubung}
+\DeclareTranslation{german}{exesheet-subpart}{Teil}
+\DeclareTranslation{german}{exesheet-annex}{Anhang}
+\DeclareTranslation{german}{exesheet-ex}{\"Ub}
+\DeclareTranslation{german}{exesheet-points}{Punkte}
+\DeclareTranslation{german}{exesheet-point}{Punkt}
+\DeclareTranslation{german}{exesheet-correction}{Verbesserung}
+\DeclareTranslation{german}{exesheet-pts}{P.}
+\DeclareTranslation{german}{exesheet-pt}{P.}
+
+\DeclareTranslation{spanish}{exesheet-exercise}{Ejercicio}
+\DeclareTranslation{spanish}{exesheet-subpart}{Parte}
+\DeclareTranslation{spanish}{exesheet-annex}{Anexo}
+\DeclareTranslation{spanish}{exesheet-ex}{Ej}
+\DeclareTranslation{spanish}{exesheet-points}{puntos}
+\DeclareTranslation{spanish}{exesheet-point}{punto}
+\DeclareTranslation{spanish}{exesheet-correction}{Correcci\'on}
+\DeclareTranslation{spanish}{exesheet-pts}{ptos}
+\DeclareTranslation{spanish}{exesheet-pt}{pto}
+
+\DeclareTranslation{italian}{exesheet-exercise}{Esercizio}
+\DeclareTranslation{italian}{exesheet-subpart}{Parte}
+\DeclareTranslation{italian}{exesheet-annex}{Annesso}
+\DeclareTranslation{italian}{exesheet-ex}{Es}
+\DeclareTranslation{italian}{exesheet-points}{punti}
+\DeclareTranslation{italian}{exesheet-point}{punto}
+\DeclareTranslation{italian}{exesheet-correction}{Correzione}
+\DeclareTranslation{italian}{exesheet-pts}{pti}
+\DeclareTranslation{italian}{exesheet-pt}{pt}
+
+\DeclareTranslation{portuges}{exesheet-exercise}{Exerc\'icio}
+\DeclareTranslation{portuges}{exesheet-subpart}{Parte}
+\DeclareTranslation{portuges}{exesheet-annex}{Anexo}
+\DeclareTranslation{portuges}{exesheet-ex}{Ex}
+\DeclareTranslation{portuges}{exesheet-points}{pontos}
+\DeclareTranslation{portuges}{exesheet-point}{ponto}
+\DeclareTranslation{portuges}{exesheet-correction}{Corre\c c\~ao}
+\DeclareTranslation{portuges}{exesheet-pts}{pts}
+\DeclareTranslation{portuges}{exesheet-pt}{pt}
\newcommand*\exercisename{\GetTranslation{exesheet-exercise}}
\newcommand*\subpartname{\GetTranslation{exesheet-subpart}}
@@ -1441,8 +1459,8 @@
% are initially empty, but they allow you to customize the styling. For example:\\
% |\renewcommand\labelexercisestyle{\sffamily}|.
%
-% The |\exe@check| macro, responsible for verifying the marking scheme, will be defined
-% in section \ref{MSoptions}.
+% The |\exe@label| macro, which needs the |exe@check| counter, will be used
+% inside warning messages about the marking scheme (see section \ref{MSoptions}).
%
% By default, the table of contents includes both exercises and parts titles,
% as controlled by the boolean |\ifexesheet@exetoc|.
@@ -1452,25 +1470,28 @@
% \begin{macro}{\exercise}
% \begin{macrocode}
\newcounter{exercise}
+\newcounter{exe@check}
\newcommand{\labelexercise}{\exercisename\space \theexercise}
\newcommand{\labelexercisestyle}{}
\newcommand*{\@exercise}[1][]{%
- \ifexesheet@checkpts \exe@check{\labelexercise} \fi
- % curiously, \exe@check must be performed before \refstepcounter
\refstepcounter{exercise}
\subsection*{\labelexercisestyle\labelexercise\enskip #1}
\ifexesheet@exetoc
\addcontentsline{toc}{subsection}{\labelexercise}
\fi
+ \ifexesheet@checkpts
+ \setcounter{exe@check}{\value{exercise}}
+ \def\exe@label{\exercisename\space\theexe@check}
+ \fi
}
\newcommand*{\@@exercise}[2][]{%
- \ifexesheet@checkpts \exe@check{#2} \fi
\subsection*{\labelexercisestyle #2\enskip #1}
\setcounter{subpart}{0} % resets the parts counter
\ifexesheet@exetoc
\addcontentsline{toc}{subsection}{#2}
\fi
+ \ifexesheet@checkpts \def\exe@label{#2} \fi
}
\newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}}
@@ -1517,8 +1538,16 @@
\newcommand{\exlabel}{\exname.~\theexercise}
\newcommand{\exsepmark}{---}
\newcommand{\@exe}{\bigskip\refstepcounter{exercise}
+ \ifexesheet@checkpts
+ \setcounter{exe@check}{\value{exercise}}
+ \def\exe@label{\exname\space\theexe@check}
+ \fi
\par\noindent\textbf{\exlabel~\exsepmark}~}
\newcommand{\@@exe}{\bigskip\refstepcounter{exercise}
+ \ifexesheet@checkpts
+ \setcounter{exe@check}{\value{exercise}}
+ \def\exe@label{\exname\space\theexe@check}
+ \fi
\par\noindent\textbf{\exlabel}~}
\newcommand{\exe}{\@ifstar{\@@exe}{\@exe}}
@@ -1558,8 +1587,7 @@
}
\ifexesheet@setlist
\standardfrenchlists
- % must be executed here when exesheet is loaded after babel
- \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
+ % must be executed here (and not at begin doc) if loaded after babel
\fi
\newcommand\labelenumone{\arabic{task}.}
@@ -1567,7 +1595,7 @@
\def\exs@process@setlist{% must be executed at begin document
\ifexesheet@setlist
- \standardfrenchlists % if exesheet is loaded before babel
+ \standardfrenchlists % executed at begin doc if loaded before babel
\setlist[enumerate]{font=\bfseries}
\setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
\fi
@@ -1586,7 +1614,7 @@
column-sep=1em,label-align=right,
item-indent=1.5em,label-width=1em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
- \NewTasksEnvironment[label=\labelenuma,
+ \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
column-sep=1em,label-align=right,
item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
@@ -1595,7 +1623,7 @@
column-sep=1em,label-align=right,
label-width=1em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
- \NewTasksEnvironment[label=\labelenuma,
+ \NewTasksEnvironment[label=\labelenuma,ref=\alph{task},
column-sep=1em,label-align=right,
item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
@@ -1826,22 +1854,28 @@
% the preceding vertical space may become too wide.
% \end{environment}
%
-% \begin{macro}{\question}
+% \DescribeMacro{\question}\DescribeMacro{\question*}
% \begin{macrocode}
-\newcommand{\question}[1]{\ifexesheet@questions #1\fi}
+\newcommand{\@question}[1]{\ifexesheet@questions #1\fi}
+\newcommand{\@@question}[1]{%
+ \ifexesheet@questions\ifexesheet@answers \else #1\fi\fi}
+\newcommand{\question}{\@ifstar{\@@question}{\@question}}
% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\answer}
+%
+% \DescribeMacro{\answer}\DescribeMacro{\answer*}
% \begin{macrocode}
-\newcommand{\answer}[1]{%
+\newcommand{\@answer}[1]{%
\ifexesheet@answers%
\ifexesheet@questions {\correctionstyle #1}\else #1\fi
\fi
}
+\newcommand{\@@answer}[1]{%
+ \ifexesheet@answers\ifexesheet@questions \else #1\fi\fi}
+\newcommand{\answer}{\@ifstar{\@@answer}{\@answer}}
% \end{macrocode}
-% \end{macro}
+%
% \begin{macro}{\answerspace}
% The |\answerspace| macro was suggested by Maxime Chupin
% to allow students space for writing their answers on the provided paper.
@@ -1901,8 +1935,8 @@
\def\exs@process@marginpos{
\ifthenelse{\equal{\exesheet@marginpos}{left}}{
\if@twoside%
- \PackageWarningNoLine{exesheet}{The default `marginpos' option
- \MessageBreak
+ \PackageWarningNoLine{exesheet}{The default `marginpos'
+ option \MessageBreak
for two-sided documents is `outer'.\MessageBreak
To change the side, use `inner'}
\def\exesheet@marginpos{outer}
@@ -1915,8 +1949,8 @@
}{% else if
\ifthenelse{\equal{\exesheet@marginpos}{right}}{
\if@twoside%
- \PackageWarningNoLine{exesheet}{The default `marginpos' option
- \MessageBreak
+ \PackageWarningNoLine{exesheet}{The default `marginpos'
+ option \MessageBreak
for two-sided documents is `outer'.\MessageBreak
To change the side, use `inner'}
\def\exesheet@marginpos{outer}
@@ -2124,9 +2158,8 @@
\newlength{\sum@exe}
\newlength{\exe@total}
\newlength{\sum@pts}
-\def\exe@label{none}
+\def\exe@currentlabel{none}
\newboolean{scale@valid}
-\setboolean{scale@valid}{true}
\gdef\gsetlength#1#2{% for obtaining global length values
\begingroup
@@ -2143,22 +2176,23 @@
\endgroup
}
-\def\exe@check#1{
- \ifthenelse{\lengthtest{\sum@pts = 0pt}\or\equal{\exe@label}{none}}{
- % do not check, no \pts or first exercise begins
+\def\exe@check{
+ \ifthenelse{\lengthtest{\sum@pts = 0pt}}{
+ % do not check, no points or first exercise begins
+ \ifthenelse{\equal{\exe@currentlabel}{none}}{}{
+ \PackageWarningNoLine{exesheet}{\exe@currentlabel:
+ \the\exe@total}}
}{
\ifthenelse{\lengthtest{\exe@total = \sum@pts}}{
- \PackageWarningNoLine{exesheet}{\exe@label:
- The scale of \the\exe@total\space is valid}
+ \PackageWarningNoLine{exesheet}{\exe@currentlabel:
+ Sum of points \the\exe@total\space is valid}
}{
- \PackageWarningNoLine{exesheet}{\exe@label:
- Sum of points is
- \the\sum@pts\space instead of \the\exe@total}
+ \PackageWarningNoLine{exesheet}{\exe@currentlabel:
+ Sum of points is \the\sum@pts\space
+ instead of \the\exe@total}
\setboolean{scale@valid}{false}
}
- \gsetlength{\sum@pts}{0pt}
- }
- \def\exe@label{#1} % for the upcoming exercise
+ }
}
\def\exs@process@checkpts{
@@ -2173,58 +2207,82 @@
\gsetlength{\sum@exe}{0pt}
\gsetlength{\exe@total}{0pt}
\gsetlength{\sum@pts}{0pt}
- \AtEndDocument{
- \ifthenelse{\equal{\exe@label}{none}}{
+ \setboolean{scale@valid}{true}
+ \AtEndDocument{% final checking (global)
+ \ifthenelse{\equal{\exe@currentlabel}{none}}{
+ \ifthenelse{\lengthtest{\sum@pts = 0pt}}{
+ \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
+ }{
\ifthenelse{\lengthtest{\sheet@total = \sum@pts}}{
- \PackageWarningNoLine{exesheet}{Sum of points
- is valid: \the\sheet@total}
+ \PackageWarningNoLine{exesheet}{Total:
+ Sum of points \the\sheet@total\space is valid}
+ }{
+ \PackageWarningNoLine{exesheet}{Total:
+ Sum of points is \the\sum@pts\space
+ instead of \the\sheet@total}
+ }}
+ }{% last exercise and final checking
+ \exe@check
+ \ifthenelse{\lengthtest{\sum@exe} = 0pt}{
+ \PackageWarningNoLine{exesheet}{checkpts: No points displayed}
}{
- \PackageWarningNoLine{exesheet}{Inconsistent
- sum of points:
- \the\sum@pts\space instead of \the\sheet@total}
- \setboolean{scale@valid}{false}
- }
- }{
- \exe@check{end}
\ifthenelse{\lengthtest{\sheet@total = \sum@exe}}{
- \PackageWarningNoLine{exesheet}{Sum of points
- is valid: \the\sheet@total}
+ \PackageWarningNoLine{exesheet}{Total:
+ Sum of points \the\sheet@total\space is valid}
}{
- \PackageWarningNoLine{exesheet}{Inconsistent
- sum of points:
- \the\sum@exe\space instead of \the\sheet@total}
+ \PackageWarningNoLine{exesheet}{Total:
+ Sum of points is \the\sum@exe\space
+ instead of \the\sheet@total}
\setboolean{scale@valid}{false}
}
- }
- \ifthenelse{\boolean{scale@valid}}{
- \PackageWarningNoLine{exesheet}{Scale is valid}
- }{
- \PackageWarningNoLine{exesheet}{INVALID SCALE!
- Refer to above}
+ \ifthenelse{\boolean{scale@valid}}{
+ \PackageWarningNoLine{exesheet}{
+ Marking scheme checked without errors}
+ }{
+ \PackageWarningNoLine{exesheet}{
+ Marking scheme checked with ERRORS! See above}
+ }
+ }
}
}
\fi
}
% \end{macrocode}
-% \end{macro}
%
-% \subsection{Marginal notes commands}
+% \subsection{Marking scheme commands}
+%
+% The |\check@points| macro, used by |\points| and |\totalexe|, triggers
+% the marking scheme control (with |\exe@check| defined above) and
+% sets label and lengths for the next exercise.
+% \begin{macrocode}
+\newcommand*{\check@points}[1]{%
+ \ifexesheet@checkpts%
+ \exe@check% checks the previous exercise
+ \gdef\exe@currentlabel{\exe@label}% for the upcoming exercise
+ \gsetlength{\sum@pts}{0pt}%
+ \gsetlength{\exe@total}{#1pt}%
+ \gaddtolength{\sum@exe}{#1pt}%
+ \fi%
+}
+
+% \end{macrocode}
%
% \begin{macro}{\points}
% \begin{macrocode}
\definecolor{pointscolor}{named}{red}
\newcommand{\pointsstyle}{%
\small\mdseries\sffamily\color{pointscolor}\fbox}
-\newcommand*{\exesheet@points}[1]{\hfill
- \pointsstyle{#1~%
- \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}
- \ifexesheet@checkpts\gaddtolength{\sum@exe}{#1pt}\fi%
-}
\newcommand*{\points}[1]{%
- \ifthenelse{\boolean{exesheet@questions}}{\exesheet@points{#1}}{}}
+ \ifthenelse{\boolean{exesheet@questions}}{\hfill
+ \pointsstyle{#1~%
+ \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}
+ \check@points{#1}
+ }{}
+}
% \end{macrocode}
+% \end{macro}
% To prevent spaces between the |\fbox| and its inner text,
% percent symbols are necessary.
% The test |#1 < 2| doesn't work with decimal numbers without |\lengthtest|,
@@ -2268,10 +2326,7 @@
\mbox{}%
\marginpar{\hspace{0pt}\markingstyle{\ovalbox{%
\makebox[\ptsboxlength]{\ptsmark{#1}}}}}%
- \fi%
- \ifexesheet@checkpts%
- \gsetlength{\exe@total}{#1pt}%
- \gaddtolength{\sum@exe}{#1pt}%
+ \check@points{#1}%
\fi%
\ignorespaces
}
@@ -2319,10 +2374,10 @@
\noindent\hspace{0pt}\notestyle #2%
}{}%
}%
- \fi%
- \ifexesheet@checkpts%
- \ifthenelse{\equal{#1}{}}{}{%
- \gaddtolength{\sum@pts}{#1pt}}%
+ \ifexesheet@checkpts%
+ \ifthenelse{\equal{#1}{}}{}{%
+ \gaddtolength{\sum@pts}{#1pt}}%
+ \fi%
\fi%
\ignorespaces
}
@@ -2330,9 +2385,9 @@
\ifexesheet@pts%
\mbox{}%
\marginpar{\noindent\hspace{0pt}\markingstyle{#1}}%
- \fi%
- \ifexesheet@checkpts%
- \gaddtolength{\sum@pts}{#1pt}%
+ \ifexesheet@checkpts%
+ \gaddtolength{\sum@pts}{#1pt}%
+ \fi%
\fi%
\ignorespaces
}
@@ -2353,8 +2408,7 @@
% \begin{macro}{\exs@process@correct}
% \begin{macrocode}
\def\exs@process@correct{
- \ifthenelse{\equal{\exesheet@correct}{false}}{
- % do nothing
+ \ifthenelse{\equal{\exesheet@correct}{false}}{% do nothing
}{% else
\@ifpackageloaded{schooldocs}{
\ifthenelse{\equal{\exesheet@correct}{true}}{
diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf
index f9845a9ce1..3eae349ae8 100644
--- a/macros/latex/contrib/exesheet/exesheet.pdf
+++ b/macros/latex/contrib/exesheet/exesheet.pdf
Binary files differ