-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathutil.sty
282 lines (254 loc) · 9.69 KB
/
util.sty
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
\ProvidesPackage{util}
\newif\if@compilingfullbook
\DeclareOption{book}{\@compilingfullbooktrue}
\ProcessOptions\relax
\usepackage[UKenglish]{babel}
% \usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[utf8]{inputenc}
\if@compilingfullbook
\else
\usepackage[a4paper]{geometry} % , margin=20mm
\fi
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mathtools}
\mathtoolsset{mathic}
\RequirePackage{unicode-math}
% for unicode-math symbols, see https://texdoc.org/serve/unimath-symbols.pdf/0
% required for the \faktor command, normally amssymb would declare this but we're using unicode-math
\newcommand{\diagup}{\char"27CB}
% https://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.html
\setmainfont[Path=../../fonts/,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic,
]{STIXTwoText}
\setmathfont[Path=../../fonts/]{STIXTwoMath-Regular}
\setmathfont[Path=../../fonts/,range=\star]{TeXGyrePagellaMath}
\usepackage{wrapfig}
\usepackage{physics}
\DeclareDocumentCommand\mathbf{m}{\symbfup{#1}} % make bold work for greek symbols
\newcommand{\bm}[1]{\symbfup{#1}}
\DeclareDocumentCommand\vnabla{}{\nabla} % use non-bold nabla for \grad, \curl etc.
% Enabled to unify laplacian symbol between vector and scalar forms
\DeclareDocumentCommand\dotproduct{}{\cdot} % use non-bold dot for scalar product to unify notation
\DeclareDocumentCommand\crossproduct{}{\times} % use non-bold dot for scalar product to unify notation
\usepackage{gensymb}
\usepackage[shortlabels]{enumitem}
\setlist[enumerate,1]{label={(\roman*)}}
\setlist[enumerate,2]{label={(\alph*)}}
\usepackage{relsize}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{array}
\usepackage{multirow}
\usepackage[parfill]{parskip}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\usepgfplotslibrary{external}
\usepackage{etoolbox}
\usepackage{tikz-cd}
\usepackage{qcircuit}
\usetikzlibrary{external}
\usetikzlibrary{cd}
% when building the books, start a new page before each section
\if@compilingfullbook
\AddToHook{cmd/section/before}{\clearpage}
\fi
% currently testing re-enabling this.
% % for some reason, externalising when compiling the books takes forever, it's probably just too big a project
% % todo: re-enable this when the book has been separated into parts IA and IB
% \if@compilingfullbook
% \else
% \tikzexternalize[prefix=tikz/]
% \AtBeginEnvironment{tikzcd}{\tikzexternaldisable}
% \AtEndEnvironment{tikzcd}{\tikzexternalenable}
% \fi
\usepackage{../../tex_vendor/quiver}
\usepackage{../../tex_vendor/tikzit}
\input{../../tex_vendor/style.tikzstyles}
\usepackage{faktor} % TODO: convert group quotients to this style
\usepackage{mathpartir}
\usepackage{scalerel}
\usepackage{microtype}
\usepackage[breakable]{tcolorbox}
\if@compilingfullbook
% always echo the tex string instead of the PDF string when compiling book
\newcommand{\texorpdfstring}[2]{#1}
\else
\usepackage[pdfa]{hyperref}
\hypersetup{
colorlinks=true,
linktoc=all,
linkcolor=green!40!black,
}
\fi
\numberwithin{equation}{section} % make equations be numbered 1.1 not 1
\newcommand{\tableofcontentsnewpage}{\tableofcontents\newpage}
% increase spacing between toc number and title
\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{1.8em}{3.2em}}
\makeatother
% create the theorem environments
\theoremstyle{definition}
\newtheorem*{definition}{Definition}
\newtheorem*{claim}{Claim}
\newtheorem*{theorem}{Theorem}
\newtheorem*{proposition}{Proposition}
\newtheorem*{lemma}{Lemma}
\newtheorem*{corollary}{Corollary}
\newtheorem*{example}{Example} % todo: convert `as an example...' to the example environment
\theoremstyle{remark}
\newtheorem*{note}{Note}
\newtheorem*{remark}{Remark}
\definecolor{lemma_col}{RGB}{170, 217, 255}
\definecolor{thm_col}{RGB}{255, 196, 215}
\definecolor{def_col}{RGB}{120, 232, 190}
\ifdefined\nocolourboxes
\else
% we don't have `frame hidden` since we can't use `skins` from tcolorbox without compile errors
\tcolorboxenvironment{definition}{colback=def_col!30,colframe=white,breakable,arc=0mm}
\tcolorboxenvironment{claim}{colback=lemma_col!30,colframe=white,breakable,arc=0mm}
\tcolorboxenvironment{proposition}{colback=lemma_col!30,colframe=white,breakable,arc=0mm}
\tcolorboxenvironment{lemma}{colback=lemma_col!30,colframe=white,breakable,arc=0mm}
\tcolorboxenvironment{corollary}{colback=lemma_col!30,colframe=white,breakable,arc=0mm}
%\tcolorboxenvironment{example}{colback=green!10,colframe=white,breakable,arc=0mm}
\tcolorboxenvironment{theorem}{colback=thm_col!30,colframe=white,breakable,arc=0mm}
\fi
\newcommand{\ddempty}{\mathrm{d}}
\newcommand{\dn}[2]{\mathrm{d}^#1#2}
\newcommand{\st}{\text{ s.t.
}}
\newcommand{\contradiction}{\(\#\)}
\newcommand{\genset}[1]{\left\langle{} #1 \right\rangle}
\newcommand{\ngenset}[1]{\left\langle\!\left\langle{} #1 \right\rangle\!\right\rangle}
\newcommand{\midd}{\,\middle|\,}
\renewcommand{\vu}[1]{\hat{\vb{#1}}}
\newcommand{\nhat}{\vu{n}}
\newcommand{\rdot}{\dot{\vb{r}}}
\newcommand{\rddot}{\ddot{\vb{r}}}
\newcommand{\transpose}{\intercal}
\newcommand{\acts}{\curvearrowright}
\newcommand{\adjugate}[1]{\widetilde{#1}}
\newcommand{\mathhuge}[1]{\mathlarger{\mathlarger{\mathlarger{#1}}}}
\newcommand{\stcomp}[1]{{#1}^c}
\newcommand{\prob}[1]{\mathbb{P}\left({#1}\right)}
\newcommand{\psub}[2]{\mathbb{P}_{#1}\left({#2}\right)}
\newcommand{\psubx}[1]{\psub{x}{#1}}
\newcommand{\expect}[1]{\mathbb{E}\left[{#1}\right]}
\newcommand{\esub}[2]{\mathbb{E}_{#1}\left[{#2}\right]}
\newcommand{\esubx}[1]{\esub{x}{#1}}
\newcommand{\Var}[1]{\Varop\left({#1}\right)}
\newcommand{\Varsub}[2]{\Varop_{#1}\left({#2}\right)}
\newcommand{\Cov}[1]{\Covop\left({#1}\right)}
\newcommand{\Corr}[1]{\Corrop\left({#1}\right)}
\newcommand{\convdist}{\xrightarrow{d}}
\newcommand{\convprob}{\xrightarrow{\mathbb{P}}}
\newcommand{\wildcard}{{}\cdot{}}
\newcommand{\inner}[1]{\left\langle{#1}\right\rangle}
\newcommand{\Markov}[1]{\Markovop\left({#1}\right)}
\newcommand{\sstar}{{\star\star}}
\newcommand{\Mob}{\text{M\"ob}}
\newcommand{\Chat}{\widehat{\mathbb C}}
\newcommand{\bound}{\ooalign{\hidewidth$\partial$\hidewidth\cr/}}
\newcommand{\hhat}[1]{\hat{\hat{#1}}}
\newcommand{\symmdiff}{\mathrel{\raisebox{1pt}{\( \mathsmaller\triangle \)}}}
\newcommand{\cop}{\mathrm{op}}
\DeclareMathOperator{\vecspan}{span}
\DeclareMathOperator{\HCF}{HCF}
\DeclareMathOperator{\LCM}{LCM}
\DeclareMathOperator{\ord}{ord}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\nullity}{null}
\DeclareMathOperator{\Orb}{Orb}
\DeclareMathOperator{\Stab}{Stab}
\DeclareMathOperator{\ccl}{ccl}
\DeclareMathOperator{\Varop}{Var}
\DeclareMathOperator{\Covop}{Cov}
\DeclareMathOperator{\Corrop}{Corr}
\DeclareMathOperator{\Markovop}{Markov}
\DeclareMathOperator{\adj}{adj}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\diam}{diam}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\Log}{Log}
\DeclareMathOperator{\Iff}{\mathrm{I}}
\DeclareMathOperator{\IIff}{\mathrm{I\!I}}
\DeclareMathOperator{\artanh}{artanh}
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\graft}{graft}
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\Instr}{Instr}
\DeclareMathOperator*{\esssup}{ess\ sup}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\fchar}{char}
\DeclareMathOperator{\code}{code}
\DeclareMathOperator{\im}{im}
\DeclareMathOperator{\coker}{coker}
\DeclareMathOperator{\coim}{coim}
\DeclareMathOperator{\End}{End}
\DeclareMathOperator{\ob}{ob}
\DeclareMathOperator{\mor}{mor}
\DeclareMathOperator{\cod}{cod}
\DeclareMathOperator{\Spec}{Spec}
\DeclareMathOperator{\mSpec}{mSpec}
\DeclareMathOperator{\Proj}{Proj}
\DeclareMathOperator{\res}{res}
\DeclareMathOperator{\Con}{Con}
\DeclareMathOperator{\cf}{cf}
\DeclareMathOperator{\ran}{ran}
\DeclareMathOperator{\Fn}{Fn}
% https://github.com/wspr/unicode-math/issues/457
\AtBeginDocument{%
\newcommand{\dashrightarrow}{\mathrel{\rightdasharrow}}
% Redefine a few things that the physics package does, but at the wrong time.
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\let\divergence\relax
\DeclareDocumentCommand\divergence{ g o d() }{ % Divergence
\IfNoValueTF{#1}{
\IfNoValueTF{#2}{
\IfNoValueTF{#3}{\vnabla \vdot}{\vnabla \vdot \quantity(#3)}
}
{\vnabla \vdot \quantity[#2] \IfNoValueTF{#3}{}{(#3)}}
}
{\vnabla \vdot #1 \IfNoValueTF{#2}{}{[#2]} \IfNoValueTF{#3}{}{(#3)}}
}
\let\divisionsymbol\div % Rename \div [division symbol] in order to free up control sequence for \divergence
\let\div\relax
\DeclareDocumentCommand\div{}{\divergence} % Shorthand for \divergence
}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\DeclarePairedDelimiter\Brackets{\lBrack}{\rBrack}
% for arrows in the middle of the line
\usetikzlibrary{decorations.markings}
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
\usetikzlibrary{automata}
\usetikzlibrary{positioning}
\ifdefined\hideproofs
\usepackage{environ}
\usepackage{calc}
\usepackage{pgf}
\newlength{\parline}
\newlength{\paroutindent}
\newlength{\lineheight}
\setlength{\lineheight}{\heightof{abcdefghijklmnoprstuvwxyz}}
\NewEnviron{killproof}{%
\setlength{\paroutindent}{\expandafter\parindent}%
\setlength{\parline}{\heightof{\noindent\begin{minipage}{\linewidth}%
\setlength{\parindent}{\paroutindent}%
\BODY%
\end{minipage}}}%
\pgfmathparse{int(round(\parline / (0.9*\lineheight)))}%
\textit{Proof hidden (approx.\ \pgfmathresult{} lines).\\}
}
\let\proof\killproof
\let\endproof\endkillproof
\fi