Newer
Older
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
%<*internal>
\iffalse
%</internal>
%<*readme> ^^A ---------- README -------------------------------------------------------
HsH-classes | LaTeX for the Hochschule Hannover
-----------:| ------------------------------------------------------------
Author | Jan Wille
E-mail | <mail@janiwlle.de>
License | Released under the LaTeX Project Public License v1.3c or later
See | <http://www.latex-project.org/lppl.txt>
This Project containes classes to create documents for the Hochschule Hannover.
To use them in you projects bring this folder on you `TEXINPUTS`.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%<*install> ^^A ---------- HsH-Classes.ins ---------------------------------------------
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
Copyright (C) 2024 by Jan Wille <mail@janiwlle.de>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version. The latest version of this license is in the file:
http://www.latex-project.org/lppl.txt
\endpreamble
\usedir{tex/latex/HsH-classes}
\generate{
\file{HsH-article.cls}{\from{\jobname.dtx}{article}}
\file{HsH-report.cls}{\from{\jobname.dtx}{report}}
\file{HsH-standalone.cls}{\from{\jobname.dtx}{standalone}}
}
%</install>
%<install>\endbatchfile
%<*internal> ^^A ---------- self-extract -----------------------------------------------
\usedir{source/latex/HsH-classes}
\generate{
\file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/HsH-classes}
\generate{
\file{README.md}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
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
%<*driver> ^^A ---------- file headers -------------------------------------------------
\ProvidesFile{HsH-classes.dtx}
%</driver>
%<article|report|standalone>\NeedsTeXFormat{LaTeX2e}[2022-06-01]
%<article>\ProvidesClass{HsH-article}
%<report>\ProvidesClass{HsH-report}
%<standalone>\ProvidesClass{HsH-standalone}
%<*article|report|standalone>
[2024-04-23 3.00 HsH-class based on KOMA]
%</article|report|standalone>
%<*driver> ^^A ---------- documentation driver -----------------------------------------
\documentclass{ltxdoc}
\usepackage{doc}[2022-06-01]
\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
\usepackage[numbered]{hypdoc}
\usepackage[style=ddmmyyyy,datesep={.}]{datetime2}
\usepackage{scrlogo}
%
\NewDocElement[idxgroup=classes]{Class}{class}
\NewDocElement{Option}{option}
\providecommand\opt{\texttt}
\newenvironment{options}%
{\begin{list}{}{%
\renewcommand{\makelabel}[1]{\opt{##1}\hfil}%
\setlength{\itemsep}{-.5\parsep}
\settowidth{\labelwidth}{\texttt{xxxxxxxxx\space}}%
\setlength{\leftmargin}{\labelwidth}%
\addtolength{\leftmargin}{\labelsep}}%
\raggedright}
{\end{list}}
\newenvironment{packages}%
{\begin{list}{}{%
\renewcommand{\makelabel}[1]{\pkg{##1}\hfil}%
\setlength{\itemsep}{-.5\parsep}
\settowidth{\labelwidth}{\texttt{xxxxxxx\space}}%
\setlength{\leftmargin}{\labelwidth}%
\addtolength{\leftmargin}{\labelsep}}%
\raggedright}
{\end{list}}
\newenvironment{note}[1]{\begin{quote}\textbf{Note:}\;#1}{\end{quote}}
\def\paragraph#1{\bigskip\textbf{#1}\\}
\newcommand\OR{\kern1pt{|}\kern1pt}
%
\renewcommand{\familydefault}{\sfdefault}
\setlength\parindent{0pt}
\setcounter{IndexColumns}{2}
\setlength\marginparsep{2\labelsep}
%
\EnableCrossrefs
\RecordChanges
%
\GetFileInfo{\jobname.dtx}
\title{
\textsf{HsH-Classes} --- A set of \LaTeX{} classes for use in Hochschule Hannover
\thanks{This file describes version \fileversion, last revised \filedate.}
}
\author{Jan Wille\thanks{E-mail: mail@janiwlle.de}}
\MaintainedBy{Maintained on \url{https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh}}
\date{Printed \today}
\begin{document}
\maketitle
\begin{multicols}{2}
\tableofcontents
\end{multicols}
\DocInput{\jobname.dtx}
\end{document}
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
%
%^^A ---------- change log -------------------------------------------------------------
%\changes{v1.00}{2021-11-09}{Initial Version. Official first release}
%\changes{v2.00}{2023-08-08}{This version changes the default build-system to \texttt{latexmk}}
%
%
%^^A ---------- document body ----------------------------------------------------------
%
% \vspace{2\baselineskip}
% \begin{abstract}
% The following documents a set of \LaTeX{} classes created for the Hochschule Hannover.
% They are intended to ease the workflow when writing documents by providing a common
% formating basis that should work for pretty much everything a studend will be expected
% to write. This can be simple one-paged documents, excercises, lab-reports, papers or
% bachelors and masters thesises.
%
% The classes provide interfaces to modify commend requriements, provide commands to get
% specifics like the logo and provide and pre-configure comonly needed packages. This
% should get you going imidealty and reduce the setuptime significantly.
% \end{abstract}
%
%
% \clearpage
% \section{The different classes}
%
% The project classes provided by the Project all carry the |HsH-| prefix. Here is a
% list of the available classes and some expleantion on when to use which class.
% \begin{description}
% \item\DescribeClass{HsH-article}
% A article-class based on \KOMAScript{}s \cls{scrartcl}.
% It is designed for quick and compact documents and is useful for writing
% lab-protocols and alike. It does not have chapters and therefore never
% breaks to a new page on its own.
% \item\DescribeClass{HsH-report}
% A report-class based on \KOMAScript{}s \cls{scrreprt}.
% This is probably the most useful class, as it can be used for a wide
% variety of documents (beginning with lab-reports and ending at complete
% thesis). The line between article and report is somewhat blurry, so use
% as you see fit.
% \item\DescribeClass{HsH-standalone}
% A helper class based based on the \cls{standalone}
% class. It is designed only for creating images as separate documents to
% keep things organized and compiler times low. It is useful for creating
% graphs, circuit diagrams or other kind of complex sub documents.
% \end{description}
%
% \section{Document options}
% To configure the behavior and style of documents using this class, options can be
% passed via the |\documentclass|\oarg{options}\marg{document-class} command.
%
% It should be noted that all unknown keys will pe passed to the parrent class and a
% log-message issued.
%
% \subsection{Generic options share by all classes}
% These Options are avalable regardless of documentclass and modify common things.
%
% \DescribeOption{fontfamily} \DescribeOption{sans}\DescribeOption{roman}
% The \opt{fontfamily=\meta{opt}} option configures which font-style is used.
% For convenience there are also short-forms providet.
% The avalable options are:
% \begin{options}
% \item[sans\OR sans-serif] A sans-serif font is used (similar to Arial)
% \item[roman\OR serif] A serif font is udes (similar to Times-new-Roman)
% \end{options}
%
% \DescribeOption{language} \DescribeOption{english}\DescribeOption{german}
% The \opt{language=\meta{opt}} option set the main language you write in. It ensures
% texts like auto-generated headings are localised properly.
% You can pass in any language-name understood by the \pkg{babel} package. German is
% the default.
% For convenience there are also short-forms providet.
%
% \medskip
% \DescribeOption{todos}
% The \opt{todos} option is a simple switch that activates support for the
% \pkg{todonotes} package. It enables/\-disables the package as well as increasing
% the pagewidth to make space for the notes.
%
% You can use the commands from the package to make notes and other anotations
% (similar to how MS-Words comments work). When you pass \opt{off\OR false} all the
% anotation will disaper from the PDF while still beeing in the source.
% \begin{note}
% setting \opt{todos=off} after having used the option will mostlikly produce
% compilation errors. These will go away after you remove the temporary files.
% \end{note}
%
% \subsection{Options for modifying the document}
% The following options are only avalable for documents (so not utility classes).
%
% \DescribeOption{linespacing}
% \DescribeOption{singlespacing}\DescribeOption{onehalfspacing}\DescribeOption{doublespacing}
% The \opt{linespacing=\meta{opt}} option configures the spacing in beween lines.
% For convenience there are also short-forms providet.
% The avalable options are:
% \begin{options}
% \item[single] No additional space is added in between lines.
% \item[onehalf] Aproximalty half a line of empty space is added inbetween lines.
% \item[double] About a full linehight is left in between lines.
% \end{options}
%
% \DescribeOption{parskip}
% The \opt{parskip=\meta{opt}} option configures the spacing in beween paragraphs.
% This is a option originally implemented by \KOMAScript{} (see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf?page=239#table.3.7}{its manual})
% so all its options apply. The class only adds additional options. \par
% For you convinience the relevant options are also listed here:
%
% \begin{options}
% \item[false\OR off] Paragraphs are identified by indentation of the first line by
% 1\,em. There is no spacing requirement at the end of the last line of a
% paragraph.
% \item[full\OR true\OR on] Paragraphs are identified by a vertical space of one line
% between paragraphs. There must be at least 1\,em of free space at the end of
% the last line of the paragraph.
% \item[full-] Paragraphs are identified by a vertical space of one line between
% paragraphs. There is no spacing requirement at the end of the last line of a
% paragraph.
% \item[full+] Paragraphs are identified by a vertical space of one line between
% paragraphs. There must be at least a third of a line of free space at the end
% of a paragraph.
% \item[full*] Paragraphs are identified by a vertical space of one line between
% paragraphs. There must be at least a quarter of a line of free space at the
% end of a paragraph.
% \item[half] Paragraphs are identified by a vertical space of half a line between
% paragraphs. There must be at least 1\,em free space at the end of the last
% line of a paragraph.
% \item[half-] Paragraphs are identified by a vertical space of half a line between
% paragraphs. There is no spacing requirement at the end of the last line of a
% paragraph.
% \item[half+] Paragraphs are identified by a vertical space of half a line between
% paragraphs. There must be at least a third of a line of free space at the end
% of a paragraph.
% \item[half*] Paragraphs are identified by a vertical space of half a line between
% paragraphs. There must be at least a quarter of a line of free space at the
% end of a paragraph.
% \item[never] No inter-paragraph spacing will be inserted even if additional
% vertical spacing is needed for vertical adjustment with |\flushbottom|.
% \item[never+] No inter-paragraph spacing will be inserted. There must be at least a
% third of a line of free space at the end of a paragraph.
% \item[never*] No inter-paragraph spacing will be inserted. There must be at least a
% quarter of a line of free space at the end of a paragraph.
% \end{options}
%
%
% \DescribeOption{headheight}
% The \opt{headheight=\meta{dim}} option allows you to set the required size of the
% header. You may need to modify this if you get a |\headheight|\emph{ to low} error
% message. The emssage should tell you what value you need, but you can pass any
% valid length.
%
% \paragraph{Often relevant \KOMAScript\ options}
% The following options are implemented by the parrent classes and only listed here
% for completness. For more detils, see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf?page=239#chapter.3}{its manual}.
% \smallskip
%
% \DescribeOption{fontsize}
% The \opt{fontsize=\meta{size}} options takes a size in \opt{pt}. It is usually in therange of
% 10-12, but other sizes can work as well.
%
% \DescribeOption{paper}
% The \opt{paper=\meta{size}} options accepts a number of options, most ISO formats
% are supported, but also others like \opt{letter} or \opt{legal}.
%
% \DescribeOption{twoside}
% The \opt{twoside} option sets your document up for doublesided printing. The header
% and footer will take this into account and binding-correction will be applide along
% the inner edge.
%
% \DescribeOption{BCOR}
% The \opt{BCOR=}\meta{dim} option allows you to define a custom binding-correction.
% Any valid length can be put here, but to large of a value will shrink the outer
% margin to a not-desirable level.
%
%
% \subsection{Standalone specific options}
% The \cls{standalone} utillity class has some special options which are documented
% here.
% \smallskip
%
% \DescribeOption{margin}
% The \opt{margin=}\meta{dim} option controlls how much whicspace is added arround
% you standalone document. This usually looks better which is why the default is
% 0.25\,cm, but you can supress it by passing 0\,cm.
%
% \DescribeOption{multi}
% The \opt{multi=}\meta{opt} option defines which enviroment make up a page. It can
% be passe more than once.
%
%
% \section{Provided commands}
% The clases define a set of commands which are explained in the following section.
%
% \DescribeMacro{\HsHClassName}
% Each class defines the macro |\HsHClassName| to contain its classname. This is
% mostly usefull so internals can reuse the classname, but you could also check
% against it if you needed to.
%
% \subsection{Title matters}
% \LaTeX{} has a set of default commands which are used to define data for the
% titlepage, like |\title| or |\author|. The classes define a few additional
% commands, which are documented her.
% \smallskip
%
% \DescribeMacro{\matrikelnr}
% The |\matrikelnr|\marg{nr[, ..]} macro sets the matrikelnumber of the author(s).
% It can be a single number or a comma seperated list of numbers. The numbers will
% be matched to the authors passed into |\author|.
%
% \DescribeMacro{\professor}
% You can pass any text to |\professor|\marg{text}, it will be printed on the
% bottom of the titelpage.
%
% \DescribeMacro{\keywords}
% This macro can be used to define keywords which are relevant to your document.
% They will be printed as part of the abstract and be put into the PDF's meta-data.
%
% \paragraph{Modifying the Logo}
% \DescribeMacro{\HsHlogoPath}
% The logo is loaded from a file whos name is read from \cmd{\HsHlogoPath}. Change
% it to use a different logo-file.
%
% \DescribeMacro{\HsHlogoPage}
% As the PDF file can hae multiple pages, the \cmd{\HsHlogoPage} command stores
% which page to load.
%
% \DescribeMacro{\includeHsHlogohere}
% The macro \cmd{\includeHsHlogohere\oarg{width}} is used by |\maketitle| to produce
% the logo. But if you want it elsewhere, you cann call this macro yourself.
%
%
% \subsection{Commands for document writing}
% The following commands will be usefull to you when writing a document.
% \smallskip
%
% \DescribeMacro{\declarationofauthorship}
% The command |\declarationofauthorship|\oarg{align} can be used to print a
% "declatation of authorship" in the current location, similar to how
% |tableofcontens| and friends work.
%
% It will produce a horizontal line, a text block containing the regulatory text and
% a signature block for every author. The command is localised for both english and
% german. Using the optional argument, you can define the positioning. Pass \opt{t}
% for alignment at the top of the page and \opt{b} for bottom alignment
% (\emph{default}).
%
% \smallskip
% The three commands \cmd{\frontmatter},\cmd{\mainmatter} and \cmd{\backmatter} are
% provided for \cls{report} classes. They seperate document section and
% automatically set up pagenumer styles. \par
% \DescribeMacro{\frontmatter}
% \cmd{\frontmatter} set the pagenumers to capital roman numerals. This is usually
% required for everything before the first chapter. \par
% \DescribeMacro{\mainmatter}
% \cmd{\mainmatter} sets the pagenumbering to "normal" arabic numbers. This is
% usually the style for the document content. \par
% \DescribeMacro{\backmatter}
% \cmd{\backmatter} can be used for apendixes and alike. It sets the pagenumbering
% to small roman numerals.
%
%
% \subsection{Default \LaTeX{} Commands that are modified}
% Additionaly, some of \LaTeX{}s default commands are moddified to better fit this
% class. This is documented here.
%
% \DescribeMacro{\title}
% The \cmd{\title\oarg{short-title}\marg{title}} command now takes an additional,
% optional argument. You can use it for a shorter version of your title, that will
% be used in the header to save on space.
%
% \DescribeMacro{\maketitle}
% The |\maketilte| command if \LaTeX{} default way to create a titlepage. We
% redefine it to produce a titlepage that matches the sytel typically used on the
% Hochschle Hannover. This incudes the logo beeing printed, depending on the
% \opt{f1} to \opt{f5} documentoptions. \par
% The command now also takes an options alignment-parameter:
% |\maketitle|\oarg{align}. You can pass \opt{l\OR c\OR r} to get \emph{left},
% \emph{center} or \emph{right} alignment.
%
%
% \section{Package laoding}
% The classes load some packges for internal use as well as loading and configuring
% common use packages. The details are documented in the following section.
%
% \subsection{Allways loaded packages}
% \begin{packages}
% \item[fontenc] for output encoding, set to the european characterset
% \item[babel] for langauge-specific typesetting
% \item[bookmark] creates bookmoarks in the PDF
% \item[hyperref] for easy referencing and linking
% \item[caption] to customize captions and make references point to the beginning
% of the floats
% \item[graphicx] for importing and manipultating images
% \item[amsmath,amssymb,amsfonts] more options when typesetting math
% \item[lmodern] sets up the Latin-Modern font
% \item[setspace] used for configuring linespacing
% \end{packages}
%
% There are also some packages for internal functionalaty that shouln't conserne the
% user, but they are listed here for completness.
% \begin{packages}
% \item[scrbase]
% \item[pgffor]
% \end{packages}
%
% \subsection{Conditionally loaded Packages}
% A subset of packages is only loaded (or loaded with specifig options) depending
% on options passed to the package
% \begin{packages}
% \item[babel] gets configured depending on \opt{language}
% \item[csquotes] for language-specific quotations marks
% \item[ziffer] only loaded for german documents, sets comma as decimal seperatior
% \item[todonotes] loaded depending on \opt{todos}
% \end{packages}
%
% \subsection{Pre-configured Packages}
% These packages are coonfigured by the class to work in a cooperative way. The
% user must load them in this preable via |\usepackage|\marg{pkg-name} however, as
% loading them allways bears additional, unnecicary overhead.
%
%
%\StopEventually{^^A
% \PrintChanges
% \PrintIndex
%}
%
% \section{Implementation}
%
%\iffalse docstrip-guard
% \subsection{Internal commands}
% \begin{macro}{\HsHClassName}
% The classname of specific class is stored in the |\HsHClassName| which gets used
% throuout the code.
% \begin{macrocode}
\let\HsHClassName\@currname
% \end{macrocode}
% \end{macro}
%
% There is also a second macro |\HsHClassName@ParrentClass| which stores the parrent
% classes name.
% \begin{macrocode}
\def\HsHClassName@ParrentClass{%
%<article> scrartcl%
%<report> scrreprt%
%<standalone> standalone%
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
% \end{macrocode}
%
%
% \subsection{Option handeling}
% The options are handled using featues provieded by the |KOMA|-Script ecosystem.
% To get access to this the \pkg{srcbase} package is loaded.
% \begin{macrocode}
\RequirePackage{scrbase}
% \end{macrocode}
%
% We also require some packages for some of the option, these are loaded next.
% \begin{macrocode}
\RequirePackage{setspace}
% \end{macrocode}
%
% A new familiy of keys is created and shared by all elelments of this project.
% For that the |\DefineFamily| macro is used. The familiy name is \emph{HsH},
% matching the usual prefixes.
% \begin{macrocode}
\DefineFamily{HsH}
% \end{macrocode}
% Additionally each class-file represents a member in the family. This is defined
% using the |\DefineFamilyMember| macro. It's optional argument is set to the current
% filename by default, so we do not need to specify it, just the family name to
% attatch it to.
% \begin{macrocode}
\DefineFamilyMember{HsH}
% \end{macrocode}
%
% \begin{macro}{\HsH@Options@PassToParrent}
% To be able to pass options to the parrent class wehre needed easiely, a command is
% defined. It also issues a log-message.
% \begin{macrocode}
\newcommand{\HsH@Options@PassToParrent}[1]{%
\ClassInfoNoLine{\HsHClassName}{passing option to parrent class: #1}%
\PassOptionsToClass{#1}{\HsHClassName@ParrentClass}%
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
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\HsH@Options@DeclareAlias}
% It is also usefull to have shot-versions of options. The following commands makes
% it easy to decalare these.
% \begin{macrocode}
\newcommand{\HsH@Options@DeclareAlias}[3][HsH]{%
\DeclareOption{#2}{\FamilyExecuteOptions{#1}{#3}}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{fontfamily}
% The first option to be defined is \opt{fontpamily}. It's defined as a
% \emph{Numerical} key so that it can accept multiple options and map them to a
% switch case.
% \begin{macrocode}
\DefineFamilyKey{HsH}{fontfamily}{
\begingroup
\FamilySetNumerical{HsH}{parskip}{@tmp}{%
{sans}{0}, {sans-serif}{0},%
{roman}{1}, {serif}{1},%
}{#1}
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifcase\@tmp% 0
\endgroup
\renewcommand{\familydefault}{\sfdefault}
\if@atdocument\AfterKOMAoptions{\selectfont}\fi
\or% 1
\endgroup
\renewcommand{\familydefault}{\rmdefault}
\if@atdocument\AfterKOMAoptions{\selectfont}\fi
\else% should never be
\endgroup
\fi
\else
\endgroup
\FamilyKeyStateUnknownValue
\fi
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
% \end{macrocode}
% \end{option}
%
% \begin{option}{sans,roman}
% For convinience, there are also two short-versions defined.
% \begin{macrocode}
\HsH@Options@DeclareAlias{sans}{fontfamily=sans}
\HsH@Options@DeclareAlias{roman}{fontfamily=roman}
% \end{macrocode}
% \end{option}
%
% \begin{macrocode}
%<*!standalone>
% \end{macrocode}
%
%
% \begin{option}{linespacing}
% The \opt{linespacing} options is also a \emph{Numerical} option, mapping to three
% cases. They execute the apropriate commands of the \pkg{setspace} package.
% \begin{macrocode}
\DefineFamilyKey{HsH}{linespacing}{
\begingroup
\FamilySetNumerical{HsH}{linespacing}{@tempa}{%
{single}{0},%
{onehalf}{1},%
{double}{2},%
}{#1}
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifcase\@tempa% 0
\endgroup
\if@atdocument\singlespacing\else\AtEndOfClass{\singlespacing}\fi
\or% 1
\endgroup
\if@atdocument\onehalfspacing\else\AtEndOfClass{\onehalfspacing\AfterTOCHead{\singlespacing}}\fi
\or% 2
\endgroup
\if@atdocument\doublespacing\else\AtEndOfClass{\doublespacing\AfterTOCHead{\singlespacing}}\fi
\else% should never be
\endgroup
\fi
\else
\endgroup
\FamilyKeyStateUnknownValue
\fi
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
% \end{macrocode}
% \end{option}
%
% \begin{option}{singlespacing,onehalfspacing,doublespacing}
% For convinience, there are also these short-versions defined.
% \begin{macrocode}
\HsH@Options@DeclareAlias{singlespacing}{linespacing=single}
\HsH@Options@DeclareAlias{onehalfspacing}{linespacing=onehalf}
\HsH@Options@DeclareAlias{doublespacing}{linespacing=double}
% \end{macrocode}
% \end{option}
%
%
% \begin{option}{parskip}
% The \opt{parskip} option is special in that ist originally a \KOMAScript{} option
% that get expanded by this class. Only two new cases are defined here and everything
% unknown gets passed to the parrent class. \par
% It should also be noted that this option can't execute its code imidealtly, as the
% commands needed are only defined later when the parrent class loads in. So the
% |\setparsizes| command is pushed into a hook.
% \begin{macrocode}
\DefineFamilyKey{HsH}{parskip}{%
\begingroup
\FamilySetNumerical{HsH}{parskip}{@tempa}{%
{never+}{0},%
{never*}{1},%
}{#1}
\if@atdocument
\ClassError{\HsHClassName}{
option `parskip' can only be configured in preamble!
}
\fi
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifcase\@tempa% 0
\endgroup
\AtEndOfClass{\setparsizes{\z@}{\z@}{.3333\linewidth \@plus 1fil}}
\or% 1
\endgroup
\AtEndOfClass{\setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}}
\else% should never be
\endgroup
\fi
\else
\endgroup
\HsH@Options@PassToParrent{parskip=#1}
\FamilyKeyStateProcessed
\fi
% \end{macrocode}
% \end{option}
%
% \begin{option}{headheight}
% The \opt{headheight} option just stet the |\headheight| to the given value.
% \begin{macrocode}
\def\HsH@opt@headheight{}
\FamilyStringKey{HsH}{headheight}{\HsH@opt@headheight}
\AtEndOfClass{%
\headheight=\HsH@opt@headheight%
% \end{macrocode}
% \end{option}
%
% For the \opt{twoside} option we only redefine the default, everyting else is
% handled by the parrent class.
% \begin{macrocode}
\DefineFamilyKey{HsH}{twoside}[semi]{%
\HsH@Options@PassToParrent{twoside=#1,BCOR=1cm}
\FamilyKeyStateProcessed
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
% \end{macrocode}
%
% \begin{macrocode}
%</!standalone>
% \end{macrocode}
%
%
% \begin{macro}{\HsH@opt@language}
% First, the macro to store the languages name in is created. The default is |nil|,
% as \pkg{babel} will see this as no-language.
% \begin{macrocode}
\def\HsH@opt@language{nil}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{language}
% The key is than defined to store its value inside the command. This allowes the
% option to be called multiple time, but only the last set value will be passed on to
% \pkg{bable}.
% \begin{macrocode}
\FamilyStringKey{HsH}{language}{\HsH@opt@language}
% \end{macrocode}
% \end{option}
%
% \begin{option}{english,german, ngerman}
% For convinience, there are also these short-versions defined.
% \begin{macrocode}
\HsH@Options@DeclareAlias{english}{language=english}
\HsH@Options@DeclareAlias{german}{language=ngerman}
\HsH@Options@DeclareAlias{ngerman}{language=ngerman}
% \end{macrocode}
% \end{option}
%
%
% \begin{macro}{\HsH@opt@faculty}
% As we need a default value that is not zero, the macro needs to be defined an
% initalised manually.
% \begin{macrocode}
\def\HsH@opt@faculty{1}
% \end{macrocode}
% \end{macro}
%
% \begin{option}{faculty}
% The \opt{faculty} options is once again a \emph{Numerical} option, mapping the five
% faculties and storeing the selected one in |\HsH@opt@faculty|.
% \begin{macrocode}
\FamilyNumericalKey{HsH}{faculty}{HsH@opt@faculty}{%
{none}{1}, {false}{1},%
{f1}{2}, {1}{2},%
{f2}{3}, {2}{3},%
{f3}{4}, {3}{4},%
{f4}{5}, {4}{5},%
{f5}{6}, {5}{6},%
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
% \end{macrocode}
% \end{option}
%
% \begin{option}{f1,f2,f3,f4,f5}
% For convinience, there are also these short-versions defined.
% \begin{macrocode}
\HsH@Options@DeclareAlias{f1}{faculty=f1}
\HsH@Options@DeclareAlias{f2}{faculty=f2}
\HsH@Options@DeclareAlias{f3}{faculty=f3}
\HsH@Options@DeclareAlias{f4}{faculty=f4}
\HsH@Options@DeclareAlias{f5}{faculty=f5}
% \end{macrocode}
% \end{option}
%
% \begin{option}{todos}
% The boolean option \opt{todos} is simply created using the commands from \pkg{scrbase}.
% Boolean options allready default to \meta{true} if called without and argument, so
% no need to define an explicit alias.
% \begin{macrocode}
\FamilyBoolKey{HsH}{todos}{@todos}
% \end{macrocode}
% \end{option}
%
% For the \cls{standalone} class the \opt{fontsize} option is mocked to present a
% standardised interface. A user might expect this option to be passable to this
% class and we shoulnd crete an anoying error just for this.
% \begin{macrocode}
%<*standalone>
\DefineFamilyKey{HsH}{fontsize}{%
\ClassInfoNoLine{\HsHClassName}{The `fontsize' option is only a mock, its has not effect}
\FamilyKeyStateProcessed
%</standalone>
% \end{macrocode}
%
% \subsubsection{Unknown options}
% Unknown options will be passed to the parent class. For that a |@else@| key is
% defined on the |HsH| family, which will be execute for every unknown key-value
% option. Unknown bare options are handled by the |\DeclareOption*| command and will
% be passed there.
% \begin{macrocode}
\DefineFamilyKey{HsH}{@else@}{
\HsH@Options@PassToParrent{#1}
\FamilyKeyStateProcessed
\DeclareOption*{
\HsH@Options@PassToParrent{\CurrentOption}
% \end{macrocode}
%
%
% \subsubsection{Default options}
% The different classes all execute a set of default options, which is handled by the
% following code.
% \begin{macrocode}
\FamilyExecuteOptions{HsH}{%
fontfamily=sans-serif,
%<*!standalone>
fontsize=11pt,
language=ngerman,
%<article> parskip=never+,
%<report> parskip=half+,
linespacing=single,
headheight=2.15\baselineskip,
%</!standalone>
faculty=none,
%<*standalone>
margin=0.25cm,
multi=tikzpicture,
multi=circuitikz,
%</standalone>
}
% \end{macrocode}
% Now we cann process the options for the |HsH| familiy.
% \begin{macrocode}
\FamilyProcessOptions{HsH}\relax
% \end{macrocode}
% \subsubsection{Loading the parrent class}
% \begin{macrocode}
\LoadClass{\HsHClassName@ParrentClass}
% \end{macrocode}
% \subsection{Package loading}
% The clases load and configure some common packages to reduce the needed amount of
% boilderplate code in your preamble.
% Additionally there are settings provided for packages that are used more rarly, but
% will be set up correctly if you decide to load them via |\usepackage{}|.
% \subsubsection{Ensuring German works}
% With modern LaTeX systems the encoding of inputfiles is UTF-8 by default, so the
% \pkg{inputenc} package is no longer requried. Should the user still use a old
% setup or use a different encoding, he is responsible for loading \pkg{inputenc}
% himself.
% \changes{v3.00}{2024-02-03}{removed the \pkg{inputenc} package, as utf8 is now default}
% The font-encoding for the pdf file is also set up to allow for the full european
% characterset.
% \changes{v3.00}{2024-02-03}{added \pkg{type1ec} package to get better font-scaling} ^^A see https://tex.stackexchange.com/questions/208304
% \begin{macrocode}
\RequirePackage[T1]{fontenc}
\RequirePackage{type1ec}
% \end{macrocode}
% To ensure localised translations of all displayed text automatically dependign on
% the user-selected \opt{language}, the \pkg{babel} package is loaded. This also
% allowes for the use of the |\iflanguage| command, which is relevant later.
% \begin{macrocode}
\RequirePackage[main=\HsH@opt@language]{babel}
% \end{macrocode}
% Quotationsmarks are also very different between languages, so the following
% ensures the correct style for the correct language.
% \begin{macrocode}
\RequirePackage[autostyle=true]{csquotes}
\MakeOuterQuote{"}
% \end{macrocode}
% German uses a comma as the decimal separator, which collides with \LaTeX{}s
% default english setting of using the comma as a thousands separator and therefore
% replacing it with some whitespace on printed version. Luckily loading the
% \pkg{ziffer} package sets this up to match the german standart.
% \begin{macrocode}
\iflanguage{ngerman}{\RequirePackage{ziffer}}{}
% We load \pkg{hyperref} for clikable links and configure it to write meta-date to
% the PDF.
% \begin{macrocode}
\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks'
\AtBeginDocument{
\hypersetup{
pdfinfo={
Title={\@title},
Author={\@author},
Subject={\@subject},
Keywords={\@keywords}
}
}
}
% \end{macrocode}
% The \pkg{todonotes} package is greate for anotation, but extremly expensive on
% compiletime. So we load it only if the user requests it. Also its commands are
% stubed, so that they can be left in the sourcecode and jut not output anything.
% \begin{macrocode}
\if@todos
\PassOptionsToPackage{
textsize=small,
figwidth=.6\textwidth
}{todonotes}
\RequirePackage{todonotes}
\else
\newcommand{\listoftodos}[1]{}
\newcommand{\todo}[2][]{}
\newcommand{\missingfigure}[2][]{}
% \begin{macrocode}
\RequirePackage[hypcap=true]{caption}
\RequirePackage{graphicx}
\RequirePackage{amsmath,amssymb,amsfonts}
\RequirePackage[svgnames]{xcolor}
% \end{macrocode}
% \subsubsection{Options for packages that could be loaded by the user}
% Some package are not always needed and potentially heavy to load in by default.
% But its still usefull to set default options for these packagese.
%
% These differ from the settings provided in |HsH-classes.cfg| in that they are
% defaults that apply allway and not user-configurable preferences which are user
% or even project specific.
%
% For the \pkg{bibtex} we ensure the \emph{biber} backend is selcted, which matches
% the settings in |.latexmkrc|.
% \begin{macrocode}
%<*article|report>
\PassOptionsToPackage{backend=biber}{biblatex}
\AtBeginDocument{
\makeatletter
\@ifpackageloaded{biblatex}{
\renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}}
}{}%
\makeatother
}
%</article|report>
% \end{macrocode}
%
% For \pkg{bibtex} we load the free-stadnding units, mostly for backwards compatibility.
% We also ensure german language specific settings are applyed.
% \begin{macrocode}
\PassOptionsToPackage{free-standing-units}{siunitx}
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
\AtBeginDocument{
\makeatletter
\@ifpackageloaded{siunitx}{
\iflanguage{ngerman}{
\sisetup{output-decimal-marker={,}}
}{}
}{}
\makeatother
}
% \end{macrocode}
%
% For better compatibility with the \pkg{listings} package we load the
% \pkg{scrhack} package. We also pass some configurations to if if it gets loaded.
% \begin{macrocode}
\RequirePackage{scrhack}
\AtBeginDocument{
\makeatletter
\@ifpackageloaded{biblatex}{
\RequirePackage{lstautogobble}\lstset{autogobble=true}
\iflanguage{ngerman}{
\lstset{literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1}
}{}
}{}
\makeatother
}
% \end{macrocode}
%
% The \pkg{circuitikz} needs bo be configure so it matches typical european styles.
% \begin{macrocode}
\PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz}
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
% \end{macrocode}
%
% For other packages we provide the settings more as a recomendation of what is
% usefull. As the user might want to change these, we outsource this to a seperat file
% and input it |\AtBeginDocument|. That way the user can just replace the file with his
% custom version.
% \begin{macrocode}
\AtBeginDocument{
\makeatletter
\InputIfFileExists{HsH-classes.cfg}{
\ClassInfo{\HsHClassName}{Local config file HsH-classes.cfg used.}
}{
\ClassInfo{\HsHClassName}{No HsH-classes.cfg!! I hope you configered it yourself.}
}
\makeatother
}
% \end{macrocode}
%
% \subsection{Custom commands}
%
% \subsubsection{Document seperation commands}
% The following commands are only defnied for \cls{book} type classes by default.
% But they are also usefull for the \cls{report} class, so we define them in that case.
% \begin{macrocode}
%<*report>
% \end{macrocode}
%
% \begin{macro}{\if@mainmatter}
% We define a switch which stores if the document is currently at a mainmatter
% section. Ir defaults to |true| as the user needs to explicitly set the state to
% something differnt.
% \begin{macrocode}
\newif\if@mainmatter\@mainmattertrue