diff options
author | Karl Berry <karl@freefriends.org> | 2023-10-26 19:52:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-10-26 19:52:22 +0000 |
commit | 8f6f27c1fc4e84eab175dedbc381b8b2c0ab0efb (patch) | |
tree | fb430cbffb83a5319afb7d65fa97518918df3b23 /Master/texmf-dist/tex | |
parent | e4628ab632beb3f01a73ae6063419305af52e565 (diff) |
exesheet (26oct23)
git-svn-id: svn://tug.org/texlive/trunk@68660 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/exesheet/exesheet.cls | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exesheet/exesheet.sty | 286 |
2 files changed, 159 insertions, 129 deletions
diff --git a/Master/texmf-dist/tex/latex/exesheet/exesheet.cls b/Master/texmf-dist/tex/latex/exesheet/exesheet.cls index cb2a84efe0e..fb7dd3b76e0 100644 --- a/Master/texmf-dist/tex/latex/exesheet/exesheet.cls +++ b/Master/texmf-dist/tex/latex/exesheet/exesheet.cls @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesClass{exesheet} -[2023/09/05 v2.2 .dtx exesheet file] +[2023/10/25 v2.3 .dtx exesheet file] \RequirePackage{kvoptions} \DeclareBoolOption[true]{exetoc} diff --git a/Master/texmf-dist/tex/latex/exesheet/exesheet.sty b/Master/texmf-dist/tex/latex/exesheet/exesheet.sty index 35f668ef633..fb8e941a20c 100644 --- a/Master/texmf-dist/tex/latex/exesheet/exesheet.sty +++ b/Master/texmf-dist/tex/latex/exesheet/exesheet.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{exesheet} -[2023/09/05 v2.2 .dtx exesheet file] +[2023/10/25 v2.3 .dtx exesheet file] \@ifclassloaded{exesheet}{}{ \RequirePackage{kvoptions} @@ -70,7 +70,7 @@ \@ifpackageloaded{geometry}{}{\RequirePackage{geometry}} \RequirePackage{xcolor} \RequirePackage[shortlabels]{enumitem} -\RequirePackage{tasks} +\RequirePackage{tasks}[2020/08/19] \RequirePackage{versions} \RequirePackage{fancybox} \RequirePackage{translations} @@ -87,65 +87,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}} @@ -158,25 +158,28 @@ \newcommand*\ptname{\GetTranslation{exesheet-pt}} \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}} @@ -211,8 +214,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}} @@ -232,8 +243,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}.} @@ -241,7 +251,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 @@ -252,7 +262,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) @@ -261,7 +271,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) @@ -411,13 +421,19 @@ \ifthenelse{\boolean{exesheet@answers}}{\correctionstyle}{\comment} }{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}} -\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}} -\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}} \newcommand\answerspace[1]{ \ifexesheet@answerspace \par\vspace{#1} \fi} @@ -448,8 +464,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} @@ -462,8 +478,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} @@ -615,9 +631,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 @@ -634,22 +649,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{ @@ -664,49 +680,67 @@ \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 } +\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% +} + \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} + }{} +} \definecolor{ptscolor}{named}{red} \newcommand{\ptsstyle}[1]{% @@ -736,10 +770,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 } @@ -767,10 +798,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 } @@ -778,9 +809,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 } @@ -790,8 +821,7 @@ \ifthenelse{\boolean{exesheet@pts}}{\totalexe}{\points}} \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}}{ |