aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-02-02 18:15:14 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2026-02-02 18:17:53 +0100
commitde9c2a8fb1d52111c0b30a9ed9c1f4866c58eaef (patch)
tree280b98c6f7b16360d9791c5f8c3970c99aef13a7
parentc13f5b077a4da047d193a7d318f49dd2b8dc5a7d (diff)
downloadunterricht-de9c2a8fb1d52111c0b30a9ed9c1f4866c58eaef.tar.gz
unterricht-de9c2a8fb1d52111c0b30a9ed9c1f4866c58eaef.zip
improve latex code quality and add more comments
-rw-r--r--latex/common.tex36
1 files changed, 20 insertions, 16 deletions
diff --git a/latex/common.tex b/latex/common.tex
index f8786a2a..105902e5 100644
--- a/latex/common.tex
+++ b/latex/common.tex
@@ -8,16 +8,17 @@
\begin{tikzpicture}[gray,step=#1]
\pgfmathtruncatemacro\anzahl{(\linewidth-\pgflinewidth)/#1} % maximale Anzahl Kästchen pro Zeile
\draw (0,0) rectangle (\anzahl*#1,#2*#1) (0,0) grid (\anzahl*#1,#2*#1);
- \end{tikzpicture}
+ \end{tikzpicture}%
}
\newcommand{\liniert}[2][9mm]{%
\begin{tikzpicture}[gray]
\path[use as bounding box](0,0)rectangle(\linewidth,-#2*#1-0.5\pgflinewidth);
\foreach \n in {1,...,#2}\draw(0 ,-#1*\n )--(\linewidth,-#1*\n );
- \end{tikzpicture}
+ \end{tikzpicture}%
}
+% Shortcut for \iftoggle{lehrerversion}
\newcommand{\iflehrer}[2]{\iftoggle{lehrerversion}{#1}{#2}}
% Expands to its argument if the lehrerversion toggle is set
\newcommand{\ifschueler}[1]{\iftoggle{lehrerversion}{}{#1}}
@@ -48,13 +49,14 @@
\node [cell] at ([shift={(1,-1)}]\xi*#1,0) {\ref{a:\xi}};
\node [cell] at ([shift={(1,-2)}]\xi*#1,0) {};
}
- \end{tikzpicture}
+ \end{tikzpicture}%
}
}
% Point distribution across subtasks
\newcommand{\Verteilung}{}
+% Input an exercise an specify its version
\newcommand{\inputAufgVersion}[2]{%
\setcounter{AufgVersion}{#1}%
\input{#2}%
@@ -69,11 +71,12 @@
\ifdefempty{\Verteilung}{}{\ \Verteilung{} BE} \hfill \iftoggle{vaguebe}{ca. }{/}\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%
+ \ifdefempty{\Verteilung}%
+ {\setcounter{distSum}{-1}}%
+ {\setcounter{distSum}{\fpeval{\Verteilung}}}%
+ \renewcommand{\Verteilung}{}% reset the distribution after each exercise
+ \global\let\Verteilung\Verteilung%
+ \setcounter{AufgVersion}{1}% Reset the exercise version
}
% Total amount of point * 2 in order to track half points in an integer counter
@@ -100,8 +103,8 @@
}
\newcommand{\Point}{%
-\PointSymbol
-\addtocounter{beA}{2}
+ \PointSymbol%
+ \addtocounter{beA}{2}%
}
\newcommand{\HalfpointSymbol}{%
@@ -115,8 +118,8 @@
}
\newcommand{\Halfpoint}{%
-\HalfpointSymbol
-\addtocounter{beA}{1}
+ \HalfpointSymbol%
+ \addtocounter{beA}{1}%
}
\newcommand{\AnzahlInsgesamtPunkte}{\fpeval{\value{be} / 2}}
@@ -166,17 +169,18 @@
\theoremstyle{Bearbeitung}
\newtheorem{Bearbeitung}{}
+% Hide the space to solve the exercise
\newcommand{\Lehrerversion}{\excludecomment{Bearbeitung}}
+% Set the lehrerversion toggle to false
\newcommand{\Schuelerversion}{\togglefalse{lehrerversion}}
\iftoggle{lehrerversion}{
- \Lehrerversion
-}{
-}
+ \Lehrerversion%
+}{}
% Add new paired delimiter 'abs' using mathtools
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
-
+% Add new distance notation in mathmode
\newcommand{\dist}[1]{\abs{\overline{#1}}}
% Commands to determine the remaining hsize of a line