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
%<*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,localisation}}
\file{HsH-report.cls}{\from{\jobname.dtx}{report,localisation}}
\file{HsH-standalone.cls}{\from{\jobname.dtx}{standalone,localisation}}
}
%</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>
%<*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-08-10 3.03.dev0 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}
\settowidth{\labelwidth}{\texttt{xxxxxxxxx\space}}
\setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep}
}\raggedright}
{\end{list}}
\newenvironment{packages}
{\begin{list}{}{
\renewcommand{\makelabel}[1]{\pkg{##1}\hfil}
\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
%
\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@janwille.de}}
\MaintainedBy{Maintained on \url{https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh}}
\begin{document}
\maketitle
\begin{multicols}{2}
\tableofcontents
\end{multicols}
\DocInput{\jobname.dtx}
\end{document}
%
%
%^^A ---------- document body ----------------------------------------------------------
%
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
%\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{faculty} \DescribeOption{f1}\DescribeOption{f2}\DescribeOption{f3}\DescribeOption{f4}\DescribeOption{f5}
% The \opt{faculty=\meta{opt}} option configures which faculties logo is used.
% For convenience there are also short-forms providet.
% The avalable options are:
% \begin{options}
% \item[none\OR false] A gray, non-faculty specific logo is used.
% \item[1\OR f1] The blue logo of faculty 1 is uded.
% \item[2\OR f2] The green logo of faculty 2 is uded.
% \item[3\OR f3] The orange logo of faculty 3 is uded.
% \item[4\OR f4] The red logo of faculty 4 is uded.
% \item[5\OR f5] The purple logo of faculty 5 is uded.
% \end{options}
%
% \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 an extending option originally implemented by \KOMAScript{}.
% \begin{options}
% \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.
% \item[\dots] see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#table.3.7}{\KOMAScript{} manual, Table 3.7} for more options.
% \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.
%
% \DescribeOption{abstract}
% The \opt{abstract=\meta{opt}} option allows you to configure different behaviors of the abstract.
% The availabel options are described below:
% \begin{options}
% \item[keywords] Print the \cmd{\keywords} after the abstract.
% \item[nokeywords] Do \emph{not} print the \cmd{\keywords} after the abstract.
% \item[totoc] The abstract will be listed in the table of contentes.
% \item[notoc] The abstract will \emph{not} be listed in the table of contentes.
% \end{options}
%
% \DescribeOption{toc}
% The \opt{toc=\meta{opt}} option configures what is listed in the table of contents.
% \begin{options}
% \item[totoc] The table of contentes will list itself.
% \item[notoc] The table of contentes will \emph{not} list itself.
% \item[abstract] The abstract will be listed in the table of contentes.
% \item[noabstract] The abstract will \emph{not} be listed in the table of contentes.
% \item[\dots] see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#table.3.5}{\KOMAScript{} manual, Table 3.5} for more options
% \end{options}
%
% \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}
%
% \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.
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
% 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 can call this macro yourself.
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
%
%
% \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.
%
% \subsection{Micalanious commands}
% The following commands are mostly for internal use, but are parte of the interface
% and might be usefull in some cases.
% \medskip
%
% \DescribeMacro{\ifsingleauthor}
% This allows you to check if |\author| holds one or multiple entries. Using this
% allows the user to display differernt things for these cases, for example switch
% words to pural, like this:
% |\ifsingleauthor{one}{multiple} person\ifsingleauthor{}{s}|
% 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
% \item[enumitem] more powerfull item-lists and enumerations
% \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, but not loaded Packages}
% These packages are coonfigured by the class to work in a cooperative way. The
% user must load them manually in this preable via |\usepackage|\marg{pkg-name},
% as loading them allways bears additional, unnecicary overhead.
% \begin{packages}
% \item[biblatex] create a bibliography
% \item[siunitx] use units in text and equations
% \item[listings] typset sourcecode snippets
% \item[csvsimple] import csv-files into tables
% \item[pgfplots / tikz] A powerfull package for drawing and plotting data
% \item[circuitikz] A TikZ libary for drawing circuits
% \end{packages}
%
%
% \StopEventually{^^A
% \PrintChanges
% \PrintIndex
% }
%
%\section{Implementation}
% \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}
% 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%
% \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}%
% \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}
% \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
\else
\endgroup
\FamilyKeyStateUnknownValue
\fi
% \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}
%
% \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
\endgroup
\FamilyKeyStateUnknownValue
\fi
% \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}
% \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.
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
% \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
% \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%
% \begin{option}{abstract}
% The \opt{abstract} option sets multiple different switches and configureations.
% We first define the needed macros:
% \begin{macrocode}
\newif\if@HsH@option@abstract@show@keywords
\def\HsH@abstract@heading{%
%<article> \addsec*%
%<report> \addchap*%
}
% \end{macrocode}
% Now the actuall option can be defiend to handle all the cases.
% \begin{macrocode}
\DefineFamilyKey{HsH}{abstract}{%
\begingroup
\FamilySetNumerical{HsH}{abstract}{@tempa}{%
{keywords}{0},%
{nokeywords}{1},%
{totoc}{2},{toc}{2},%
{notoc}{3},{nottotoc}{3},%
}{#1}
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifcase\@tempa% 0
\endgroup
\@HsH@option@abstract@show@keywordstrue
\or% 1
\endgroup
\@HsH@option@abstract@show@keywordsfalse
\or% 2
\endgroup
\def\HsH@abstract@heading{%
%<article> \addsec%
%<report> \addchap%
}
\def\HsH@abstract@heading{%
%<article> \addsec*%
%<report> \addchap*%
}
\else% should never be
\endgroup
\fi
\else
\endgroup
\fi
}
% \end{macrocode}
% \end{option}
%
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
% \begin{option}{toc}
% The \opt{toc} option is a \KOMAScript options we just extend. Options for the abstract and toc are added.
% \begin{macrocode}
\DefineFamilyKey{HsH}{toc}{%
\begingroup
\FamilySetNumerical{HsH}{toc}{@tempa}{%
{totoc}{0},{toc}{0},%
{notoc}{1},{nottotoc}{1},%
{abstract}{2},%
{noabstract}{3},%
}{#1}
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifcase\@tempa% 0
\endgroup
\AtEndOfClass{\setuptoc{toc}{totoc}}
\or% 1
\endgroup
\AtEndOfClass{\unsettoc{toc}{totoc}}
\or% 2
\endgroup
\FamilyExecuteOptions{HsH}{abstract=totoc}
\or% 3
\endgroup
\FamilyExecuteOptions{HsH}{abstract=nottotoc}
\else% should never be
\endgroup
\fi
\else
\endgroup
\HsH@Options@PassToParrent{toc=#1}
\FamilyKeyStateProcessed
\fi
}
% \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
% \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}
% \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}
% \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}
% \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}
% \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}{%
{0}{1}, {none}{1}, {false}{1}, {off}{1},%
{1}{2}, {f1}{2},%
{2}{3}, {f2}{3},%
{3}{4}, {f3}{4},%
{4}{5}, {f4}{5},%
{5}{6}, {f5}{6},%
% \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}
% \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}
% 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
% \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}
% \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 can 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.
% The font-encoding for the pdf file is also set up to allow for the full european
% characterset.
% \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.
\iflanguage{ngerman}{\RequirePackage{ziffer}}{}
% \subsubsection{Generally usefull packages}
% We load \pkg{hyperref} for clickable links, a interacitve document outline
% in the PDF and configure it to write meta-date to the PDF.
\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks'
\AtBeginDocument{
\hypersetup{
pdfinfo={
Title={\@title},
Author={\@author},
Subject={\@subject},
Keywords={\@keywords}
}
}
}
% The \pkg{hyperref} package has a problem when linking to images,
% clicking a linke to one leads to the \emph{bottom} of the float
% (where the caption is located), instead of to the \emph{top}.
% Loading the \pkg{captoion} package with the \opt{hypercap} option
% fixes that.
% \begin{macrocode}
\RequirePackage[hypcap=true]{caption}
% \end{macrocode}
%
% To display images (mostly through the |\includegraphics| command)