diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-08-01 13:39:58 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-08-01 13:48:35 +0200 |
| commit | 21a4da5f74ddb81662f92c1529bc4da6715f941e (patch) | |
| tree | 546d860e01d05ed0356313d374b8890d2f56e66d /latex/common.tex | |
| parent | a5a817a143205802c099ce4833e8e7639425a104 (diff) | |
| download | unterricht-21a4da5f74ddb81662f92c1529bc4da6715f941e.tar.gz unterricht-21a4da5f74ddb81662f92c1529bc4da6715f941e.zip | |
overhaul the automatic point counting
The Lsg environment now sets the expected points even if it is not rendered.
This allows us to use the automatic point counting also in "schueler" versions.
All exercise points are stored in an exercise-local counter and are
persisted using refstepcounter and an appropriate label.
Diffstat (limited to 'latex/common.tex')
| -rw-r--r-- | latex/common.tex | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/latex/common.tex b/latex/common.tex index 2d2efbea..5cdc2985 100644 --- a/latex/common.tex +++ b/latex/common.tex @@ -33,23 +33,54 @@ {}% name of head font {}% punctuation between head and body {\newline }% space after theorem head; " " = normal interword space -{\textbf{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}\ifdefined\Verteilung{}: \ \Verteilung \hfill {/}\AnzahlPunkte \ BE\fi}} +{\textbf{\thmname{#1} \thmnumber{#2}\thmnote{ (#3)}\ifdefined\Verteilung{}: \ \Verteilung \hfill {/}\ref{a:\thmnumber{#2}} \ BE\fi}} \theoremstyle{Aufg} \newtheorem{Aufg}{Aufgabe} -\newtheoremstyle{Lsg}% name of the style to be used -{2pt}% measure of space to leave above the theorem. E.g.: 3pt -{}% measure of space to leave below the theorem. E.g.: 3pt -{}% name of font to use in the body of the theorem -{}% measure of space to indent -{}% name of head font -{}% punctuation between head and body -{\newline }% space after theorem head; " " = normal interword space -{\textbf{\thmname{#1}\thmnote{ (#3)}:}} +% Total amount of point * 2 in order to track half points in an integer counter +\newcounter{be} % Total amount of points in the document +\newcounter{beA}[Aufg] % Amount of point in the current exercise +\newcounter{beAManuell} % Counter to manually override the points in the current exercise +\setcounter{beAManuell}{-1} + +\newcommand{\BE}[1]{% +\iftoggle{erwartungshorizont}{% Typeset the points only if we are creating a horzon of expectation +#1 BE}{}% TODO: better typesetting +\addtocounter{beA}{\fpeval{#1*2}}} + +\newcommand{\AnzahlInsgesamtPunkte}{\fpeval{\value{be} / 2}} -\theoremstyle{Lsg} -\newtheorem{Lsg}{Lösung} +% Point distribution across subtasks +\newcommand{\Verteilung}{} + +% Manually override the points +\newcommand{\AnzahlPunkte}[1]{\setcounter{beAManuell}{\fpeval{#1*2}}} + + +\newenvironment{Lsg} +{ +\iftoggle{lehrerversion}{ +\noindent\textbf{Lösung:}\newline +}{ +\begin{adjustbox}{max height=0cm, minipage=[0pt]{\textwidth},frame,phantom} +} +} +{%end_def +\iftoggle{lehrerversion}{}{\end{adjustbox}\vspace{-\baselineskip}} +% Overwrite the beA counter +\ifthenelse{\arabic{beAManuell} > -1}% +{\setcounter{beA}{\value{beAManuell}}}% +{} +\setcounter{beAManuell}{-1} +% Sum up all points +\addtocounter{be}{\value{beA}} +% Persist the current exercise count +\setcounter{beA}{\fpeval{\value{beA} / 2}}% +\addtocounter{beA}{-1}% decrement beA count because refstepcount will increment it +\refstepcounter{beA}% make the beA available for the ref and label mechanisms +\expandafter\label{a:\theAufg}% create a label for this exercise +} \newtheoremstyle{Bearbeitung}% name of the style to be used {0pt}% measure of space to leave above the theorem. E.g.: 3pt @@ -65,12 +96,10 @@ \newtheorem{Bearbeitung}{} \newcommand{\Lehrerversion}{\excludecomment{Bearbeitung}} -\newcommand{\Schuelerversion}{\excludecomment{Lsg}} \iftoggle{lehrerversion}{ \Lehrerversion }{ - \Schuelerversion } % Add new paired delimiter 'abs' using mathtools |
