-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathatlas-preamble.sty
666 lines (569 loc) · 23.3 KB
/
atlas-preamble.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
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
\def\atlaspreamble@name{atlas-preamble}
\def\atlaspreamble@version{2.2.0}
\def\atlaspreamble@date{2022/06/12}
\def\atlaspreamble@msg{Niklas Bogensperger's custom preamble}
\def\atlaspreamble@url{https://github.com/niklasbogensperger/atlas-preamble}
\def\atlaspreamble@releaseinfo{\atlaspreamble@date \space v\atlaspreamble@version \space \atlaspreamble@msg \space \atlaspreamble@url}
\def\atlaspreamble@Error#1#2{\PackageError{\atlaspreamble@name}{#1}{#2}}
\def\atlaspreamble@Warning#1{\PackageWarning{\atlaspreamble@name}{#1}}
\def\atlaspreamble@Info#1{\PackageInfo{\atlaspreamble@name}{#1}}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{\atlaspreamble@name}[\atlaspreamble@releaseinfo]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Pre-options section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% if-switches for options
\newif\if@captionsfootnotes
\newif\if@code
\newif\if@columns
\newif\if@computerscience
\newif\if@encoding
\newif\if@graphics
\newif\if@headings
\newif\if@lists
\newif\if@math
\newif\if@physics
\newif\if@probabilitytheory
\newif\if@references
\newif\if@spacings
\newif\if@tables
\newif\if@theorems
\newif\if@toc
\newif\if@typesetting
% if-switches for other uses
\newif\if@classuseschapter
\@ifclassloaded{book}{\@classuseschaptertrue}{}
\@ifclassloaded{report}{\@classuseschaptertrue}{}
\@ifclassloaded{memoir}{\@classuseschaptertrue}{}
\newif\if@languagegerman
\iflanguage{ngerman}{\@languagegermantrue}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Options section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% options
\DeclareOption{captionsfootnotes}{\@captionsfootnotestrue}
\DeclareOption{code}{\@codetrue}
\DeclareOption{columns}{\@columnstrue}
\DeclareOption{computerscience}{\@computersciencetrue}
\DeclareOption{encoding}{\@encodingtrue}
\DeclareOption{graphics}{\@graphicstrue}
\DeclareOption{headings}{\@headingstrue}
\DeclareOption{lists}{\@liststrue}
\DeclareOption{math}{\@mathtrue}
\DeclareOption{physics}{\@physicstrue}
\DeclareOption{probabilitytheory}{\@probabilitytheorytrue}
\DeclareOption{references}{\@referencestrue}
\DeclareOption{spacings}{\@spacingstrue}
\DeclareOption{tables}{\@tablestrue}
\DeclareOption{theorems}{\@theoremstrue}
\DeclareOption{toc}{\@toctrue}
\DeclareOption{typesetting}{\@typesettingtrue}
% common option combinations
\newcommand{\baseoptions}{\@encodingtrue \@graphicstrue \@mathtrue \@tablestrue}
\newcommand{\extraoptions}{\@columnstrue \@liststrue \@spacingstrue \@typesettingtrue}
% base options
\DeclareOption{base}{%
\baseoptions
}
% extra options
\DeclareOption{extra}{%
\baseoptions
\extraoptions
}
% experiment options
\DeclareOption{experiment}{%
\baseoptions
\extraoptions
\@captionsfootnotestrue
\@physicstrue
\@referencestrue
}
% script options
\DeclareOption{script}{%
\baseoptions
\extraoptions
\@captionsfootnotestrue
\@headingstrue
\@physicstrue
\@referencestrue
\@theoremstrue
}
% compsci options
\DeclareOption{compsci}{%
\baseoptions
\extraoptions
\@computersciencetrue
\@physicstrue
}
% probability options
\DeclareOption{probability}{%
\baseoptions
\extraoptions
\@probabilitytheorytrue
}
% complete options
\DeclareOption{complete}{%
\baseoptions
\extraoptions
\@captionsfootnotestrue
\@computersciencetrue
\@headingstrue
\@physicstrue
\@probabilitytheorytrue
\@referencestrue
\@theoremstrue
}
% all options
\DeclareOption{all}{%
\baseoptions
\extraoptions
\@captionsfootnotestrue
\@codetrue
\@computersciencetrue
\@headingstrue
\@physicstrue
\@probabilitytheorytrue
\@referencestrue
\@theoremstrue
}
% fallback for unknown options
\DeclareOption*{\atlaspreamble@Warning{Unknown option '\CurrentOption'}}
% process given options
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Post-options section -- activation of enabled options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if@encoding
\RequirePackage{lmodern}
% latin modern font
% -> Provided by / TeXLive package to install: 'lm'
% -> Caveats: should be loaded before package 'fontenc'
\RequirePackage[T1]{fontenc}
% encoding of rendered output
% -> Provided by / TeXLive package to install: included in TeX distributions
\RequirePackage[utf8]{inputenc}
% encoding of source code input
% -> Provided by / TeXLive package to install: included in TeX distributions
% -> Caveats: loading it after package 'fontenc' is recommended when using option 'utf-8'
\fi
\if@typesetting
% see https://texdoc.net/texmf-dist/doc/latex/l2tabu-english/l2tabuen.pdf for why these values are chosen
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\widowpenalty=10000
\vfuzz \hfuzz
\raggedbottom
\fi
\if@math
\RequirePackage{amsmath}
% necessary math features
\RequirePackage{amssymb}
% necessary math symbols
% -> Provided by / TeXLive package to install: 'amsfonts'
% -> Caveats: loads package 'amsfonts' (wanted behavior; we do not need to do it twice)
\RequirePackage{bm}
% better bold math symbols
% -> Provided by / TeXLive package to install: 'tools'
% -> Caveats: needs to be loaded after package 'amsmath' to avoid conflicts
\RequirePackage{dsfont}
% doublestroke math font
% -> Provided by / TeXLive package to install: 'doublestroke'
% -> Needed for: doublestroke '1' symbol, i.e. indicator function
\RequirePackage{mathtools}
% some extensions and fixes to amsmath
% -> Caveats: loads package 'amsmath' if not already imported
% -> Options (several packages): useful macros in auxiliary features section below
\fi
\if@theorems
\RequirePackage{amsthm}
% theorem environment
% -> Options (amsthm): theorem style setup in auxiliary features section below
\fi
\if@physics
\RequirePackage{physics}
% several useful commands for physics
\RequirePackage{siunitx}
% worry-free SI units rendering
\sisetup{separate-uncertainty=true}
% -> Options (siunitx): separate all uncertainties from their values
\fi
\if@computerscience
% see https://tex.stackexchange.com/a/230789 for why this combination of packages is chosen
\RequirePackage{algorithm}
% floating environment for algorithms
% -> Provided by / TeXLive package to install: 'algorithms'
\RequirePackage{algpseudocode}
% pseudocode flavor of the package 'algorithmicx'
% -> Provided by / TeXLive package to install: 'algorithmicx'
\RequirePackage{complexity}
% typesetting for complexity theoretic terms (e.g. P, NP, EXPSPACE, etc.)
% -> Caveats: redefines \L (Ł), \P (¶), and \S (§); access these using \default{L,P,S}
% -> Options (several packages): useful macros in auxiliary features section below
\fi
\if@probabilitytheory
% nothing here yet...
% -> Options: useful macros in auxiliary features section below
\fi
\if@graphics
\RequirePackage{graphicx}
% graphics embedding
% -> Provided by / TeXLive package to install: 'graphics'
\RequirePackage{wrapfig}
% wrap text around figures
% TODO: consider using package 'wrapfig2' instead
\fi
\if@tables
\RequirePackage{array}
% tables in their most essential form
% -> Provided by / TeXLive package to install: 'tools'
\RequirePackage{booktabs}
% tables without horizontal lines for aesthetics
\RequirePackage{tabularx}
% tables which can automatically fit the environment width
% -> Provided by / TeXLive package to install: 'tools'
\RequirePackage{tabulary}
% tables which can automatically fit the environment width and have variable width columns that can have different text alignments
\RequirePackage{xltabular}
% tables spanning more than one page (combines packages 'tabularx' and 'longtable')
\RequirePackage{makecell}
% several tweaks, including multiline cells
\fi
\if@captionsfootnotes
\RequirePackage{caption}
% essential tweaks for captions
\RequirePackage{floatrow}
% change caption positions and introduce the strict float option 'H'
\RequirePackage[bottom, flushmargin, hang]{footmisc}
% footnote customization
% -> Import-time options (footmisc): ensure footnotes stay at the very bottom and make ones that span multiple lines indented to the same (modified) level
\captionsetup{font=small, labelfont=bf, justification=raggedright, singlelinecheck=false}
% -> Options (caption): small and bold font, left alignment, do not center one-line captions
\floatsetup[table]{capposition=top}
% -> Options (floatrow): table caption on top
\renewcommand{\footnoterule}{\kern -3pt \hrule width \textwidth height 1pt \kern 2pt}
% -> Options: footnoterule as wide as textwidth
\fi
\if@lists
\RequirePackage{enumitem}
% easily change properties of list environments
\setlist{itemsep=0pt, labelsep=7pt, labelwidth=7pt, leftmargin=14pt, parsep=0pt, topsep=4pt}
% -> Options (enumitem): spacings of list environments
\fi
\if@columns
\RequirePackage{multicol}
% multiple columns environment
% -> Provided by / TeXLive package to install: 'tools'
\fi
\if@toc
\RequirePackage[nottoc, numbib]{tocbibind}
% include bibliography and other (usually omitted) indexes in the toc
% -> Import-time options (tocbibind): include numbered bibliography in toc
\RequirePackage{tocloft}
% change style of the toc
% -> Caveats: conflicts with package 'parskip'; loading it after 'parskip' causes the package to abort altogether, loading it before 'parskip' causes 'parskip' to throw a non-critical warning; see also https://tex.stackexchange.com/q/395779; results may vary depending on the typesetting engine
\setcounter{tocdepth}{2}
% -> Options: set depth of the toc to subsection level
\if@classuseschapter
\cftsetindents{chapter}{0em}{2.5em}
% -> Options (tocloft): indent of chapter level in toc (if highest level in documentclass is 'chapter')
\cftsetindents{section}{2.5em}{3em}
% -> Options (tocloft): indent of section level in toc (if highest level in documentclass is 'chapter')
\cftsetindents{subsection}{5.5em}{3.5em}
% -> Options (tocloft): indent of subsection level in toc (if highest level in documentclass is 'chapter')
\else
\cftsetindents{section}{0em}{2.5em}
% -> Options (tocloft): indent of section level in toc (if highest level in documentclass is 'section')
\cftsetindents{subsection}{2.5em}{3em}
% -> Options (tocloft): indent of subsection level in toc (if highest level in documentclass is 'section')
\fi
\fi
\if@spacings
\RequirePackage{parskip}
% better handling of spacing for paragraphs
% -> Caveats: conflicts with package 'tocloft'; loading it before 'tocloft' causes 'tocloft' to abort altogether, loading it after 'tocloft' causes it to throw a non-critical warning; see also https://tex.stackexchange.com/q/395779; results may vary depending on the typesetting engine
\setlength{\parindent}{2em}
% -> Options (parskip (associated)): larger indent of first line in paragraphs
\setlength{\parskip}{0.5em}
% -> Options (parskip (associated)): space between paragraphs
\fi
\if@code
\@ifpackageloaded{caption}{}{\RequirePackage{caption}}
% see comment for package 'minted' below
\@ifpackageloaded{floatrow}{}{\RequirePackage{floatrow}}
% see comment for package 'minted' below
\RequirePackage[newfloat, outputdir=.texpadtmp]{minted}
% formatting and highlighting for code
% -> Caveats: package 'floatrow' needs to be loaded before to avoid conflicts when using import-time option 'newfloat'
% package 'caption' needs to be loaded before to successfully parse the \newenvironment command
% -> Import-time options (minted): 'outputdir' is used to hide intermediate files in Texpad's hidden folder for those files
\newenvironment{code}{\captionsetup{type=listing}}{}
% -> Options: create new environment 'code'
\SetupFloatingEnvironment{listing}{within=section, name=Code}
% -> Options: customize captions for new environment 'code' ('capposition=top' is not needed, as captions for listings are on top by default)
\fi
\if@headings
\@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}
% see comment for package 'titlesec' below
\RequirePackage{titlesec}
% custom styles for headings
% -> Caveats: package 'xcolor' needs to be loaded before to successfully parse the \titleformat commands below
\if@classuseschapter
\titleformat{\chapter}[hang]{\LARGE\bfseries}{\textcolor{white!75!black}{\hspace{-17mm}\makebox[11mm][r]{\thechapter}\hspace{6mm}}}{0pt}{\LARGE\bfseries}
% -> Options (titlesec): style of chapter headings (if level 'chapter' exists in documentclass)
\fi
\titleformat{\section}[hang]{\Large\bfseries}{\textcolor{white!75!black}{\hspace{-17mm}\makebox[11mm][r]{\thesection}\hspace{6mm}}}{0pt}{\Large\bfseries}
% -> Options (titlesec): style of section headings
\titleformat{\subsection}[hang]{\large\bfseries}{\textcolor{white!75!black}{\hspace{-17mm}\makebox[11mm][r]{\thesubsection}\hspace{6mm}}}{0pt}{\large\bfseries}
% -> Options (titlesec): style of subsection headings
\fi
\if@references
\@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}
% see comment for package 'hyperref' below
\RequirePackage[hyperfootnotes=false, hypertexnames=false, pdfusetitle]{hyperref}
% basic cross-reference commands
% -> Caveats: package 'hyperref' should almost always be imported last
% package 'xcolor' needs to be loaded before to successfully parse the \hypersetup command below
% -> Import-time options (hyperref): prohibit link creation in footnotes (would otherwise conflict with package 'footmisc'), enable the more robust but less guessable way to count links, and write correct author and title metadata to pdf file
\RequirePackage{cleveref}
% enhanced cross-reference features
% -> Caveats: package 'cleveref' should almost always be imported last and must be imported after package 'hyperref'
% use with package 'amsthm' to allow the theorem type to be determined automatically; all \newtheorem definitions must be placed after package 'cleveref' is loaded
% when using package 'babel' for support for other languages, pass the language optional argument not to the babel package but to the documentclass, so cleveref recognizes it as well
\hypersetup{colorlinks, allcolors={blue!65!black}}
% -> Options (hyperref): setup colors of links
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Post-options section -- auxiliary features of some enabled options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if@math
%% -> Options (several packages): useful math macros (see examples folder for usage)
\@ifpackageloaded{xparse}{}{\RequirePackage{xparse}}
% high-level interface for advanced document-level commands (\NewDocumentCommand, \IfNoValueTF, etc.)
% -> Provided by / TeXLive package to install: 'l3packages'
% use "blackboard bold"-style characters for common number sets
% avoiding clashes with the complexity package that is imported with the computerscience option
\if@computerscience
\let\R\Rcomplexity
\let\K\Kcomplexity
\let\C\Ccomplexity
\fi
\newcommand{\C}{\mathbb{C}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\K}{\mathbb{K}}
% "double stroke"-style character for the identity (not available via "blackboard bold" fonts)
% can also be used with an argument to signify an indicator function with a subscript
\NewDocumentCommand{\1}{g}{%
\ensuremath{\mathds{1}%
\IfNoValueTF{#1}
{}
{_{#1}}
}%
}
% easily declare mathematical sets with either a single argument or two arguments for pipe-separated condition
\NewDocumentCommand{\Set}{m g}{%
\ensuremath{\left\{ #1%
\IfNoValueTF{#2}
{}
{\ \middle|\ #2}
\right\}%
}%
}
% easy scaling delimiters for inner product sharp angle braces
\DeclarePairedDelimiterX{\inp}[2]{\langle}{\rangle}{#1, #2}
% nice spacing for argmin and argmax operators
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
% use some alternative "var" greek letters by default and redefine the old ones
\let\oldepsilon\epsilon
\renewcommand{\epsilon}{\ensuremath{\varepsilon}}
\let\oldrho\rho
\renewcommand{\rho}{\ensuremath{\varrho}}
\let\oldphi\phi
\renewcommand{\phi}{\ensuremath{\varphi}}
\fi
\if@theorems
%% -> Options (amsthm): theorem style setup (see examples folder for usage)
% fix paragraph spacing if package 'parskip' is loaded; see https://tex.stackexchange.com/a/22130
\@ifpackageloaded{parskip}{\def\thm@space@setup{\thm@preskip=\parskip \thm@postskip=0pt}}{}
% localization
\newcommand{\localizationtheorem}{Theorem}
\newcommand{\localizationclaim}{Claim}
\newcommand{\localizationproposition}{Proposition}
\newcommand{\localizationlemma}{Lemma}
\newcommand{\localizationobservation}{Observation}
\newcommand{\localizationcorollary}{Corollary}
\newcommand{\localizationdefinition}{Definition}
\newcommand{\localizationexample}{Example}
\newcommand{\localizationexercise}{Exercise}
\newcommand{\localizationremark}{Remark}
\newcommand{\localizationnotation}{Notation}
\newcommand{\localizationprerequisites}{Prerequisite(s):}
\newcommand{\localizationstatements}{Statement(s):}
\if@languagegerman
\renewcommand{\localizationtheorem}{Satz}
\renewcommand{\localizationclaim}{Behauptung}
\renewcommand{\localizationproposition}{Proposition}
\renewcommand{\localizationlemma}{Lemma}
\renewcommand{\localizationobservation}{Observation}
\renewcommand{\localizationcorollary}{Korollar}
\renewcommand{\localizationdefinition}{Definition}
\renewcommand{\localizationexample}{Beispiel}
\renewcommand{\localizationexercise}{Übung}
\renewcommand{\localizationremark}{Bemerkung}
\renewcommand{\localizationnotation}{Notation}
\renewcommand{\localizationprerequisites}{Gegeben:}
\renewcommand{\localizationstatements}{Aussage(n):}
\fi
% predefined style 'plain' for statements (numbered and unnumbered variants)
\theoremstyle{plain}
\newtheorem{theorem}{\localizationtheorem}[section]
\newtheorem*{theorem*}{\localizationtheorem}
\newtheorem{claim}[theorem]{\localizationclaim}
\newtheorem*{claim*}{\localizationclaim}
\newtheorem{proposition}[theorem]{\localizationproposition}
\newtheorem*{proposition*}{\localizationproposition}
\newtheorem{lemma}[theorem]{\localizationlemma}
\newtheorem*{lemma*}{\localizationlemma}
\newtheorem{observation}[theorem]{\localizationobservation}
\newtheorem*{observation*}{\localizationobservation}
\newtheorem{corollary}[theorem]{\localizationcorollary}
\newtheorem*{corollary*}{\localizationcorollary}
% predefined style 'definition' for definitions (numbered and unnumbered variants) and other important items (only unnumbered variant)
\theoremstyle{definition}
\newtheorem{definition}[theorem]{\localizationdefinition}
\newtheorem*{definition*}{\localizationdefinition}
\newtheorem*{example}{\localizationexample}
\newtheorem*{exercise}{\localizationexercise}
% custom style 'newremark' for less important items (only unnumbered variants)
\newtheoremstyle{newremark}{}{}{\slshape}{}{\scshape}{.}{0.4em}{}
\theoremstyle{newremark}
\newtheorem*{remark}{\localizationremark}
\newtheorem*{notation}{\localizationnotation}
% custom style 'summtheorem' for summaries of statements (only unnumbered variant)
\newtheoremstyle{summtheorem}{}{}{\itshape}{}{\bfseries}{.}{\newline}{}
\theoremstyle{summtheorem}
% commands for use within summaries of statements (for division into prerequisites and statements)
\newcommand{\preq}[1]{%
\par
{\normalfont\scshape\localizationprerequisites} #1%
}
\newcommand{\state}[1]{%
\par
{\normalfont\scshape\localizationstatements} #1%
}
% creation of 'summarythm*' environment that takes a theorem name as mandatory argument (achieved through a workaround which involves invoking a \newtheorem with the new empty command \thistheoremname and re-initializing \thistheoremname with the mandatory argument every time the environment is started)
% within this environment \parindent is always set to 0
\newcommand{\thistheoremname}{}
\newtheorem*{genericthm*}{\thistheoremname}
\newenvironment{summarythm*}[1]
{\renewcommand{\thistheoremname}{#1}%
\setlength{\parindent}{0em}%
\begin{genericthm*}}
{\end{genericthm*}}
% predefined style 'definition' for summaries of definitions (only unnumbered variant)
\theoremstyle{definition}
% creation of 'summarydef*' environment that takes a definition name as mandatory argument (for a description of the employed workaround, see 'summarythm*' above)
% within this environment \parindent is always set to 0
\newcommand{\thisdefinitionname}{}
\newtheorem*{genericdef*}{\thisdefinitionname}
\newenvironment{summarydef*}[1]
{\renewcommand{\thisdefinitionname}{#1}%
\setlength{\parindent}{0em}%
\begin{genericdef*}}
{\end{genericdef*}}
\fi
\if@computerscience
%% -> Options (several packages): useful computer science macros (see examples folder for usage)
% asymptotic notation shortcuts
\newcommand{\Oh}[1]{\ensuremath{\mathcal{O}\left(#1\right)}}
\newcommand{\oh}[1]{\ensuremath{o\left(#1\right)}}
\newcommand{\Th}[1]{\ensuremath{\Theta\left(#1\right)}}
\newcommand{\Om}[1]{\ensuremath{\Omega\left(#1\right)}}
\newcommand{\om}[1]{\ensuremath{\omega\left(#1\right)}}
% algorithm
\newcommand{\algorithminput}{\textbf{Input: }}
\newcommand{\algorithmoutput}{\textbf{Output: }}
\algnewcommand{\CommentLine}[1]{\State \(\triangleright\) #1} % comment on a single line
\algdef{SE}{RepeatTimes}{EndRepeatTimes}[1]{\textbf{repeat } \(\mbox{#1}\) \textbf{times}}{\textbf{end}} % loops
\fi
\if@probabilitytheory
%% -> Options: useful probability theory macros (see examples folder for usage)
\@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}}
\@ifpackageloaded{amssymb}{}{\RequirePackage{amssymb}}
\@ifpackageloaded{xparse}{}{\RequirePackage{xparse}}
% high-level interface for advanced document-level commands (\NewDocumentCommand, \IfNoValueTF, etc.)
% -> Provided by / TeXLive package to install: 'l3packages'
\@ifpackageloaded{xspace}{}{\RequirePackage{xspace}}
% decides whether to insert a space to replace one "eaten" by the TeX engine (needed for intelligent periods after \iid command)
% -> Provided by / TeXLive package to install: 'tools'
% use a blackboard-bold 'P' for probability instead of the default 'Pr'
% can also be used with an argument to put an event in square brackets
\let\oldPr\Pr
\RenewDocumentCommand{\Pr}{g}{%
\ensuremath{\operatorname{\mathbb{P}}%
\IfNoValueTF{#1}
{}
{\left[ #1 \right]}
}%
}
% expectation
% avoiding a clash with the complexity package that is imported with the computerscience option
\if@computerscience
\let\E\Ecomplexity
\fi
\NewDocumentCommand{\E}{m g}{%
\ensuremath{\operatorname{\mathbb{E}}%
\IfNoValueTF{#2}
{}
{_{#1}}
\left[%
\IfNoValueTF{#2}
{#1}
{#2}
\right]%
}%
}
% factorial moment
\NewDocumentCommand{\Efact}{m m}{%
\ensuremath{\operatorname{\mathbb{E}}_{#1}\left[ #2 \right]}%
}
% variance
\NewDocumentCommand{\Var}{m g}{%
\ensuremath{\operatorname{Var}%
\IfNoValueTF{#2}
{}
{_{#1}}
\left[%
\IfNoValueTF{#2}
{#1}
{#2}
\right]%
}%
}
% covariance
\NewDocumentCommand{\Cov}{m g}{%
\ensuremath{\operatorname{Cov}%
\IfNoValueTF{#2}
{}
{_{#1}}
\left(%
\IfNoValueTF{#2}
{#1}
{#2}
\right)%
}%
}
% shorthand for "independent and identically distributed"
% last period is omitted depending on whether a period already comes after it
\newcommand{\iid}{i.i.d\@ifnextchar.{}{.\@\xspace}}
% distributions
\newcommand{\Bernoulli}[1]{\operatorname{Bernoulli}\left( #1 \right)}
\newcommand{\Bin}[2]{\operatorname{Bin}\left( #1, #2 \right)}
\newcommand{\Po}[1]{\operatorname{Po}\left( #1 \right)}
\fi
\endinput