aboutsummaryrefslogtreecommitdiff
path: root/latex/common.tex
blob: d4817e095f4e563b43bb9b1e2abfc45d645a21a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
\newcommand{\Signatur}{fis}
\newcommand{\Schule}{Gymnasium Münchberg}
\newcommand{\LogoSchule}{images/logos/gymMuenchberg.png}

\newtcolorbox{wiederholung}[1]{colback=orange!5!white,colframe=orange!75!black,fonttitle=\bfseries,title=Wiederholung: #1}

\newcommand\kariert[2][0.5cm]{% 
   \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} 
}

\newcommand{\liniert}[2][0.5cm]{% 
  \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}
}

\newcommand{\iflehrer}[2]{\iftoggle{lehrerversion}{#1}{#2}}

\newcommand{\solution}[1]{\iftoggle{lehrerversion}{#1}{\textcolor{white}{#1}}}
\newcommand{\psolution}[1]{\iftoggle{lehrerversion}{#1}{\phantom{#1}}}

\newcommand{\gap}[1]{\underLine{\solution{#1}}}

% Point distribution across subtasks
\newcommand{\Verteilung}{}

\newcounter{Aufg}
\newenvironment{Aufg}[1][]{
\refstepcounter{Aufg}%
\noindent\textbf{Aufgabe \theAufg\ifstrempty{#1}{}{\ #1}:%
\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%
}

% 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}

\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
\addtocounter{beA}{\fpeval{#1*2}}}

\newcommand{\AnzahlInsgesamtPunkte}{\fpeval{\value{be} / 2}}

% 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{-0.5\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 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
{0pt}% measure of space to leave above the theorem. E.g.: 3pt
{25pt}% 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
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}}

\theoremstyle{Bearbeitung}
\newtheorem{Bearbeitung}{}

\newcommand{\Lehrerversion}{\excludecomment{Bearbeitung}}
\newcommand{\Schuelerversion}{\togglefalse{lehrerversion}}

\iftoggle{lehrerversion}{
  \Lehrerversion
}{
}

% Add new paired delimiter 'abs' using mathtools
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%

\newcommand{\dist}[1]{\abs{\overline{#1}}}