Debian Codegraph @

texmf-dist/source/latex/se2thesis/se2packages.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: se2packages.dtx Copyright (C) 2022--2024 Stephan Lukasczyk
4 %
5 % It may be distributed and/or modified under the conditions of the
6 % LaTeX Project Public License (LPPL), either version 1.3c of this
7 % license or (at your option) any later version. The latest version
8 % of this license is in the file
9 %
10 % https://www.latex-project.org/lppl.txt
11 %
12 % This file is part of the "se2thesis bundle" (The Work in LPPL)
13 % and all files in that bundle must be distributed together.
14 %
15 % The released version of this bundle is available from CTAN.
16 %
17 % ----------------------------------------------------------------------
18 %
19 % The development version of the bundle can be found at
20 %
21 % https://github.com/se2p/se2thesis
22 %
23 % for those people who are interested.
24 %
25 % ----------------------------------------------------------------------
26 %
27 %<*driver>
28 \documentclass{l3doc}
29 % The next line is needed so that \GetFileInfo will be able to pick up
30 % version data.
31 \usepackage{se2packages}
32
33 \usepackage[UKenglish]{babel}
34 \usepackage{hvlogos}
35
36 \begin{document}
37 \DocInput{\jobname.dtx}
38 \end{document}
39 %</driver>
40 % \fi
41 %
42 % \GetFileInfo{se2packages.sty}
43 %
44 % \title{^^A
45 % \pkg{se2packages}---Supporting Packages for the \pkg{se2thesis} Bundle^^A
46 % \thanks{This file describes \fileversion, last revised \filedate.}^^A
47 % }
48 %
49 % \author{^^A
50 % Stephan Lukasczyk^^A
51 % \thanks{Email: \href{mailto:[email protected]}{[email protected]}}^^A
52 % }
53 %
54 % \date{Released \filedate}
55 %
56 % \maketitle
57 %
58 % \begin{documentation}
59 %
60 % \section{The \pkg{se2packages} package}\label{sec:doc-se2packages}
61 %
62 % Several packages can be useful for writing a thesis.
63 % We provide a simple package for the user
64 % that loads these support packages with the recommended options.
65 % Please note that you might not need all these packages,
66 % however,
67 % having a look at them (especially their documentation)
68 % might give you an insight whether to use a certain package.
69 % Our general recommendation is to use as few packages as you can;
70 % some might have conflicts,
71 % others basically do the same,
72 % or are outdated.
73 % Please consider reading the documentation of each package you are using
74 % to figure out whether they have any conflicts with other packages
75 % (for example, one cannot use the recommended \pkg{siunitx} package
76 % together with \pkg{SIunits}) or they might require to be loaded
77 % at special places in your preamble (for example, \pkg{hyperref}
78 % is usually meant to be loaded as the last package,
79 % except you are also using \pkg{cleveref},
80 % which needs to be loaded \emph{after} \pkg{hyperref}).
81 %
82 % \subsection{The Recommended Packages}
83 %
84 % We first present the packages we recommend
85 % and give a rationale why we believe they should be used.
86 % Afterwards,
87 % we will discuss how to load the \pkg{se2packages} package
88 % to use one or the other of these recommended packages
89 % in the next section.
90 %
91 % \subsubsection{Quoting with \pkg{csquotes}}
92 %
93 % The \pkg{csquotes} packages allows you for intelligent quoting of text.
94 % While verbose quotes are not that common in computer science,
95 % the package still provides some useful macros to the user.
96 %
97 % \subsubsection{Number formatting with \pkg{siunitx}}
98 %
99 % While \pkg{siunitx}'s original purpose was to format physical quantities,
100 % it provides a lot of useful features
101 % when typesetting theses (and other documents) in computer science.
102 % When you skim through its documentation,
103 % especiall look at the \cmd{\qty} and \cmd{\num} macros,
104 % as well as the section on typesetting tabular material.
105 % We also recommend reading an extensive discussion on number formatting,
106 % precision of presented numbers,
107 % and more related topics in Beyer et al.'s journal paper
108 % on requirements and solutions for reliable
109 % benchmarking~\cite{DBLP:journals/sttt/BeyerLW19}.
110 %
111 % \subsubsection{Code Listings}
112 %
113 % We prefer using the \pkg{minted} package for code listings
114 % because it provides a lot of options for styling
115 % as well as built-in support for a huge number of languages.
116 % However,
117 % this package requires the installation of Python
118 % and the setting of the |-shell-escape| option to your \TeX{} engine.
119 % Please read the package's documentation to set it up;
120 % the aforementioned Docker images from the Island of \TeX{} project
121 % provide you everything set up already.
122 %
123 % In case you do not want to use the \pkg{minted} package,
124 % please consider using \pkg{listings} for typesetting your code listings.
125 %
126 % Please be aware to use \emph{either} \pkg{minted} \emph{or} \pkg{listings}!
127 %
128 % \emph{Attention:} The way how \pkg{minted} is implemented causes the resulting
129 % code to be typeset in gray scale, if you use the \pkg{se2colors} package with
130 % option |cmode=bw| or the \cls{se2thesis} class with |colormode=bw| (or their
131 % respective aliases). Students were requesting that they want to use the
132 % black-and-white mode of \pkg{se2color} because it saves lots of money when
133 % printing their thesis, while they want the colours in the syntax highlighting
134 % of \pkg{minted}. One can achieve this by adding hooks to the preamble of the
135 % document, after loading the \pkg{minted} package (which is recommend by
136 % setting |minted=true| as an option to \pkg{se2packages}):
137 % \begin{LaTeXdemo}[code only]
138 % \AddToHook{env/minted/begin}{\selectcolormodel{cmyk}}
139 % \AddToHook{cmd/mintinline/before}{\selectcolormodel{cmyk}}
140 % \end{LaTeXdemo}
141 % Thanks to Ulrike Fischer for pointing out this hook mechanism.\footnote{%
142 % \href{https://tex.stackexchange.com/a/718719/14622}{tex.stackexchange.com/a/718719/14622}
143 % }
144 %
145 % Another option, if you do not want colours in the \pkg{minted} output when you
146 % use the gray-scale mode of \pkg{se2colors} is the change the highlighting
147 % style, \pkg{minted} uses. The package for this provides the macro
148 % \cs{usemintedstyle}, which accepts a style available in your local
149 % \texttt{pygments} installation, see the \texttt{pygments}
150 % documentation\footnote{%
151 % \href{https://pygments.org/styles/}{pygments.org/styles/}
152 % } for an overview over the available styles; the |bw| style is explicitly
153 % designed for this kind of scenario.
154 %
155 % \subsubsection{Designing Tables}
156 %
157 % A basically mandatory package to all users of tables
158 % is the \pkg{booktabs} package.
159 % Especially its documentation is a must-read!
160 % It provides a large variety of hints for designing tables,
161 % most notably that one should never ever use vertical lines;
162 % horizontal lines should be used sparesly;
163 % \pkg{booktabs} provides three macros for lines that shall be used
164 % instead of \cmd{\hline} from standard \LaTeX:
165 % \cmd{\toprule} for a rule on the top of a table,
166 % above the column heads;
167 % \cmd{\midrule} to separate column heads and the content,
168 % and \cmd{\bottomrule} to mark the bottom of a table.
169 % We highly recommend that you follow this style when writing your thesis.
170 %
171 % Note that captions of tables shall be put \emph{above} the table
172 % whereas captions of figures shall go \emph{below} the figure.
173 % The rationale is that a figure should be more or less self explaining
174 % while a table almost always needs some explanation.
175 %
176 % Unfortunately,
177 % the distances when using a \cmd{\caption} above a table are wrong by default;
178 % when creating tables,
179 % consider loading the \pkg{hvfloats} package
180 % and use its \cmd{\tabcaption} instead of \cmd{\caption} for tables.
181 % The \pkg{hvfloats} package furthermore provides additional useful macros
182 % to typeset all kinds of floats.
183 %
184 % \subsubsection{Controlling Ligatures, Orphans, and Widows}
185 %
186 % When using \LuaTeX{}~(which we recommend anyway),
187 % we additionally recommend to use the \pkg{selnolig}
188 % and \pkg{lua-widow-control} packages.
189 % The former implements a better control over ligatures,
190 % the latter provides better control over orphans and widows.
191 %
192 % For some reason we were not yet able to fix properly,
193 % \pkg{lua-widow-control} works on some machine but fails on others,
194 % although they are using the same version of \TeXLive.
195 % We therefore deactivate \pkg{lua-widow-control} by default.
196 %
197 % \subsubsection{Use \pkg{microtype} for Microtypographic Optimisation}
198 %
199 % \pkg{microtype} is a game changer when writing documents.
200 % While standard \LaTeX{} provides reasonably good typography,
201 % the \pkg{microtype} package brings it to the next level.
202 % We refer you to the documentation of the package for details.
203 %
204 % Additionally,
205 % we prefer to have a thin space around the m-dash.
206 % Although we are aware of the discussion
207 % whether to have such a space in English,
208 % we think it looks more beautiful and thus recommend it.
209 %
210 % \subsubsection{Use \pkg{biblatex} for Bibliographic References}
211 %
212 % The standard way of typesetting bibliographic references used to be \BibTeX.
213 % The original \BibTeX,
214 % however,
215 % seems to be very outdated in various ways:
216 % it originally only supported 7\,bit character sets
217 % and creating citation styles requires the usage
218 % of a kind of an archaic language.
219 % \BibLaTeX{} resolves many of the drawbacks of \BibTeX;
220 % when combined with the |biber| engine,
221 % it supports full UTF-8 unicode,
222 % therefore correct sorting of the references now works out of the box;
223 % also creating citation styles can now be done using simple \LaTeX{} commands.
224 %
225 % \subsubsection{Use \pkg{cleveref} for Internal References}
226 %
227 % \LaTeX{} provides an easy-to-use reference mechanism using the \cmd{\label}
228 % and \cmd{\ref} macros.
229 % However,
230 % this requires some manual effort and the text needs to specify
231 % whether a reference is to a figure, section, or table.
232 % We often see in drafts artefacts such as \enquote{we discuss our findings in 4};
233 % but what is \enquote{4} here?
234 % Is it a section?
235 % A table?
236 % A figure?
237 %
238 % To avoid such confusion,
239 % use the \pkg{cleveref} package,
240 % which automatically infers the type of the reference~(see its documentation
241 % on how this works).
242 % The \pkg{cleveref} package furthermore avoids an additional, common mistake:
243 % between the name of the element and its reference
244 % one needs to have a non-breaking space that is often forgotten.
245 % Instead people are using normal spaces that can break at the end of a line
246 % which looks very ugly.
247 %
248 % Please note that,
249 % in contrast to most other packages,
250 % \pkg{cleveref} has to be loaded \emph{after} the \pkg{hyperref} package!
251 %
252 % \subsection{Loading \pkg{se2packages}}
253 %
254 % When you load the \pkg{se2packages} package
255 % it will automatically load the \pkg{csquotes} and \pkg{booktabs} packages
256 % because we believe that you definitely should use them.
257 % Still, it is possible to avoid this by setting the following
258 % load-time options to the package.
259 % \begin{function}{csquotes,nocsquotes}
260 % \begin{syntax}
261 % |csquotes| = \meta{true,false}
262 % |nocsquotes|
263 % \end{syntax}
264 % The argument to |csquotes| can be one of |true| or |false|.
265 % The latter does not load \pkg{csquotes}, the former is the default value.
266 % By using |nocsquotes| you can also avoid that \pkg{csquote} is loaded.
267 % \end{function}
268 %
269 % \begin{function}{booktabs,nobooktabs}
270 % \begin{syntax}
271 % |booktabs| = \meta{true,false}
272 % |nobooktabs|
273 % \end{syntax}
274 % The argument to |booktabs| can be one of |true| or |false|.
275 % The latter does not load \pkg{booktabs}, the former is the default value.
276 % By using |nobooktabs| you can also avoid that \pkg{booktabs} is loaded.
277 % \end{function}
278 %
279 % The \pkg{siunitx} package is helpful to set quantities
280 % and to automatically format numbers consistently.
281 % The following load-time option loads it automatically.
282 % \begin{function}{siunitx}
283 % \begin{syntax}
284 % |siunitx| = \meta{true,false}
285 % \end{syntax}
286 % Decides whether the package loads \pkg{siunitx}
287 % and sets the options for \pkg{siunitx} to the values we recommend.
288 % The default value is |false|, set it to |true| to load \pkg{siunitx}.
289 % \end{function}
290 %
291 % We provide a load-time option to load \pkg{minted}
292 % and configure it.
293 % \begin{function}{minted}
294 % \begin{syntax}
295 % |minted| = \meta{true,false}
296 % \end{syntax}
297 % Decides whether the package loads \pkg{minted}
298 % and sets the options for \pkg{minted} to the values we recommend.
299 % The default value is |false|, set it to |true| to load \pkg{minted}.
300 % Note that \pkg{minted} requires additional installation effort
301 % and the use of the |-shell-escape| option, see its documentation.
302 % \end{function}
303 %
304 % We also provide a load-time option to load \pkg{listings}
305 % and configure it.
306 % This option and the |minted| option are mutually exclusive!
307 % \begin{function}{listings}
308 % \begin{syntax}
309 % |listings| = \meta{true,false}
310 % \end{syntax}
311 % Decides whether the package loads \pkg{listings}
312 % and sets the options for \pkg{listings} to the values we recommend.
313 % The default value is |false|, set it to |true| to load \pkg{listings}.
314 % \end{function}
315 %
316 % We provide a load-time option to load \pkg{selnolig}.
317 % \begin{function}{selnolig,noselnolig}
318 % \begin{syntax}
319 % |selnolig| = \meta{true,false}
320 % |noselnolig|
321 % \end{syntax}
322 % The argument to |selnolig| can be one of |true| or |false|.
323 % The latter does not load \pkg{selnolig}, the former is the default value.
324 % By using |noselnolig| you can also avoid that \pkg{selnolig} is loaded.
325 % \end{function}
326 %
327 % We provide a load-time option to load \pkg{lua-widow-control}.
328 % \begin{function}{widowcontrol,nowidowcontrol}
329 % \begin{syntax}
330 % |widowcontrol| = \meta{true,false}
331 % |nowidowcontrol|
332 % \end{syntax}
333 % The argument to |widowcontrol| can be one of |true| or |false|.
334 % The former loads \pkg{lua-widow-control},
335 % the latter is the default value.
336 % By using |nowidowcontrol| you can also avoid
337 % that \pkg{lua-widow-control} is loaded.
338 % \end{function}
339 %
340 % We provide a load-time option to load and configure \pkg{microtype}.
341 % \begin{function}{microtype,nomicrotype}
342 % \begin{syntax}
343 % |microtype| = \meta{true,false}
344 % |nomicrotype|
345 % \end{syntax}
346 % The argument to |microtype| can be one of |true| or |false|.
347 % The latter does not load \pkg{microtype}, the former is the default value.
348 % By using |nomicrotype| you can also avoid that \pkg{microtype} is loaded.
349 % \end{function}
350 %
351 % We provide a load-time option to load and configure \pkg{biblatex}.
352 % \begin{function}{biblatex}
353 % \begin{syntax}
354 % |biblatex| = \meta{true,false,alphabetic,numeric}
355 % \end{syntax}
356 % Decides whether the package loads \pkg{biblatex}
357 % and sets the options for \pkg{biblatex} to the values we recommend.
358 % The default value is |false|, set it to |true| to load \pkg{biblatex}.
359 %
360 % By setting the value to |alphabetic|, \pkg{se2packages} sets the citation
361 % style for \pkg{biblatex} to its alphabetic one; selecting |numeric| loads
362 % the numeric style as provided by the \pkg{acmart} bundle of the ACM. The
363 % value |true| also loads the latter style as a default.
364 %
365 % Note that for the |numeric| style, we provide an enhanced \cs{autocite}
366 % command, which does not only print the citation mark in the text but also
367 % a short entry listing of the bibliography entry in the margin column of the
368 % page. This entry is only printed for the first occurence of a citation per
369 % chapter to not clutter the margin column too much. The other citation
370 % commands from \pkg{biblatex} work as usual.
371 % \end{function}
372 %
373 % Additionally,
374 % we provide a load-time option to load \pkg{cleveref}.
375 % This option makes use of \LaTeX's hook system to load it as the very last
376 % thing in the preamble.
377 % You shall not use this option, but load \pkg{cleveref} on your own,
378 % if your document requires packages that need to be loaded even \emph{after}
379 % \pkg{cleveref}.
380 % \begin{function}{cleveref}
381 % \begin{syntax}
382 % |cleveref| = \meta{true,false}
383 % \end{syntax}
384 % Decides whether the package load \pkg{cleveref}.
385 % The default value is |false|, set it to |true| to load \pkg{cleveref}.
386 % \end{function}
387 %
388 % Lastly,
389 % we provide one option to load all recommended packages~(with \pkg{minted}
390 % prefered over \pkg{listings}).
391 % \begin{function}{all}
392 % \begin{syntax}
393 % |all| = \meta{true,false}
394 % \end{syntax}
395 % Decides whether the package loads all recommended packages.
396 % The default value is |false|, set it to |true| to load them.
397 % \end{function}
398 %
399 % \subsection{Additional Recommended Packages}
400 %
401 % The following packages are not part of \pkg{se2packages}
402 % because they serve a very specific purpose.
403 % They might not be needed by many thesis writers,
404 % however,
405 % we mention them here in order to give you a pointer.
406 % We list them in alphabetic order.
407 %
408 % \begin{itemize}
409 % \item \pkg{algorithm2e}: provides tooling for typesetting algorithm
410 % diagrams.
411 % We recommend loading it with the following options:
412 % \begin{LaTeXdemo}[code only]
413 % \usepackage[ruled,noline,noend,linesnumbered]{algorithm2e}
414 % \end{LaTeXdemo}
415 % \item \pkg{hvfloat}: a package to control captions, fullpage, and
416 % double-page floats.
417 % We recommend to load it and use its \cmd{\tabcaption} for table captions.
418 % \item \pkg{lettrine}: allows to start a paragraph with a large initial.
419 % This is a beautiful opener for the first paragraph of a thesis' main
420 % content.
421 % \item \pkg{mathtools}: an enhanced version of the famous \amsmath
422 % package that provides more functionality and fixes some of the known bugs.
423 % \item \pkg{pdfx}: adds support for PDF/X and PDF/A, which is useful for
424 % creating documents that can be archived, for example, by the University's
425 % library.
426 % \item \pkg{pgfplots}: a library for creating all kinds of plots, based on
427 % \pkg{pgf}, which is also the basis of the \pkg{tikz} package.
428 % \item \pkg{sidenotesplus}: a package to place all kinds of objects in the
429 % margin of a document, from footnotes (then called sidenotes) to figures
430 % and tables.
431 % \item \pkg{subcaption}: support for sub-captions and sub-figures.
432 % \item \pkg{tabularray}: a rewrite of \LaTeX's array and tabular abilities
433 % in \LaTeXIII.
434 % While the package offers a great combination of several other packages'
435 % functionality, it tends to be quite slow for large tables due to the way
436 % it is implemented internally.
437 % \item \pkg{tcolorbox}: allows to typeset coloured boxes, for example, for
438 % short summaries on research questions or hypotheses.
439 % \item \pkg{tikz}: for creating all kinds of figures.
440 % Beware: \TikZ{} is a really huge package with a lot of functionality and
441 % a manual of more than 1300~pages.
442 % \end{itemize}
443 %
444 %
445 % \begin{thebibliography}{9}
446 % \bibitem{DBLP:journals/sttt/BeyerLW19} Dirk Beyer, Stefan Löwe, and Philipp
447 % Wendler: \emph{Reliable benchmarking: requirements and solutions}. STTT
448 % 21(1): 1--29 (2019)
449 % \bibitem{Knu86} Donald E. Knuth: \emph{The \TeX{}book}. Addison-Wesley
450 % (1986)
451 % \end{thebibliography}
452 %
453 %
454 %
455 %
456 % \end{documentation}
457 %
458 % \begin{implementation}
459 %
460 % \section{\pkg{se2packages} implementation}
461 %
462 % Start the \pkg{DocStrip} guards.
463 % \begin{macrocode}
464 %<*package>
465 % \end{macrocode}
466 %
467 % Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention): only
468 % internal material in this \emph{submodule} should be used directly.
469 % \begin{macrocode}
470 %<@@=slcd_packages>
471 % \end{macrocode}
472 %
473 % Identify the package and give the overall version information.
474 % \begin{macrocode}
475 \ProvidesExplPackage {se2packages} {2026-04-03} {4.4.1}
476 {Supporting packages for the se2thesis bundle}
477 % \end{macrocode}
478 %
479 % \subsection{Load-time options}
480 %
481 % Before we define the actual options,
482 % define some Boolean variables to store the selected values.
483 %
484 % \begin{macro}{\l_@@_csquotes_bool}
485 % Whether or not to load \pkg{csquotes}.
486 % \begin{macrocode}
487 \bool_new:N \l_@@_csquotes_bool
488 % \end{macrocode}
489 % \end{macro}
490 %
491 % \begin{macro}{\l_@@_booktabs_bool}
492 % Whether or not to load \pkg{booktabs}.
493 % \begin{macrocode}
494 \bool_new:N \l_@@_booktabs_bool
495 % \end{macrocode}
496 % \end{macro}
497 %
498 % \begin{macro}{\l_@@_siunitx_bool}
499 % Whether or not to load and configure \pkg{siunitx}.
500 % \begin{macrocode}
501 \bool_new:N \l_@@_siunitx_bool
502 % \end{macrocode}
503 % \end{macro}
504 %
505 % \begin{macro}{\l_@@_minted_bool}
506 % Whether or not to load and configure \pkg{minted}.
507 % \begin{macrocode}
508 \bool_new:N \l_@@_minted_bool
509 % \end{macrocode}
510 % \end{macro}
511 %
512 % \begin{macro}{\l_@@_listings_bool}
513 % Whether or not to load and configure \pkg{listings}.
514 % \begin{macrocode}
515 \bool_new:N \l_@@_listings_bool
516 % \end{macrocode}
517 % \end{macro}
518 %
519 % \begin{macro}{\l_@@_biblatex_tl}
520 % Whether or not to load and configure \pkg{biblatex}.
521 % \begin{macrocode}
522 \tl_new:N \l_@@_biblatex_tl
523 % \end{macrocode}
524 % \end{macro}
525 %
526 % \begin{macro}{\l_@@_selnolig_bool}
527 % Whether or not to load \pkg{selnolig} (\LuaTeX{} only).
528 % \begin{macrocode}
529 \bool_new:N \l_@@_selnolig_bool
530 % \end{macrocode}
531 % \end{macro}
532 %
533 % \begin{macro}{\l_@@_luawidowcontrol_bool}
534 % Whether or not to load \pkg{luawidowcontrol} (\LuaTeX{} only).
535 % \begin{macrocode}
536 \bool_new:N \l_@@_luawidowcontrol_bool
537 % \end{macrocode}
538 % \end{macro}
539 %
540 % \begin{macro}{\l_@@_microtype_bool}
541 % Whether or not to load \pkg{microtype}.
542 % \begin{macrocode}
543 \bool_new:N \l_@@_microtype_bool
544 % \end{macrocode}
545 % \end{macro}
546 %
547 % \begin{macro}{\l_@@_cleveref_bool}
548 % Whether or not to load and configure \pkg{cleveref}.
549 % \begin{macrocode}
550 \bool_new:N \l_@@_cleveref_bool
551 % \end{macrocode}
552 % \end{macro}
553 %
554 % \begin{macro}{\l_@@_all_bool}
555 % Whether or not to load and configure all recommended packages.
556 % \begin{macrocode}
557 \bool_new:N \l_@@_all_bool
558 % \end{macrocode}
559 % \end{macro}
560 %
561 % Define the actual load-time options.
562 % \begin{macrocode}
563 \keys_define:nn { seiipackages }
564 {
565 csquotes .bool_gset:N = \l_@@_csquotes_bool,
566 csquotes .initial:n = true,
567 nocsquotes .meta:n = { csquotes=false },
568
569 booktabs .bool_gset:N = \l_@@_booktabs_bool,
570 booktabs .initial:n = true,
571 nobooktabs .meta:n = { booktabs=false },
572
573 siunitx .bool_gset:N = \l_@@_siunitx_bool,
574 siunitx .initial:n = false,
575
576 minted .bool_gset:N = \l_@@_minted_bool,
577 minted .initial:n = false,
578
579 listings .bool_gset:N = \l_@@_listings_bool,
580 listings .initial:n = false,
581
582 biblatex .tl_gset:N = \l_@@_biblatex_tl,
583 biblatex .initial:n = false,
584
585 selnolig .bool_gset:N = \l_@@_selnolig_bool,
586 selnolig .initial:n = true,
587 noselnolig .meta:n = { selnolig=false },
588
589 widowcontrol .bool_gset:N = \l_@@_luawidowcontrol_bool,
590 widowcontrol .initial:n = false,
591 nowidowcontrol .meta:n = { widowcontrol=false },
592
593 microtype .bool_gset:N = \l_@@_microtype_bool,
594 microtype .initial:n = true,
595 nomicrotype .meta:n = { microtype=false },
596
597 cleveref .bool_gset:N = \l_@@_cleveref_bool,
598 cleveref .initial:n = false,
599
600 all .bool_gset:N = \l_@@_all_bool,
601 all .initial:n = false,
602 }
603 % \end{macrocode}
604 %
605 % \subsection{Option handling}
606 %
607 % \begin{macrocode}
608 \IfFormatAtLeastTF { 2022-06-01 }
609 { \ProcessKeyOptions [ seiipackages ] }
610 {
611 \RequirePackage{ l3keys2e }
612 \ProcessKeysOptions { seiipackages }
613 }
614 % \end{macrocode}
615 %
616 % Define an error message if both \pkg{minted} and \pkg{listings} are requested.
617 % \begin{macrocode}
618 \msg_set:nnnn { seiipackages } { conflicting-packages }
619 { Setting~ both~ minted~ and~ listings~ to~ true~ is~ not~ possible. }
620 { Choose~ either~ of~ them! }
621 % \end{macrocode}
622 %
623 % Define a message for logging that a specific package will be loaded by
624 % \pkg{se2packages}.
625 % Expects as parameter the name of the package that will be loaded.
626 % \begin{macrocode}
627 \msg_new:nnn { seiipackages } { load-package }
628 { se2packages~ loads~ the~ #1~ package now. }
629 % \end{macrocode}
630 %
631 % And, in case both values are set to |true|,
632 % raise the error message.
633 % \begin{macrocode}
634 \bool_lazy_and:nnT { \l_@@_minted_bool }
635 { \l_@@_listings_bool }
636 {
637 \msg_error:nn { seiipackages } { conflicting-packages }
638 }
639 % \end{macrocode}
640 %
641 % In case the |all| option is set,
642 % set all other values to |true|.
643 % \begin{macrocode}
644 \bool_if:NT \l_@@_all_bool
645 {
646 \bool_gset_true:N \l_@@_csquotes_bool
647 \bool_gset_true:N \l_@@_booktabs_bool
648 \bool_gset_true:N \l_@@_siunitx_bool
649 \bool_gset_true:N \l_@@_minted_bool
650 \bool_gset_false:N \l_@@_listings_bool
651 \bool_gset_true:N \l_@@_selnolig_bool
652 \bool_gset_true:N \l_@@_luawidowcontrol_bool
653 \bool_gset_true:N \l_@@_microtype_bool
654 \tl_gset:Nn \l_@@_biblatex_bool { true }
655 \bool_gset_true:N \l_@@_cleveref_bool
656 }
657 % \end{macrocode}
658 %
659 % \subsection{Package loading}
660 %
661 % Conditionally load the \pkg{csquotes} package.
662 % \begin{macrocode}
663 \bool_if:NT \l_@@_csquotes_bool
664 {
665 \msg_info:nnn { seiipackages } { load-package } { csquotes }
666 \RequirePackage { fvextra }
667 \RequirePackage { csquotes }
668 }
669 % \end{macrocode}
670 %
671 % Conditionally load the \pkg{booktabs} package.
672 % \begin{macrocode}
673 \bool_if:NT \l_@@_booktabs_bool
674 {
675 \msg_info:nnn { seiipackages } { load-package } { booktabs }
676 \RequirePackage { booktabs }
677 }
678 % \end{macrocode}
679 %
680 % Conditionally load and configure the \pkg{siunitx} package.
681 % \begin{macrocode}
682 \bool_if:NT \l_@@_siunitx_bool
683 {
684 \msg_info:nnn { seiipackages } { load-package } { siunitx }
685 \RequirePackage [
686 add-integer-zero=false,
687 free-standing-units=true,
688 group-minimum-digits=4,
689 list-final-separator={ ,~ and~ },
690 round-mode=figures,
691 round-precision=3,
692 separate-uncertainty=true,
693 uncertainty-mode=separate,
694 mode=match,
695 ] { siunitx }
696 }
697 % \end{macrocode}
698 %
699 % Conditionally load and configure the \pkg{minted} package.
700 % \begin{macrocode}
701 \bool_if:NT \l_@@_minted_bool
702 {
703 \msg_info:nnn { seiipackages } { load-package } { minted }
704 \RequirePackage [ newfloat=true ] { minted }
705 \setminted {
706 autogobble,
707 breaklines=true,
708 fontsize=\footnotesize,
709 frame=single,
710 linenos=false,
711 resetmargins=true,
712 xleftmargin=1em,
713 xrightmargin=1em,
714 }
715 }
716 % \end{macrocode}
717 %
718 % Conditionally load and configure the \pkg{listings} package.
719 % \begin{macrocode}
720 \bool_if:NT \l_@@_listings_bool
721 {
722 \msg_info:nnn { seiipackages } { load-package } { listings }
723 \RequirePackage { listings }
724 \lstset{
725 basicstyle=\footnotesize\ttfamily,
726 breaklines=true,
727 captionpos=t,
728 extendedchars=true,
729 frame=single,
730 keywordstyle=\color { blue }\bfseries,
731 showspaces=false,
732 showtabs=false,
733 showstringspaces=false,
734 tabsize=2,
735 }
736 }
737 % \end{macrocode}
738 %
739 % Conditionally load \pkg{selnolig} if present and we run \LuaTeX.
740 % \begin{macrocode}
741 \bool_lazy_and:nnT { \l_@@_selnolig_bool }
742 { \sys_if_engine_luatex_p: }
743 {
744 \IfFileExists { selnolig.sty }
745 {
746 \RequirePackage { selnolig }
747 } {
748 \msg:nnnn { seiipackages }
749 { selnolig-not-available }
750 { Could~ not~ find~ selnolig.sty }
751 { You~ might~ want~ to~ install~ it~ for~ better~ ligatures~ control.}
752 \msg_note:nn { seipackages } { selnolig-not-available }
753 }
754 }
755 % \end{macrocode}
756 %
757 % Conditionally load \pkg{luawidowcontrol} if present and we run \LuaTeX.
758 % \begin{macrocode}
759 \bool_lazy_and:nnT { \l_@@_luawidowcontrol_bool }
760 { \sys_if_engine_luatex_p: }
761 {
762 \IfFileExists { lua-widow-control.sty }
763 {
764 \RequirePackage { lua-widow-control }
765 } {
766 \msg:nnnn { seiipackages }
767 { lua-widow-control-not-available }
768 { Could~ not~ find~ lua-widow-control.sty }
769 {
770 You~ might~ want~ to~ install~ it~ for~ better~ control~ over~
771 widows~ and~ orphans.
772 }
773 \msg_note:nn { seipackages } { lua-widow-control-not-available }
774 }
775 }
776 % \end{macrocode}
777 %
778 % Conditionally load and configure \pkg{microtype}.
779 % If a package option requires for the \pkg{lua-widow-control} package,
780 % we do not set penalties for widows and orphans
781 % but let that package control these penalties.
782 % \begin{macrocode}
783 \bool_if:NT \l_@@_microtype_bool
784 {
785 \msg_info:nnn { seiipackages } { load-package } { microtype }
786 \RequirePackage { microtype }
787 \bool_if:NF \l_@@_luawidowcontrol_bool
788 {
789 \clubpenalty=10000
790 \widowpenalty=10000
791 \displaywidowpenalty=10000
792 }
793 \SetExtraKerning{
794 encoding = { OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2 }
795 } {
796 \textemdash = { 167,167 },
797 — = { 167,167 }
798 }
799 }
800 % \end{macrocode}
801 %
802 % Conditionally load and configure the \pkg{biblatex} package.
803 % \begin{macrocode}
804 \tl_if_eq:NnT \l_@@_biblatex_tl {alphabetic}
805 {
806 \msg_info:nnn { seiipackages } { load-package } { biblatex }
807 \PassOptionsToPackage
808 {
809 backend=biber,
810 backref=true,
811 datamodel=software,
812 giveninits=true,
813 hyperref=auto,
814 maxnames=100,
815 minalphanames=3,
816 sorting=nyt,
817 style=alphabetic,
818 } { biblatex }
819 \RequirePackage { biblatex }
820 \RequirePackage { software-biblatex }
821 \ExecuteBibliographyOptions {
822 halid=false,
823 swhid=true,
824 shortswhid=false,
825 swlabels=true,
826 vcs=true,
827 license=true,
828 }
829 }
830
831 \bool_new:N \l_@@_biblatex_numeric_variants_bool
832 \tl_if_eq:NnT \l_@@_biblatex_tl { true }
833 {
834 \bool_gset_true:N \l_@@_biblatex_numeric_variants_bool
835 }
836 \tl_if_eq:NnT \l_@@_biblatex_tl { numeric }
837 {
838 \bool_gset_true:N \l_@@_biblatex_numeric_variants_bool
839 }
840
841 \bool_if:NT \l_@@_biblatex_numeric_variants_bool
842 {
843 \msg_info:nnn { seiipackages } { load-package } { biblatex }
844 \PassOptionsToPackage
845 {
846 backend=biber,
847 backref=true,
848 citereset=chapter+,
849 citetracker=context,
850 giveninits=true,
851 hyperref=auto,
852 sorting=nyt,
853 datamodel=acmdatamodel,
854 style=acmnumeric,
855 } { biblatex }
856 \RequirePackage { biblatex }
857 \RequirePackage { ragged2e }
858 \RequirePackage [ mark=arabic,shape=up,Ragged ] { sidenotesplus }
859
860 \newbibmacro { cite:authoryear }
861 {
862 \printtext [ labelnumberwidth ] {
863 \usebibmacro { cite }
864 }
865 \setunit { \addspace }
866 \printnames { labelname }
867 \setunit { \labelnamepunct }\newblock%
868 \usebibmacro { year }%
869 \newunit%
870 \printfield [ title ] { labeltitle }
871 }
872
873 \newrobustcmd* { \makebibmarginnote } [ 1 ]
874 {
875 \sidenote* { \blxmkbibnote { foot } { #1 } }
876 }
877
878 \DeclareCiteCommand { \maycite } [ \makebibmarginnote ]
879 { \usebibmacro { prenote } }
880 {
881 \usebibmacro { citeindex }%
882 \usebibmacro { cite:authoryear }
883 }
884 { \multicitedelim }
885 { \usebibmacro { postnote } }
886
887 \newcommand* { \cbx@savedcites } {}
888
889 \newcommand* { \cbx@margcitewrap } [ 1 ]
890 {%
891 \global\let\cbx@savedcites\empty
892 \mkbibbrackets { #1 }%
893 \cbx@savedcites
894 }
895
896 \DeclareCiteCommand { \margincite } [ \cbx@margcitewrap ]
897 { \usebibmacro { prenote } }
898 {
899 \usebibmacro { citeindex }%
900 \usebibmacro { cite }%
901 \ifciteseen
902 {}
903 {
904 \xappto\cbx@savedcites {
905 \noexpand\maycite {
906 \thefield { entrykey }
907 }
908 }
909 }
910 }
911 { \multicitedelim }
912 { \usebibmacro { postnote } }
913
914 \DeclareMultiCiteCommand { \margincites } [ \cbx@margcitewrap ]
915 { \margincite } { \multicitedelim }
916
917 \DeclareAutoCiteCommand { margin } { \margincite } { \margincites }
918 \ExecuteBibliographyOptions { autocite=margin }
919 \newcommand { \bibliofont } { \footnotesize }
920 \DeclareFieldFormat { titlecase } { #1 }% Preserve title capitalisation
921 }
922 % \end{macrocode}
923 %
924 % Conditionally load the \pkg{cleveref} package as the last of the preamble.
925 % \begin{macrocode}
926 \bool_if:NT \l_@@_cleveref_bool
927 {
928 \msg_info:nnn { seiipackages } { load-package } { cleveref }
929 \AddToHook { begindocument/before }
930 {
931 \RequirePackage [ capitalise ] { cleveref }
932 \Crefname { resq } { Research Question } { Research Questions }
933 \Crefname { hyp } { Hypothesis } { Hypotheses }
934 }
935 }
936 % \end{macrocode}
937 %
938 %
939 %
940 %
941 % \begin{macrocode}
942 %</package>
943 % \end{macrocode}
944 %
945 % \end{implementation}
946 %
947 % \PrintIndex