-
Notifications
You must be signed in to change notification settings - Fork 1
/
preamble_common.tex
executable file
·135 lines (120 loc) · 4.72 KB
/
preamble_common.tex
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
% Add document information
\date{\today}
\author{Moritz Wachsmuth-Melm}
% Fix too many alphabets error
\newcommand\hmmax{0}
\newcommand\bmmax{0}
%====================================================%
%================== Basic packages ==================%
% Packages that just should be there in any preamble %
%====================================================%
\RequirePackage[T1]{fontenc}
% \RequirePackage[utf8]{inputenc}
\RequirePackage[full]{textcomp} % required for older texlive distributions when using kpfonts
\RequirePackage[ngerman,english]{babel}
% \RequirePackage[outputdir=output]{minted} % Code syntax highlighting, has to be loaded before csquotes
\RequirePackage[final,nopatch=footnote]{microtype} % Better font spacing and stuff. Final option provides that it is not disabled in draft mode
\RequirePackage[autostyle]{csquotes} % Better quoting, but mainly here because it is recommended for babel and biblatex
\RequirePackage{graphicx}
%=========%
% SIUnitx %
% =========%
\RequirePackage[
per-mode=reciprocal-positive-first, % Format of units (fraction or reciprocal)
locale=US, % Set locale
range-units=single, % Don't repeat units in number ranges
list-units=single, % Don't repeat units in number lists
detect-all, % Apply same font settings to the number/unit as the surrounding text
forbid-literal-units=true, % Only allow predefined units to enforce consistency
use-xspace=true, % Correct space after unit
]{siunitx} % Nice SI units, but also for number formatting/alignment in tables (with s and S column specifier)
% Declare custom units (mainly chemistry and biology related)
\DeclareSIUnit{\basepair}{bp} % Basepairs
\DeclareSIUnit{\base}{b} % Bases
\DeclareSIUnit{\molar}{\textsc{m}} % Molarity (mol/l)
\DeclareSIUnit{\mmolar}{\milli\molar} % Short form
\DeclareSIUnit{\umolar}{\micro\molar} % Short form
\DeclareSIUnit{\enzymeunit}{U} % Enzyme activity units
\DeclareSIUnit{\electron}{e\textsuperscript{-}} % Electrons
\DeclareSIUnit{\xg}{xg} % Centrifugal force (g)
\DeclareSIUnit{\rpm}{rpm} % Rounds per minute (centrifugation)
\DeclareSIUnit{\hpi}{hpi} % Hours past infection (virology)
\DeclareSIUnit{\PFU}{\textsc{PFU}} % Plaque forming units (virology)
\DeclareSIUnit{\Da}{Da} % Plaque forming units (virology)
\DeclareSIUnit{\kDa}{kDa} % Plaque forming units (virology)
\DeclareSIUnit[number-unit-product = {}]{\percent}{\%} % Remove space before percent sign
%===========%
% Chemistry %
%===========%
\RequirePackage{chemformula} % Stuff like \ch{MgCl2}
%=============%
% Table stuff %
%=============%
\RequirePackage{booktabs} % \toprule, \midrule, \bottomrule, nicer tables (must have!)
\RequirePackage{multirow} % \multicolumn{num_of_columns}{X}{Content} and \multirow{num_of_rows}{X}{Content}
%=========================%
% Floats, figures, images %
%=========================%
\RequirePackage[
inkscapearea=page,
inkscapeformat=png,
inkscapedpi=600,
% inkscapelatex=false
]{svg}
\RequirePackage{tikz} % Figures you can draw on (text, lines, braces, stuff)
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\tikzset{
tight/.style={inner sep=0, outer sep=0},
tile/.style={tight,draw=none,fill=none,align=center}}
%===============%
% Miscellaneous %
%===============%
% Print text width and height in draft mode
\makeatletter
\def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1}
\makeatother
\RequirePackage{ifdraft}
\ifdraft{
\AtEndDocument{\noindent
text width: \the\textwidth : \convertto{mm}{\textwidth} mm\\
text height: \the\textheight : \convertto{mm}{\textheight} mm
}
}
%=============%
% Tikz things %
%=============%
\newcommand{\helplines}{\draw[help lines] (0, 0) grid[xstep=0.1, ystep=0.1] (1, 1)}
% \scalebar{node}{length}{text}
% Length can be either an actual length (e.g. .5\textwidth)
% or a fraction of the node's width (e.g. 0.1).
% In the latter case, the node's inner and outer sep must be 0, otherwise the scalebar is wrong!
\newlength{\scalebarwidth}
\setlength{\scalebarwidth}{1ex}
\newcommand{\scalebar}[3]{
\begin{tikzonnode}{#1}
\draw[line width=\scalebarwidth,draw=white]
($(1, 0) + (-.25\scalebarwidth, 0.75\scalebarwidth)$) -- +(-#2, 0)
node[midway, font=\tiny\bfseries, text=black] {#3};
\end{tikzonnode}
}
% Drawing on figures
\newenvironment{tikzonnode}[1]{%
\begin{scope}[shift={(#1.south west)},x={(#1.south east)},y={(#1.north west)}]%
}{%
\end{scope}%
}
\newenvironment{tikzongraphics}[2][width=\textwidth]{
\begin{tikzpicture}
\node[align=center, anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[#1]{#2}};
\begin{tikzonnode}{image}
}{
\end{tikzonnode}
\end{tikzpicture}
}
\newcommand{\tikzoverlay}[1]{
\tikz[overlay,remember picture] {
#1
}
}
\endinput