-
Notifications
You must be signed in to change notification settings - Fork 2
/
hpitr.dtx
4750 lines (4426 loc) · 166 KB
/
hpitr.dtx
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
% \iffalse meta-comment
% hpitr.dtx
% Copyright (c) Daniel Richter, Uwe Hentschel 2013-2014
% Copyright (c) Tobias Pape, 2014-2021
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer and author of this work is Tobias Pape.
%
% This work consists of the file `hpitr.dtx'.
%
%<*dtx|ins>
\expandafter\ifx\csname ProvidesFile\endcsname\relax
\def\ProvidesFile#1[#2]{\message{#1: #2}}%
\fi
%</dtx|ins>
%<class>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<class>\ProvidesClass{hpitr}%
%<*dtx|ins|doc|manual>
\ProvidesFile{%
hpitr%
%<doc&!manual> -source%
%<de> -de%
%<dtx> .dtx%
%<ins> .ins%
%<doc> .ltx%
}%
%</dtx|ins|doc|manual>
%<README>hpitr
%<README>=====
%<README> Copyright (c) Tobias Pape <tobias.pape at hpi.uni-potsdam.de>
%<*dtx|ins|doc|class|README>
%<*!README>
[%
%</!README>
2021/10/05 v2.1
%<README>
%<!README>^^J
A unified class for Technical Reports at the HPI
%<*!README>
]
%</!README>
%</dtx|ins|doc|class|README>
% \fi^^A meta-comment
% ^^A
%
% \changes{v0.1}{2014/06/01}{Initial class derived from \Class{polze.cls}}
% \changes{v0.2}{2014/07/10}{Minimal changes to play nice with babel and
% subcaption}
% \changes{v0.5}{2014/08/15}{Small fixes to abstract and title, loading of float}
% \changes{v0.6}{2014/08/27}{Provide \cs{keywords} command.}
% \changes{v0.7}{2014/09/04}{Discriminate between proceedings and collections}
% \changes{v0.9}{2014/09/30}{Add inproceedings pseudo-trtype}
% \changes{v1.0}{2015/01/15}{First release}
% \changes{v1.1}{2015/02/13}{golden ratio text block, record prc, make
% copyright an option, inproceedings example}
% \changes{v1.1a}{2015/03/24}{Compatibility for older \TeX en}
% \changes{v1.1b}{2015/03/26}{Font load order}
% \changes{v1.1c}{2015/07/13}{Allow for empty groups in proceedings}
% \changes{v1.1d}{2015/09/30}{Use \Package{hypcap}; \cs{lstinline} fix for contrib
% inclusion; use \Package{ltxcmds} version of some commands}
% \changes{v1.2}{2015/12/02}{Revert to Palatino as maths font}
% \changes{v1.3}{2016/06/23}{Disable \cs{hyphsubst} for \LuaTeX}
% \changes{v1.4}{2016/09/01}{Fix compatibility (\ghissue{2}, \ghissue{4},
% \ghissue{5}), add \Package{extdash} (\ghissue{8}), announce automatic chapter
% labels (\ghissue{15}), robustify with \Package{hardwrap} (\ghissue{16})}
% \changes{v1.5}{2017/03/03}{Expand \File{README} a little bit}
% \changes{v1.6}{2017/08/09}{Only predef quotes when \Package{xunicode} is there.}
% \changes{v1.7}{2018/02/10}{Split the documentation (\ghissue{1}).}
% \changes{v1.8}{2019/02/28}{Add appendix support for collections.}
% \changes{v1.9}{2019/09/27}{Make sure colors from ps are preferred.}
% \changes{v2.0}{2019/11/20}{Robustify patching, move appendices before bibs.}
% \changes{v2.1}{2021/10/05}{Add \cs{weblink}, \Package{fncpt}, ban
% \Package{flafter}, early \Package{auxhook} etc.}
% \GetFileInfo{hpitr.dtx}
%^^A
%^^A
%^^A
%
% \makeatletter
% ^^A Heiko Oberdiek's fix from latexbugs (latex/3540):
% \expandafter\DoNotIndex
% \expandafter{\detokenize{\#,\$,\^,\_,\|,\~,\ ,\&,\<,\>}}
% \def\PercentIndex{}\def\LeftBraceIndex{}\def\RightBraceIndex{}
%
% ^^A Non-Index list derived from microtype.dtx and titlepage.dtx
%
% \DoNotIndex{\!,\",\',\(,\),\*,\+,\,,\-,\.,\/,\:,\;,\=,\?,\@Alph,\@M}
% \DoNotIndex{\@addtoreset,\@arabic,\@classoptionslist,\@currext}
% \DoNotIndex{\@currname,\@dotsep,\@empty,\@firstofone,\@float,\@gobble}
% \DoNotIndex{\@highpenalty,\@ifpackagelater,\@ifundefined,\@makeother}
% \DoNotIndex{\@minus,\@ne,\@nil,\@plus,\@tempa,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempdimc,\@tocrmarg,\@topnum,\AtBeginDocument,\Class}
% \DoNotIndex{\CodelineIndex,\CurrentOption,\DeclareOption}
% \DoNotIndex{\DeclareRobustCommand,\DoNotIndex,\EnableCrossrefs,\File}
% \DoNotIndex{\IfFileExists,\InputIfFileExists,\MessageBreak}
% \DoNotIndex{\OnlyDescription,\Option,\Package,\PassOptionsToPackage}
% \DoNotIndex{\PrintChanges,\PrintIndex,\ProvidesClass,\RequirePackage}
% \DoNotIndex{\[,\\,\],\`,\addcontentsline,\addpenalty,\addtocontents}
% \DoNotIndex{\addvspace,\advance,\baselineskip,\begin,\begingroup}
% \DoNotIndex{\bfseries,\bgroup,\c@figure,\c@table,\catcode,\cdot}
% \DoNotIndex{\centering,\changes,\char,\cleardoublepage,\clearpage,\cs}
% \DoNotIndex{\csname,\csuse,\def,\dimexpr,\documentclass,\edef,\else}
% \DoNotIndex{\em,\emph,\empty,\end,\endcsname,\endgroup,\endinput}
% \DoNotIndex{\endlist,\endtitlepage,\expandafter,\fi,\futurelet,\gdef}
% \DoNotIndex{\global,\hbox,\hsize,\hskip,\hspace,\hss,\if,\ifcase}
% \DoNotIndex{\ifdim,\iffalse,\ifmmode,\ifnum,\ifx,\immediate,\include}
% \DoNotIndex{\input,\item,\itshape,\jobname,\languagename,\leavevmode}
% \DoNotIndex{\leftskip,\let,\lineskip,\list,\long,\m@ne,\m@th}
% \DoNotIndex{\makeatletter,\markboth,\mathbf,\mathit,\mathrm,\mbox}
% \DoNotIndex{\newblock,\newcommand,\newcounter,\newenvironment,\newpage}
% \DoNotIndex{\newtoks,\nobreak,\noexpand,\noindent,\normalcolor}
% \DoNotIndex{\normalfont,\normalsize,\null,\or,\pagenumbering}
% \DoNotIndex{\pagestyle,\par,\paragraph,\parbox,\parfillskip,\penalty}
% \DoNotIndex{\pretolerance,\protect,\providecommand,\raggedbottom}
% \DoNotIndex{\raggedright,\refstepcounter,\relax,\renewcommand}
% \DoNotIndex{\rightmargin,\rightskip,\rmfamily,\setbox,\setcounter}
% \DoNotIndex{\setlength,\sffamily,\skip,\sloppy,\space,\string,\the}
% \DoNotIndex{\thispagestyle,\ttfamily,\typeout,\unskip,\vbox,\vfil}
% \DoNotIndex{\vspace,\wd,\xdef,\year}
% \makeatother
%
%^^A
%^^A
%^^A
% \StopEventually{
% \newpage
% \appendix
% \PrintChanges
% \PrintIndex
% }
%
% \section{Implementation}
% \label{sec:Implementation}
%
% \subsection{The Installation Driver `\protect\File{hpitr.ins}'}
% \label{sec:hpitr-ins}
% \iffalse meta-comment
%<*dtx|ins>
% \fi ^^A meta-comment
% First of all we produce \File{hpitr.ins}, the installation driver. It
% starts very common with loading \File{docstrip}, preamble declaration and
% start of generation.
% \begin{macrocode}
\ifx\documentclass\@undefined\relax
\input pdftexcmds.sty
\else
\RequirePackage{pdftexcmds}
\makeatletter
\fi
\def\batchfile{hpitr.dtx}
\input docstrip.tex
\ifToplevel{%
\Msg{********************************************************************}
\Msg{*}
\Msg{* Steps of hpitr generation:}
\Msg{* ==========================}
\Msg{*}
\Msg{* - Generation of all needed files:}
\keepsilent
\askforoverwritefalse
}
\preamble
Copyright (c) Daniel Richter, Uwe Hentschel 2013-2014
Copyright (c) Tobias Pape, 2014-2021
This file was generated from file(s) of hpitr distribution.
----------------------------------------------------------------------
This work may be distributed and/or modified under the conditions of
the LaTeX Project Public License, version 1.3c of the license.
The latest version of this license is in
http://www.latex-project.org/lppl.txt
and version 1.3c or later is part of all distributions of LaTeX
version 2005/12/01 or later.
This work has the LPPL maintenance status "maintained".
The Current Maintainer and author of this work is Tobias Pape.
This file may only be distributed together with the file
`hpitr.dtx'. You may however distribute the file `hpitr.dtx'
without this file.
\endpreamble
\generate{%
% \end{macrocode}
% But while the dtx file is the ins file itself, we will never generate this
% file.\\
% |\file{hpitr.ins}{\from{hpitr.dtx}{ins}}% not needed|
% \begin{macrocode}
\file{hpitr.cls}{\from{hpitr.dtx}{class}}%
\file{hpitr-source.ltx}{\from{hpitr.dtx}{doc,en}}%
\file{hpitr.ltx}{\from{hpitr.dtx}{doc,manual,en}}%
\file{hpitr-de.ltx}{\from{hpitr.dtx}{doc,manual,de}}%
\nopreamble\nopostamble
\file{example-single.tex}{\from{hpitr.dtx}{example,single}}%
\file{example-singlea.tex}{\from{hpitr.dtx}{example,single,article}}%
\file{example-proceedings.tex}{\from{hpitr.dtx}{example,proceedings}}%
\file{example-inproceedings.tex}{\from{hpitr.dtx}{example,inproceedings,article}}%
\file{README.txt}{\from{hpitr.dtx}{README}}%
\file{README.md}{\from{hpitr.dtx}{README}}%
}%
% \end{macrocode}
% After file generation, we use shell escapes (aka \verb|\write18|
% feature) --- if available -- to create \File{hpitr.pdf}, the
% manual, and \File{hpitr-source.pdf}, the full documentation
% including source code.
% \begin{macrocode}
\ifToplevel{%
\Msg{* \space\space done.}
}
\ifnum1=\pdf@shellescape\relax
\immediate\write18{lualatex -interaction=nonstopmode hpitr.ltx}
\immediate\write18{mkindex hpitr}
\immediate\write18{lualatex -interaction=nonstopmode hpitr.ltx}
\immediate\write18{mkindex hpitr}
\immediate\write18{lualatex -interaction=nonstopmode hpitr.ltx}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-de.ltx}
\immediate\write18{mkindex hpitr-de}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-de.ltx}
\immediate\write18{mkindex hpitr-de}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-de.ltx}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-source.ltx}
\immediate\write18{mkindex hpitr-source}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-source.ltx}
\immediate\write18{mkindex hpitr-source}
\immediate\write18{lualatex -interaction=nonstopmode hpitr-source.ltx}
\immediate\write18{lualatex -interaction=nonstopmode example-inproceedings}
\immediate\write18{biber example-inproceedings}
\immediate\write18{lualatex -interaction=nonstopmode example-inproceedings}
\immediate\write18{lualatex -interaction=nonstopmode example-inproceedings}
\fi
\ifToplevel{%
\Msg{* \space\space done.}
\Msg{*}
\Msg{* You may install all the files now.}
\Msg{*}
\Msg{********************************************************************}
}
% \end{macrocode}
% At docstrip, this concludes the run.
% \begin{macrocode}
\endbatchfile
\csname endinput\endcsname
% \end{macrocode}
% \iffalse meta-comment
%</dtx|ins>
% \fi^^A meta-comment
%^^A
%^^A
%^^A
% \iffalse meta-comment
%<*class>
% \fi^^A meta-comment
%
% \subsection{The Tech Report Class}
%
% \subsubsection{Identification and Error handling}
% \changes{v1.4}{2016/09/01}{Use \Package{hardwrap} for error messages (see \ghissue{16}).}
% \begin{macrocode}
\edef\TR@ClassName{\@currname}
\RequirePackage{hardwrap}
\def\HardWrapSetup{%
\def\MessageBreak{\\}%
\def\newline{\\}}
\GenerateLogMacros{class}[TR]{\TR@ClassName}
\newcommand*\TR@fonterror{\TR@error{%
Old font commands are not to be used}}
% \end{macrocode}
%
% \subsubsection{Preparation}
% Some basic tools we need everywhere: Common macros, the KOMA-Script base
% package. Also, all the conditionals we might need.
% \changes{v2.0}{2019/11/20}{Robustify patching}
% \changes{v2.1}{2021/10/13}{Load \Package{auxhook} early
% (\ghissue{27}), drop ifthen}
% \begin{macrocode}
\RequirePackage{etexcmds,etoolbox,xpatch,ltxcmds,auxhook}
\RequirePackage{scrbase}[2013/12/19]
\RequirePackage{ifdraft,iftex,ifxetex,ifluatex}
% \end{macrocode}
% \changes{v2.1}{2021/10/13}{Compatibility shim for old
% \Package{iftex}}
% \begin{macrocode}
\ifcsundef{iftutex}%
{\ifboolexpr{bool {luatex} or bool {xetex}}%
{\csletcs{iftutex}{iftrue}}%
{\csletcs{iftutex}{iffalse}}}
{}
% \end{macrocode}
% \changes{v2.1}{2021/10/13}{one-armed ifs}
\newcommand*{\whenbool}[1]{%
\ifcsundef{if#1}
{\etb@err@nobool{#1}\@gobble}
{\csname if#1\endcsname
\expandafter\@firstofone
\else
\expandafter\@gobble
\fi}}
\newcommand*{\whennotbool}[1]{%
\ifcsundef{if#1}
{\etb@err@nobool{#1}\@gobble}
{\csname if#1\endcsname
\expandafter\@gobble
\else
\expandafter\@firstofone
\fi}}
% \begin{macrocode}
%
% \subsubsection{Initialization}
% First, option handling.
%
% We need to reach into the gut of latex' kernel to push back global vars which
% we consumed. This makes it possible to, eg, consume |draft| but also pass it on.
% \begin{macrocode}
\newcommand*\@pushback@classoption[1]{%
\xdef\@classoptionslist{%
\ifx\@classoptionslist\@empty\else\@classoptionslist,\fi
#1}%
}
% \end{macrocode}
% Inspired by KOMA, a command that ensures execution after the class has been
% loaded.
% \begin{macrocode}
\newcommand*{\TR@NowButAtEndOfClass}{\AtEndOfClass}
\AtEndOfClass{\let\TR@NowButAtEndOfClass\@firstofone}
% \end{macrocode}
% Set up |hpitr| key-value settings, inspired by the base ``family'' in |scrkbase|.
% \begin{macrocode}
\DefineFamily{hpitr}
\def\TRFamily{\DefineFamilyMember{hpitr}}
\TRFamily%
\newcommand*{\TRKey}[1][.\@currname.\@currext]{%
\DefineFamilyKey[#1]{hpitr}%
}
\newcommand*{\TRExecuteOptions}[1][.\@currname.\@currext]{%
\FamilyExecuteOptions[#1]{hpitr}%
}
\newcommand*{\TRoptions}{\FamilyOptions{hpitr}}
\newcommand*{\AfterTRoptions}{}
\let\AfterTRoptions\AtEndOfFamilyOptions
\newcommand*{\TRoption}{\FamilyOption{hpitr}}
\newcommand*{\TRnewif}{\TRFamily\FamilyBoolKey{hpitr}}
\newcommand*{\TRsetif}{\FamilySetBool{hpitr}}
\newcommand*{\TRnewnumc}{\TRFamily\FamilyNumericalKey{hpitr}}
\newcommand*{\TRsetnumc}{\FamilySetNumerical{hpitr}}
\newcommand*{\TRnewifStd}[1]{%
\newbool{TR@#1}
\TRnewif{#1}{TR@#1}}
\newcommand*{\TR@curropt}{}
\newcommand*{\TRStdOption}[3][]{%
\let\TR@curropt\CurrentOption
\DeclareOption{#2}{
#1%
\TRExecuteOptions{#3}}
\let\CurrentOption\TR@curropt
}
\providebool{@draft}
\newbool{TR@fulldraft}
\TRKey{draft}[true]{%
\TRsetif{draft}{@draft}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\boolfalse{TR@fulldraft}
\else
\ifstr{#1}{full}{%
\booltrue{@draft}
\booltrue{TR@fulldraft}
}{}
\fi
\AfterTRoptions{
\whenbool{@draft}{
\@pushback@classoption{draft}
\whennotbool{TR@fulldraft}{
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\PassOptionsToPackage{final}{listings}
% \end{macrocode}
% \changes{v0.3a}{2014/08/08}{Require \Package{grffile} for non-trivial file names}
% For non-fulldraft to work with grffile, we unconditionally use the
% graphics internal draft boolean.
% \begin{macrocode}
\AtBeginDocument{\Gin@draftfalse}%
% \end{macrocode}
% \begin{macrocode}
}}}}
\TRStdOption{final}{draft=false}
\TRStdOption{draft}{draft=true}
%% name of the base class
\providecommand*\TR@BaseClass{\@empty}
% \end{macrocode}
% \subsubsection{Contribtools Author Access}
% Author-level access for the |contribtools| style titles
% \begin{macrocode}
\newbool{TR@firsttitleseen}
\boolfalse{TR@firsttitleseen}
% \end{macrocode}
% \begin{option}{contribtools}
% Force the use of |contribtools| in formats that otherwise do not
% use them. \emph{Not documented!}
% \begin{macrocode}
\TRnewifStd{contribtools}
\TRStdOption{contribtools}{contribtools=true}
% \end{macrocode}
% \end{option}
% \begin{macro}{\setcontribmaketitle}
% Force the use of the ``individual contribution style" title, as
% use with |inproceedings|. \emph{Not documented!}.
% \begin{macrocode}
\newcommand*\setcontribmaketitle{%
\AtBeginDocument{%
\whenbool{TR@contribtools}%
{\booltrue{TR@firsttitleseen}%
\let\maketitle\TR@contrib@maketitle%
\let\author\TR@contrib@author%
\lehead{\TR@titlemark}}}}
% \end{macrocode}
% \end{macro}
% \subsubsection{Contribtools Author Access}
% Author-level access for the |contribtools| style titles
% \begin{macrocode}
% \end{macrocode}
% \subsubsection{Various Flags for Report Type}
% \begin{macrocode}
\newbool{TR@proceedings}
\newbool{TR@collection}
\newbool{TR@inproceedings}
\newbool{TR@chapters}
\booltrue{TR@chapters}
% \end{macrocode}
% \begin{option}{chapterbib}
% \begin{macrocode}
\TRnewifStd{chapterbib}
\TRStdOption{chapterbib}{chapterbib=true}
% \end{macrocode}
% \end{option}
%
% \begin{option}{copyrightmark}
% \changes{v1.1}{2015/02/13}{Optionalize copyright mark} %
% Provide an option to not include a copyright information in the pdf
% metadata.
% \begin{macrocode}
\TRnewifStd{copyrightmark}
\TRStdOption{copyrightmark}{copyrightmark=true}
\TRStdOption{nocopyrightmark}{copyrightmark=false}
% \end{macrocode}
% \end{option}
% \subsubsection{Type of Report}
% \begin{option}{trtype}
% \begin{macrocode}
\TRKey{trtype}{
\TRsetnumc{trtype}{@tempa}{%
{singlearticle}{0},{article}{0},%
{singlereport}{1},{report}{1},%
{proceedings}{2},%
{collection}{3},%
{inproceedings}{4}%
}{#1}
\ifcase \@tempa\relax
\renewcommand*\TR@BaseClass{scrartcl}
\boolfalse{TR@proceedings}
\boolfalse{TR@collection}
\boolfalse{TR@chapters}
\boolfalse{TR@contribtools}
\or
\renewcommand*\TR@BaseClass{scrreprt}
\boolfalse{TR@proceedings}
\booltrue{TR@chapters}
\boolfalse{TR@collection}
\boolfalse{TR@contribtools}
\or
\renewcommand*\TR@BaseClass{scrbook}
\booltrue{TR@proceedings}
\booltrue{TR@contribtools}
\boolfalse{TR@collection}
\booltrue{TR@chapters}
\booltrue{TR@chapterbib}
\or
\renewcommand*\TR@BaseClass{scrbook}
\boolfalse{TR@proceedings}
\booltrue{TR@collection}
\booltrue{TR@contribtools}
\booltrue{TR@chapters}
\or
\renewcommand*\TR@BaseClass{scrartcl}
\booltrue{TR@proceedings}
\booltrue{TR@contribtools}
\boolfalse{TR@collection}
\boolfalse{TR@chapters}
\boolfalse{TR@chapterbib}
\booltrue{TR@inproceedings}
\AtBeginDocument{%
\booltrue{TR@firsttitleseen}%
\clearheadinfo%
}
\fi
}
% \end{macrocode}
% \end{option}
% Non--key-value--style options for the above.
% \begin{option}{single}
% \begin{macrocode}
\TRStdOption{single}{trtype=singlereport}
% \end{macrocode}
% \end{option}
% \begin{option}{singlereport}
% \begin{macrocode}
\TRStdOption{singlereport}{trtype=singlereport}
% \end{macrocode}
% \end{option}
% \begin{option}{singlearticle}
% \begin{macrocode}
\TRStdOption{singlearticle}{trtype=singlearticle}
% \end{macrocode}
% \end{option}
% \begin{option}{proceedings}
% \begin{macrocode}
\TRStdOption{proceedings}{trtype=proceedings}
% \end{macrocode}
% \end{option}
% \begin{option}{inproceedings}
% \begin{macrocode}
\TRStdOption{inproceedings}{trtype=inproceedings}
% \end{macrocode}
% \end{option}
% \begin{option}{collection}
% \begin{macrocode}
\TRStdOption{collection}{trtype=collection}
% \end{macrocode}
% \end{option}
% \begin{macrocode}
\TRnewifStd{inproceedingspagenumbers}
% \end{macrocode}
%
%
% \subsubsection{Customization of the Table of Contents}
% Helper macros for \Option{intoc}
% \begin{macrocode}
\def\TR@toc@enable#1{\AtBeginDocument{%
\global\csletcs{#1tocdepth}{TR@toc@#1@level}%
\global\csletcs{toclevel@#1}{TR@toc@#1@toclevel}}}
\def\TR@toc@disable#1{\AtBeginDocument{%
\global\csdef{#1tocdepth}{9999}%
\global\cslet{toclevel@#1}\maxdimen}}
% \end{macrocode}
%
% \begin{option}{intoc}
% \begin{macrocode}
\TRKey{intoc}{
\TRsetnumc{intoc}{@tempa}{%
{title}{0}, {notitle}{1},%
{author}{2}, {noauthor}{3},%
{affiliation}{4}, {noaffiliation}{5},%
{principalInvestigator}{6}, {noprincipalInvestigator}{7},%
{event}{8}, {noevent}{9},%
{all}{10}%
}{#1}
\ifcase \@tempa\relax
\TR@toc@enable{title}
\or\TR@toc@disable{title}
\or\TR@toc@enable{author}
\or\TR@toc@disable{author}
\or\TR@toc@enable{affiliation}
\or\TR@toc@disable{affiliation}
\or\TR@toc@enable{principalInvestigator}
\or\TR@toc@disable{principalInvestigator}
\or\TR@toc@enable{event}
\or\TR@toc@disable{event}
\or
\TR@toc@enable{title}
\TR@toc@enable{author}
\TR@toc@enable{affiliation}
\TR@toc@enable{principalInvestigator}
\TR@toc@enable{event}
\else
\TR@error{Unknown key #1}
\fi
}
% \end{macrocode}
% \end{option}
% \begin{macrocode}
\TRnewifStd{todotools}
\TRnewifStd{egiecomma}
\errorcontextlines=999
%% execute the standard options
\TRExecuteOptions{
trtype=singlereport,%
copyrightmark=true,%
}
\TRExecuteOptions{
intoc=noevent,%
intoc=noprincipalInvestigator,%
intoc=title,%
intoc=author,%
intoc=noaffiliation,%
}
\FamilyProcessOptions{hpitr}\relax
% \end{macrocode}
%
% Load base class file
% \begin{macrocode}
\LoadClass{\TR@BaseClass}
% \end{macrocode}
% \changes{v1.3}{2016/06/23}{Make greek letters work in \pdfTeX}
% \begin{macrocode}
\RequirePackage[LGR,OT1,LY1,T1]{fontenc}
\notbool{tutex}{%
\RequirePackage[utf8]{inputenx}
\input{ix-utf8enc.dfu}
\RequirePackage{alphabeta}
}{}
% \end{macrocode}
% With \TeX Live 2016, \LuaTeX\ does not expose most \pdfTeX\ primitives under
% the \cs{pdf..} names. Currently, some packages still rely on this, however.
% So we use \cs{luatex85}. Since the package first appeared in 2016, it is a
% good way to see whether we need it in the first place.
% \begin{macrocode}
\ifbool{luatex}{%
\IfFileExists{luatex85.sty}{%
\RequirePackage{luatex85}}{}}{}%
% \end{macrocode}
% Set basic paper and typearea options
% \begin{macrocode}
\KOMAoptions{
twocolumn=false,
fontsize=11pt,
footinclude=false,
headinclude=false,
}
\KOMAoptions{%
pagesize=auto,
paper=a4,
DIV=9,
twoside=semi,
}
% \end{macrocode}
%
% Adjust the text block to exhibit a \(\phi\) ratio (golden ratio).
% \mbox{}
% \changes{v1.1}{2015/02/13}{golden ratio textblock}
% \begin{macrocode}
\areaset[current]{\textwidth}{1.61803399\textwidth}
\AtEndPreamble{\recalctypearea}
% \end{macrocode}
%
% \begin{macrocode}
\ifboolexpr{bool {TR@proceedings} and bool{TR@chapters}}{
\KOMAoption{open}{right}
}{}
% \end{macrocode}
% \changes{v1.4}{2016/09/01}{Load \Package{fixltx2e} only if necessary (see \ghissue{2})}
% \begin{macrocode}
\IfFileExists{latexrelease.sty}%
{\PreventPackageFromLoading*[%
\typeout{avoid fixltx2e if it does nothing in the first place}]%
{fixltx2e}}
{\RequirePackage{fixltx2e}}%
\RequirePackage{scrhack}
\PassOptionsToPackage{log-declarations=false}{xparse}
\RequirePackage{expl3}[2011/09/05]
\RequirePackage{xparse}
% https://tex.stackexchange.com/questions/185713/fontspec-2-4-and-scale-matchlowercase-causes-error
\ExplSyntaxOn
\cs_if_free:NTF \fp_div:Nn
{
\cs_new_protected:Npn \fp_div:Nn #1 #2
{
\fp_set:Nn #1 { #1/#2 }
}
}{}
\ExplSyntaxOff
% \end{macrocode}
%\subsubsection{Title}
%
% No actual title, only a titlepage page when in draft mode.
%
% However, we collect the information for the pdf and also for
% convenience.
% \changes{v0.4}{2014/08/12}{Delay \cs{title}/\cs{author} pdf setting
% to latest point}
% \begin{macrocode}
\@ifpackagelater{scrbase}{2013/12/19}{%
\KOMAoption{titlepage}{firstiscover}
}{
\KOMAoption{titlepage}{yes}
}
\xapptocmd{\title}{%
\AfterPreamble{
\begingroup
\appto\pdfstringdefPreHook{\def\\{\space\ignorespaces}}
\hypersetup{pdftitle={#1}}
\endgroup}}
{}{%
\TR@warning@noline{Cannot patch \string\title to set pdftitle}}
\xapptocmd{\author}{%
\AfterPreamble{
\begingroup
\appto\pdfstringdefPreHook{\def\and{,\space\ignorespaces}}
\hypersetup{pdfauthor={#1}}
\endgroup}
}
{}{%
\TR@warning@noline{Cannot patch \string\author to set pdfauthor}}
% \end{macrocode}
%
% \begin{macro}{\email}
% \mbox{}
%\changes{v0.4}{2014/08/12}{Provide \cs{email} based on \Package{hyperref}}
% \begin{macrocode}
\providecommand*\email[1]{\href{mailto:#1}{\nolinkurl{#1}}\xspace}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\hairspace}
% \mbox{}
%\changes{v0.8}{2014/09/26}{Provide \cs{hairspace}}
% \begin{macrocode}
\providecommand*\hairspace{\ifmmode\mskip1mu\else\kern0.08em\fi}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eg}
% \begin{macro}{\Eg}
% \begin{macro}{\ie}
% \begin{macro}{\Ie}
% \begin{macro}{\zB}
% \begin{macro}{\ZB}
% \begin{macro}{\dh}
% \begin{macro}{\Dh}
% \mbox{}
%\changes{v0.8}{2014/09/26}{Provide convenient abbreviations}
% \begin{macrocode}
\ifbool{TR@egiecomma}{
\providecommand*\eg{e.\hairspace{}g.,\xspace}
\providecommand*\Eg{E.\hairspace{}g.,\xspace}
\providecommand*\Ie{I.\hairspace{}e.,\xspace}
\providecommand*\ie{i.\hairspace{}e.,\xspace}
}{
\providecommand*\eg{e.\hairspace{}g.\xspace}
\providecommand*\Eg{E.\hairspace{}g.\xspace}
\providecommand*\Ie{I.\hairspace{}e.\xspace}
\providecommand*\ie{i.\hairspace{}e.\xspace}
}
\providecommand*\zB{z.\hairspace{}B.\xspace}
\providecommand*\ZB{Z.\hairspace{}B.\xspace}
\providecommand*\dh{d.\hairspace{}h.\xspace}
\providecommand*\Dh{D.\hairspace{}h.\xspace}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\weblink}
% \changes{v2.1}{2021/10/05}{Add \cs{weblink} (\ghissue{18}).}
% \cs{weblink} is a tiny helper to consistently put \textsc{url}s in
% footnotes and to not forget the last-accessed--date.
% \begin{macrocode}
\providecommand*\weblink[2][\today]{\footnote{\url{#2} (last accessed {#1}).}}
% \end{macrocode}
% \end{macro}
%^^A
% Titlepage
%^^A
% \changes{v0.4}{2014/08/12}{If draft-titlepage, set its numbering in Roman
% (for \pdfTeX)}
% \begin{macrocode}
\ifbool{@draft}{
\AtBeginDocument{
\setkomafont{author}{\normalfont\normalsize}
\setkomafont{date}{\normalfont\normalsize}
\setkomafont{dedication}{\normalfont\normalsize}
\setkomafont{publishers}{\normalfont\normalsize}
\setkomafont{subtitle}{\normalfont\small}
\setkomafont{title}{\normalfont\normalsize}
\setkomafont{titlehead}{\normalfont\normalsize}
}
\pretocmd{\titlepage}{%
\whenbool{@mainmatter}{\pagenumbering{Roman}}
\let\center\flushright%
\let\endcenter\endflushright%
\let\huge\normalsize%
}{}{%
\TR@warning@noline{Cannot patch \string\maketitle}}
\xapptocmd{\endtitlepage}{%
\cleardoubleemptypage%
\ifbool{@mainmatter}{%
\pagenumbering{arabic}}{%
\pagenumbering{roman}}
\whennotbool{TR@inproceedingspagenumbers}{%
\setcounter{page}{5}%
}
\relax%
}{}{%
\TR@warning@noline{Cannot patch \string\maketitle}}
}{%
\def\maketitle{%
\whennotbool{TR@inproceedingspagenumbers}{%
\setcounter{page}{5}%
}\relax}
}
% \end{macrocode}
% ToC-formatters for proceedings contributions.\\
% Note: these have to be done at toplevel, currently, or else there
% will be errors when |\TOCEntryStyleStartInitCode| is executed.
%
% This consists of several parts to be configurable after the fact:
% \begin{itemize}
% \item the default values for |level| aka |tocdeph| for the ToC as
% done by \Package{tocbasic}, and |toclevel| as used by
% \Package{hyperref}, for the PDF bookmarks;
% \begin{macrocode}
\def\TR@toc@event@level{-1}
\let\TR@toc@event@toclevel\TR@toc@event@level
\def\TR@toc@principalInvestigator@level{-1}
\let\TR@toc@principalInvestigator@toclevel\TR@toc@principalInvestigator@level
\def\TR@toc@title@level{0}
\let\TR@toc@title@toclevel\TR@toc@title@level
\def\TR@toc@author@level{0}
\let\TR@toc@author@toclevel\maxdimen
\def\TR@toc@affiliation@level{0}
\let\TR@toc@affiliation@toclevel\maxdimen
% \end{macrocode}
% \item the indentation as used for the ToC, dependent on which
% elements are actually shown;
% \begin{macrocode}
\def\TR@toc@event@indent{0pt}
\def\TR@toc@principalInvestigator@indent{%
\ifnum\numexpr\eventtocdepth\relax>\numexpr\principalInvestigatortocdepth\relax%
0pt\else\the\dimexpr\TR@toc@event@indent + 15pt\relax\fi}
\def\TR@toc@title@indent{%
\ifnum\numexpr\principalInvestigatortocdepth\relax>\numexpr\titletocdepth\relax%
0pt\else\TR@toc@principalInvestigator@indent\fi}
\def\TR@toc@author@indent{\the\dimexpr\TR@toc@title@indent +15pt\relax}
\let\TR@toc@affiliation@indent\TR@toc@author@indent
% \end{macrocode}
% \item the ``toc styles'' themselves, starting with an edge case.
% \begin{itemize}
% \item the |chapter| style is not going to be used for
% non-collection/proceedings etc. but since this here
% is evaluated regardless of |trtype|, we have to
% emulate when the |chapter| style is not defined in
% the first place,
% \begin{macrocode}
\whennotbool{TR@chapters}{
\CloneTOCEntryStyle{section}{chapter}}
% \end{macrocode}
% \item the style for events (no page numbers, no
% indentation, bold, empty line before);
% \begin{macrocode}
\CloneTOCEntryStyle{chapter}{event}
\TOCEntryStyleStartInitCode{event}{%
\expandafter\providecommand%
\csname scr@tso@#1@pagenumberformat\endcsname[1]{}%
\expandafter\providecommand%
\csname scr@tso@#1@indent\endcsname{\csuse{TR@toc@#1@indent}}
}
\DeclareTOCStyleEntry[level=\TR@toc@event@level,numwidth=1.5em,beforeskip=\baselineskip]{event}{event}
% \end{macrocode}
% \item the style for principal investigators (just like
% events)
% \begin{macrocode}
\CloneTOCEntryStyle{chapter}{principalInvestigator}
\TOCEntryStyleStartInitCode{principalInvestigator}{%
\expandafter\providecommand%
\csname scr@tso@#1@pagenumberformat\endcsname[1]{}%
\expandafter\providecommand%
\csname scr@tso@#1@indent\endcsname{\csuse{TR@toc@#1@indent}}
}
\DeclareTOCStyleEntry[level=\TR@toc@principalInvestigator@level,numwidth=1.5em,beforeskip=\baselineskip]{principalInvestigator}{principalInvestigator}
% \end{macrocode}
% \item the style for titles (like sections, empty line
% before, dotted leaders);
% \begin{macrocode}
\CloneTOCEntryStyle{section}{title}
\TOCEntryStyleStartInitCode{title}{%
\expandafter\providecommand%
\csname scr@tso@#1@indent\endcsname{\csuse{TR@toc@#1@indent}}
}
\DeclareTOCStyleEntry[level=\TR@toc@title@level,numwidth=1.5em,beforeskip=\baselineskip]{title}{title}
% \end{macrocode}
% \item the style for authors (indented to titles, no empty
% line before, italic, no leaders, no page numbers);
% \begin{macrocode}
\CloneTOCEntryStyle{section}{author}
\TOCEntryStyleStartInitCode{author}{%
\expandafter\providecommand%
\csname scr@tso@#1@entryformat\endcsname[1]{\itshape ##1}%
\expandafter\providecommand%
\csname scr@tso@#1@pagenumberformat\endcsname[1]{}%
\expandafter\providecommand%
\csname scr@tso@#1@linefill\endcsname{\hfill}
\expandafter\providecommand%
\csname scr@tso@#1@indent\endcsname{\csuse{TR@toc@#1@indent}}
}
\TOCEntryStyleInitCode{author}{
\AtBeginDocument{\csletcs{toclevel@#1}{TR@toc@#1@toclevel}}
}
\DeclareTOCStyleEntry[level=\TR@toc@author@level,numwidth=0pt]{author}{author}
% \end{macrocode}
% \item the style for affiliations, derived from authors.
% Affiliations will be separated by newlines instead of
% ``and''.
% \begin{macrocode}
\CloneTOCEntryStyle{author}{affiliation}
\TOCEntryStyleStartInitCode{affiliation}{%
\expandafter\providecommand%
\csname scr@tso@#1@entryformat\endcsname[1]{{%
\def\and{\unskip\newline}%
\itshape ##1}}%
}
\DeclareTOCStyleEntry[level=\TR@toc@affiliation@level,numwidth=0pt]{affiliation}{affiliation}
% \end{macrocode}
% \end{itemize}
% \end{itemize}
%
% \begin{macrocode}
\ifboolexpr{bool {TR@proceedings} or bool {TR@contribtools}}{
% \end{macrocode}
%
% Proceedings stuff.
% \begin{macro}{\event}
% Title of the event
% \changes{v0.4}{2014/08/12}{Delay to latest point for \Package{hyperref}}
% \changes{v1.8}{2019/02/13}{Clear out principal investigator when
% setting the event, so that it wont carry over}
% \begin{macrocode}
\newcommand*\event[1]{%
\gdef\@eventtitle{#1}%
\let\@principalInvestigator\@empty
\let\@lastprincipalInvestigator\@empty
\AfterPreamble{\hypersetup{pdfsubject = {Technical Report: #1}}}}
\def\@eventtitle{%
\TR@warning{No \string\event\space given}
\global\cslet{@eventtitle}\@empty}
\let\@lastevent\@empty
% \end{macrocode}
% \end{macro}
% \begin{macro}{\noevent}
% No event: clear it cleanly
% \changes{v0.4}{2014/08/12}{Provide \cs{noevent}}
% \begin{macrocode}
\newcommand*\noevent{\gdef\@eventtitle{}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\papernumber}
% Provide the number of the paper within the proceedings.
% \begin{macrocode}
\newcommand{\papernumber}[1]{%
\def\@papernumber{#1}
\ifx\@papernumber\empty
\else
\renewcommand*{\thepage}{\@papernumber-\arabic{page}}
\fi
}
\let\@papernumber\@empty
% \end{macrocode}
% \end{macro}
% \begin{macro}{\principalInvestigator}
% Name of person responsible for the work presented. This is only
% ever meaningful in project reports that are handed in in
% proceedings-style.
% \begin{macrocode}
\newcommand*\principalInvestigator[1]{%
\gdef\@principalInvestigator{#1}}
\let\@principalInvestigator\@empty
\let\@lastprincipalInvestigator\@empty
% \end{macrocode}