aboutsummaryrefslogtreecommitdiff
path: root/latex/common.tex
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-08-01 16:18:15 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-08-01 16:18:15 +0200
commitb4db5ea03dd236bfcf23dd6335ccd00ed8498575 (patch)
tree047523d9df5bd8b4b334fbf824a4ea7eaaae4833 /latex/common.tex
parent56c60918d71a2e4e8ee558fd0d1fcd77ad3bdac9 (diff)
downloadunterricht-b4db5ea03dd236bfcf23dd6335ccd00ed8498575.tar.gz
unterricht-b4db5ea03dd236bfcf23dd6335ccd00ed8498575.zip
detect if the point distribution and the points in the solution differ
Diffstat (limited to 'latex/common.tex')
-rw-r--r--latex/common.tex13
1 files changed, 12 insertions, 1 deletions
diff --git a/latex/common.tex b/latex/common.tex
index 87ede1c4..288d03f9 100644
--- a/latex/common.tex
+++ b/latex/common.tex
@@ -32,9 +32,12 @@
\newenvironment{Aufg}[1][]{
\refstepcounter{Aufg}%
\noindent\textbf{Aufgabe \theAufg\ifstrempty{#1}{}{\ #1}:%
-\ifdefempty{\Verteilung}{}{\ \Verteilung} \hfill {/}\ref{a:\theAufg} \ BE}%
+\ifdefempty{\Verteilung}{}{\ \Verteilung{} BE} \hfill {/}\ref{a:\theAufg} \ BE}%
\newline
}{%
+\ifdefempty{\Verteilung}%
+ {\setcounter{distSum}{-1}}%
+ {\setcounter{distSum}{\fpeval{\Verteilung}}}%
\renewcommand{\Verteilung}{}% reset the distribution after each exercise
\global\let\Verteilung\Verteilung%
}
@@ -45,6 +48,9 @@
\newcounter{beAManuell} % Counter to manually override the points in the current exercise
\setcounter{beAManuell}{-1}
+\newcounter{distSum} % Counter to check the sum of the point distribution
+\setcounter{distSum}{-1}
+
\newcommand{\BE}[1]{%
\iftoggle{erwartungshorizont}{% Typeset the points only if we are creating a horizon of expectation
#1 BE}{}% TODO: better typesetting
@@ -78,6 +84,11 @@
\addtocounter{beA}{-1}% decrement beA count because refstepcounter 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
+\ifnumgreater{\thedistSum}{-1}{%
+ \ifnumequal{\thedistSum}{\thebeA}{}{%
+ \errmessage{Aufg \theAufg: \noexpand\Verteilung (\thedistSum) and point count (\thebeA) are not equal}%
+ }%ifnumequal
+}{}%ifnumfreater
}
\newtheoremstyle{Bearbeitung}% name of the style to be used