Debian Codegraph @

texmf-dist/source/latex/rub-kunstgeschichte/rub-kunstgeschichte.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: rub-kunstgeschichte.dtx
4 % Copyright (C) 2024 by Joran Schneyer <[email protected]>
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3c
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % https://www.latex-project.org/lppl.txt
11 % and version 1.3c or later is part of all distributions of LaTeX
12 % version 2008 or later.
13 %
14 % This work has the LPPL maintenance status `maintained'.
15 %
16 % The Current Maintainer of this work is Joran Schneyer <[email protected]>.
17 %
18 % This work consists of the files rub-kunstgeschichte.dtx
19 % rub-kunstgeschichte-example.tex
20 % rub-kunstgeschichte.ins
21 % and the derived file rub-kunstgeschichte.cls
22 %
23 % \fi
24
25 % \iffalse
26 %<*driver>
27 \ProvidesFile{rub-kunstgeschichte.dtx}
28 %</driver>
29 %<class>\NeedsTeXFormat{LaTeX2e}[2022-06-01]
30 %<class>\ProvidesClass{rub-kunstgeschichte}
31 %<*class>
32 [2025-02-04 v0.5.0 RUB Kunstgeschichte class]
33 %</class>
34 %<*driver>
35 \documentclass{ltxdoc}
36
37 %^^A Load packages needed for the documentation
38 \usepackage{dtxdescribe}
39 \fvset{commandchars={|()}}
40
41 \EnableCrossrefs
42 \CodelineIndex
43 \RecordChanges
44 \begin{document}
45 \DocInput{\jobname.dtx}
46 \PrintChanges
47 \PrintIndex
48 \end{document}
49 %</driver>
50 % \fi
51 %
52 %^^A Document general changes here
53 % \changes{v0.1.0}{2024-05-26}{Initial version}
54 %
55 % \GetFileInfo{\jobname.dtx}
56 %
57 % \DoNotIndex{\newcommand,\newenvironment}
58 % \DoNotIndex{\begin,\end}
59 % \DoNotIndex{\fi}
60 % \DoNotIndex{\section,\subsection,\subsubsection}
61 % \DoNotIndex{\title,\author,\tableofcontents}
62 % \DoNotIndex{\LaTeX,\verb}
63 % \DoNotIndex{\texorpdfstring}
64 % \DoNotIndex{\@rubkgi@bibheading,\@rubkgi@bibheading@primary,\@rubkgi@bibheading@secondary}
65 % \DoNotIndex{\@rubkgi@maketitle}
66 % \DoNotIndex{\@rubkgi@titlepage@gradebox@width}
67 % \DoNotIndex{\@author,\@date,\@title}
68 % \DoNotIndex{\@rubkgi@titlepage@author@email,\@rubkgi@titlepage@author@matricnum,\@rubkgi@titlepage@author@semester,\@rubkgi@titlepage@seminar@semester,\@rubkgi@titlepage@seminar@lecturer,\@rubkgi@titlepage@seminar@name,\@rubkgi@titlepage@seminar@degree,\@rubkgi@titlepage@seminar@module,\@rubkgi@titlepage@seminar@creditpoints}
69 % \DoNotIndex{\@rubkgi@printfiguresources@heading}
70 %
71 %^^A define helper commands for consistent typesetting in the documentation
72 % \DeclareDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}}
73 %
74 % \title{The \pkg{\jobname} class^^A
75 % \thanks{This document corresponds to \pkg{\jobname}~\fileversion,
76 % dated \filedate.}}
77 % \author{\copyright{} Joran Schneyer^^A
78 % \thanks{Released under the LaTeX Project Public License v1.3c or later.^^A
79 % \\ See \url{https://www.latex-project.org/lppl.txt}}^^A
80 % \\ \email{[email protected]}}
81 % \date{\filedate}
82 %
83 % \maketitle
84 % \tableofcontents
85 %
86 % \section{Introduction}\label{sec:introduction}
87 %
88 % This \LaTeX{} class aims to implement the guidelines on scientific writing of the art history institute (Kunstgeschichtliches Institut - short: KGI) at Ruhr University Bochum.^^A
89 % \footnote{Guidelines version July 2023 \url{https://kgi.ruhr-uni-bochum.de/wp-content/uploads/2023/04/Anleitung-zum-Erstellen-von-Hausarbeiten-im-Fach-Kunstgeschichte_Fassung-Juli-2023.pdf}}
90 %
91 % Note, that at this point this is not an official class made by anyone at the institute but rather a free-time hobby project of me, Joran, who knows \LaTeX{} from studying Electrical Engineering and just wants to help out some friends studying art history.
92 %
93 % You can find the latest releases and the development of this project at GitHub: \url{https://github.com/rub-kgi/rub-kunstgeschichte-latex}
94 %
95 % \section{Usage}\label{sec:usage}
96 %
97 % To use this class, simply specify it as the document class.^^A
98 % \footnote{You can also find a complete example usage of this class that you can use as a template in the file \texttt{rub-kunstgeschichte-example.tex}. You can find this file alongside a compiled pdf version as part of the releases on GitHub \url{https://github.com/rub-kgi/rub-kunstgeschichte-latex/releases}.}
99 % \begin{sourceverb}
100 % \documentclass{rub-kunstgeschichte}
101 % \end{sourceverb}
102 %
103 % \subsection{Caveats}
104 % When using this class, some packages are loaded automatically with options (see also \autoref{sec:implementation:package-loading}).
105 % That means that you can't reload the same package with different options without risking an option clash error.
106 % The relevant packages offer other ways to change their options in the preamble:
107 %
108 % \DescribePackage{biblatex}
109 % Customize citations and bibliography.
110 %
111 % \verb|\ExecuteBibliographyOptions|\oarg{entrytype}\marg{options} can be used to set most options,
112 % but some can only be set at the time of loading the \pkg{biblatex} package.
113 % Those can be set in the class options using the \optn{biblatex} key (see also \autoref{sec:usage:class-options}).
114 %
115 % \DescribePackage{hyperref}
116 % Customize behavior of clickable elements and pdf meta-data.
117 %
118 % \verb|\hypersetup|\marg{options} should be used for nearly all options.
119 % The few options that can only be given at load time of the package have to be passed along using the \optn{hyperref} class option (see also \autoref{sec:usage:class-options}).
120 %
121 % \DescribePackage{setspace}
122 % Overwrite the 1.5 line-spacing setting.
123 %
124 % Either \verb|\singlespacing|,
125 % \verb|\doublespacing|
126 % or for custom spacing factors also
127 % \verb|\setstretch|\marg{baselinestretch}.
128 %
129 % \DescribePackage{geometry}
130 % Overwrite geometry options such as the page margin settings.
131 %
132 % \verb|\geometry|\marg{options}
133 %
134 % \subsection{Class options}\label{sec:usage:class-options}
135 % You can pass several \meta{options} to the class by using
136 % \begin{sourceverb}
137 % \documentclass|oarg(options){rub-kunstgeschichte}
138 % \end{sourceverb}
139 % The \meta{options} are key/value pairs that sometimes defer to a default value when only the key is given.
140 %
141 % \DescribeOption{biblatex}
142 % Pass along options to the \pkg{biblatex} package. They overwrite default options set by this class.
143 %
144 % \DescribeOption{hyperref}
145 % Pass along options to the \pkg{biblatex} package. They do \textbf{not} overwrite default options set by this class as they are set after loading the package using the \verb|\hypersetup| command.
146 % To overwrite them, use \verb|\hypersetup|\marg{options} in the preamble.
147 %
148 % \DescribeOption{parskip}
149 % \DescribeDefault{\optn{true}}
150 % Specify wether to load the \pkg{parskip} package to remove indentation at the start of paragraphs.
151 %
152 % \DescribeOption{noparskip}
153 % \DescribeDefault{\optn{true}}
154 % The complementary option to the \optn{parskip} option.
155 %
156 % If neither \optn{parksip} nor \optn{noparskip} are given, the \pkg{parskip} package is automatically loaded by default.
157 %
158 % \subsection{Macros}\label{sec:usage:macros}
159 %
160 % \DescribeMacro{\printbibliographies} \oarg{options}
161 %
162 % Prints the bibliography, divided into two subbibliographies.
163 % One for primary sources and one for secondary literature, as suggested in section 3.7.1 of the guidelines on page 14.
164 % It uses the keyword mechanism to distinguish primary sources i.e. in order for a bib entry to be sorted into the primary sources section, it needs the \texttt{source} keyword.
165 % E.g. the bible would be considered a primary source:
166 % \begin{sourceverb}
167 % @inbook{bible,
168 % author = {{The Bible}},
169 % title = {The Holy Bible: King James Version},
170 % |ldots
171 % keywords = {source}
172 % }
173 % \end{sourceverb}
174 % All other entries which don't have the \texttt{source} keyword will be sorted into the secondary literature section of the bibliography.
175 %
176 % You can customize the behavior of the macro using key-value \meta{options}. The option keys that are currently available are \optn{heading}, \optn{heading-primary} and \optn{heading-secondary} to overwrite the headings of the bibliography and the two subbibliographies respectively.
177 %
178 % \DescribeMacro{\maketitle} \oarg{titlepage-info}
179 %
180 % The native command \cs{maketitle} is redefined to create the title page according to the template in the guidelines.
181 % The new title page needs more information than the standard one.
182 % Besides the name of the author and title it needs more details about the author such as the matriculation number as well as information about the seminar the work is associated with.
183 % The extra info can be passed as key-value pairs to the optional \meta{titlepage-info} argument of the redefined \cs{maketitle} macro
184 % \DescribeMacro{\configureTitlepage}
185 % or to the \cs{configureTitlepage} macro implemented for just this task.
186 % The following custom keys are implemented:
187 % \begin{description}
188 % \ItemDescribeOption[titlepage]{email} The email of the author.
189 % \ItemDescribeOption[titlepage]{matricnum} The matriculation number of the author.
190 % \ItemDescribeOption[titlepage]{author-semester} The number of semesters the author has studied the subject.
191 % \ItemDescribeOption[titlepage]{seminar-semester} The semester in which the seminar takes place in. E.g. \optn{Sommersemester 2024} or \optn{Wintersemester 2023/24}.
192 % \ItemDescribeOption[titlepage]{seminar-lecturer} The name of the lecturer of the seminar.
193 % \ItemDescribeOption[titlepage]{seminar-name} The name of the seminar itself.
194 % \ItemDescribeOption[titlepage]{seminar-degree} The degree in which the author has taken the seminar in.
195 % \ItemDescribeOption[titlepage]{seminar-module} The module in which the author has taken the seminar in.
196 % \ItemDescribeOption[titlepage]{seminar-cp} The credit points the author will be rewarded with when completing the seminar.
197 % \end{description}
198 % Additionally you should set the normal \cs{author}, \cs{date} and \cs{title} info in the preamble.
199 %
200 % Note, that in contrast to e.g. the headers of the bibliography, the title page is not translated into the document language.
201 % The guidleines specify that exactly this template should be used and to our understanding this means that it should always be written in german, regardless of the document language.
202 %
203 % \DescribeMacro{\subtitle}
204 % In addition to the standard \cs{title} command, this class provides a \cs{subtitle} command. Note, that the subtitle has no key in \cs{configureTitlepage} but can only be set with the \cs{subtitle} command.
205 %
206 % \DescribeMacro{\appendix}
207 % To indicate the end of the main content and start of the appendix, the \cs{appendix} command is used in \LaTeX. Here, the command was redefined to automatically disable section numbering for the appendix as suggested in the guidelines. This means you can just use normal section commands such as
208 % \begin{sourceverb}
209 % \section{Figures}
210 % \end{sourceverb}
211 % after calling
212 % \begin{sourceverb}
213 % \appendix
214 % \end{sourceverb}
215 % and it will not have a section number.
216 %
217 % \DescribeMacro{\figuresource} \marg{figure source text}
218 %
219 % You can add the source of a figure inside a \env{figure} environment with the \cs{figuresource} command,\footnote{Hint: You can use \cs{fullcite} inside of \cs{figuresource} to print a full citation e.g. of a literature where the figure is from to further ease the process of stating figure sources.}
220 %
221 % \DescribeMacro{\printfiguresources} \oarg{options}
222 %
223 % so that you can later use \cs{printfiguresources} to automatically list all figure sources in the order of figure numbers.
224 % \DescribeKey{heading}
225 % Currently, \meta{options} only consist of the \texttt{heading} key to overwrite the heading of the figure sources section.\footnote{If you only want to add a heading for a different language, see \autoref{sec:usage:translations}.}
226 %
227 % \subsection{Translations}\label{sec:usage:translations}
228 %
229 % The class uses the \pkg{translations} package to allow multi-lingual strings. The default language is english. To tell it which language it should use, you can load a package like \pkg{babel} with the corresponding language as the package option in the preamble. E.g. for german using the new spelling rules
230 % \begin{sourceverb}
231 % \usepackage[ngerman]{babel}
232 % \end{sourceverb}
233 %
234 % All pre-defined strings this class prints on the page of the document (such as the headings of the bibliographies when using \cs{printbibliographies}) are available in multiple languages.
235 % So far this package only defines its strings for english and german, but you can define them for other languages too.\footnote{E.g. using the \cs{declaretranslation} command. For more info, refer to the documentation of the \pkg{translations} package: \url{https://ctan.org/pkg/translations}}
236 %
237 % The translation string definitions can be found in \autoref{sec:implementation:translations}.
238 %
239 % \StopEventually{}
240 %
241 % \clearpage
242 % \appendix
243 %
244 % \section{Implementation}\label{sec:implementation}
245 %
246 % \iffalse
247 %<*class>
248 % \fi
249 %
250 % \subsection{Class options}\label{sec:implementation:class-options}
251 % \iffalse
252 %% Class options
253 % \fi
254 % The class options are defined as keyval options for great flexibility.
255 % They toggle some of the class features or customize their behavior.
256 %
257 % \begin{option}{biblatex}
258 % The \optn{biblatex} option stores its content in a macro until it is later passed along to the \pkg{biblatex} package after specifying the default options (see \autoref{sec:implementation:package-loading:bibliography}).
259 % Therefore, options provided with this key overwrite the ones set per default by this class.
260 % \begin{macrocode}
261 \DeclareKeys[rubkgi]{
262 biblatex.store = \@rubkgi@biblatexOptions,
263 biblatex.usage = load
264 }
265 % \end{macrocode}
266 % \end{option}
267 %
268 % \begin{option}{hyperref}
269 % The \optn{hyperref} option passes its content along immediately, to be used as options when the \pkg{hyperref} package is loaded.
270 % This will \textbf{not} overwrite default options set by this class as they are set after loading the package using \verb|\hypersetup|\marg{options} (see also \autoref{sec:implementation:package-loading:others}).
271 % \begin{macrocode}
272 \DeclareKeys[rubkgi]{
273 hyperref.code = \PassOptionsToPackage{#1}{hyperref},
274 hyperref.usage = load
275 }
276 % \end{macrocode}
277 % \end{option}
278 %
279 % \paragraph{Paragraph indentation}
280 % First we define a TeX switch which is later used (see \autoref{sec:implementation:package-loading}) to check wether to load the \pkg{parskip} package to remove the indentation at the start of paragraphs.
281 % \iffalse
282 %% TeX switch to decide wether to load the parskip package
283 % \fi
284 % \begin{macrocode}
285 \newif\if@rubkgi@parskip
286 % \end{macrocode}
287 % By default we set the switch to true, so the parskip package is normally loaded when using this class.
288 % \begin{macrocode}
289 \@rubkgi@parskiptrue
290 % \end{macrocode}
291 % \begin{option}{parskip}
292 % Then we declare the key so the switch can be turned on and off by the user in the class options.
293 % \begin{macrocode}
294 \DeclareKeys[rubkgi]{
295 parskip.if = @rubkgi@parskip,
296 parskip.usage = load,
297 % \end{macrocode}
298 % \end{option}
299 % \begin{option}{noparskip}
300 % Finally we define the complementary key for easier disabling of the parskip feature.
301 % \begin{macrocode}
302 noparskip.ifnot = @rubkgi@parskip,
303 noparskip.usage = load
304 }
305 % \end{macrocode}
306 % \end{option}
307 %
308 % \paragraph{Process options}
309 % After defining the class options it is necessary to process them too in order to actually make use of them.
310 % \begin{macrocode}
311 \ProcessKeyOptions[rubkgi]
312 % \end{macrocode}
313 %
314 % \subsection{Base class}\label{sec:implementation:base-class}
315 % \DescribeClass{article}
316 % The \pkg{\jobname} class is based on the \pkg{article} class.
317 % When loading the class we specify \texttt{12pt} as the base font size, as required by the guidelines.
318 % \iffalse
319 %% Load base class with 12pt base font size
320 % \fi
321 % \begin{macrocode}
322 \LoadClass[12pt]{article}
323 % \end{macrocode}
324 %
325 % \subsection{Loading packages}\label{sec:implementation:package-loading}
326 %
327 % \subsubsection{Bibliography}\label{sec:implementation:package-loading:bibliography}
328 %
329 % \DescribePackage{biblatex}
330 % \changes{v0.2.0}{2024-09-06}{Use biblatex with authortitle-dw style from biblatex-dw package.}^^A
331 % \changes{v0.3.0}{2024-10-30}{Use arthistory-bonn biblatex style instead of authortitle-dw.}^^A
332 % To support bibliography facilities out of the box, the \pkg{biblatex} package is loaded. To customize the behavior, a few options are passed to the package.
333 % \iffalse
334 %% biblatex options
335 % \fi
336 % \begin{macrocode}
337 \PassOptionsToPackage{
338 % \end{macrocode}
339 %
340 % \DescribeOption[biblatex]{backend}
341 % Defines the backend program. To use all features of \pkg{biblatex}, the \prog{biber} backend must be used.
342 % \begin{macrocode}
343 backend=biber,
344 % \end{macrocode}
345 %
346 % \DescribeOption[biblatex]{singletitle}
347 % Prints the title of a cited work in short citations only if there is more than one work of the same author.
348 % \begin{macrocode}
349 singletitle=true,
350 % \end{macrocode}
351 %
352 % \DescribeOption[biblatex]{autocite}
353 % Defines the behavior of the \cs{autocite} command, which in this case will behave like the \cs{footcite} command and will print citations in the footnotes instead of directly in the text.
354 % \begin{macrocode}
355 autocite=footnote,
356 % \end{macrocode}
357 %
358 % \DescribeOption[biblatex]{autopunct}
359 % Controls whether the citation commands scan ahead for punctuation marks and move the citation after the punctuation.
360 % \begin{macrocode}
361 autopunct=true
362 }{biblatex}
363 % \end{macrocode}
364 %
365 % \DescribePackage{biblatex-arthistory-bonn}
366 % \iffalse
367 %% biblatex-arthistory-bonn package
368 % \fi
369 % Further approximation of the suggested bibliography and citation styles in the guidelines is achieved by using the \pkg{biblatex-arthistory-bonn} package.
370 % To use it, a few more options are passed to \pkg{biblatex}:
371 % \begin{macrocode}
372 \PassOptionsToPackage{
373 % \end{macrocode}
374 %
375 % \DescribeOption[biblatex]{style}
376 % The \optn{arthistory-bonn} style provided by the \pkg{biblatex-arthistory-bonn} package is suited to approximate the citation style suggested in the guidelines.
377 % \begin{macrocode}
378 style=arthistory-bonn,
379 % \end{macrocode}
380 %
381 % The following options of the \optn{arthistory-bonn} biblatex style are set to further implement the guidelines:
382 %
383 % \DescribeOption[biblatex]{firstcitefull}
384 % Delivers a full citation for the first occurence of an entry.
385 % \begin{macrocode}
386 firstcitefull=true,
387 % \end{macrocode}
388 %
389 % \DescribeOption[biblatex]{enddot}
390 % Every bibliography entry will end with a dot.
391 % \begin{macrocode}
392 enddot=true,
393 % \end{macrocode}
394 %
395 % The next \optn{arthistory-bonn} option is not implementing any part of the guidelines but is still useful:
396 %
397 % \DescribeOption[biblatex]{namelinked}
398 % Both name and year in a short citation will link to the respective bibliography entry.
399 % \begin{macrocode}
400 namelinked=true
401 }{biblatex}
402 % \end{macrocode}
403 %
404 % After specifying the default options, we pass along the ones that might have been set in the class options.
405 % \iffalse
406 %% pass biblatex class options along
407 % \fi
408 % \begin{macrocode}
409 \PassOptionsToPackage{\@rubkgi@biblatexOptions}{biblatex}
410 % \end{macrocode}
411 %
412 % And finally the \pkg{biblatex} package is loaded.
413 % \iffalse
414 %% load biblatex
415 % \fi
416 % \begin{macrocode}
417 \RequirePackage{biblatex}
418 % \end{macrocode}
419 %
420 % \subsubsection{Document format}
421 %
422 % \DescribePackage{setspace}
423 % To achieve 1.5 times line spacing as required by the guidelines,
424 % we simply load the package \pkg{setspace} with the \optn{onehalfspacing} option.
425 % \iffalse
426 %% Set 1.5 times line spacing
427 % \fi
428 % \begin{macrocode}
429 \RequirePackage[onehalfspacing]{setspace}
430 % \end{macrocode}
431 %
432 % \DescribePackage{geometry}
433 % Used to set page size and margins.
434 % The guidelines require 2cm top, left and bottom margins as well as a 4cm correction margin on the right side.
435 % Furthermore A4 paper is the standard page size here.
436 % \iffalse
437 %% Set a4 paper size and margins
438 % \fi
439 % \begin{macrocode}
440 \RequirePackage[
441 a4paper,
442 top=2cm,left=2cm,bottom=2cm,right=4cm
443 ]{geometry}
444 % \end{macrocode}
445 %
446 % \DescribePackage{parskip}
447 % \changes{v0.2.0}{2024-09-06}{Use parskip to avoid paragraph indentation}^^A
448 % To avoid indentation at the start of paragraphs, the \pkg{parskip} package is loaded if the corresponding switch is set to true. See also \autoref{sec:implementation:class-options}.
449 % \iffalse
450 %% Avoid paragraph indentation
451 % \fi
452 % \begin{macrocode}
453 \if@rubkgi@parskip
454 \RequirePackage{parskip}
455 \fi
456 % \end{macrocode}
457 %
458 % \subsubsection{Other useful packages}\label{sec:implementation:package-loading:others}
459 %
460 % \DescribePackage{etoolbox}
461 % \changes{v0.5.0}{2025-02-04}{Use \pkg{etoolbox} for dynamic definition of internal macros.}^^A
462 % Used for several programming tasks. E.g. it allows dynamic internal macro names which is used for the automatic figure source printing system.
463 % \begin{macrocode}
464 \RequirePackage{etoolbox}
465 % \end{macrocode}
466 %
467 % \DescribePackage{forloop}
468 % \changes{v0.5.0}{2025-02-04}{Use \pkg{forloop} package for simple loops.}^^A
469 % Another package for better, easier and more robust programming which simply provides a command for doing loops.
470 % \begin{macrocode}
471 \RequirePackage{forloop}
472 % \end{macrocode}
473 %
474 % \DescribePackage{hyperref}
475 % \changes{v0.2.0}{2024-09-06}{Use hyperref for clickable links and references.}^^A
476 % Makes links and references clickable.
477 % \iffalse
478 %% Hyperref
479 % \fi
480 % \begin{macrocode}
481 \RequirePackage{hyperref}
482 % \end{macrocode}
483 % By default, we configure it to not highlight clickable elements.
484 % \begin{macrocode}
485 \hypersetup{hidelinks}
486 % \end{macrocode}
487 %
488 % \DescribePackage{translations}
489 % Used internally by the class to create multilingual strings that react to the document language set e.g. by \pkg{babel}.
490 % \iffalse
491 %% Translations
492 % \fi
493 % \begin{macrocode}
494 \RequirePackage{translations}
495 % \end{macrocode}
496 %
497 % \iffalse
498 %% Other
499 % \fi
500 %
501 % \DescribePackage{tabularx}
502 % To make fancy tables. Is used e.g. in the title page.
503 % \begin{macrocode}
504 \RequirePackage{tabularx} % For fancy tables. Is used in title page.
505 % \end{macrocode}
506 %
507 % \DescribePackage{boxedminipage}
508 % Used by title page.
509 % \begin{macrocode}
510 \RequirePackage{boxedminipage} % Used in title page.
511 % \end{macrocode}
512 %
513 % \subsection{Macros}\label{sec:implementation:macros}
514 % \iffalse
515 %% Macros
516 % \fi
517 %
518 % \begin{macro}{\printbibliographies}
519 % \changes{v0.4.0}{2024-12-11}{Fix: Unwanted space before bibliography headings}^^A
520 % \changes{v0.3.0}{2024-10-30}{was added}^^A
521 % Prints the bibliography using the native \cs{printbibliography} macro, but divides it into sections for primary sources and secondary literature. The keyword \texttt{source} is used to sort entries into the primary sources section.
522 %
523 % We start by defining the macro with an optional argument that is passed to \cs{SetKeys} to allow customization using key-value pairs.
524 % \begin{macrocode}
525 \newcommand{\printbibliographies}[1][]{%
526 \SetKeys[rubkgi@printbibliographies]{#1}%
527 % \end{macrocode}
528 % We add an entry to the table of contents and insert the main bibliography heading.
529 % \begin{macrocode}
530 \addcontentsline{toc}{section}{%
531 \texorpdfstring{\@rubkgi@bibheading}{bibliography}%
532 }%
533 \printbibheading[%
534 heading = bibliography,%
535 title = {\@rubkgi@bibheading}%
536 ]
537 % \end{macrocode}
538 % Then we print the subbibliographies.
539 % \begin{macrocode}
540 \printbibliography[%
541 keyword = source,%
542 heading = subbibliography,%
543 title = {\@rubkgi@bibheading@primary}%
544 ]
545 \printbibliography[%
546 notkeyword = source,%
547 heading = subbibliography,%
548 title = {\@rubkgi@bibheading@secondary}%
549 ]
550 }
551 % \end{macrocode}
552 % For greater flexibility we define the heading strings as internal macros that can be redefined by the user with key-value options and use the \pkg{translations} package for the default strings. See \autoref{sec:implementation:translations} for the implementation of the translations. We don't want heading strings to include paragraphs, this is why we use the starred variant of \cs{newcommand}.
553 % \begin{macrocode}
554 \newcommand*{\@rubkgi@bibheading}{%
555 \GetTranslationWarn{Bibliography}
556 }
557 \newcommand*{\@rubkgi@bibheading@primary}{%
558 \GetTranslationWarn{Primary Bibliography}
559 }
560 \newcommand*{\@rubkgi@bibheading@secondary}{%
561 \GetTranslationWarn{Secondary Bibliography}
562 }
563 % \end{macrocode}
564 % Finally, we declare the keys that the user can use to redefine the headings.
565 % \begin{macrocode}
566 \DeclareKeys[rubkgi@printbibliographies]
567 {
568 heading .store = \@rubkgi@bibheading,
569 heading-primary .store = \@rubkgi@bibheading@primary,
570 heading-secondary .store = \@rubkgi@bibheading@secondary
571 }
572 % \end{macrocode}
573 % \end{macro}
574 %
575 % \begin{macro}{\maketitle}
576 % \changes{v0.3.0}{2024-10-30}{Redefined for custom title page according to template in guidelines.}^^A
577 % We redefine the \cs{maketitle} macro to print a custom title page.
578 % We also add the ability to customize it using key-value pairs in the optional argument.
579 % \begin{macrocode}
580 \renewcommand{\maketitle}[1][]{%
581 \SetKeys[rubkgi@titlepage]{#1}%
582 \@rubkgi@maketitle%
583 }
584 % \end{macrocode}
585 % \end{macro}
586 %
587 % \begin{macro}{\@rubkgi@maketitle}
588 % The custom title page is defined as a dedicated internal command.
589 % \begin{macrocode}
590 \newcommand{\@rubkgi@maketitle}{
591 % \end{macrocode}
592 % It uses the \env{titlepage} environment to dedicate a full page to the titel.
593 % Inside, it uses groups, minipages and tabularx tables to arrange the fields to resemble the template of the guidelines.
594 % \begin{macrocode}
595 \begin{titlepage}
596 % set page margins for the title page
597 \newgeometry{left=2.5cm,top=2.5cm,bottom=2cm,right=2.5cm}%
598 % define the width of the grade box
599 \def\@rubkgi@titlepage@gradebox@width{5.03cm}%
600 %
601 % create a group for the top part of the title page
602 {\raggedright%
603 % create a minipage for the top left part
604 \begin{minipage}[t]%
605 % calculate the width of the top left part
606 % based on the grade box width
607 {\dimexpr\textwidth%
608 -\@rubkgi@titlepage@gradebox@width%
609 -0.5cm\relax}%
610 \vspace{0pt}% somehow helps aligning at the top
611 \begin{tabularx}{\linewidth}{@{}lX}%
612 \multicolumn{2}{@{}l}{%
613 Ruhr-Universität Bochum%
614 }\\%
615 \multicolumn{2}{@{}l}{%
616 Fakultät für Geschichtswissenschaft%
617 }\\%
618 \multicolumn{2}{@{}l}{%
619 Kunstgeschichtliches Institut%
620 }\\%
621 \multicolumn{2}{@{}l}{%
622 \@rubkgi@titlepage@seminar@semester%
623 }\\%
624 Dozent:in: & \@rubkgi@titlepage@seminar@lecturer\\%
625 Seminartitel: & \@rubkgi@titlepage@seminar@name\\%
626 Studiengang: & \@rubkgi@titlepage@seminar@degree\\%
627 Modul: & \@rubkgi@titlepage@seminar@module\\%
628 Kreditpunkte: & \@rubkgi@titlepage@seminar@creditpoints\\%
629 \end{tabularx}%
630 \end{minipage}%
631 % align grade box on the right side by filling in the gap
632 \hfill%
633 % define the grade box as a boxedminipage
634 \begin{boxedminipage}[t][3.78cm][t]%
635 {\@rubkgi@titlepage@gradebox@width}%
636 % leave a little space and add the text inside
637 \vspace{1em}%
638 \hspace{1em}Note:%
639 \end{boxedminipage}%
640 }% top part ends here
641 %
642 \vfill% vertical space to fill
643 %
644 % create center part (title and author)
645 \begin{center}%
646 % add title relatively LARGE
647 {\LARGE \@title \par}%
648 {\Large \@subtitle \par}%
649 \vskip 2em% add space between (sub-)title and author
650 % add author slightly larger than normal text
651 {\large \@author \par}%
652 % end the center environment
653 % and switch back to normal paragraph text style
654 \end{center}\par%
655 %
656 \vfill% fill gap to put next part at bottom
657 %
658 % create bottom part
659 {\raggedright%
660 \begin{tabular}{@{}ll}%
661 Matrikelnr.: & \@rubkgi@titlepage@author@matricnum\\%
662 % Add email as a clickable link
663 Email: & \href{mailto:\@rubkgi@titlepage@author@email}%
664 {\@rubkgi@titlepage@author@email}\\%
665 Fachsemester: & \@rubkgi@titlepage@author@semester\\%
666 Abgabetermin: & \@date\\%
667 \end{tabular}
668 }%
669 \end{titlepage}%
670 % \end{macrocode}
671 % The guidelines specify that the titlepage counts towards the page numbers but should not display one. Therefore we set the page number counter to two after the title page.
672 % \begin{macrocode}
673 \setcounter{page}{2}%
674 % \end{macrocode}
675 % We also reset the geometry to the one defined before the title page and then end the custom titlepage macro.
676 % \begin{macrocode}
677 \restoregeometry%
678 }
679 % \end{macrocode}
680 % The custom title page needs extra information which we want the user to be able to set via key-value pairs. We first define the key-value pairs and then set the defaults.
681 % \begin{macrocode}
682 \DeclareKeys[rubkgi@titlepage]
683 {
684 email .store = \@rubkgi@titlepage@author@email,
685 matricnum .store = \@rubkgi@titlepage@author@matricnum,
686 author-semester .store = \@rubkgi@titlepage@author@semester,
687 seminar-semester .store = \@rubkgi@titlepage@seminar@semester,
688 seminar-lecturer .store = \@rubkgi@titlepage@seminar@lecturer,
689 seminar-name .store = \@rubkgi@titlepage@seminar@name,
690 seminar-degree .store = \@rubkgi@titlepage@seminar@degree,
691 seminar-module .store = \@rubkgi@titlepage@seminar@module,
692 seminar-cp .store = \@rubkgi@titlepage@seminar@creditpoints
693 }
694 \SetKeys[rubkgi@titlepage]
695 {
696 email = {YOUR-EMAIL},
697 matricnum = {YOUR MATRICULATION NUMBER},
698 author-semester = {YOUR NUMBER OF SEMESTERS},
699 seminar-semester = {THE SEMESTER IN WHCIH THE SEMINAR IS HELD},
700 seminar-lecturer = {NAME OF SEMINAR LECTURER},
701 seminar-name = {NAME OF THE SEMINAR},
702 seminar-degree = {DEGREE SEMINAR IS TAKEN IN},
703 seminar-module = {MODULE SEMINAR IS TAKEN IN},
704 seminar-cp = {SEMINAR CP}
705 }
706 % \end{macrocode}
707 % \end{macro}
708 %
709 % \begin{macro}{\configureTitlepage}
710 % Furthermore, we create a macro that can be used in the preamble to set the titlepage info keys.
711 % \begin{macrocode}
712 \newcommand{\configureTitlepage}[1]{%
713 \SetKeys[rubkgi@titlepage]{#1}%
714 }
715 % \end{macrocode}
716 % \end{macro}
717 %
718 % \begin{macro}{\subtitle}
719 % \changes{v0.5.0}{2025-02-04}{Added}^^A
720 % The titlepage also has the option for a subtitle.
721 % For consistency with other packages and classes we provide a dedicated \cs{subtitle} command instead of a key in \cs{configureTitlepage}.
722 % \begin{macrocode}
723 \newcommand{\subtitle}[1]{%
724 \gdef\@subtitle{#1}%
725 }
726 % \end{macrocode}
727 % We also initialize the subtitle as empty
728 % \begin{macrocode}
729 \gdef\@subtitle{}%
730 % \end{macrocode}
731 % \end{macro}
732 %
733 % \begin{macro}{\appendix}
734 % \changes{v0.4.0}{2024-12-11}{redefined to disable section numbering}^^A
735 % To automatically disable section numbering in appendix sections,
736 % we redefine \cs{appendix} to include setting the section numbering depth to zero.
737 % \iffalse
738 %% Extend \appendix to disable section numbering
739 % \fi
740 % First, we save the old appendix definition in a different macro.
741 % \begin{macrocode}
742 \let\oldappendix\appendix%
743 % \end{macrocode}
744 % Then we redefine the \cs{appendix} command
745 % \begin{macrocode}
746 \renewcommand{\appendix}{%
747 % \end{macrocode}
748 % starting with the old appendix macro
749 % \begin{macrocode}
750 \oldappendix%
751 % \end{macrocode}
752 % and extending it with setting the section numbering depth to zero,
753 % which will result in disabled section numbers.
754 % \begin{macrocode}
755 \setcounter{secnumdepth}{0}%
756 }
757 % \end{macrocode}
758 % \end{macro}
759 %
760 % \begin{macro}{\figuresource}
761 % \changes{v0.5.0}{2025-02-04}{Added}^^A
762 % This is used to save a figure source string (potentially including a \cs{cite} command) for later use with \cs{printfiguresources}.
763 % We use the \cs{csgdef} command of the \pkg{etoolbox} package to define a dynamically named macro for each figure to store the figure source string.
764 % \begin{macrocode}
765 \newcommand{\figuresource}[1]{%
766 \csgdef{figsource@\thefigure}{#1}%
767 }
768 % \end{macrocode}
769 % \end{macro}
770 % \begin{macro}{\printfiguresources}
771 % \changes{v0.5.0}{2025-02-04}{Added}^^A
772 % With the saved figure sources from \cs{figuresource}, we can print a list of them using the \cs{forloop} command of the \pkg{forloop} package.
773 % We also provide an optional argument to overwrite the heading of the figure sources section that we create in this command.
774 % \begin{macrocode}
775 \newcommand{\printfiguresources}[1][]{%
776 \SetKeys[rubkgi@printfiguresources]{#1}%
777 \section{\@rubkgi@printfiguresources@heading}%
778 \newcounter{@figindex}%
779 \forloop{@figindex}{1}%
780 {\value{@figindex} < \numexpr\value{figure}+1\relax}{%
781 \ifcsdef{figsource@\the@figindex}{%
782 \noindent \figurename~\the@figindex: %
783 \csname figsource@\the@figindex\endcsname\par%
784 }{}%
785 }%
786 }
787 % \end{macrocode}
788 % In order for this to work we will use the translation package for the heading by default
789 % \begin{macrocode}
790 \newcommand*{\@rubkgi@printfiguresources@heading}{%
791 \GetTranslationWarn{Figure Sources}%
792 }
793 % \end{macrocode}
794 % and declare a key for the options of \cs{printfiguresources} to overwrite the heading:
795 % \begin{macrocode}
796 \DeclareKeys[rubkgi@printfiguresources]
797 {
798 heading .store = \@rubkgi@printfiguresources@heading
799 }
800 % \end{macrocode}
801 % \end{macro}
802 %
803 % \subsection{Translations}\label{sec:implementation:translations}
804 % \changes{v0.3.0}{2024-10-30}{Use translations package for multi-lingual support.}^^A
805 % \changes{v0.5.0}{2025-02-04}{Add strings for figure sources section heading.}^^A
806 %
807 % The \pkg{translations} package offers an easy interface to create multilingual strings. We can define them all at once here, at the end of the class, since they are only used when the user commands are expanded in the document.
808 %
809 % \subsubsection*{Bibliography headings}
810 %
811 % The \pkg{translations} package already comes with translations for the main heading of the bibliography. Additionally, we provide the headings for the subbibliographies in english and german.
812 % \begin{macrocode}
813 \DeclareTranslation{english}{Primary Bibliography}{Primary sources}
814 \DeclareTranslation{german}{Primary Bibliography}{Primärliteratur}
815 \DeclareTranslation{english}{Secondary Bibliography}{Secondary literature}
816 \DeclareTranslation{german}{Secondary Bibliography}{Sekundärliteratur}
817 % \end{macrocode}
818 %
819 % \subsubsection*{Figures}
820 %
821 % We provide figure sources section headings for english and german:
822 % \begin{macrocode}
823 \DeclareTranslation{english}{Figure Sources}{Figure Credits}
824 \DeclareTranslation{german}{Figure Sources}{Abbildungsnachweise}
825 % \end{macrocode}
826 %
827 % \iffalse
828
829 %</class>
830 % \fi
831 %
832 % \Finale