about summary refs log tree commit diff stats
path: root/latex/headers/preamble.tex
blob: 9620808cebbbeb57e8d6aff4316d77f9be2a4351 (plain) (blame)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
% This preamble assumes pdflatex
% derived from:
% https://github.com/gillescastel/lecture-notes/blob/929672a96abc27eaeb6fa58b1d277b3582d28532/group-theory/preamble.tex
% encodings
\usepackage[utf8]{inputenc} % use utf8 encoding
\usepackage[T1]{fontenc} % for 8bit font support
\usepackage{lmodern} % latin modern fonts, should be better than ae, aecompl
% \usepackage{ae,aecompl} % full T1 font support
% \usepackage{textcomp} % support for yen and so on, not needed since latex2e(2020)

% references
\usepackage[ngerman]{babel} % For German language support, with reformed orthography!
\usepackage{csquotes} % required by biblatex
% \usepackage{biber} % required by biblatex
\usepackage[backend=biber,
        style=numeric,
        autocite=superscript
    ]{biblatex} % For bibtex references
\addbibresource{resources/reference}
% \bibliography{res/reference} % Set the location of the references

% dates, time
\usepackage[de-DE, showdow]{datetime2} % make handling dates easier

% index
% \usepackage{index} % Helps to create an index TODO compare with other such packages
% \makeindex

% math
\usepackage{amsmath}  % extensive math commands
\usepackage{amsfonts} % more fonts for math (fracture, boldfaced and so on)
\usepackage{mathtools} % extension to amsmath, with more sensible defaults (eq numbers only when referenced)
\usepackage{amssymb} % more symbols, mostly redundant because already loaded by something else
\usepackage{mathrsfs} % support for the RSFS fonts (through \mathscr command)
\usepackage{cancel} % allows to cancel a part in math mode, for example to shorten a term
\usepackage{bm} % bold mode in math, but better than \boldsymbol command from ams. \bm
\usepackage[locale = DE]{siunitx} % For easy unit representation
\sisetup{per-mode = fraction}
\usepackage[version=4]{mhchem} % for \ce command



% graphics and floats
\usepackage{float} % makes dealing with floats easier
\usepackage{graphicx} % allows for easy inclusion of graphics
\usepackage[shortlabels]{enumitem} % makes enumerate, itemize and description better
\usepackage{wrapfig} % Wraps text around figures with the \wrapfigure environment
\usepackage[dvipsnames]{xcolor} % colors and color mixing \color{red!30!green!40!blue}
\usepackage{pgfplots} % plots, 2D and 3D
\pgfplotsset{compat=1.18} % use version 1.13
\usepackage{tikz} % Nice drawn graphics, for library see: https://tex.stackexchange.com/a/42664
% \usetikzlibrary{intersections, angles, quotes, calc, positioning}
% \usetikzlibrary{arrows.meta} %TODO maybe deprecated?
% \usepackage{tikz-cd} % better commutative diagrams
% \usepackage{subcaption} % like caption package, but for subfigures
% \usepackage{booktabs} % better tables


% visuals
\usepackage{fancyhdr}  % Text layout and margins, headers so on
\usepackage{microtype} % makes text better to read
\usepackage{multicol} % allows for multi-columns everywhere, with the "multicols" environment
\usepackage{emptypage} % no page numbers and headings on empty pages
% \usepackage[a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry} % For nice margins
% \usepackage{xspace} % Adds a space when it thinks it is necessary
% \usepackage{blindtext} % blindtext

% tikz style config
\tikzset{help_lines/.style={step=.5cm,gray!50,very thin}}

% notes
\usepackage{todonotes}

% links
% \usepackage[hidelinks]{hyperref} % Links in the pdf
\usepackage[pdflang=de-DE]{hyperref}
\hypersetup{
        colorlinks,
        linkcolor={black},
        citecolor={black},
        urlcolor={blue!80!black}
    }


% \usepackage{stmaryrd} % for \lightning
% \newcommand\contra{\scalebox{1.1}{$\lightning$}}

% number sets
\newcommand\N{\ensuremath{\mathbb{N}}}
\newcommand\R{\ensuremath{\mathbb{R}}}
\newcommand\Z{\ensuremath{\mathbb{Z}}}
\newcommand\Q{\ensuremath{\mathbb{Q}}}
\newcommand\C{\ensuremath{\mathbb{C}}}
\renewcommand\O{\ensuremath{\emptyset}} % replaces the Ø

% readable limits
\let\svlim\lim{}
\renewcommand\lim{\svlim\limits}

% aliases
\let\implies\Rightarrow{}
\let\impliedby\Leftarrow{}
\let\iff\Leftrightarrow{}

\renewcommand\epsilon{\varepsilon} % I like the textual epsilon more
% \renewcommand\phi{\varphi}

% horizontal rule
\newcommand\hr{
        \par\noindent\rule[0.5ex]{\linewidth}{0.5pt}
    }

