Debian Codegraph @

texmf-dist/source/latex/fhj-script/fhjbook.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright 2025 Michael E. Hammer
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Michael E. Hammer.
16 %
17 % This file is part of the "fhj-script bundle" and all files in that
18 % bundle must be distributed together.
19 %
20 % \fi
21 % \iffalse
22 %<*driver>
23 \ProvidesFile{fhjbook.dtx}
24 %</driver>
25 %<class>\NeedsTeXFormat{LaTeX2e}[2023-11-01]
26 %<class>\ProvidesClass{fhjbook}
27 %<*class>
28 [2026-02-25 v4.2c A class for formatting books/thesis in the FHJ style]
29 %</class>
30 %
31 %<*driver>
32 \documentclass[a4paper]{ltxdoc}
33 \usepackage{fhjcommon}
34 \EnableCrossrefs
35 \CodelineIndex
36 \RecordChanges
37 \OnlyDescription % We only want the description
38 \begin{document}
39 \DocInput{fhjbook.dtx}
40 \end{document}
41 %</driver>
42 % \fi
43 %
44 % \GetFileInfo{fhjbook.dtx}
45 %
46 % \changes{v4.0}{2025/08/03}{Initial package version}
47 %
48 % \title{The \textsf{fhjbook} class\thanks{This document
49 % corresponds to \textsf{fhjbook}~\fileversion,
50 % dated \filedate.}}
51 % \author{Michael E. Hammer \\ \texttt{[email protected]}}
52 %
53 % \maketitle
54 %
55 % \begin{abstract}
56 % This class is intended to be used for formatting books and thesis in the FHJ style.
57 % It is based on the \textsf{scrbook} class and provides a set of
58 % macros and commands to simplify the formatting of thesis and books.
59 % \end{abstract}
60 %
61 % \tableofcontents
62 %
63 % \section{Configuration and styling}
64 %
65 % It is important to note that this class is based on the \textsf{scrbook} class and we
66 % support forwarding options to it.
67 %
68 % \begin{macrocode}
69 \newcommand{\@ClassName}{fhjbook}
70 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrbook}}
71 \ProcessOptions\relax
72 % \end{macrocode}
73 %
74 % We load the \textsf{scrbook} class with the following options:
75 %
76 % \begin{itemize}
77 % \item \texttt{a4paper}: We want to use A4 paper size
78 % \item \texttt{DIV=14}: The DIV parameter should be set to 14 to ensure a good
79 % balance between text width and height
80 % \item \texttt{BCOR=10mm}: The binding correction should be set to 10mm to ensure
81 % proper binding of the printed document
82 % \end{itemize}
83 %
84 % \textit{Remark}: Feel free to switch to \verb|twoside| which we clearly recommend!
85 %
86 % \begin{macrocode}
87 \LoadClass[a4paper,DIV=14,BCOR=10mm]{scrbook}
88 % \end{macrocode}
89 %
90 % For styling of the document headers we rely on the predefined stylings from
91 % KOMA-Script.
92 %
93 % \begin{macrocode}
94 \pagestyle{headings}
95 % \end{macrocode}
96 %
97 % \subsection{Used packages}
98 %
99 % For the styling of the document we use the following packages and therefore they are
100 % preloaded and you might not load them again in your document:
101 %
102 % \begin{macrocode}
103 \RequirePackage{fhjcommon}
104 \PassOptionsToPackage{hidelinks}{hyperref}
105 \RequirePackage{hyperref}
106 \RequirePackage{array}
107 \RequirePackage{supertabular}
108 \RequirePackage{xstring}
109 % \end{macrocode}
110 %
111 % \section{Preamble}
112 %
113 % For using the class you need to define a few macros (preferably in your preamble).
114 %
115 % \subsection{Multlilingual support}
116 %
117 % This class supports multilingual documents and therefore we recommend to load the
118 % \texttt{babel} package and set one of two supported languages -- either \texttt{ngerman}
119 % or \texttt{english}. A possible boilerplate for the preamble could look like this:
120 %
121 % \begin{quote}
122 % |\newcommand{\mylanguage}|\marg{language}\\
123 % |\usepackage[T1]{fontenc}|\\
124 % |\usepackage[\mylanguage]{babel}|\\
125 % |\selectlanguage{\mylanguage}|
126 % \end{quote}
127 %
128 % The definition of the macro \cs{mylanguage} is optional, but it has the advantage that
129 % you might want to use it in other packages as well.
130 %
131 % \subsection{Title page}
132 %
133 % To have the correct icon and name for the study program typeset on the title page, you
134 % need to define it with the macro from \texttt{fhjcommon} package (see the according
135 % documentation):
136 %
137 % \begin{quote}
138 % |\FHJProgram{DAT}|
139 % \end{quote}
140 %
141 % \DescribeMacro{\title}
142 % This command defines the title of your master thesis and is placed on the title page
143 % on the according position. It is supported to use line breaks in the title, so you can
144 % have up to three lines in the title.
145 %
146 % \DescribeMacro{\subtitle}
147 % This command defines the subtitle of your master thesis and is placed on the title
148 % page on the according position. The subtitle is optional and it is expected to be a
149 % single line.
150 %
151 % \DescribeMacro{\author} \DescribeMacro{\authorinfo}
152 % On the title page it is mandatory to define the author of the thesis. The command
153 % \cs{author} is used for this purpose and must be followed by the author's name in the
154 % following format -- make sure to use first name first and the last name second in all
155 % capital letters:
156 %
157 % \begin{quote}
158 % |\author{Lisa MUSTERFRAU}|
159 % \end{quote}
160 %
161 % Besides the name of the author, you need to provide some additional information with
162 % the macro \cs{authorinfo}\marg{gender}\marg{mat-nr}\marg{year} which may look as
163 % follows:
164 %
165 % \begin{quote}
166 % |\authorinfo{f}{0130508}{2024}|
167 % \end{quote}
168 %
169 % Currently we support the following values for the gender -- \texttt{m}, \texttt{f} and
170 % \texttt{o} (for other). The matrikel number is the student's ID number and the year
171 % is the cohort of the student.
172 %
173 % \DescribeMacro{\supervisor}
174 % Finally it is mandatory to define the supervisor of the thesis with the help of
175 % \cs{supervisor}\marg{name}\marg{gender} macro:
176 %
177 % \begin{quote}
178 % |\supervisor{MMMMag. DDr. Wolfgang GRANIGG}{m}|
179 % \end{quote}
180 %
181 % \DescribeMacro{\cosupervisor}
182 % It may be the case that you have a second supervisor, which is optional and can be
183 % defined with the help of \cs{cosupervisor}\marg{name}\marg{gender} macro in the same
184 % way as for \cs{supervisor}.
185 %
186 % \DescribeMacro{\date}
187 % The date of submission is defined with the \cs{date} macro and it is expected to be
188 % a single line in the following format:
189 %
190 % \begin{quote}
191 % |\date{YYYY-MM-DD}|
192 % \end{quote}
193 %
194 % \DescribeMacro{\FHJLocation}
195 % The location which is used on the titlepage is defined with the \cs{FHJLocation} macro
196 % and it is expected to be a single line.
197 %
198 % \subsection{Abstract and keywords}
199 %
200 % All master thesis must contain an abstract in both German and English. The abstract
201 % should provide a brief summary of the research question, methodology, and key
202 % findings. To support you in typesetting the abstract, we provide macros for defining
203 % the abstract itself and the keywords.
204 %
205 % \DescribeMacro{\FHJAbstractDE} \DescribeMacro{\FHJAbstractEN}
206 % These macros are used to define the abstract in German and English respectively. Both
207 % commands follow the same syntax:
208 %
209 % \begin{quote}
210 % |\FHJAbstractDE|\marg{abstract text}\marg{keyword1,keyword2,$\dots$}\\
211 % |\FHJAbstractEN|\marg{abstract text}\marg{keyword1,keyword2,$\dots$}
212 % \end{quote}
213 %
214 % \textbf{Note:} The keywords are expected to be a comma-separated list of keywords
215 % whithout spaces before or after the commas. Do not forget to define the abstract and
216 % keywords in both languages!
217 %
218 % \section{Thesis document}
219 %
220 % \subsection{Front matter}
221 %
222 % If you have defined all necessary macros in the preamble, you can start with the
223 % document itself. In most cases you will want to use the following boilerplate at the
224 % beginning:
225 %
226 % \begin{quote}
227 % |\begin{document}|\\
228 % \hspace*{2em}|\frontmatter|\\
229 % \hspace*{2em}|\FHJThesisFrontMatter|\\
230 % \hspace*{2em}|\tableofcontents|\\
231 % \hspace*{2em}|\listoftables|\\
232 % \hspace*{2em}|\listoffigures|\\
233 % \hspace*{2em}|\mainmatter|\\
234 % \hspace*{2em}$\dots$\\
235 % |\end{document}|
236 % \end{quote}
237 %
238 % The macros \cs{frontmatter}, \cs{mainmatter} are special macros from KOMA-Script which
239 % seperate the front matter from the main content of the thesis -- one consequence for
240 % example is roman numbering of the pages in the front matter and arabic numbering in
241 % the main matter.
242 %
243 % \DescribeMacro{\FHJThesisFrontMatter}
244 % The macro \cs{FHJThesisFrontMatter} is used to typeset the front matter of the thesis.
245 % It will take care of all
246 % necessary formatting for you (for title page, abstract and declarations).
247 % Nevertheless, we also export the individual macros for the title page, abstract and
248 % declarations.
249 %
250 % \DescribeMacro{\FHJMakeTitlePage}
251 % The macro \cs{FHJMakeTitlePage} is used to typeset the title page of the thesis.
252 % It is expected to be
253 % called in the document body and will take care of all necessary formatting for you.
254 % It generates an empty page and should be the first page of the document.
255 %
256 % \DescribeMacro{\FHJMakeDeclaration}
257 % The macro \cs{FHJDeclaration} is used to typeset the declaration page of the thesis.
258 % It is actually contained in package \texttt{fhjcommon}.
259 %
260 % \DescribeMacro{\FHJMakeAbstract}
261 % The macro \cs{FHJMakeAbstract} is used to typeset the abstract of the thesis including
262 % keywords in both languages.
263 %
264 % \subsection{Appendix}
265 %
266 % The appendix is a section at the end of the thesis where you can include additional
267 % material that is not essential to the main text but may be helpful for the reader.
268 % This can include supplementary data, detailed explanations of methods or source code,
269 % or other relevant information.
270 %
271 % We at least recommend to include the list of abbreviations.
272 %
273 % \begin{quote}
274 % |\appendix|\\
275 % |\chapter{Appendix}|\\
276 % |\section{Source Code}|\\
277 % $\cdots$\\
278 % |\section{|$\cdots$|}|\\
279 % $\cdots$\\
280 % |% Will create its own section in the table of contents|\\
281 % |\printacronyms[template=supertabular,heading=section]|\\
282 % \end{quote}
283 %
284 % \subsection{Bibliography}
285 %
286 % The bibliography is an essential part of any thesis, as it provides a list of all the
287 % sources that were cited or consulted during the research process. It is important to
288 % follow a consistent citation style throughout the thesis and to include all necessary
289 % information for each source (see \verb|fhj_guide.pdf| for further information on
290 % writing a thesis in {\LaTeX}).
291 %
292 % A possible boilerplate for printing the bibliography in the document could look like
293 % this (|heading=bibnumbered| ensures that the bibliography is listed and numbered in
294 % the table of contents):
295 %
296 % \begin{quote}
297 % |\printbibliography[heading=bibnumbered]|
298 % \end{quote}
299 %
300 % \MaybeStop{\PrintChanges}
301 %
302 % \section{Implementation}
303 %
304 % \begin{macrocode}
305 \renewcommand*{\title}[1]{\renewcommand*{\@title}{{#1}}}
306 \newcommand{\check@title}{%
307 \@ifundefined{@author}{
308 \ClassWarningNoLine{fhjbook}{Author not defined}\author{first SECOND}
309 }{}
310 \@ifundefined{@title}{
311 \ClassWarningNoLine{fhjbook}{Title not defined}\title{Title}
312 }{}
313 \@ifundefined{@supervisor}{
314 \ClassWarningNoLine{fhjbook}{Supervisor not defined}\supervisor{Supervisor}{m}
315 }{}
316 }
317 \newcommand{\check@abstract}{%
318 \@ifundefined{@abstractDE}{
319 \ClassWarningNoLine{fhjbook}{German ``Kurzfassung'' not defined!}\FHJAbstractDE{Eine Beispielkurzfassung...}{kw1,kw2}
320 }{}
321 \@ifundefined{@abstractEN}{
322 \ClassWarningNoLine{fhjbook}{English abstract not defined!}\def\@abstractDE{An example abstract...}{kw1,kw2}
323 }{}
324 }
325 % Handhabung von Untertiteln:
326 \newif\ifsubtitlepresent\subtitlepresentfalse
327 \renewcommand{\subtitle}[1]
328 {\subtitlepresenttrue
329 \def\thesissubtitle{#1}}
330
331 % Autoren- und Betreuerinformationen:
332 \newif\ifauthormale\authormalefalse
333 \newif\ifauthorfemale\authorfemalefalse
334 \newcommand{\authorinfo}[3]{
335 \if#1m \authormaletrue \fi
336 \if#1f \authorfemaletrue \fi
337 \def\personenkennzahl{#2}
338 \def\jahrgang{#3}
339 }
340
341 \newif\ifsupervisormale\supervisormalefalse
342 \newif\ifsupervisorfemale\supervisorfemalefalse
343 \newcommand{\supervisor}[2]{
344 \def\@supervisor{#1}
345 \if#2m \supervisormaletrue \fi
346 \if#2f \supervisorfemaletrue \fi
347 }
348
349 \newif\ifcosupervisorpresent\cosupervisorpresentfalse
350 \newif\ifcosupervisormale\cosupervisormalefalse
351 \newif\ifcosupervisorfemale\cosupervisorfemalefalse
352 \newcommand{\cosupervisor}[2]{
353 \cosupervisorpresenttrue
354 \def\thesiscosupervisor{#1}
355 \if#2m \cosupervisormaletrue \fi
356 \if#2f \cosupervisorfemaletrue \fi
357 }
358
359 \newcommand{\FHJLocation}[1]{
360 \newcommand{\@location}{#1}
361 }
362
363 % Main title page
364 \newcommand{\FHJMakeTitlePage}{%
365 \check@title%
366 \thispagestyle{empty}%
367 \begin{center}
368 %% \IfStrEqCase{\FHJProgramShort}{
369 %% {DAT}{%
370 %% \includegraphics[width=70mm]{fhjInformaticsLogo.img.pdf}
371 %% }{IMS}{%
372 %% \includegraphics[width=70mm]{fhjInformaticsLogo.img.pdf}
373 %% }
374 \iflanguage{ngerman}{\includegraphics[width=70mm]{fhjInformaticsLogo.de.img.pdf}}{}
375 \iflanguage{english}{\includegraphics[width=70mm]{fhjInformaticsLogo.en.img.pdf}}{}
376 \\[10mm]
377
378 % Masterarbeit, Titel, Untertitel
379 \iflanguage{ngerman}{\textbf{MASTERARBEIT}}{}
380 \iflanguage{english}{\textbf{MASTER'S THESIS}}{}
381 \\[10mm]
382
383 \begin{minipage}{\textwidth}\begin{center}
384 \fontsize{16}{20}\selectfont
385 \textbf{\@title}
386 \end{center}\end{minipage}\\[5mm]
387
388 \ifsubtitlepresent
389 {\large\thesissubtitle}\\[10mm]
390 \else
391 \vspace*{15mm}
392 \fi
393
394 \iflanguage{ngerman}{
395 {\footnotesize
396 Eingereicht bei
397 }\\[2mm]
398 \FHJ\\
399 Masterstudiengang\\
400 ``\FHJProgramLong''
401 }{}
402 \iflanguage{english}{
403 { \footnotesize
404 Submitted at
405 }\\[2mm]
406 \FHJ\\
407 Master's Degree Programme\\
408 ``\FHJProgramLong''
409 }{}
410 \vspace*{10mm}
411
412 { \footnotesize
413 \iflanguage{ngerman}{\ifauthormale Autor \else \ifauthorfemale Autorin \else Autor:in \fi \fi}{}
414 \iflanguage{english}{Author}{}\\[2mm]
415 }
416 \@author\\
417 \personenkennzahl\\
418 \iflanguage{english}{Cohort}{}\iflanguage{ngerman}{Jahrgang}{} \FHJProgramShort\ \jahrgang\\[10mm]
419
420 {\footnotesize
421 \iflanguage{ngerman}{\ifsupervisormale Betreuer \else \ifsupervisorfemale Betreuerin \else Betreuer:in \fi \fi}{}
422 \iflanguage{english}{Supervisor}{}\\[2mm]
423 }
424 \@supervisor\\[10mm]
425
426 \ifcosupervisorpresent
427 {\footnotesize
428 \iflanguage{ngerman}{\ifcosupervisormale Zweiter Betreuer \else \ifcosupervisorfemale Zweite Betreuerin \else Zweite:r Betreuer:in \fi \fi}{}
429 \iflanguage{english}{Second Supervisor}{}\\[2mm]
430 }
431 \thesiscosupervisor
432 \fi
433
434 \end{center}
435
436 \vfill
437
438 \@location, \@date \hfill
439 \iflanguage{ngerman}{Unterschrift}{}
440 \iflanguage{english}{Signature}{}
441 \par\vspace*{1cm}
442 }
443
444 \newcommand{\FHJAbstractDE}[2]{%
445 \newcommand{\@abstractDE}{#1}
446 \newcommand*{\@keywordsDE}{#2}
447 }
448
449 \newcommand{\FHJAbstractEN}[2]{%
450 \newcommand{\@abstractEN}{#1}
451 \newcommand*{\@keywordsEN}{#2}
452 }
453
454 \newcommand*{\@lastkeyword}{}%
455 \newcommand*{\@kwseparator}{\space$\vert$\space}%
456 \newcommand{\@printkeyword}[1]{%
457 \expandafter\ifblank\expandafter{\@lastkeyword}{}%
458 {\@kwseparator}%
459 {#1}%
460 \renewcommand*{\@lastkeyword}{#1}%
461 }
462
463 \newcommand{\@printkeywords}[2]{%
464 \renewcommand*{\@lastkeyword}{}%
465 \IfStrEq{#2}{de}{\textit{Schlüsselwörter: }}{}%
466 \IfStrEq{#2}{en}{\textit{Keywords: }}{}%
467 \expandafter\forcsvlist\expandafter\@printkeyword\expandafter{#1}%
468 }
469
470 \newcommand{\FHJMakeAbstract}{%
471 \check@abstract
472 \cleardoublepage
473 \begingroup % to make sure we change parindent only in this group
474 \setlength{\parindent}{0pt}
475 \textbf{\Large Kurzfassung:}\\[5mm]
476 \@abstractDE
477 \vfill
478 \@printkeywords{\@keywordsDE}{de}
479 \clearpage
480 \textbf{\Large Abstract:}\\[5mm]
481 \@abstractEN
482 \vfill
483 \@printkeywords{\@keywordsEN}{en}
484 \endgroup
485 \cleardoublepage
486 }
487
488 %% Compile all title pages together
489 \newcommand{\FHJThesisFrontMatter}{%
490 % Main title page
491 \FHJMakeTitlePage%
492 % Declaration
493 \FHJMakeDeclaration%
494 % Abstract
495 \FHJMakeAbstract%
496 }
497 % \end{macrocode}
498 %
499 % \Finale
500 %
501 % \section{Acknowledgements}
502 %
503 % The original work for creating a base class for the study program ``\FHJDATLong'' was
504 % done by \textbf{Klaus Lichtenegger}. All appreciation goes to him for creating the
505 % first version of this class.
506 %
507 \endinput