From 7267b4f9a08ef49e4608cc24431dfa64db4e2814 Mon Sep 17 00:00:00 2001
From: Justin Gassner <justin.gassner@mailbox.org>
Date: Fri, 17 Nov 2023 02:04:25 +0100
Subject: weiter

---
 preamble.tex | 156 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 121 insertions(+), 35 deletions(-)

(limited to 'preamble.tex')

diff --git a/preamble.tex b/preamble.tex
index 9f72468..95aff6c 100644
--- a/preamble.tex
+++ b/preamble.tex
@@ -1,5 +1,5 @@
-%! TeX program = lualatex
-\documentclass[UKenglish,12pt,BCOR=10mm]{scrartcl}
+%\DocumentMetadata{}
+\documentclass[USenglish,12pt,BCOR=10mm]{scrbook}
 
 \usepackage[defaultfeatures={%
     Ligatures={TeX,Common,Discretionary}
@@ -12,6 +12,7 @@
 \usepackage{mathtools}
 \usepackage[colon=literal]{unicode-math}
 \usepackage{enumitem}
+%\usepackage{graphicx}
 \usepackage{tcolorbox}
 \usepackage[style=ext-numeric]{biblatex}
 \usepackage[intoc]{nomencl}
@@ -20,7 +21,7 @@
 \usepackage{hyperref}
 \usepackage{bookmark}
 \usepackage{hypdestopt}
-\usepackage[capitalise]{cleveref}
+\usepackage[capitalize,nameinlink]{cleveref}
 %\usepackage{refcheck}
 
 % ---------- fontspec
@@ -37,18 +38,47 @@
 % ---------- koma-script
 \KOMAoptions{%
   numbers=noenddot,
-  index=totoc
+  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}}
+
 % ---------- selnolig
 \nolig{tz}{t|z}
 %\debugon
 
 % ---------- amsmath
-\numberwithin{equation}{section}
+\numberwithin{equation}{chapter}
 \DeclareMathOperator{\supp}{supp}
 \DeclareMathOperator{\dom}{dom}
 % extend amsmath's proof environment
@@ -61,9 +91,11 @@
 \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} % add breakable library?
@@ -87,52 +119,58 @@
     terminator sign none,
   }
 }
-\newcounter{mythmcounter}
-\counterwithin{mythmcounter}{section}
-\newcommand{\mynewthm}[2]{%
+\newcounter{enunciation}
+\newcommand*{\newenunciation}[2]{%
   \newtcbtheorem[%
-    use counter*=mythmcounter,
-    Crefname={\MakeTitlecase{#1}}{\MakeTitlecase{#1s}}
-    ]{#1}{\MakeTitlecase{#1}}{mythmstyle=#2}{#1}
+    use counter=enunciation,%
+    number within=chapter,%
+    Crefname={\MakeTitlecase{#1}}{\MakeTitlecase{#1s}}%
+    ]{#1}{\MakeTitlecase{#1}}{mythmstyle=#2}{#1}%
 }
-\mynewthm{definition}{gray}
-\mynewthm{example}{gray}
-\mynewthm{remark}{gray}
-\mynewthm{theorem}{faunat}
-\mynewthm{lemma}{faunat}
-\mynewthm{proposition}{faunat}
-\mynewthm{corollary}{faunat}
+% 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}
 
 % ---------- biblatex
 \addbibresource[glob]{bib/*.bib}
 \ExecuteBibliographyOptions{%
-  refsegment=section,
+  refsegment=chapter,
   sorting=none,
   defernumbers,
   giveninits,
   backref,
 }
-\defbibheading{subbibliography}{%
-  \bookmarksetupnext{level=subsection,italic}
-  \pdfbookmark{\refname}{refbm:\arabic{refsegment}}
-  \subsection*{\refname\ for \Cref*{refsegment:\therefsection\therefsegment}}
+\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 p.},
-  backrefpages={ref.\ on pp.}
+  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
@@ -147,6 +185,7 @@
   bookmarksopen,
   bookmarksopenlevel=2,
   hypertexnames=false,
+  pdfpagelabels,
   pdftitle={Title},
   pdfauthor={Justin Gassner},
   pdfsubject={Subject},
@@ -169,22 +208,69 @@
     + 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}}
+\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}}
+
 % emphasis for defined terms
 \newcommand{\defn}[1]{\textbf{\textit{#1}}}
-% Hilbert spaces
-\newcommand{\hilb}[1]{\mathcal{#1}}
+
+\newcommand{\ts}[1]{\textnormal{#1}} % textual subscript
+
 % Fourier transformation
-\newcommand{\ft}[1]{\hat{#1}}
-\newcommand{\FT}[1]{\mathcal{F}\parens*{#1}}
-\newcommand{\iFT}[1]{\mathcal{F}^{-1}\parens*{#1}}
+% ----------------------
+\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}
+
+% 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)}
+
+% 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}}
-- 
cgit v1.2.3-70-g09d2

