-
Notifications
You must be signed in to change notification settings - Fork 20
/
acp.cls
3586 lines (3200 loc) · 141 KB
/
acp.cls
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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LuaLaTeX based on KOMA-Script
%
% Author (2021): Alex Povel - tex(at)alexpovel.de
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Class Options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Refer to https://www.overleaf.com/learn/latex/Writing_your_own_class
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{acp}[2021-10-06 v4.0.0 acp class]
% Fail early and give useful information on the required engine.
% This helps users who do not read the documentation beforehand, by promoting the
% requirement from some statement in the docs to actual code that errors out.
\RequirePackage{iftex}
\RequireLuaTeX{}
\newcommand*{\@baseclass}{scrbook}% Name of class this one is based on
% If option 'language' is not given at all, use initialization 'english' as a fallback.
% If it is called without a value, use default (or throw error of no default given)
% This method was chosen to have the language available in a macro, so it may be passed
% to polyglossia.
% This approach messes with the forwarding of the language and raises a warning
% 'Unused global options'; we can probably ignore that for now
% (https://tex.stackexchange.com/a/278172/120853).
\RequirePackage{kvoptions}
%[default]{language} % If no default entered: option requires a value:
\DeclareStringOption[english]{language}
\DeclareStringOption{titlestyle}
\DeclareBoolOption{censoring}% Initially false by default
\ProcessKeyvalOptions*
\PassOptionsToClass{%
\acp@language,% Scheme: \filename@keyoption
twoside,% For printing two-sided documents
% 'List of (Tables, Figures, ...)' gets pushed down one hierarchical level:
% listof=leveldown,
listof=totoc,% All registered Lists of XYZ to Table of Contents
bibliography=totoc,
chapterprefix=true,% Print 'Chapter' etc. label in front of number
open=right,% Open new Chapters on recto pages
numbers=noenddot,% https://tex.stackexchange.com/a/102305/120853
}{\@baseclass}
% Bundle 'a5' to not only have a5paper but also decrease font size.
% https://tex.stackexchange.com/a/418947/120853
% https://tex.stackexchange.com/a/27149/120853
\DeclareOption{a5}{%
% Not forwarded to typearea package if passed as class option: do it manually here:
\PassOptionsToPackage{paper=a5}{typearea}
\PassOptionsToClass{fontsize=10pt}{\@baseclass}%
}%
% Forward all other options given to \documentclass[] to base class:
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\@baseclass}}
\ProcessOptions\relax% Execute these options
\LoadClass{\@baseclass}% Finally, load the base class
\RequirePackage[\acp@language]{tracklang}% Language Tracking
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typography and Misc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{scrhack}% Fixes for packages incompatible with KOMA features
\RequirePackage{import}% Relative path imports
\RequirePackage[super]{nth}% For ordinal numbers, like \nth{1} -> 1^{st}
\RequirePackage{etoolbox}% Programming facilities
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Translations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Providing localization that are not automatically covered by polyglossia.
% The commands are provided by KOMAscript.
% Maintaining the list is not the easiest, but currently likely the best approach.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Colophon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransCompiledOn}{Compiled on}
\providecaptionname{german}{\TransCompiledOn}{Kompiliert am}
\providecaptionname{english}{\TransLatexClass}{Class}
\providecaptionname{german}{\TransLatexClass}{Klasse}
\providecaptionname{english}{\TransGenerator}{Generator}
\providecaptionname{german}{\TransGenerator}{Generiert durch}
\providecaptionname{english}{\TransCensorNotice}{CENSORED VERSION}
\providecaptionname{german}{\TransCensorNotice}{ZENSIERTE VERSION}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Task
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransPlaceDate}{Place \& Date}
\providecaptionname{german}{\TransPlaceDate}{Ort \& Datum}
\providecaptionname{english}{\TransTopic}{Topic}
\providecaptionname{german}{\TransTopic}{Thema}
\providecaptionname{english}{\TransTask}{Task}
\providecaptionname{german}{\TransTask}{Problemstellung}
\providecaptionname{english}{\TransFor}{For}
\providecaptionname{german}{\TransFor}{Für}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Declaration of Authorship
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransAuthorshipDeclTitle}{Declaration of Authorship}
\providecaptionname{german}{\TransAuthorshipDeclTitle}{Erklärung zur Eigenständigkeit}
%
% No warranty these wordings are valid in your case!
%
\providecaptionname{english}{\TransAuthorshipDeclText}{%
I, \@author{}, hereby declare to be the sole, independent author of the
\@documenttype{} submitted here.
No other than the cited references have been used.
Any content directly or indirectly obtained from external sources has been marked up as such.
This thesis has neither been submitted to a second examination authority nor been published.%
}%
\providecaptionname{german}{\TransAuthorshipDeclText}{%
Hiermit bestätige ich, \@author{}, der alleinige und selbstständige Autor der hier
vorgelegten \@documenttype{} zu sein.
Keine anderen als die angegebenen Quellen wurden benutzt.
Jeglicher aus externen Quellen direkt oder indirekt bezogene Inhalt ist als solcher markiert.
Diese Arbeit wurde weder einer anderen Prüfungsbehörde vorgelegt noch veröffentlicht.
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cleveref
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransReaction}{Reaction}
\providecaptionname{german}{\TransReaction}{Reaktion}
\providecaptionname{english}{\TransReactions}{Reactions}
\providecaptionname{german}{\TransReactions}{Reaktionen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glossary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransGreek}{Greek}
\providecaptionname{german}{\TransGreek}{Griech.}
\providecaptionname{english}{\TransRoman}{Roman}
\providecaptionname{german}{\TransRoman}{Röm.}
\providecaptionname{english}{\TransOther}{Other}
\providecaptionname{german}{\TransOther}{Andere}
\providecaptionname{english}{\TransTerms}{Terms}
\providecaptionname{german}{\TransTerms}{Begriffe}
\providecaptionname{english}{\TransNames}{Names}
\providecaptionname{german}{\TransNames}{Namen}
\providecaptionname{english}{\TransAcronyms}{Acronyms}
\providecaptionname{german}{\TransAcronyms}{Akronyme}
\providecaptionname{english}{\TransSubscripts}{Subscripts}
\providecaptionname{german}{\TransSubscripts}{Indizes}
\providecaptionname{english}{\TransSuperscripts}{Superscripts}
\providecaptionname{german}{\TransSuperscripts}{Hochgest.}
\providecaptionname{english}{\TransSubSuperTitle}{Sub- and Superscripts}
\providecaptionname{german}{\TransSubSuperTitle}{Indizes}
\providecaptionname{english}{\TransUnit}{Unit}
\providecaptionname{german}{\TransUnit}{Einheit}
\providecaptionname{english}{\TransPhysicalQuantity}{Phys.\ Qtt.}
\providecaptionname{german}{\TransPhysicalUnit}{Phys.\ Größe}
\providecaptionname{english}{\TransFirstUse}{\nth{1} Use}
\providecaptionname{german}{\TransFirstUse}{Einführ.}
\providecaptionname{english}{\TransShort}{Short}
\providecaptionname{german}{\TransShort}{Kurz}
\providecaptionname{english}{\TransContinued}{continued}
\providecaptionname{german}{\TransContinued}{fortgesetzt}
\providecaptionname{english}{\TransGlossaryLegend}{
Marked (\specificsymbolmark) symbols possess a mass\-/specific variant in which
the symbol is written in lowercase and the unit is extended by
\unit[per-mode=reciprocal]{\per\kilogram}.
Alternative symbols are specified following the \alternativesymbolmark{} mark.
International symbols are specified in brackets.%
}
\providecaptionname{german}{\TransGlossaryLegend}{
Markierte (\specificsymbolmark) Symbole besitzen eine massenspezifische Variante,
bei der das Symbol als Kleinbuchstabe gesetzt und die Einheit entsprechend um
\unit[per-mode=reciprocal]{\per\kilogram} erweitert wird.
Alternative Symbole sind nach \alternativesymbolmark{} angegeben,
internationale Symbole in eckigen Klammern.%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SCRLayer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransBlankPage}{Rest of this page intentionally left blank.}
\providecaptionname{german}{\TransBlankPage}{Rest der Seite absichtlich freigelassen.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lists of ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransIllustrativeElements}{Illustrative Elements}
\providecaptionname{german}{\TransIllustrativeElements}{Veranschaulichende Elemente}
\providecaptionname{english}{\TransListOfIllustrations}{List of Illustrations}
\providecaptionname{german}{\TransListOfIllustrations}{Illustrationsverzeichnis}
\providecaptionname{english}{\TransListing}{Code Listing}
\providecaptionname{english}{\TransListings}{Code Listings}% Plural for cleveref
\providecaptionname{german}{\TransListing}{Code}
\providecaptionname{german}{\TransListings}{Codes}% Plural for cleveref
\providecaptionname{english}{\TransListOfListings}{List of Code}
\providecaptionname{german}{\TransListOfListings}{Codeverzeichnis}
\providecaptionname{english}{\TransListOfExamples}{List of Examples}
\providecaptionname{german}{\TransListOfExamples}{Beispielverzeichnis}
\providecaptionname{english}{\TransExample}{Example}
\providecaptionname{german}{\TransExample}{Beispiel}
\providecaptionname{english}{\TransExamples}{Examples}
\providecaptionname{german}{\TransExamples}{Beispiele}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransFurtherReadingTitle}{Further Reading}
\providecaptionname{german}{\TransFurtherReadingTitle}{Weitere Literatur}
\providecaptionname{english}{\TransFurtherReadingText}{%
The following references were used in this work but not cited in the text body;
they are provided here as\-/is.
}
\providecaptionname{german}{\TransFurtherReadingText}{%
Die folgenden Quellen wurden im Rahmen dieser Arbeit benutzt, jedoch nicht
explizit zitiert.
Sie sind hier der Vollständigkeit halber aufgeführt.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Other
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecaptionname{english}{\TransConstant}{const}
\providecaptionname{german}{\TransConstant}{konst}
\providecaptionname{english}{\TransAdaptedFrom}{Adapted from}
\providecaptionname{german}{\TransAdaptedFrom}{Adaptiert von}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tweaks and improvements for amsmath; also loads amsmath.
% Needs to be loaded before unicode-math!
\RequirePackage{mathtools}
% We want to be cool, so standard parantheses don't cut it:
\newtagform{brackets}{[}{]}
\usetagform{brackets}
% Allow multi-line environments to break across pages.
% While it makes sense to disallow it, not doing so can produce big spacing issues.
% Usually, any such environment will require manual attention.
% Number from 1 to 4 as optional argument:
% [1]: allow pagebreaks, but avoid as much as possible.
% [4]: maximum permissiveness
\allowdisplaybreaks[2]
% Automatic macro for delimiters (parentheses, brackets, ...)
% Using the starred variant of the created command (like \parens*{<content>})
% also scales the delimiters automatically, using \left and \right.
\DeclarePairedDelimiter{\parens}{(}{)}
\DeclarePairedDelimiter{\brackets}{[}{]}
\DeclarePairedDelimiter{\braces}{\{}{\}}
% For a 'cases' environment that also supports equation numbering,
% https://tex.stackexchange.com/a/180910/120853
\RequirePackage{empheq}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Colour
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load this before unicode-math font specifications to make colors available there
\RequirePackage[x11names]{xcolor}% x11names provides some usable default names
% Shades of grey (we don't need 50 though)
% This is nice to have consistent color shading.
\colorlet{g1}{black!70}
\colorlet{g2}{black!55}
\colorlet{g3}{black!40}
\colorlet{g4}{black!20}
\colorlet{g5}{black!10}
\colorlet{g6}{black!05}
% Different fluids/materials.
\definecolor{Glass}{RGB}{170, 238, 255}% Very light blue
\definecolor{Air}{RGB}{213, 246, 255}% Light blue
\definecolor{LightFluid}{RGB}{148, 224, 255}
\definecolor{MediumFluid}{RGB}{135, 178, 232}
\definecolor{DarkFluid}{RGB}{119, 151, 197}
\definecolor{HotFluid}{RGB}{255, 128, 128}% 255/128/128 is same as 'red!50'
% Dark blue link color:
\definecolor{darklink}{RGB}{48, 62, 116}%
% From colorbrewer's RdYlBu: from red (1) to blue (6)
\definecolor{rdylbu1}{RGB}{215, 48, 39}%
\definecolor{rdylbu2}{RGB}{252, 141, 89}%
\definecolor{rdylbu3}{RGB}{254, 224, 144}%
\definecolor{rdylbu4}{RGB}{224, 243, 248}%
\definecolor{rdylbu5}{RGB}{145, 191, 219}%
\definecolor{rdylbu6}{RGB}{ 69, 117, 180}%
% From colorbrewer's Set2 for qualitative data/color discernibility
\definecolor{Set2A}{RGB}{102, 194, 165}%
\definecolor{Set2B}{RGB}{252, 141, 98}%
\definecolor{Set2C}{RGB}{141, 160, 203}%
\definecolor{Set2D}{RGB}{231, 138, 195}%
\definecolor{Set2E}{RGB}{166, 216, 84}%
\definecolor{Set2F}{RGB}{255, 217, 47}%
\definecolor{Set2G}{RGB}{229, 196, 148}%
\definecolor{Set2H}{RGB}{179, 179, 179}%
% Matlab colours:
\definecolor{mBlue}{HTML}{0072BD}
\definecolor{mOrange}{HTML}{D95319}
\definecolor{mYellow}{HTML}{EDB120}
\definecolor{mPurple}{HTML}{7E2F8E}
\definecolor{mGreen}{HTML}{77AC30}
\definecolor{mSky}{HTML}{4DBEEE}
\definecolor{mRed}{HTML}{A2142F}
% Code annotations:
\definecolor{cRed}{RGB}{209,0,86}%
\definecolor{cBlue}{RGB}{0, 130, 185}%
\definecolor{cGreen}{RGB}{0, 128, 63}%
\definecolor{cOrange}{RGB}{244, 131, 66}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typeset code snippets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% minted is a Python-based syntax highlighter and therefore much, much more powerful
% than anything LaTeX-built-in
\RequirePackage[%
% `minted` uses the `float` package to provide the `[H]` float position specifier.
% Sadly, the `float` package is incompatible with `floatrow`, which we make heavy
% use of. Luckily, we can use `minted` with the `newfloat` package instead, fixing
% all those otherwise breaking issues.
% See https://tex.stackexchange.com/a/378588/120853
newfloat=true,%
]{minted}
\setminted{% Global `minted` aka code syntax highlighting options
% If code is indented in the LaTeX source, this is reflected in the print.
% This option automatically removes as much whitespace as the first line of a listing
% is indented by (note: requires `python` to be available, not only `pygmentize`)
autogobble=true,
%
% Assuming the code to be displayed is written at 80-90 characters per line,
% \footnotesize makes sure it fits onto one line (roughly).
fontsize=\footnotesize,
%
breaklines=true,
breakanywhere=false, % default "false"; could be ugly, only use if required
breakbytokenanywhere=true, % Breaks tokens on non-spaces too
%
% Regular LaTeX can occur in these (on UK Keyboard: SHIFT+`).
% Otherwise, you'll have to copy-paste this whenever needed.
% The problem is that the escapechar has to be quite exotic so it never occurs
% in source code.
escapeinside=¬¬,
%
frame=leftline, % leftline pulls it together visually quite nicely
framerule=1pt, % default is 0.4pt
rulecolor=\color{g3},
%
numbers=left,
numberfirstline=true, % Always color the first line despite `stepnumber` setting
stepnumber=5, % Interval of line numbering
numbersep=2pt, % Horizontal distance between line number and line
%
% Used highlighting style, see https://pygments.org/demo/#try or `python -m pygments -L`
% For colorful output, I like:
% `paraiso-light` (prob. too light for print), `manni`, `tango`, `lovelace`
% For grayscale:
% `algol`
style=manni,
}
\setmintedinline{% Overwrite `\setminted` settings
fontsize=auto,% Reset to surrounding font size so its fits into the text flow
}
% Set up the floating environment, e.g. what is says in the caption of floats:
\SetupFloatingEnvironment{listing}{% Requires `newfloat` usage
name=\TransListing{},
listname=\TransListOfListings{},
}
% Create a new environment for breaking code listings across pages.
\newenvironment{longlisting}{\captionsetup{type=listing}}{}
% Setup for referencing the floats correctly is done in `cleveref` settings!
% In code environments, to be able to copy from the PDF (despite that not being a good
% idea usually), we want the line numbers to not be part of the selection.
% This command prints them, but renders the actual copied content empty,
% on supported readers like Adobe Acrobat.
\RequirePackage{accsupp}% https://tex.stackexchange.com/a/57160/120853
\newcommand*{\emptyaccsupp}[1]{%
\BeginAccSupp{ActualText={}}#1\EndAccSupp{}%
}%
\renewcommand*{\theFancyVerbLine}{ % Redefine how line numbers are printed
\textcolor{g3}{\ttfamily\tiny\emptyaccsupp{\arabic{FancyVerbLine}}}
}
% Colors for escaped, normal LaTeX in code environments
\newcommand*{\phstring}[1]{%
\textcolor{cRed}{#1}%
}%
\newcommand*{\phnum}[1]{%
\textcolor{cBlue}{#1}%
}%
\newcommand*{\phother}[1]{%
\textcolor{cGreen}{#1}%
}%
\newcommand*{\phnote}[1]{%
{%
\hypersetup{allcolors=cOrange}% If references occur in here
\textbf{\textcolor{cOrange}{#1}}%
}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO notes in the PDF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{todonotes}% TODO-notes in the margins
\setuptodonotes{fancyline}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[
warnings-off={
% Unicode overwrites colon-commands but uses over/underbracket from mathtools
% and warns us; suppress this:
mathtools-colon,%
mathtools-overbracket,%
}
]{unicode-math}% Builds onto fontspec and loads it automatically
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts shipped with TeXLive from here: https://tug.org/FontCatalogue/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmainfont[%
Numbers=Lowercase,% Hanging/OldStyle numbers through Lowercase numbers
% Color=Orange2,% Toggle color for debugging (should be xcolor name)
]{TeX Gyre Pagella}% Load existing fond, see also https://tex.stackexchange.com/a/351100/120853
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source: https://fonts.google.com/specimen/Inconsolata
% (Consolas is considered better but is not free (?))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmonofont[%
% Inconsolata doesn't have italics font, so fake it. Discouraged but should
% only occur in a few places in code and not be noticable there. Inconsolata
% is too nice to give up on it for lack of italics. See also
% https://tex.stackexchange.com/a/183220/120853
AutoFakeSlant,
Scale=MatchLowercase,% Prettier when using inline-code alongside our main font
% Color=DodgerBlue3,% Toggle color for debugging (should be xcolor name)
]{inconsolata}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source: https://www.exljbris.com/fontinsans.html
% Viable alternative: https://fonts.google.com/specimen/Fira+Sans
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setsansfont[%
% Color=Red3,% Toggle color for debugging (should be xcolor name)
]{Merriweather Sans}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source: https://ctan.org/texarchive/fonts/tex-gyre-math/opentype
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmathfont[%
%Set math-font-commands to new versions; use \symbf{} instead of \mathbf{} etc:
mathrm=sym,%
mathit=sym,%
mathsf=sym,%
mathbf=sym,%
mathtt=sym,%
% 'tpgl': 'TexGyrePagellaLining'.
% This 'NFSS' style is required for \fontfamily{nfss-code}\selectfont to work,
% e.g. in package chemmacros/chemformula
NFSSFamily=tgpl,%
% Color=Green4,% Toggle color for debugging (should be xcolor name)
]{TeX Gyre Pagella Math}% Load existing fond, see also https://tex.stackexchange.com/a/351100/120853
% Provide a new font family for siunitx to work.
% See: https://tex.stackexchange.com/a/468031/120853.
% \newfontfamily is used similarly to \setmainfont etc,
% see: https://tex.stackexchange.com/a/12568/120853
\newfontfamily{\unitnumberfont}[
% New font family for typesetting units.
% Required since otherwise, numbers typeset with \qty/\num etc. from siunitx
% might be hanging if that feature is turned on in the main font (OldStyle numbers).
% To ensure these physical numbers are always upright, set Numbers:
Numbers=Uppercase,
% Color=LightCyan4,% Toggle color for debugging (should be xcolor name)
]{TeX Gyre Pagella}% Load existing fond, see also https://tex.stackexchange.com/a/351100/120853
% Looking at CTAN, `fontawesome5' looks much more recent and packs many more symbols
% in comparison to `fontawesome'.
% It ships with its own font files, so no need to specify here.
\RequirePackage{fontawesome5}% High-quality Unicode vector web symbols
% Wrapper for "i.e.", "e.g.", "c.f.", "etc.", etc.
% Call this command as "The animals, \iecfeg{e.g.}\ an elephant, are..."
% to get a small space after the ending period.
% We do not define dedicated commands here (like \eg or \etc) to print that stuff
% automatically, since there are way too many exceptions and caveats.
% Such macros are not worth it because the requirements change too much from use to use
% (different languages, capitalisation, ending dot if abbreviation is at end of
% sentence, ...).
% It is left to the user to do the specifics.
% This macro just makes sure it is all in italics.
\newcommand*{\iecfeg}[1]{\textit{#1}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% System Information Banner
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Provides \hologo and \Hologo to typeset various logos, like the LuaLaTeX logo.
\RequirePackage{hologo}
% Using fontspec, this document is incompatible with anything but XeLaTeX/LuaLaTeX.
% LuaLaTeX can grab additional memory as needed, therefore no issues with tikz and no
% need to tikzexternalize (!).
% Further, contour-package and XeLaTeX are strictly incompatible (LuaLaTeX works).
% Therefore, only ever use LuaLaTeX anyway.
\RequirePackage{xstring}% String manipulation macros
% Print only what occurs after 'This is ' and store in macro given in brackets at end.
% luatexbanner is provided by luatex engine, but prints 'This is luatex XYX' usually.
% https://tex.stackexchange.com/a/394043/120853
\StrBehind*{\luatexbanner}{This is }[\shortbanner]
% Take input and substitute strings; here: make plain LuaTeX string into pretty logo.
% StrSubstitue has no starred variant, therefore dekotenize.
% https://tex.stackexchange.com/a/350583/120853
\StrSubstitute{\shortbanner}{\detokenize{LuaTeX}}{\hologo{LuaTeX}}[\prettybanner]
% Generate some control sequences which contain metadata, which can be inserted e.g.
% into the PDF metadata (e.g. to have the exact git commit SHA of a build).
% See % https://www.overleaf.com/learn/latex/Articles/An_Introduction_to_LuaTeX_(Part_2):_Understanding_%5Cdirectlua
% for how to inline Lua code in TeX.
% It's an absolute abomination; the below code first passes through TeX, gets expanded,
% then gets processed by Lua.
% Hence, there is a lot of escaping going on.
\directlua{%
local function get_cmd_stdout(cmd)
% -- See: https://stackoverflow.com/a/326715/11477374
local fh = assert(io.popen(cmd))
local first_line = assert(fh:read())
fh:close()
return first_line
end
%
% -- Environment variables as used e.g. in GitLab CI.
% -- Otherwise, e.g. when developing locally, use commands as a fallback.
local macro_content_sources = {
GitRefName = {
env = "CI_COMMIT_REF_NAME",
cmd = "git rev-parse --abbrev-ref HEAD",
},
GitShortSHA = {
env = "CI_COMMIT_SHORT_SHA",
cmd = "git rev-parse --short HEAD",
},
}
%
for macro_name, content_sources in pairs(macro_content_sources) do
% -- Default: check for environment variable:
local env = content_sources.env
local cmd = content_sources.cmd
% -- Default value:
local content = "n.a."
local env_content = os.getenv(env)
%
% -- Empty string evaluates to true:
if env_content and env_content \noexpand~= "" then
texio.write_nl("Found and will be using environment variable '"..env.."'.")
content = env_content
else
texio.write_nl("Environment variable '"..env.."' undefined or empty, trying fallback command.")
% -- luatex reference for shell escape:
% -- "0 means disabled, 1 means anything is permitted, and 2 is restricted"
if status.shell_escape == 1 then
local cmd_success, cmd_stdout = pcall(get_cmd_stdout, cmd)
if cmd_success then
texio.write_nl("Fallback command '"..cmd.."' succeeded.")
content = cmd_stdout
else
texio.write_nl("Fallback command '"..cmd.."' unsuccessful.")
end
else
texio.write_nl("shell-escape is disabled, cannot use fallback command.")
end
end
%
% -- Shouldn't happen, would be programmer error, therefore assert Python-style
assert(content, "Content not defined (neither success nor fallback present)")
%
% --[[
% The `content` can contain unprintable characters, like underscores in git branch
% names. Towards this end, use detokenize in the macro itself, which will make all
% characters printable (assigns category code 12). See also:
% https://www.overleaf.com/learn/latex/Articles/An_Introduction_to_LuaTeX_(Part_2):_Understanding_%5Cdirectlua
% --]]
local escaped_content = "\unexpanded{\\detokenize{"..content.."}"}
%
texio.write_nl("Providing new macro '"..macro_name.."' with contents: '"..escaped_content.."'.")
% -- Set a macro (newcommand) see also: https://tex.stackexchange.com/a/450892/120853
token.set_macro(macro_name, escaped_content)
end
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Macros to pretty-print keyboard buttons and menu navigation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[
os=win,% Default is `mac`
]{menukeys}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% KOMA Layout, Sectioning etc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% label, e.g. 'Chapter', appearing before the chapter number:
\addtokomafont{chapterprefix}{\raggedleft}
\renewcommand*{\chapterformat}{%
\color{g3}% g3 is a shade of grey
%
% chapappifchapterprefix{addtext} checks if 'chapterprefix=true' is active,
% then prints 'Chapter' or 'Appendix' in front of number,
% followed by more text 'addtext':
\chapappifchapterprefix{~}% ~ is an unbreakable space character
%
% Autodot automates the generation of a dot/period, like \thechapter\autodot.
% Leave out for no dot.
\scalebox{4.5}{\thechapter}
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Titlepage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define new font for the title page, so it is created once (\newkomafont)
% and can later be set however often required (\setkomafont)
\newkomafont{documenttype}{\usekomafont{subtitle}\footnotesize}
% Emulating a budget 'case' switch statement here
% \ifstrequal from etoolbox doesn't work, it does not expand macros.
% Use \ifdefstring from same package,
% see also https://tex.stackexchange.com/a/451937/120853
\ifdefstring{\acp@titlestyle}{thesis}{
% These exist already, overwrite:
\setkomafont{title}{\sffamily\bfseries\Huge}
\setkomafont{subtitle}{\normalfont\normalsize\sffamily}
\setkomafont{author}{\sffamily\bfseries}
\setkomafont{publishers}{\sffamily}
%
% One same line as subtitle, so should look the same; inherit style:
\setkomafont{date}{\usekomafont{subtitle}}
%
\setkomafont{documenttype}{\usekomafont{subtitle}\footnotesize}
%
\renewcommand{\maketitle}{%
\begin{titlepage}
\hfill%
%
% 2nd optional argument is height, required for \vfill etc. to work
\begin{minipage}[b][1\textheight]{0.05\textwidth}%
\color{black}\rule{0.15em}{\textheight}% Vertical line
\hfill%
\end{minipage}% This comment char is important to suppress linebreak
%
\begin{minipage}[b][1\textheight]{0.75\textwidth}
\vspace{4\baselineskip}
{\usekomafont{documenttype}\faGraduationCap{}\ \@documenttype{}\hspace{0.5em}}
\hrulefill
\begin{spacing}{1.1}% In case of multi-line titles, more relaxed spacing
\usekomafont{title}\raggedright\@title
\end{spacing}
\hrule
\vspace{0.8\baselineskip}
{%
\usekomafont{author}%
% Tabular enables \and and \\ syntax
\begin{tabular}[t]{@{}l@{}}%
\@author
\end{tabular}
}%
\hfill
{\usekomafont{date}\@date}\par
\vfill
{\usekomafont{subtitle}\@subtitle}\par
\vspace{2\baselineskip}
{%
\usekomafont{publishers}%
\begin{tabular}[t]{@{}l@{}}%
\@publishers
\end{tabular}
}\par
\vspace{0.2ex}% Also required for \vfill as something to 'fill against'
\end{minipage}
\end{titlepage}
}%
}{%
% Else: nothing; faking a 'case' environment
}
\ifdefstring{\acp@titlestyle}{book}{
% These exist already, overwrite:
\setkomafont{title}{\sffamily\bfseries\Huge}
\setkomafont{subtitle}{\itshape}
\setkomafont{author}{\scshape\Large}
\setkomafont{date}{\normalfont\normalsize\sffamily}
\setkomafont{publishers}{\scshape}
%
% One same line as date, so should look the same; inherit style:
\setkomafont{documenttype}{\usekomafont{date}}
%
\renewcommand{\maketitle}{%
\begin{titlepage}
\hfill%
%
% 2nd optional argument is height, required for \vfill etc. to work
\begin{minipage}[b][1\textheight]{0.05\textwidth}%
\color{black}\rule{0.15em}{\textheight}% Vertical line
\hfill%
\end{minipage}% This comment char is important to suppress linebreak
%
\begin{minipage}[b][1\textheight]{0.75\textwidth}
\vspace{2\baselineskip}
{\usekomafont{author}
% Tabular enables \and and \\ syntax
\begin{tabular}[t]{@{}l@{}}%
\@author
\end{tabular}
}\par
\vspace{1.5\baselineskip}
\begin{spacing}{1.1}% In case of multi-line titles, more relaxed spacing
\usekomafont{title}\raggedright\@title
\end{spacing}
\hrule
\vspace{0.8\baselineskip}
{\usekomafont{documenttype}\@subtitle}
\hfill
{\usekomafont{date}\@date}\par
\vfill
{\usekomafont{publishers}
\begin{tabular}[t]{@{}l@{}}%
\@publishers
\end{tabular}
}\par
\vspace{0.2ex}% Also required for \vfill as something to 'fill against'
\end{minipage}
\end{titlepage}
}%
}{
% Else: nothing; faking a 'case' environment
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tocbasic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Dynamic width of number column in LoF/LoT etc (numsep + width of longest entry).
% 'tocline' is the (dynamic) default style.
\DeclareTOCStyleEntry[dynnumwidth=true]{tocline}{figure}
\DeclareTOCStyleEntry[dynnumwidth=true]{tocline}{table}
% Declare a new list of contents, with the file suffix in brackets.
% This will give access to \listof<name>s
\DeclareNewTOC[%
type=example,% This also creates types=example+s, that is by appending an s
% Listname is "List of <Type>s" by default, therefore translate:
listname={\TransListOfExamples{}},
]{loe}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SCRLayer for page makeup (header/footer etc.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[automark]{scrlayer-scrpage}% Automatically mark
\clearpairofpagestyles % Reset defaults
% Declare new length (acting as a height) for the vertical bar in the header:
\newlength{\headerrulelength}
% Increase height of rule here; KOMA Script will complain, no idea how to fix
\setlength{\headerrulelength}{3ex}
% New command for the vertical rule, with height as specified by the new length above:
\newcommand*{\headerrule}{%
\rule[-1ex]{0.1em}{\headerrulelength}%
}%
% Define headers:
\lehead{% Left, even head
\llap{%
\pagemark\enskip\headerrule%
}%
\enskip\headmark%
}%
\rohead{% Right, odd head
\headmark\enskip%
\rlap{%
\headerrule\enskip\pagemark%
}%
}%
% https://tex.stackexchange.com/q/299125/120853:
\renewcommand*{\chaptermarkformat}{\thechapter\enskip}%
\addtokomafont{pagehead}{\sffamily\itshape\footnotesize}%
\addtokomafont{pagenumber}{\sffamily\bfseries\footnotesize}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Deliberately blank pages with message
% Occurs if new chapter starts (opens right) but previous chapter ended on
% a recto (right) page itself.
% The intermediate left page will be blank; leave a message that this is intentional.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\blankpage}{% https://tex.stackexchange.com/a/205536/120853
\par\vspace*{\fill}%
\begin{center}
\textcolor{g2}{%
\TransBlankPage{}% See translations file
}%
\end{center}
}%
\DeclareNewLayer[% Create new layer under some name
foreground,%
textarea,%
contents=\blankpage,%
]{blankpage.fg}
\DeclarePageStyleByLayers{blank}{blankpage.fg}% Make layer available as pagestyle
\KOMAoptions{cleardoublepage=blank}% Use pagestyle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typesetting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Using 'shortcuts' package option, do e.g. 'fast\-/paced' to get a breakable
% 'fast-pace' word in print.
% Otherwise, LaTeX does not hyphenate/linebreak words that already come with a hyphen,
% since that could be ambiguous
\RequirePackage[shortcuts]{extdash}
\RequirePackage{microtype}% Advanced typesetting for kerning etc.
% Dummy text in readable English (Other languages are also detected)
% Provides a more realistic preview than Lorem Ipsum
\RequirePackage{blindtext}
\RequirePackage{pdflscape}% Pages in landscape format
\RequirePackage{url}% Escaping special chars as URL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Language Support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{polyglossia}% Language rules. Replacement for babel in lualatex
% Expand this properly; the version without \expandsafters does not work fully.
% It works this way:
% The first \expandafter is seen, so the following \setdefaultlanguage is not
% expanded and skipped.
% Next, the second \expandafter is looked at. It sees the token { next, saving it
% for later.
% \acp@language is then expanded fully, to the current language.
% What is left is a properly working string, \setdefaultlanguage{<language string>}
\expandafter\setdefaultlanguage\expandafter{\acp@language }
% Whatever main language (setmainlanguage = setdefaultlanguage) was loaded, we want
% the "other" one (since we expect only English and German) to be available as a
% secondary language. This is very convenient if for example a thesis is in English,
% but certain parts have to be in German, e.g. for legal reasons. A simple switch
% \begin{german} ... \end{german} would then achieve that.
\setotherlanguages{german,english}
% Proper quotation support, mainly through \enquote
\RequirePackage[
autostyle=true,% true always adapts quotes to current language
]
{csquotes}
% Add itshape to beginning (beg) of display quote environments:
\renewcommand*{\mkbegdispquote}[2]{\itshape}
\RequirePackage[inline]{enumitem}% Custom list environments
\setlist{noitemsep}% No vertical spacing in lists
\setlist[1]{labelindent=\parindent}% Indent lists by paragraph indent
% Refer to unimath_symbols.pdf for source of \smblksquare etc.:
% https://ctan.org/texarchive/macros/latex/contrib/unicode-math
\setlist[itemize,1]{label=\smblksquare}%
\setlist[enumerate]{font=\sffamily\bfseries}
% For compact itemize lists within table cells:
\newlist{tabitemize}{itemize}{1}% Second argument is max. depth
\setlist[tabitemize]{%
label=\smblksquare,%
nosep,% nosep kills all vertical spacing
align=parleft,
leftmargin=*,
% https://tex.stackexchange.com/a/443573/120853,
% but before=\compress didn't work:
after=\vspace{-\baselineskip},
before=\vspace{-0.75\baselineskip},% Hacky manual parameter
}
% For compact enumerations lists within table cells:
\newlist{tabenum}{enumerate}{1}% Second argument is max. depth
\setlist[tabenum]{
label={\arabic*.},
font=\sffamily\bfseries,
leftmargin=*,
nosep,% nosep kills all vertical spacing
align=parleft,
% https://tex.stackexchange.com/a/443573/120853,
% but before=\compress didn't work:
after=\vspace{-\baselineskip},
before=\vspace{-0.75\baselineskip},% Hacky manual parameter
}
% An enumerated description list:
% https://tex.stackexchange.com/a/30035/120853
\newcounter{descriptcount}
\newlist{enumdescript}{description}{2}% Derive from existing description env.
\setlist[enumdescript, 1]{% Set first level action
before={%
\setcounter{descriptcount}{0}%
% \renewcommand*\thedescriptcount{\alph{descriptcount}}%
},
font={\bfseries\stepcounter{descriptcount}\thedescriptcount.~}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Floats