summaryrefslogtreecommitdiffstats
path: root/preamble.tex
blob: 4a88ef726b5d0c6ae5d1f31fe7ef9198e57698ef (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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
%\DocumentMetadata{}
\documentclass[USenglish,12pt,BCOR=10mm]{scrbook}

\usepackage[defaultfeatures={%
    Ligatures={TeX,Common,Discretionary}
  },nomath]{libertinus}
\usepackage{xcolor}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{selnolig}
\usepackage{amsmath,amsthm}
\usepackage{mathtools}
\usepackage[colon=literal]{unicode-math} % TODO get rid of this since it messes up math italic correction
\usepackage{enumitem}
%\usepackage{graphicx}
\usepackage{tcolorbox}
\usepackage[style=ext-alphabetic]{biblatex}
\usepackage[intoc]{nomencl}
\usepackage{makeidx}
\usepackage{idxlayout}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage{hypdestopt}
\usepackage[capitalize,nameinlink]{cleveref}
%\usepackage{refcheck}

% ---------- fontspec
\setfontfamily\fausansoffice{FAUSansOffice}
\setmathfont[Scale=MatchLowercase]{New Computer Modern Math}
% restore traditional bb and cal glyphs
\let\mathbb\relax\DeclareMathAlphabet\mathbb{U}{msb}{m}{n}
\let\mathcal\relax\DeclareMathAlphabet\mathcal{OMS}{cmsy}{m}{n}

% ---------- xcolor
\definecolor{faunat}{RGB}{29,134,73}
\definecolor{linkcolor}{RGB}{134,29,38} % split complementary method

% ---------- koma-script
\KOMAoptions{%
  numbers=noenddot,
  toc=bib,
  toc=idx,
  %chapterprefix,
  headings=normal,
  overfullrule,
}
\addtokomafont{sectioning}{\fausansoffice\color{faunat}}
% keep layout when removing BCOR=10mm
%\areaset{426.8pt}{635.5pt}

% https://tex.stackexchange.com/questions/693750/modified-bourbaki-problem
\newcommand*{\trailingtext}[1]{%
   \unskip
   \hskip 1.5em plus 1fill
   \penalty100\null\nobreak \hskip 0pt plus 1fill
   \discretionary
   {}%
   {\vtop{%
  % shorter line (if you like)
  \leftskip 20pt
  #1\par
  % reset last line flush right
  \setbox0\lastbox
  \nointerlineskip
  \hbox to \hsize{\hfill\unhbox0\unskip\unskip}}%
    }%
   {\hbox{#1}}%
}

% ---------- csquotes
\SetBlockThreshold{0}
\SetCiteCommand{\textcite}
\renewcommand*{\mkcitation}[1]{\trailingtext{---\mkbibnamegiven{#1}}}
\renewcommand*{\mkccitation}[1]{\trailingtext{---#1}}
\renewcommand*{\mkblockquote}[4]{\small#1#2#4#3}

% ---------- selnolig
\nolig{tz}{t|z}
%\debugon

% ---------- amsmath
\numberwithin{equation}{chapter}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\dom}{dom}
% extend amsmath's proof environment
\NewDocumentEnvironment{myproof}{Ob}{\IfNoValueTF{#1}{\begin{proof}}{\begin{proof}[\proofname\ of \Cref{#1}]}}{\end{proof}}

% ---------- mathtools
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
\DeclarePairedDelimiter\parens{\lparen}{\rparen}
\DeclarePairedDelimiter\bracks{\lbrack}{\rbrack}
\DeclarePairedDelimiter\braces{\lbrace}{\rbrace}
\DeclarePairedDelimiter\angles{\langle}{\rangle}
% TODO set macro with proper spacing
\DeclarePairedDelimiter\bra{\lvert}{\rangle}
\DeclarePairedDelimiter\ket{\langle}{\rvert}
\DeclarePairedDelimiterX\innerp[2]{\langle}{\rangle}{#1,#2}
\DeclarePairedDelimiterX\LorentzBF[2]{\lparen}{\rparen}{#1,#2}

% ---------- tcolorbox
\tcbuselibrary{skins,theorems,breakable} % add breakable library?
\tcbset{%
  beforeafter skip balanced=0.4\baselineskip,
  mythmstyle/.style={%
    enhanced,
    breakable,
    sharp corners=all,
    interior hidden,
    borderline west={3pt}{0pt}{#1},
    colframe=#1!25,
    coltitle=black,
    fonttitle=\bfseries,
    toptitle=0.6ex,
    left=3pt+0.6ex,
    bottom=0.6ex,
    top=0.6ex,
    theorem style=break,
    separator sign={\ \mdseries---},
    description delimiters none,
    terminator sign none,
  }
}
\newcounter{enunciation}
\newcommand*{\newenunciation}[2]{%
  \newtcbtheorem[%
    use counter=enunciation,%
    number within=chapter,%
    Crefname={\MakeTitlecase{#1}}{\MakeTitlecase{#1s}}%
    ]{#1}{\MakeTitlecase{#1}}{mythmstyle=#2}{#1}%
}
% theorem style
\newenunciation{corollary}{faunat}
\newenunciation{lemma}{faunat}
\newenunciation{proposition}{faunat}
\newenunciation{theorem}{faunat}
% definition style
\newenunciation{definition}{gray}
\newenunciation{example}{gray}
\newenunciation{remark}{gray}

%\theoremstyle{definition}
%\newtheorem{defin}
%\renewenvironment{definition}[2]{\begin{defin}[#1]\label{#2}}{\end{defin}}

% ---------- biblatex
\addbibresource[glob]{bib/*.bib}
\ExecuteBibliographyOptions{%
  refsegment=chapter,
  sorting=none,
  defernumbers,
  giveninits,
  backref,
}
\defbibheading{chapterbib}[\refname]{%
  \hypertarget{refbm:\arabic{refsegment}}{}
  \subsection*{#1\addspace{for}\addspace\Cref*{refsegment:\therefsection\therefsegment}}
  \bookmark[level=section,italic,dest=refbm:\arabic{refsegment}]{#1}
}
\newcommand*{\chapterbib}{\printbibliography[segment=\therefsegment,heading=chapterbib]}
\DefineBibliographyStrings{english}{%
  backrefpage={ref.\ on \pno}, %TODO use \addspace ?
  backrefpages={ref.\ on \ppno}
}
\DeclareFieldFormat[article]{volume}{\textbf{#1}}
\DeclareFieldFormat[article]{title}{\textit{#1}}
%\DeclareFieldFormat{bracketswithperiod}{\mkbibbrackets{#1\addperiod}}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\renewcommand{\mkbibnamegiven}[1]{\textsc{#1}}
\renewcommand{\mkbibnameprefix}[1]{\textsc{#1}}
\renewcommand{\mkbibnamesuffix}[1]{\textsc{#1}}
\renewcommand*{\finentrypunct}{}
% https://tex.stackexchange.com/questions/574292
\renewcommand*{\subtitlepunct}{\addcolon\space}
\DeclarePunctuationPairs{colon}{*}

% ---------- nomencl
\makenomenclature
\renewcommand*{\nomname}{List of Symbols}
\def\pagedeclaration#1{, \hyperlink{page.#1}{page\nobreakspace#1}}

% ---------- makeidx
\makeindex

% ---------- hyperref
\hypersetup{%
  colorlinks,
  allcolors=linkcolor,
  linktoc=all,
  bookmarksnumbered,
  bookmarksopen,
  bookmarksopenlevel=2,
  hypertexnames=false,
  pdfpagelabels,
  pdftitle={Title},
  pdfauthor={Justin Gassner},
  pdfsubject={Subject},
  pdfkeywords={Keyword1, Keyword2},
}

% ---------- more pdf stuff
\pdfvariable minorversion 6
\pdfvariable suppressoptionalinfo \numexpr
        0
    +   1   % PTEX.FullBanner
    +   2   % PTEX.FileName
    +   4   % PTEX.PageNumber
    +   8   % PTEX.InfoDict
    +  16   % Creator
    +  32   % CreationDate
    +  64   % ModDate
    + 128   % Producer
    + 256   % Trapped
    + 512   % ID
\relax

% Make @ behave as per catcode 13 (active). The TeXbook, p. 155.
\mathcode`@="8000
{\catcode`\@=\active\gdef@{\mkern1mu}}

% ---------- misc
%\renewcommand\phi\varphi
%\renewcommand\epsilon\varepsilon
% number systems
\newcommand*{\NN}{\mathbb{N}}
\newcommand*{\ZZ}{\mathbb{Z}}
\newcommand*{\QQ}{\mathbb{Q}}
\newcommand*{\RR}{\mathbb{R}}
\newcommand*{\CC}{\mathbb{C}}

% don't use Fraktur for the real and imaginary parts
% TODO Why does this not work?
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\Imag}{\operatorname{Im}}

% emphasis for defined terms
\newcommand*{\defn}[1]{\textbf{\textit{#1}}}

\newcommand*{\ts}[1]{\textnormal{#1}} % textual subscript

% monomials
\newcommand{\Mon}{\operatorname{Mon}}

% Infinitesimal Weyl algebra
\newcommand{\WeylAlg}{\mathcal{W}}
\newcommand{\weylannihilator}{A}
\newcommand{\weylcreator}{\weylannihilator^\dagger}

% Fourier transformation
% ----------------------
\newcommand*{\ft}[1]{\hat{#1}}
\newcommand*{\FT}[1]{\mathcal{F}\parens*{#1}}
\newcommand*{\iFT}[1]{\mathcal{F}^{-1}\parens*{#1}}

% Hilbert spaces
% --------------
\newcommand*{\hilb}[1]{\mathcal{#1}}
\newcommand*{\Hilb}[1]{\mathcal{#1}}
% algebraic dircet sum
\newcommand{\AlgebraicDirectSum}[1]{\sideset{}{_{\!\ts{alg}}}\bigoplus#1}
% Hilbert space direct sum
%\newcommand{\AlgebraicDirectSum}[1]{\sideset{}{_{\!\ts{Hilb}}}\bigoplus #1}

% Test functions and distributions
% --------------
\newcommand*{\testfun}[1]{\mathcal{D}(#1)}
\newcommand*{\distrib}[1]{\mathcal{D}'(#1)}
\newcommand*{\schwartz}[1]{\mathcal{S}(#1)}
\newcommand*{\realschwartz}[1]{\mathcal{S}_{\RR}(#1)}
\newcommand*{\tempdistrib}[1]{\mathcal{S}'(#1)}

% Fock spaces
% -----------
\newcommand*{\FullFock}[1]{\mathcal{F}(#1)}
\newcommand*{\FullFockFinite}[1]{\mathcal{F}^{@0}(#1)}
\newcommand*{\BosonFock}[1]{\mathcal{F}_{\!\ts{s}}(#1)}
\newcommand*{\BosonFockFinite}[1]{\mathcal{F}^{@0}_{\!\ts{s}}(#1)}
\newcommand*{\FermionFock}[1]{\mathcal{F}_{\!\ts{s}}(#1)}
\newcommand*{\FermionFockFinite}[1]{\mathcal{F}^{@0}_{\!\ts{s}}(#1)}

% Operators
% ---------
\newcommand*{\Domain}[1]{\mathcal{D}(#1)}
\newcommand*{\Range}[1]{\mathcal{R}(#1)}
\newcommand*{\Graph}[1]{\mathcal{G}(#1)}

% Quadratic forms
% ---------
\newcommand*{\QF}[1]{QF(#1)}
\newcommand{\QFequal}{\overset{\text{\scriptsize QF}}{=}}

% Standard Subspaces
% ------------------
% real scalarproduct
\DeclarePairedDelimiterXPP\realscalarp[2]{\Re}{\langle}{\rangle}{}{#1,#2}
\DeclarePairedDelimiterXPP\symplecticp[2]{\Im}{\langle}{\rangle}{}{#1,#2}
% symplectic complement
\newcommand*{\sympcomp}{'}
% real orthogonal complement
\newcommand*{\realorthcomp}{^\bot}

% normal ordering (aka Wick ordering)
\newcommand*{\normord}[1]{{\vcentcolon\mathrel{#1}\vcentcolon}}

\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
  \left.\kern-\nulldelimiterspace % automatically resize the bar with \right
  #1 % the function
  \vphantom{\big|} % pretend it's a little taller at normal size
  \right| {#2} % this is the delimiter
  }}

\newcommand{\defequal}{\overset{\text{\scriptsize def}}{=}}