% copyright:
\makeatletter
\DeclareRobustCommand\authors[1]{\gdef\@authors{#1}}
\DeclareRobustCommand\years[1]{\gdef\@years{#1}}
\makeatother

% theorems
% packages:
\usepackage[framemethod=TikZ]{mdframed}
\mdfsetup{skipabove=1em,skipbelow=0em, innertopmargin=5pt, innerbottommargin=6pt}
\usepackage{amsthm}  % math commands for theorems
\usepackage{thmtools} % improved theorems
\usepackage{environ} % for hiding of the solution env

% styles:
% \renewcommand\qedsymbol{\ensuremath{\text{\textit{O.}}~\epsilon.~\delta.}}
\renewcommand\qedsymbol{\dots}
\theoremstyle{definition}
\declaretheoremstyle[
        headfont=\bfseries\sffamily\color{NavyBlue!80},
        bodyfont=\normalfont,
        headpunct={:\\},
        qed=\qedsymbol,
        mdframed={
                linewidth=2pt,
                rightline=false, topline=false, bottomline=false,
                linecolor=NavyBlue, backgroundcolor=NavyBlue!5,
            },
    ]{thmexample}
\declaretheoremstyle[
        headfont=\bfseries\sffamily\color{RawSienna!80},
        bodyfont=\normalfont,
        headpunct={:\\},
        qed=\qedsymbol,
        mdframed={
                linewidth=2pt,
                rightline=false, topline=false, bottomline=false,
                linecolor=RawSienna, backgroundcolor=RawSienna!5,
            },
    ]{thmexercise}
\declaretheoremstyle[
        headfont=\bfseries\sffamily\color{Violet!80},
        bodyfont=\normalfont,
        headpunct={:\\},
        notebraces={f\"ur }{},
        qed=\qedsymbol,
        mdframed={
                linewidth=2pt,
                rightline=false, topline=false, bottomline=false,
                linecolor=Violet, backgroundcolor=Violet!5,
            },
    ]{thmsolution}
\declaretheoremstyle[
        headfont=\bfseries\sffamily\color{ForestGreen!80},
        bodyfont=\normalfont,
        headpunct={:\\},
        qed=\qedsymbol,
        mdframed={
                linewidth=2pt,
                rightline=false, topline=false, bottomline=false,
                linecolor=ForestGreen, backgroundcolor=ForestGreen!5,
            },
    ]{thmdef}
\declaretheoremstyle[
        headfont=\bfseries\sffamily\color{RawSienna!70!black},
        bodyfont=\normalfont,
        headpunct={:\\},
        qed=\qedsymbol,
        mdframed={
                linewidth=2pt,
                leftline=false, rightline=true, topline=false, bottomline=false,
                linecolor=RawSienna, backgroundcolor=Red!5,
            }
    ]{thmtheorem}

\declaretheorem[numbered=yes, style=thmdef, name=Definition]{definition}
\declaretheorem[numbered=no, style=thmexample,name=Beispiel]{eg}
\declaretheorem[numbered=no, style=thmexercise, name=Aufgabe]{ex}
\declaretheorem[numbered=yes, style=thmtheorem, name=Satz]{theorem}
% \declaretheorem[style=thmredbox, name=Proposition]{prop}
% \declaretheorem[style=thmredbox, name=Lemma]{lemma}
% \declaretheorem[style=thmredbox, numbered=no, name=Corollary]{corollary}

% Solutions
\makeatletter
\@ifclasswith{report}{nosolutions}
    {%
        \NewEnviron{solution}[1][]{Eine L\"osung mit dem Name ("L\"osung für #1") wurde versteckt.\ \\ \par}
        \newcommand\hdsolution[1]{L\"osung versteckt}
    }{%
        \declaretheorem[numbered=no, style=thmsolution, name=L\"osung]{replacementSolution}

        \NewEnviron{solution}[1][]{
            \vspace{-1em}
            \begin{replacementSolution}[#1]
            \
            \BODY
            \end{replacementSolution}
        }
        \newcommand\hdsolution[1]{#1}
    }
\makeatother

\DTMnewdatestyle{margindate}{
        \renewcommand*\DTMdisplaydate[4]{
                \MakeLowercase{\DTMgermanshortweekdayname{##4}}\space
                \number##3\relax\space
                \MakeLowercase{\DTMgermanshortmonthname{##2}}\space
                \DTMtwodigits{\DTMtwodigits{##1}}
            }
        \renewcommand*\DTMDisplaydate[4]{
                \DTMgermanshortweekdayname{##4}\space
                ##3\space
                \DTMgermanshortmonthname{##2}\space
                \DTMtwodigits{\DTMtwodigits{##1}}
            }
    }

\newcommand*\margindate[1]{
        \DTMsetdatestyle{margindate}
        \marginpar{
                \small\textsf{\mbox{\DTMDate{#1}}}
            }\relax
    }

\def\@lesson{}%
\newcommand{\lesson}[3]{
        \if\relax\detokenize{#3}\relax
            \def\@lesson{Unterricht: #1}%
        \else
            % \def\@lesson{Unterricht #1: #3}%
            \def\@lesson{#1: #3}%
        \fi
        \subsection*{\@lesson}
        \margindate{#2}
    }

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE, RO]{}
\fancyhead[RO, LE]{\@lesson}
\fancyhead[RE, LO]{}
\fancyfoot[LE, RO]{\thepage}
\fancyfoot[C]{\leftmark}


% Parameters
% \renewcommand{\sfdefault}{ptm}
% \pagenumbering{arabic}
% \setcounter{page}{2}
% \renewcommand{\thesection}{\Roman{section}}
% \renewcommand{\thesubsection}{\thesection.\Roman{subsection}}
%

%% Footers and Headers
%\pagestyle{fancy}
%\fancyhf{}
%\renewcommand{\headrulewidth}{2pt}
%\renewcommand{\footrulewidth}{1pt}
%\renewcommand{\baselinestretch}{1.5}
%\fancyhead[L]{{\textbf{\titleset}}}
%\fancyhead[R]{\textbf{\course}}
%\fancyfoot[L]{\thepage}