Debian Codegraph @

texmf-dist/source/latex/phimisci/phimisci.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \begingroup
4 %</internal>
5 %<*install>
6 \input{l3docstrip.tex}
7 \keepsilent
8 \askforoverwritefalse
9 \preamble
10 -------------------------------------------------------------------------------
11 Template for the journal Philosophy and the Mind Sciences
12
13 Copyright (c) 2026 Ruhr-Universität Bochum
14
15 This file may be distributed and/or modified under the conditions of the LaTeX
16 Project Public License, either version 1.3c of this license or (at your option)
17 any later version. The latest version of this license is available at:
18 http://www.latex-project.org/lppl.txt
19 -------------------------------------------------------------------------------
20 \endpreamble
21 \generate{\file{\jobname.cls}{\from{\jobname.dtx}{class}}}
22 %</install>
23 %<install>\endbatchfile
24 %<*internal>
25 \generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}}
26 \endgroup
27 %</internal>
28 %<*driver>
29 \documentclass{l3doc}
30 \usepackage{metalogo}
31 \usepackage{tgheros}
32 \usepackage[zerostyle=d]{newtxtt}
33 \let\familydefault\sfdefault
34 \hypersetup{linkcolor=blue,citecolor=blue,urlcolor=blue}
35 \usepackage[british]{babel}
36 \usepackage{biblatex}
37 \usepackage{booktabs}
38 \usepackage{multicol}
39 \usepackage{xcolor}
40 \usepackage{pifont}
41 \usepackage{parskip}
42 \definecolor{PhiMiSciHeadingBlue}{RGB}{10, 26, 97}
43 \definecolor{PhiMiSciBlueTwo}{RGB}{19, 47, 178}
44 \definecolor{PhiMiSciBlueThree}{RGB}{12, 30, 115}
45 \definecolor{PhiMiSciGrey}{RGB}{157, 164, 196}
46 \begin{filecontents}[overwrite]{\jobname.bib}
47 @book{Talbot2015,
48 author = {Talbot, Nicola L. C.},
49 year = {2015},
50 title = {{LaTeX} for Administrative Work},
51 publisher = {Dickimaw Books},
52 url = {https://www.dickimaw-books.com/latex/admin}
53 }
54 @misc{Interface3,
55 author = {{The \LaTeX{} Project}},
56 year = {2023},
57 url = {https://ctan.org/pkg/l3kernel},
58 title = {The \LaTeX3 Interfaces},
59 note = {Version 2023-06-30},
60 }
61 @misc{lthooks,
62 author = {Frank Mittelbach},
63 year = {2022},
64 title = {\LaTeX's hook management},
65 url = {https://www.latex-project.org/help/documentation/lthooks-doc.pdf},
66 note = {Version 2022-05-19}
67 }
68 @misc{ltpara,
69 author = {Frank Mittelbach},
70 year = {2022},
71 title = {The \texttt{ltpara.dtx} code},
72 url = {https://www.latex-project.org/help/documentation/ltpara-doc.pdf},
73 note = {Version 2022-05-13}
74 }
75 @misc{scrguide,
76 author = {Markus Kohm},
77 title = {{KOMA-Script}: {The} guide},
78 year = {2023},
79 note = {Version 2023-06-16},
80 url = {https://texdoc.org/serve/scrartcl/0}
81 }
82 @article{Chernoff2022,
83 author = {Max Chernoff},
84 year = {2022},
85 doi = {10.47397/tb/43-1/tb133chernoff-widows},
86 title = {Automatically removing widows and orphans with lua-widow-control},
87 journal = {TUGboat},
88 volume = {43},
89 number = {1},
90 pages = {28-39}
91 }
92 \end{filecontents}
93 \addbibresource{\jobname.bib}
94 \begin{document}
95 \DocInput{\jobname.dtx}
96 \end{document}
97 %</driver>
98 % \fi
99 % \title{Technical documentation of the \texttt{phimisci} class}
100 % \author{Felix Kopecky}
101 % \date{20 March 2026}
102 % \maketitle
103 % \texttt{phimisci} is the document class for \emph{Philosophy and the Mind
104 % Sciences} (PhiMiSci), a diamond open access journal in philosophy,
105 % neuroscience and related disciplines.
106 %
107 % This technical documentation covers the entire source code of \texttt{phimisci}.
108 % A quick reference sheet is available separately. Submission guidelines can be
109 % found on the journal's web site, at \url{https://philosophymindscience.org/}.
110 %
111 % Issues should be reported to the editorial staff or on GitHub at
112 % \url{https://github.com/phimisci/latex}.
113 % {\setlength{\parskip}{0pt}
114 % \tableofcontents}
115 % \section{Basic set-up}
116 % \subsection{Prerequisites}
117 % A \LaTeX{} installation from 2022 or newer is required. Additionally, the
118 % following packages need to be installed:
119 %
120 % \begin{multicols}{4}
121 % \begin{itemize}
122 % \item \pkg{amsmath}
123 % \item \pkg{amsthm}
124 % \item \pkg{amssymb}
125 % \item \pkg{array}
126 % \item \pkg{babel}
127 % \item \pkg{biblatex}
128 % \item \pkg{booktabs}
129 % \item \pkg{csquotes}
130 % \item \pkg{enumitem}
131 % \item \pkg{etoolbox}
132 % \item \pkg{geometry}
133 % \item \pkg{fontspec}
134 % \item \pkg{graphicx}
135 % \item \pkg{hyperref}
136 % \item \pkg{hyphenat}
137 % \item \pkg{koma-script}
138 % \item \pkg{l3kernel}
139 % \item \pkg{l3packages}
140 % \item \pkg{libertinus}
141 % \item \pkg{lineno}
142 % \item \pkg{lua-widow-control}
143 % \item \pkg{microtype}
144 % \item \pkg{noto}
145 % \item \pkg{orcidlink}
146 % \item \pkg{xcolor}
147 % \item \pkg{xparse}
148 % \end{itemize}
149 % \end{multicols}
150 %
151 % \noindent Documents in the \texttt{phimisci} class can be compiled with
152 % \LuaLaTeX{} and \XeLaTeX{}.
153 % \pagebreak
154 % \subsection{Class identification}
155 % Start by identifying the document class.
156 % \begin{macrocode}
157 %<*class>
158 \NeedsTeXFormat {LaTeX2e}
159 \ProvidesExplClass {phimisci} {2026-03-20} {1.0.4}
160 {Philosophy and the Mind Sciences Journal Template}
161 % \end{macrocode}
162 % \subsection{Messages, errors and warnings}
163 % These pre-defined messages are used at various points in the class.
164 % \begin{variable}{missing-logo-url}
165 % A message that warns the user in case the logo file cannot be found.
166 % \begin{macrocode}
167 \msg_new:nnnn { phimisci } { missing-logo-url }
168 { I~didn't~find~a~logo~file~to~print~in~the~article's~header. }
169 {
170 Please~supply~the~file~location~with~the~document~class~
171 option~'settings/logo-url~=~path/to/file.pdf'.
172 }
173 % \end{macrocode}
174 % \end{variable}
175 % \begin{variable}{missing-font}
176 % A message that warns the user about a missing font or font file.
177 % \begin{macrocode}
178 \msg_new:nnnn { phimisci } { missing-font }
179 { A~font~could~not~be~found. }
180 {
181 Neither~the~file~"#1"~nor~a~system-installed~font~named~
182 "#2"~could~be~found.~Please~install~the~font~(file)~or~
183 adjust~your~font~settings.~
184 For~now,~I'm~defaulting~to~the~default~sans~font.
185 }
186 % \end{macrocode}
187 % \end{variable}
188 % \begin{variable}{tex-installation-too-old}
189 % Inform the user that their \TeX\ installation is too old.
190 % \begin{macrocode}
191 \msg_new:nnn {phimisci} { tex-installation-too-old }
192 {
193 The~phimisci~class~requires~a~TeX~installation~from~2022~or~
194 newer.~Please~update~your~TeX~installation.
195 }
196 % \end{macrocode}
197 % \end{variable}
198 % \begin{variable}{wrong-tex-engine}
199 % Inform the user that they have selected an unsupported \TeX\ engine.
200 % \begin{macrocode}
201 \msg_new:nnn { phimisci } { wrong-tex-engine }
202 {
203 You~are~using~the~\str_use:N \c_sys_engine_str~engine,~but~
204 your~document~can~only~be~compiled~with~the~#1~engine(s).
205 }
206 % \end{macrocode}
207 % \end{variable}
208 % \subsection{Version and engine checks}
209 % Perform a check whether the used \LaTeX\ installation is recent enough. If
210 % not, exit immediately and give user feedback.
211 % \begin{macrocode}
212 \RequirePackage{xparse}
213 \@ifpackagelater {xparse} {2022/01/01}
214 {}
215 {
216 \msg_fatal:nn { phimisci } { tex-installation-too-old }
217 }
218 % \end{macrocode}
219 % Check whether an appropriate engines is used and exit immediately if not.
220 % \begin{macrocode}
221 \sys_if_engine_xetex:F
222 {
223 \sys_if_engine_luatex:F
224 {
225 \msg_fatal:nnn { phimisci } { wrong-tex-engine }
226 { lualatex~or~xelatex }
227 }
228 }
229 % \end{macrocode}
230 % \subsection{Class inheritance}
231 % This class is based on Markus Kohm's \texttt{scrartcl} class. We load
232 % this class with apropriate settings. We also load
233 % \texttt{scrlayer-scrpage} for better controls of headers and
234 % \texttt{scrlayer-notecolumn} for the paragraph counting feature.
235 % \begin{macrocode}
236 \LoadClass [fontsize=10.5bp, oneside] {scrartcl}
237 \RequirePackage[autoenlargeheadfoot=off]{scrlayer-scrpage}
238 \RequirePackage{scrlayer-notecolumn}
239 % \end{macrocode}
240 % The option \texttt{onpsinit} from \texttt{scrartcl} allows us to detect
241 % paragraphs in the header and footer of the document. We use this anchor to
242 % call \cs{PhiMiSci@DetectKomaHeader} (see Section~\ref{sec:parnumbering}
243 % below).
244 % \begin{macrocode}
245 \KOMAoption{onpsinit}{\protect\PhiMiSci@DetectKomaHeader{}}
246 % \end{macrocode}
247 % \subsection{Basic packages}
248 % We load well-known packages that are used regularly in the preparation of
249 % scientific texts.
250 % \begin{macrocode}
251 \RequirePackage{amsmath, amsthm, amssymb, array, booktabs,
252 csquotes, enumitem, graphicx, hyphenat}
253 % \end{macrocode}
254 % We also load helper packages that are necessary to program features of this
255 % class. \texttt{hyperref} and \texttt{xcolor} are special in this regard,
256 % because some of their options have to be loaded at initial package loading.
257 % \begin{macrocode}
258 \RequirePackage[final, hyperfootnotes=false, pdfusetitle=true]{hyperref}
259 \RequirePackage[table]{xcolor}
260 \RequirePackage{etoolbox, expl3, l3keys2e, microtype, orcidlink}
261 % \end{macrocode}
262 % \subsection{Data storage, Boolean switches and command variants}
263 % These Booleans, control sequences, integer variables, mappings, sequences and
264 % token lists are used by the class internally to organise data, make
265 % decisions, and enable features of the class. They are only defined here but
266 % not documented individually -- please refer to their usage within other
267 % functions.
268 % \begin{macrocode}
269 \ExplSyntaxOn
270 \bool_new:N \l__phimisci_output_keywords_bool
271 \bool_new:N \l__phimisci_output_abstract_bool
272 \bool_new:N \l__phimisci_output_contact_bool
273 \bool_new:N \l__phimisci_output_rights_bool
274 \bool_new:N \l__phimisci_output_doi_bool
275 \bool_new:N \l__phimisci_output_authors_bool
276 \bool_new:N \l__phimisci_output_publication_header_footer_bool
277 \bool_new:N \l__phimisci_output_draft_footer_bool
278 \bool_new:N \l__phimisci_koma_head_mode_bool
279 \bool_new:N \l__phimisci_settings_sloppybottom_bool
280 \bool_new:N \l__phimisci_settings_luawidow_bool
281 \cs_new:Nn \__phimisci_affiliation_line_separator: { \thickspace }
282 \cs_new:Nn \__phimisci_affiliation_name_separator: { \thinspace }
283 \cs_generate_variant:Nn \seq_set_split:Nnn { NVn }
284 \cs_generate_variant:Nn \seq_set_split:Nnn { NVx }
285 \cs_generate_variant:Nn \int_set:Nn { Nx }
286 \cs_generate_variant:Nn \tl_rescan:nn { nx }
287 \int_new:N \l__phimisci_abstract_length_int
288 \int_new:N \l__phimisci_output_authors_int
289 \iow_new:N \l__phimisci_citation_file_stream
290 \prop_new:N \l__phimisci_authors_to_ids_prop
291 \prop_new:N \l__phimisci_author_ids_to_affiliations_prop
292 \prop_new:N \l__phimisci_author_ids_to_orcids_prop
293 \prop_new:N \l__phimisci_affiliation_id_resolver_prop
294 \seq_new:N \l__phimisci_keywords_seq
295 \seq_new:N \l__phimisci_authors_seq
296 \tl_const:Nn \l__phimisci_parnum_excluded_objects_base_tl
297 {
298 env/quote, env/quotation, env/itemize, env/enumerate, env/description,
299 env/list, env/table, env/figure, env/tabbing, env/lstlisting,
300 env/verbatim
301 }
302 \tl_new:N \l_phimisci_header_authors_tl
303 \tl_new:N \l_phimisci_authors_tl
304 \tl_new:N \l__phimisci_authors_citation_footer_tl
305 \tl_new:N \l__phimisci_custom_header_authors_tl
306 \tl_new:N \l__phimisci_keywords_tl
307 \tl_new:N \l__phimisci_dedication_tl
308 \tl_new:N \l__phimisci_copyright_holder_tl
309 \tl_new:N \l__phimisci_contact_tl
310 \tl_new:N \l__phimisci_contact_author_tl
311 \tl_new:N \l__phimisci_tmp_orcid_link_tl
312 \ExplSyntaxOff
313 % \end{macrocode}
314
315 % \subsection{Font loading}
316 % \textit{Philosophy and the Mind Sciences} uses Libertinus as its bread and
317 % butter type, which we load through the \LaTeX\ package \texttt{libertinus}.
318 % PhiMiSci uses Noto as its sans font, which we load as \texttt{noto-sans}.
319 % \begin{macrocode}
320 \RequirePackage[semibold]{libertinus}
321 \RequirePackage[regular, semibold]{noto-sans}
322 % \end{macrocode}
323 % Titles and section heads use Noto Sans Display, which was not distributed
324 % on CTAN when we created this class. The font is loaded additionally via
325 % fontspec.
326 % \begin{macrocode}
327 \RequirePackage{fontspec}
328 \ExplSyntaxOn
329 \IfFontExistsTF { NotoSansDisplay-Regular.ttf }
330 {
331 \newfontfamily \PhiMiSciTitleFont
332 { NotoSansDisplay-Regular.ttf }
333 [ Ligatures = TeX,
334 BoldFont = NotoSansDisplay-SemiBold.ttf,
335 ItalicFont = NotoSansDisplay-SemiBoldItalic.ttf,
336 BoldItalicFont = NotoSansDisplay-SemiBoldItalic.ttf ]
337 }
338 {
339 \IfFontExistsTF { Noto~Sans~Display }
340 {
341 \newfontfamily \PhiMiSciTitleFont
342 { Noto~Sans~Display }
343 [ Ligatures = TeX,
344 BoldFont = Noto~Sans~Display~SemiBold,
345 ItalicFont = Noto~Sans~Display~SemiBold~Italic,
346 BoldItalicFont = Noto~Sans~Display~SemiBold~Italic ]
347 }
348 {
349 \let\PhiMiSciTitleFont\sffamily
350 \msg_warning:nnnn { phimisci } { missing-font }
351 { NotoSansDisplay-SemiBold.ttf }
352 { Noto~Sans~Display~SemiBold }
353 }
354 }
355 \ExplSyntaxOff
356 % \end{macrocode}
357 %
358 % The font Noto Sans Medium is distributed on CTAN via the \texttt{noto}
359 % package. We rely on it being available.
360 % \begin{macrocode}
361 \newfontfamily \PhiMiSciMediumFont {NotoSans-Medium.ttf}
362 [Ligatures = TeX, ItalicFont = NotoSans-MediumItalic.ttf]
363 % \end{macrocode}
364 %
365 % The main text is set in 10.5pt with 13.5pt line spacing. \emph{Note:} We
366 % are using big points (\texttt{bp}) as our design was layed out with
367 % PostScript points.
368 % \begin{macrocode}
369 \AtBeginDocument{\fontsize{10.5bp}{13.5bp}\selectfont}
370 % \end{macrocode}
371 %
372 % We adjust the font settings inherited from \texttt{scrartcl} and create new
373 % font commands for specific PhiMiSci elements.
374 %
375 % The first few elements cover presentation of title, author, and other meta
376 % data on the title page.
377 % \begin{macrocode}
378 \setkomafont{title}
379 {%
380 \raggedright%
381 \PhiMiSciTitleFont%
382 \bfseries%
383 \color{PhiMiSciHeadingBlue}%
384 \fontsize{23bp}{28bp}\selectfont%
385 }
386 \setkomafont{subtitle}
387 {%
388 \raggedright%
389 \PhiMiSciTitleFont%
390 \bfseries%
391 \color{PhiMiSciHeadingBlue}%
392 \fontsize{17.25bp}{22bp}\selectfont%
393 }
394 \setkomafont{subject}
395 {%
396 \PhiMiSciMediumFont%
397 \fontsize{9.8bp}{13.72bp}\selectfont%
398 \color{PhiMiSciHeadingBlue}%
399 }
400 \setkomafont{author}
401 {%
402 \raggedright%
403 \PhiMiSciTitleFont%
404 \color{PhiMiSciHeadingBlue}%
405 \fontsize{12bp}{17bp}\selectfont%
406 \bfseries%
407 }
408 \newkomafont{PhiMiSciAffiliationItem}
409 {%
410 \sffamily\bfseries%
411 \fontsize{10bp}{13.5bp}\selectfont%
412 \color{PhiMiSciHeadingBlue}%
413 }
414 \newkomafont{PhiMiSciAffiliationLine}
415 {%
416 \usekomafont{footnote}%
417 }
418 \newkomafont{PhiMiSciDedication}
419 {%
420 \normalfont\normalsize%
421 \fontsize{10bp}{13.72bp}\selectfont%
422 \itshape\bfseries%
423 \color{PhiMiSciHeadingBlue}%
424 }
425 \newkomafont{PhiMiSciEmail}{\normalfont\slshape}
426 \newkomafont{PhiMiSciFooter}
427 {%
428 \raggedright%
429 \usekomafont{footnote}%
430 \color{PhiMiSciHeadingBlue}%
431 }
432 \newkomafont{PhiMiSciKeywords}
433 {%
434 \normalfont\fontsize{10bp}{13.5bp}\selectfont%
435 \color{PhiMiSciHeadingBlue}%
436 }
437 \newkomafont{PhiMiSciTableBody}
438 {%
439 \sffamily\fontsize{9bp}{13.5bp}\selectfont%
440 }
441 \newkomafont{PhiMiSciWatermark}
442 {%
443 \normalfont\normalcolor\color{black!15}%
444 }
445 % \end{macrocode}
446 % These next settings configure the font in the page header. Note that the
447 % colour of the header separation line is also given as a ``font'' option.
448 % \begin{macrocode}
449 \addtokomafont{pagefoot}{\normalfont\color{PhiMiSciHeadingBlue}}
450 \addtokomafont{pagehead}
451 {%
452 \normalfont%
453 \PhiMiSciMediumFont%
454 \footnotesize%
455 \color{PhiMiSciBlueThree}%
456 }
457 \addtokomafont{headsepline}{\sffamily\bfseries}
458 % \end{macrocode}
459 % In KOMA's font settings, the key \texttt{disposition} is inherited by all
460 % section headers.
461 % \begin{macrocode}
462 \addtokomafont{disposition}{%
463 \PhiMiSciTitleFont%
464 \bfseries%
465 \color{PhiMiSciHeadingBlue}%
466 }
467 \addtokomafont{section}
468 {%
469 \fontsize{15.25bp}{18.5bp}%
470 \selectfont%
471 }
472 \addtokomafont{subsection}
473 {%
474 \color{PhiMiSciBlueThree}%
475 \fontsize{13.25bp}{17bp}%
476 \selectfont%
477 }
478 \addtokomafont{subsubsection}
479 {%
480 \color{PhiMiSciBlueThree}%
481 \fontsize{12bp}{17bp}%
482 \selectfont%
483 }
484 \addtokomafont{paragraph}
485 {%
486 \color{PhiMiSciBlueThree}%
487 \fontsize{10bp}{13.5bp}%
488 \selectfont%
489 }
490 % \end{macrocode}
491 % The remaining font options configure elements in the text.
492 % \begin{macrocode}
493 \setkomafont{dictum}{\normalfont\normalsize\itshape}
494 \setkomafont{dictumauthor}{\normalfont\normalsize}
495 \setkomafont{descriptionlabel}{\normalfont\bfseries}
496 \addtokomafont{footnote}{\fontsize{9.25bp}{11.5bp}\selectfont}
497 \setkomafont{footnotelabel}{\sffamily\bfseries\color{PhiMiSciBlueTwo}}
498 \addtokomafont{footnotereference}{\sffamily\small\bfseries\color{PhiMiSciBlueTwo}}
499 \setkomafont{caption}{\usekomafont{footnote}\bfseries}
500 \setkomafont{captionlabel}
501 {%
502 \sffamily\bfseries%
503 \fontsize{8bp}{10bp}\selectfont%
504 \color{PhiMiSciHeadingBlue}%
505 }
506 \setkomafont{notecolumn.marginpar}{\normalfont\color{black!50}}
507 \newkomafont{PhiMiSciQuote}{\normalfont\fontsize{10bp}{13.5bp}\selectfont}
508 % \end{macrocode}
509 %
510 % \subsection{Bibliography management through \texttt{biblatex}}
511 % The entire bibliography management is delegated to \texttt{biblatex}. We enable
512 % \texttt{natbib} as well so that authors can use traditional commands, most notably
513 % \cs{citet}, \cs{citep} and \cs{citealt}. \emph{Philosophy and the Mind Sciences}
514 % strictly follows the citation rules of the APA.
515 % \begin{macrocode}
516 \RequirePackage[style=apa, natbib=true]{biblatex}
517 % \end{macrocode}
518 % \subsection{PDF meta data and links through \texttt{hyperref}}
519 % After loading hyperref earlier, we set all links to our blue color.
520 % \begin{macrocode}
521 \hypersetup{breaklinks=true,
522 colorlinks=true,
523 linkcolor=PhiMiSciBlueTwo,
524 citecolor=PhiMiSciBlueTwo,
525 urlcolor=PhiMiSciBlueTwo}
526 % \end{macrocode}
527 % We delay setting the PDF title string to the end of the preamble
528 % to allow for meta data processing first. The meta data is output only in
529 % some publication stages (see Section~\ref{sec:stages}).
530 % \begin{macrocode}
531 \ExplSyntaxOn
532 \AtEndPreamble
533 {
534 \hypersetup
535 {
536 pdftitle = { \tl_use:N \l_phimisci_document_title_tl }
537 }
538 }
539 \ExplSyntaxOff
540 % \end{macrocode}
541 % \subsection{Setting the stage (preparation, submission, draft, publication)}
542 % \label{sec:stages}
543 % Our \texttt{phimisci} class supports four document stages. These stages are
544 % intended to support different steps in the preparation and publication of a
545 % document:
546 %
547 % \begin{description}
548 % \item[Preparation:] Used by authors to compose a paper for submission to the
549 % journal.
550 % \item[Submission:] Used to compile the document for the peer review process.
551 % \item[Draft:] Used internally by the PhiMiSci office for production of the
552 % proofs.
553 % \item[Final:] A stage to produce the publication PDF.
554 % \end{description}
555 %
556 % These stages control the appearance of the generated document (see
557 % Table~\ref{tab:stages}). For example, no meta data are output in the
558 % \texttt{submission} stage to ensure anonymity during peer review.
559 % The modes are activated through the class setting \texttt{stage}
560 % (see Section~\ref{sec:options} for more user options). For example,
561 % \texttt{draft} mode is enabled with:
562 % \begin{center}
563 % \cs{documentclass}\texttt{[stage=draft]\{phimisci\}}
564 % \end{center}
565 %
566 % \begin{table}[h]
567 % \centering
568 % \caption{Possible values for \texttt{stage} and the document settings applied
569 % at each stage.\label{tab:stages}}
570 % \begin{tabular}{lcccc}
571 % \toprule
572 % & & \multicolumn{3}{c}{Output}\\\cmidrule(lr){3-5}
573 % Stage & Draft mode & Authors & Contact info & Footer\\\midrule
574 % Preparation & \ding{55} & \ding{51} & \ding{51} & \ding{55}\\
575 % Submission & \ding{55} & \ding{55} & \ding{55} & \ding{55}\\
576 % Draft & \ding{51} & \ding{51} & \ding{51} & \ding{51}\\
577 % Final & \ding{55} & \ding{51} & \ding{51} & \ding{51}\\
578 % \bottomrule
579 % \end{tabular}
580 % \end{table}
581 %
582 % \begin{function}{\__phimisci_stage_preparation:}
583 % Enable settings for the \texttt{preparation} stage.
584 % \end{function}
585 % \begin{macrocode}
586 \ExplSyntaxOn
587 \cs_new:Nn \__phimisci_stage_preparation:
588 {
589 \KOMAoptions{overfullrule=false}
590 \bool_set_true:N \l__phimisci_output_authors_bool
591 \bool_set_true:N \l__phimisci_output_contact_bool
592 \bool_set_false:N \l__phimisci_output_publication_header_footer_bool
593 \bool_set_false:N \l__phimisci_output_draft_footer_bool
594 \bool_set_true:N \l__phimisci_output_rights_bool
595 \bool_set_false:N \l__phimisci_output_doi_bool
596 }
597 % \end{macrocode}
598 %
599 % \begin{function}{\__phimisci_stage_submission:}
600 % Enable settings for the \texttt{submission} stage.
601 % \end{function}
602 % \begin{macrocode}
603 \cs_new:Nn \__phimisci_stage_submission:
604 {
605 \KOMAoptions{overfullrule=false}
606 \bool_set_false:N \l__phimisci_output_authors_bool
607 \bool_set_false:N \l__phimisci_output_contact_bool
608 \bool_set_false:N \l__phimisci_output_publication_header_footer_bool
609 \bool_set_false:N \l__phimisci_output_draft_footer_bool
610 \bool_set_false:N \l__phimisci_output_rights_bool
611 \bool_set_false:N \l__phimisci_output_doi_bool
612 }
613 % \end{macrocode}
614 % \begin{function}{\__phimisci_stage_draft:}
615 % Enable settings for a \texttt{draft} after acceptance and during production.
616 % \end{function}
617 % \begin{macrocode}
618 \cs_new:Nn \__phimisci_stage_draft:
619 {
620 \KOMAoptions{overfullrule=true}
621 \RequirePackage{scrtime}
622 \RequirePackage{tikz}
623 \AddToHook{shipout/background}{%
624 \put(0pt, 0pt) {%
625 \begin{tikzpicture}[remember~picture, overlay]
626 \node [rotate=45, scale=5] at (current~page.center)
627 {
628 \usekomafont{PhiMiSciWatermark}
629 \tl_use:N \l__phimisci_draft_watermark_tl
630 };
631 \end{tikzpicture}
632 }
633 }
634 \RequirePackage[pagewise, switch]{lineno}
635 \AtBeginDocument{\linenumbers}
636 \bool_set_true:N \l__phimisci_output_authors_bool
637 \bool_set_true:N \l__phimisci_output_contact_bool
638 \bool_set_true:N \l__phimisci_output_publication_header_footer_bool
639 \bool_set_true:N \l__phimisci_output_draft_footer_bool
640 \bool_set_true:N \l__phimisci_output_rights_bool
641 \bool_set_true:N \l__phimisci_output_doi_bool
642 }
643 % \end{macrocode}
644 % \begin{function}{\__phimisci_stage_final:}
645 % Enable settings for the \texttt{final} publication PDF.
646 % \end{function}
647 % \begin{macrocode}
648 \cs_new:Nn \__phimisci_stage_final:
649 {
650 \KOMAoptions{overfullrule=false}
651 \bool_set_true:N \l__phimisci_output_authors_bool
652 \bool_set_true:N \l__phimisci_output_contact_bool
653 \bool_set_true:N \l__phimisci_output_publication_header_footer_bool
654 \bool_set_false:N \l__phimisci_output_draft_footer_bool
655 \bool_set_true:N \l__phimisci_output_rights_bool
656 \bool_set_true:N \l__phimisci_output_doi_bool
657 }
658 % \end{macrocode}
659 % \section{User-configurable options}
660 % \label{sec:options}
661 % Users can configure the output of \texttt{phimisci} documents using a
662 % key-value interface. Options can be loaded \emph{early} or \emph{late}. Early
663 % settings are those passed to \cs{documentclass}:
664 %
665 % \begin{center}
666 % \cs{documentclass}\oarg{\meta{key\textsubscript{1}}=
667 % \meta{value\textsubscript{1}},
668 % \meta{key\textsubscript{2}}=
669 % \meta{value\textsubscript{2}},
670 % ...}\verb+{phimisci}+
671 % \end{center}
672 % \noindent Late configurations appear after \cs{documentclass} but ideally
673 % before \verb+\begin{document}+. They are passed to \cs{PhiMiSciSettings}:
674 %
675 % \begin{center}
676 % \cs{PhiMiSciSettings}\marg{\meta{key\textsubscript{1}}=
677 % \meta{value\textsubscript{1}},
678 % \meta{key\textsubscript{2}}=
679 % \meta{value\textsubscript{2}},
680 % ...}
681 % \end{center}
682 %
683 % \begin{description}
684 % \item[Hint:] Later settings always override previous ones.
685 % \item[Warning:] Many of the options will take either no effect or cause
686 % unexpected output if they are changed in the document body. It is recommended
687 % to change all settings in the preamble, before \verb+\begin{document}+.
688 % \end{description}
689 % A \meta{key} can be any of the settings described below. Possible settings
690 % for the \meta{value} depend on the respective \meta{key}.
691 %
692 % There are three types of \meta{keys}. Document meta data can be configured
693 % with the first group. These are described in Section~\ref{sec:document-data}.
694 % Settings for the layout and document element behavior are stored in the
695 % \meta{settings/} sub-group of keys (Section~\ref{sec:settings-layout}).
696 % Locale options are stored in the \meta{locale/} sub-group
697 % (Section~\ref{sec:settings-locale}).
698 % \subsection{Configure document data}\label{sec:document-data}
699 % \begin{function}{\PhiMiSciSettings}
700 % \begin{syntax}
701 % \cs{PhiMiSciSettings} \{ \meta{key\textsubscript{1}} = \meta{value\textsubscript{1}}, \meta{key\textsubscript{2}} = \meta{value\textsubscript{2}}, ... \}
702 % \end{syntax}
703 % \end{function}
704 % Meta data that are not input through dedicated commands (such as \cs{author}
705 % or \cs{title}) can be configured with \cs{PhiMiSciSettings}. This command
706 % accepts a comma-separated key-value list of settings and values.
707
708 % For example, to prepare a draft for in volume 100 in the year 2100, you
709 % would set:
710 %
711 % \begin{quote}
712 % \verb+\PhiMiSciSettings{stage=draft, volume=100, year=2100}+
713 % \end{quote}
714 %
715 % The meaning of the settings below can be found in the quick reference sheet
716 % for this class, available as a separate document.
717 % \begin{macrocode}
718 \keys_define:nn { phimisci }
719 {
720 stage .choice:,
721 stage / preparation .code:n = { \__phimisci_stage_preparation: },
722 stage / submission .code:n = { \__phimisci_stage_submission: },
723 stage / draft .code:n = { \__phimisci_stage_draft: },
724 stage / final .code:n = { \__phimisci_stage_final: },
725 stage .default:n = {preparation},
726 volume .tl_set:N = \l_phimisci_volume_tl,
727 volume .initial:n = { \int_eval:n { \the\year - 2019 } },
728 number .tl_set:N = \l_phimisci_number_tl,
729 number .initial:n = {00},
730 doi .tl_set:N = \l_phimisci_doi_tl,
731 doi .initial:n = {10.33735/phimisci.0000.0000},
732 year .int_set:N = \l_phimisci_publication_year_int,
733 year .initial:x = {\the\year},
734 issue .tl_set:N = \l_phimisci_issue_title_tl,
735 issue .initial:n = {},
736 editor .code:n =
737 { \seq_set_split:Nnn \l_phimisci_issue_editor_seq { ; } { #1 } },
738 discussed-book .tl_set:N = \l_phimisci_discussed_book_tl,
739 discussed-book .initial:n = {},
740 discussed-book-authors .code:n =
741 {
742 \seq_set_split:Nnn \l_phimisci_discussed_book_authors_seq
743 { ; } { #1 }
744 },
745 language .clist_set:N = \l__phimisci_languages_clist,
746 language .initial:n = {english}
747 }
748 % \end{macrocode}
749 % \subsection{Settings to document elements and layout}
750 % \label{sec:settings-layout}
751 % \begin{variable}{phimisci/settings}
752 % \begin{syntax}
753 % \cs{PhiMiSciSettings} \{ settings / \meta{key} = \meta{value} \}
754 % \end{syntax}
755 % \end{variable}
756 % These settings allow you to go deep into the behavior of the class. For
757 % the features that a user is most likely to set, please refer to the quick
758 % reference sheet available as a separate document.
759 % \begin{macrocode}
760 \keys_define:nn { phimisci / settings }
761 {
762 author-output-separator .tl_set:N = \l__phimisci_authors_osep_tl,
763 author-output-separator .initial:n = {,~},
764 author-output-final-separator .tl_set:N =
765 \l__phimisci_authors_osep_final_tl,
766 author-output-final-separator .initial:n = {~\&~},
767 affiliations-input-separator .tl_set:N =
768 \l__phimisci_affiliations_isep_tl,
769 affiliations-input-separator .initial:n = { ; },
770 citation-file .tl_set:N = \l__phimisci_citation_file_name_tl,
771 citation-file .initial:n = { phimisci-current-article.bib },
772 copyright-text .tl_set:N = \l__phimisci_copyright_tl,
773 copyright-text .initial:n = { },
774 emergency-stretch .dim_set:N = \l__phimisci_settings_emergencystretch_dim,
775 emergency-stretch .initial:n = { 2em },
776 paragraph-indent .dim_set:N = \parindent,
777 paragraph-indent .initial:n = { 6.5mm },
778 list-indent .dim_set:N = \leftmargini,
779 list-indent .initial:n = { 6.5mm },
780 extra-sentence-spacing .bool_set:N =
781 \l__phimisci_settings_extra_sentence_spacing_bool,
782 extra-sentence-spacing .initial:n = {false},
783 dictum-width .code:n = { \renewcommand* { \dictumwidth } { #1 } },
784 dictum-width .initial:n = { 0.62\linewidth },
785 draft-footer-text .tl_set:N = \l__phimisci_draft_footer_tl,
786 draft-footer-text .initial:n =
787 {
788 \textit{Draft~generated~on~\today{}~at~\thistime{}.}
789 },
790 draft-watermark .tl_set:N = \l__phimisci_draft_watermark_tl,
791 draft-watermark .initial:n = {PhiMiSci~uncorrected~proofs},
792 footnote-break-penalty .int_set:N =
793 \l__phimisci_settings_footnote_penalty_int,
794 footnote-break-penalty .initial:n = { 1000 },
795 footnote-distance-from-main .code:n = { \setlength{\skip\footins}{#1} },
796 footnote-distance-from-main .initial:n = { 13.5bp plus 4pt minus 2pt },
797 head-rule-thickness .dim_set:N = \l__phimisci_head_rule_height_dim,
798 head-rule-thickness .initial:n = { 0.25bp },
799 logo-url .tl_set:N = \l__phimisci_branding_logo_tl,
800 logo-url .initial:n = { },
801 logo-width .dim_set:N = \l__phimisci_logo_width_dim,
802 logo-width .initial:n = { 20.6mm },
803 submission-footer-text .tl_set:N = \l__phimisci_submission_footer_tl,
804 submission-footer-text .initial:n =
805 {
806 Submission~to~\textit{Philosophy~and~the~Mind~Sciences}
807 },
808 keyword-input-separator .tl_set:N =
809 \l__phimisci_keywords_isep_tl,
810 keyword-input-separator .initial:n = { ; },
811 keyword-output-separator .tl_set:N =
812 \l__phimisci_keywords_osep_tl,
813 keyword-output-separator .initial:n =
814 {
815 \nobreak\space
816 \textsf{\textbullet}
817 \space
818 },
819 number-authors-header .int_set:N =
820 \l__phimisci_max_authors_in_header_int,
821 number-authors-header .initial:n = { 2 },
822 orcid-color .tl_set:N = \l__phimisci_orcid_color_tl,
823 orcid-color .initial:n = { A6CE39 },
824 orphan-penalty .int_set:N = \l__phimisci_settings_orphan_penalty_int,
825 orphan-penalty .initial:n = { 300 },
826 output-orcids .bool_set:N = \l__phimisci_output_orcids_bool,
827 output-orcids .initial:n = {true},
828 paragraph-numbering-excluded-objects .tl_set:N =
829 \l__phimisci_parnum_excluded_objects_tl,
830 paragraph-numbering-excluded-objects .initial:n = {},
831 widow-control .choice:,
832 widow-control / arseneau .code:n =
833 { \bool_set_true:N \l__phimisci_settings_sloppybottom_bool },
834 widow-control / chernoff .code:n =
835 { \bool_set_true:N \l__phimisci_settings_luawidow_bool },
836 widow-penalty .int_set:N = \l__phimisci_settings_widow_penalty_int,
837 widow-penalty .initial:n = { 500 },
838 }
839 % \end{macrocode}
840 % \subsection{Locale settings}\label{sec:settings-locale}
841 % \begin{variable}{phimisci/locale}
842 % \begin{syntax}
843 % \cs{PhiMiSciSettings} \{ locale / \meta{key} = \meta{value} \}
844 % \end{syntax}
845 % \end{variable}
846 % These settings control the names of document elements. For example, the
847 % key \texttt{phimisci / locale / abstract} stores the header of the abstract
848 % on the title page.
849 % \begin{macrocode}
850 \keys_define:nn { phimisci / locale }
851 {
852 abstract .tl_set:N = \l__phimisci_locale_abstract_tl,
853 abstract .initial:n = {Abstract},
854 contact .tl_set:N = \l__phimisci_locale_contact_tl,
855 contact .initial:n = {Primary~contact:~},
856 et-al .tl_set:N = \l__phimisci_locale_et_al_tl,
857 et-al .initial:n = {et~al.},
858 edited-by .tl_set:N = \l__phimisci_locale_edited_by_tl,
859 edited-by .initial:n = {,~edited~by~},
860 authored-by .tl_set:N = \l__phimisci_locale_authored_by_tl,
861 authored-by .initial:n = {~by~},
862 journal-name .tl_set:N = \l__phimisci_journal_name_tl,
863 journal-name .initial:n = {Philosophy~and~the~Mind~Sciences},
864 journal-short-name .tl_set:N = \l__phimisci_journal_short_name_tl,
865 journal-short-name .initial:n = {PhiMiSci},
866 keywords .tl_set:N = \l__phimisci_locale_keywords_tl,
867 keywords .initial:n = {Keywords:~},
868 volume .tl_set:N = \l__phimisci_locale_volume_tl,
869 volume .initial:n = {Vol.},
870 number .tl_set:N = \l__phimisci_locale_number_tl,
871 number .initial:n = {No.},
872 book-symposium .tl_set:N = \l__phimisci_locale_book_symposium_tl,
873 book-symposium .initial:n = {Book~symposium~on~},
874 special-issue .tl_set:N = \l__phimisci_locale_special_issue_tl,
875 special-issue .initial:n = {Special~Issue:~}
876 }
877 % \end{macrocode}
878 % \begin{function}{\PhiMiSciSettings}
879 % \begin{syntax} \cs{PhiMiSciSettings} \marg{ \#1 }
880 % \end{syntax}
881 % This is the implementation of the \cs{PhiMiSciSettings} command. It serves
882 % as an interface from user input to internal processing.
883 % \begin{macrocode}
884 \NewDocumentCommand { \PhiMiSciSettings } { m }
885 {
886 \keys_set:nn { phimisci } { #1 }
887 }
888 \ProcessKeysOptions{phimisci}
889 % \end{macrocode}
890 % \end{function}
891 % \section{Metadata processing}
892 %
893 % \subsection{Manage author data}
894 % Author data, including affiliations and ORCiDs, are processed by an
895 % adjusted \cs{author} command. The input is stored and processed for the
896 % output on the title page as well as in the page header and some other
897 % places.
898 %
899 % \begin{function}{\author, \affiliation, \orcid}
900 % \begin{arguments}
901 % \item A shortened author string to be printed in the page header
902 % \item Author-affiliation-ORCiD triples, separated by \cs{and}
903 % \end{arguments}
904 % \begin{syntax}
905 % \cs{author} \oarg{\#1} \marg{\#2}
906 % \end{syntax}
907 % If the optional argument \oarg{\#1} is not given, the list of authors to
908 % be printed in the header is determined from the input in \marg{\#2}
909 % according to APA citation guidelines.
910 %
911 % In the input, author data is given as \texttt{author} -- \texttt{affiliation}
912 % -- \texttt{orcid} unordered triple, where the input follows the pattern:
913 % \begin{quote}
914 % \texttt{Author name}\cs{affiliation}\marg{list of affiliations}\cs{orcid}\marg{orcid}
915 % \end{quote}
916 %
917 % \begin{description}
918 % \item[Notes:]
919 % \begin{enumerate}
920 % \item[]
921 % \item Affiliations and ORCiDs are optional for each author.
922 %
923 % \item The position of \cs{affiliation} and \cs{orcid} is
924 % interchangeable.
925 %
926 % \item Within \marg{list of affiliations}, items are separated by
927 % \texttt{;}. Multiple authors are separated by the marker \cs{and}.
928 %
929 % \item New lines are allowed in the argument to \cs{author}.
930 %
931 % \item \cs{affiliation} and \cs{orcid} are \emph{not}
932 % defined commands here, but merely elements parsing to hook on to
933 % \cite[see][46]{Interface3}.
934 % \end{enumerate}
935 %
936 % \item[Example:] ~
937 % \begin{quote}
938 % \cs{author}\texttt{\{}\\
939 % Author 1\cs{affiliation} \marg{Affiliation 1; Affiliation 2}
940 % \cs{orcid}\marg{...}\\
941 % \cs{and} Author 2 \cs{orcid}\marg{...} \cs{affiliation}\marg{...}\\
942 % \cs{and} Author 3 \cs{affiliation}\marg{Affiliation 2}\\
943 % \texttt{\}}
944 % \end{quote}
945 % \end{description}
946 % \end{function}
947 % \begin{macrocode}
948 \RenewDocumentCommand {\author} { O{} +m }
949 {
950 \tl_set:Nx \l__phimisci_custom_header_authors_tl { #1 }
951 \gdef \@author { #2 }
952 \AtEndPreamble { \PhiMiSci@ProcessAuthorData { #2 } }
953 }
954 % \end{macrocode}
955 % \begin{macrocode}
956 % \end{macrocode}
957 % \begin{function}{\PhiMiSci@ProcessAuthorData}
958 % A document command that forwards user input to internal author data
959 % processing in \cs{phimisci_process_author_data:nNNN}.
960 % \end{function}
961 % \begin{macrocode}
962 \NewDocumentCommand { \PhiMiSci@ProcessAuthorData } { +m }
963 {%
964 \exp_args:No \phimisci_process_author_data:nNNN
965 { #1 }
966 \l__phimisci_authors_to_ids_prop
967 \l__phimisci_author_ids_to_affiliations_prop
968 \l__phimisci_author_ids_to_orcids_prop
969 \hypersetup { pdfauthor = { \tl_use:N \l_phimisci_authors_tl } }
970 }
971 % \end{macrocode}
972 % \begin{function}{\PhiMiSci@OutputAuthorData}
973 % Control the output of author data on the title page. This function is
974 % called by \cs{maketitle}.
975 % \end{function}
976 % \begin{macrocode}
977 \NewDocumentCommand { \PhiMiSci@OutputAuthorData } {}
978 {
979 \group_begin:
980 \parindent 0pt
981 \bool_if:NT \l__phimisci_output_authors_bool
982 {
983 \group_begin:
984 \usekomafont{author}
985 \phimisci_output_authors:NNN
986 \l__phimisci_authors_to_ids_prop
987 \l__phimisci_author_ids_to_affiliations_prop
988 \l__phimisci_author_ids_to_orcids_prop
989 \group_end:
990 % \end{macrocode}
991 % Check whether the article is part of a book symposium or a special issue.
992 % Articles cannot be part of both; if both are given, the special issue
993 % takes precedence. Whether or not the article is part of a special issue
994 % or a book symposium is determined through the article's meta data. If any
995 % title for a book symposium or special issue is given, the article is
996 % considered part of such.
997 % \begin{macrocode}
998 \tl_if_blank:VTF \l_phimisci_issue_title_tl
999 {
1000 \tl_if_blank:VF \l_phimisci_discussed_book_tl
1001 {
1002 \vskip 1em
1003 \group_begin:
1004 \usekomafont{subject}
1005 \tl_use:N \l__phimisci_locale_book_symposium_tl
1006 \textit{\tl_use:N \l_phimisci_discussed_book_tl}
1007 \seq_if_empty:NF \l_phimisci_discussed_book_authors_seq
1008 {
1009 \tl_use:N \l__phimisci_locale_authored_by_tl
1010 \seq_use:Nnnn
1011 \l_phimisci_discussed_book_authors_seq
1012 {~\&~}
1013 {,~}
1014 {,~\&~}
1015 }
1016 \seq_if_empty:NF \l_phimisci_issue_editor_seq
1017 {
1018 \tl_use:N \l__phimisci_locale_edited_by_tl
1019 \seq_use:Nnnn
1020 \l_phimisci_issue_editor_seq
1021 {~\&~}
1022 {,~}
1023 {,~\&~}
1024 }
1025 \group_end:
1026 \par
1027 }
1028 }
1029 {
1030 \vskip 1em
1031 \group_begin:
1032 \usekomafont{subject}
1033 \tl_use:N \l__phimisci_locale_special_issue_tl
1034 \textit{\tl_use:N \l_phimisci_issue_title_tl}
1035 \seq_if_empty:NF \l_phimisci_issue_editor_seq
1036 {
1037 \tl_use:N \l__phimisci_locale_edited_by_tl
1038 \seq_use:Nnnn
1039 \l_phimisci_issue_editor_seq
1040 {~\&~}
1041 {,~}
1042 {,~\&~}
1043 }
1044 \group_end:
1045 \par
1046 }
1047 \tl_if_blank:VF \l__phimisci_dedication_tl
1048 {
1049 \vskip 1em
1050 \group_begin:
1051 \usekomafont{PhiMiSciDedication}
1052 \tl_use:N \l__phimisci_dedication_tl
1053 \par
1054 \group_end:
1055 }
1056 \vfill
1057 \group_begin:
1058 \phimisci_output_affiliations:N
1059 \l__phimisci_affiliation_id_resolver_prop
1060 \group_end:
1061 \par
1062 \vspace* { 2\baselineskip }
1063 }
1064 \group_end:
1065 }
1066 % \end{macrocode}
1067 % \begin{function}{\phimisci_process_author_data:nNNN}
1068 % This command handles the internal author-affiliation-orcid processing.
1069 % \begin{arguments}
1070 % \item The input author-affiliation-orcid text,
1071 % \item[] and the following outpus:
1072 % \item A property map that assigns each author to a unique ID.
1073 % \item A property map that assigns each ID to an affiliation.
1074 % \item A property map that assigns each ID to an ORCiD.
1075 % \end{arguments}
1076 % \end{function}
1077 % \begin{macrocode}
1078 \cs_new:Npn \phimisci_process_author_data:nNNN #1#2#3#4
1079 {
1080 \seq_clear_new:N \l__phimisci_authors_header_tmp_seq
1081 % \end{macrocode}
1082 % We first split the input string by \cs{and}, the common separator between
1083 % authors in the \LaTeX\ world. The result is stored in a sequence.
1084 % \begin{macrocode}
1085 \seq_set_split:Nnn \l__phimisci_authors_seq
1086 { \and~ }
1087 { #1 }
1088 % \end{macrocode}
1089 % We now loop over the items stored in the sequence. The sequence is a list of all
1090 % authors and each item stores all information of a single author. The currently
1091 % processed author item is known to \LaTeX\ as \texttt{\#\#1}.
1092 % \begin{macrocode}
1093 \int_zero_new:N \l__phimisci_current_author_id_int
1094 \seq_map_inline:Nn \l__phimisci_authors_seq
1095 {
1096 \tl_clear_new:N \l__phimisci_author_tmp_tl
1097 \tl_set:Nn \l__phimisci_author_tmp_tl { ##1 }
1098 % \end{macrocode}
1099 % The author's affiliation and ORCID are extracted using regex parsing. As stated
1100 % above, \cs{affiliation} and \cs{orcid} are not defined control sequences, but
1101 % rather hooks for the regex parsing to attach to. The order of the author's name,
1102 % the affiliation and ORCID is irrelevant to the regex parsing -- though it is
1103 % certainly best practice to advise users to always follow a conventional input
1104 % pattern.
1105 %
1106 % These two regular expressions each match a brace group following, if provided in
1107 % the input, \cs{affiliation} and \cs{orcid}. The resulting sequence variables
1108 % will contain the completely matched string as a frist item -- for example,
1109 % |\affiliation{ABC University}| -- and the contents of the brace group as the
1110 % second item -- for example, |ABC University|.
1111 % \begin{macrocode}
1112 \regex_extract_once:nnN
1113 {\c{affiliation} \cB. (\c[^BE].*) \cE.}
1114 { ##1 }
1115 \l__phimisci_tmp_author_affiliation_seq
1116
1117 \regex_extract_once:nnN
1118 {\c{orcid} \cB. (\c[^BE].*) \cE.}
1119 { ##1 }
1120 \l__phimisci_tmp_author_orcid_seq
1121 % \end{macrocode}
1122 % Following extraction we remove the author's affiliation and ORCID from the input
1123 % so that only the name remains in the data for the current author.
1124 % \begin{macrocode}
1125 \regex_replace_all:nnN {\c{orcid} \cB. (\c[^BE].*) \cE.}
1126 {}
1127 \l__phimisci_author_tmp_tl
1128 \regex_replace_all:nnN {\c{affiliation} \cB. (\c[^BE].*) \cE.}
1129 {}
1130 \l__phimisci_author_tmp_tl
1131 % \end{macrocode}
1132 % Next, we trim leading and trailing spaces and store the name of the author
1133 % in a sequence.
1134 % \begin{macrocode}
1135 \tl_trim_spaces:N \l__phimisci_author_tmp_tl
1136 \seq_put_right:NV \l__phimisci_authors_header_tmp_seq
1137 \l__phimisci_author_tmp_tl
1138 % \end{macrocode}
1139 % Loop over the affiliation(s) of the current author and assign each ID to
1140 % an affiliation ID, if not already present. \#\#\#\#1 is the current
1141 % affiliation. We first split the sequence of affiliations for each author.
1142 % \begin{macrocode}
1143 \seq_clear_new:N \l__phimisci_author_affiliation_seq
1144 \seq_clear_new:N \l__phimisci_author_affiliation_ids_seq
1145 \tl_clear_new:N \l__phimisci_afil_loop_tl
1146 \seq_set_split:NVx \l__phimisci_author_affiliation_seq
1147 \l__phimisci_affiliations_isep_tl
1148 {
1149 \seq_item:Nn
1150 \l__phimisci_tmp_author_affiliation_seq
1151 {2}
1152 }
1153 % \end{macrocode}
1154 % We now loop over all the affiliations of an author. We first check whether
1155 % the current affiliation, \#\#\#\#1, is empty or is already assigned to an
1156 % affiliation ID. If neither is the case, we create a new global ID for this
1157 % affiliation. We then add the affiliation ID to the author's sequence of
1158 % affiliation IDs.
1159 % \begin{macrocode}
1160 \seq_map_inline:Nn \l__phimisci_author_affiliation_seq
1161 {
1162 \tl_if_blank:nF { ####1 }
1163 {
1164 \prop_get:NnNTF \l__phimisci_affiliation_id_resolver_prop { ####1 }
1165 \l__phimisci_afil_loop_tl
1166 {
1167 \seq_put_right:NV
1168 \l__phimisci_author_affiliation_ids_seq
1169 \l__phimisci_afil_loop_tl
1170 }
1171 {
1172 \prop_put:Nxx \l__phimisci_affiliation_id_resolver_prop
1173 { ####1 }
1174 {
1175 \int_eval:n
1176 {
1177 \prop_count:N \l__phimisci_affiliation_id_resolver_prop
1178 + 1
1179 }
1180 }
1181 \seq_put_right:Nx \l__phimisci_author_affiliation_ids_seq
1182 {
1183 \prop_count:N \l__phimisci_affiliation_id_resolver_prop
1184 }
1185 }
1186 }
1187 }
1188 % \end{macrocode}
1189 % We now store all the data in three separate property lists. In the first we
1190 % assign authors to (lists of) affiliations. Seconly, we map authors to their
1191 % ORCIDs in a separate property list. And third, we store the e-mail address
1192 % in another property map. The currently processed affiliation is given by
1193 % |####1|.
1194 % \begin{macrocode}
1195 \prop_put:Nxx { #2 }
1196 { \int_use:N \l__phimisci_current_author_id_int }
1197 { \tl_use:N \l__phimisci_author_tmp_tl }
1198
1199 \prop_put:Nxx { #3 }
1200 { \int_use:N \l__phimisci_current_author_id_int }
1201 {
1202 \seq_use:Nn
1203 \l__phimisci_author_affiliation_ids_seq
1204 {,~}
1205 }
1206
1207 \prop_put:Nxx { #4 }
1208 { \int_use:N \l__phimisci_current_author_id_int }
1209 { \seq_item:Nn \l__phimisci_tmp_author_orcid_seq {2} }
1210 % \end{macrocode}
1211 % Increase the ID and continue the loop with the next author.
1212 % \begin{macrocode}
1213 \int_incr:N \l__phimisci_current_author_id_int
1214 }
1215 % \end{macrocode}
1216 % When all authors are parsed, create a token list of authors to be placed
1217 % in the header. If there are more authors than are allowed, print the first
1218 % author and the \textit{et al.} string. The author string in the header can
1219 % be overwritten by the optional argument to \cs{author} (but only if author
1220 % printing in the header is enabled).
1221 % \begin{macrocode}
1222 \bool_if:NTF \l__phimisci_output_authors_bool
1223 {
1224 \tl_if_blank:VTF \l__phimisci_custom_header_authors_tl
1225 {
1226 \tl_set:Nx \l_phimisci_header_authors_tl
1227 {
1228 \int_compare:nNnTF
1229 { \seq_count:N \l__phimisci_authors_header_tmp_seq }
1230 >
1231 { \l__phimisci_max_authors_in_header_int }
1232 {
1233 \seq_item:Nn \l__phimisci_authors_header_tmp_seq { 1 }
1234 \ \tl_use:N \l__phimisci_locale_et_al_tl
1235 }
1236 {
1237 \seq_use:Nnnn \l__phimisci_authors_header_tmp_seq
1238 {~\&~}
1239 {,~}
1240 {,~\&~}
1241 }
1242 }
1243 }
1244 {
1245 \tl_set_eq:NN \l_phimisci_header_authors_tl
1246 \l__phimisci_custom_header_authors_tl
1247 }
1248 \tl_set:Nx \l_phimisci_authors_tl
1249 {
1250 \seq_use:Nnnn \l__phimisci_authors_header_tmp_seq
1251 { \l__phimisci_authors_osep_final_tl }
1252 { \l__phimisci_authors_osep_tl }
1253 { \l__phimisci_authors_osep_final_tl }
1254 }
1255 \tl_set:Nx \l__phimisci_authors_citation_footer_tl
1256 {
1257 \seq_use:Nn \l__phimisci_authors_header_tmp_seq
1258 { ~and~ }
1259 }
1260 \int_compare:nNnTF
1261 { \seq_count:N \l__phimisci_authors_header_tmp_seq } = 1
1262 {
1263 \tl_set:Nn \l__phimisci_copyright_holder_tl { The~author }
1264 }
1265 {
1266 \tl_set:Nn \l__phimisci_copyright_holder_tl { The~authors }
1267 }
1268 }
1269 {
1270 \tl_set:Nn \l_phimisci_header_authors_tl { Anonymized }
1271 }
1272 }
1273 % \end{macrocode}
1274 % We have now sorted our data in two mappings, a \{author: <affiliations>\} and
1275 % an \{author: orcid\} mapping. These two are now output.
1276 % \begin{function}{\phimisci_output_authors:NNN}
1277 % \begin{arguments}
1278 % \item A property mapping that assigns each author to an ID.
1279 % \item A property map that assigns each ID to a list of affiliations.
1280 % \item A property map that assigns each ID to an ORCiD.
1281 % \end{arguments}
1282 % \end{function}
1283 % \begin{macrocode}
1284 \cs_new:Npn \phimisci_output_authors:NNN #1#2#3
1285 {
1286 \seq_clear_new:N \l__phimisci_output_authors_loop_seq
1287 \int_set:Nx \l__phimisci_output_authors_int
1288 { \prop_count:N \l__phimisci_author_ids_to_affiliations_prop }
1289 \int_do_until:nNnn { \seq_count:N \l__phimisci_output_authors_loop_seq }
1290 =
1291 {
1292 \l__phimisci_output_authors_int
1293 }
1294 {
1295 \seq_put_right:Nx
1296 \l__phimisci_output_authors_loop_seq
1297 {
1298 \seq_count:N
1299 \l__phimisci_output_authors_loop_seq
1300 }
1301 }
1302 \seq_map_inline:Nn \l__phimisci_output_authors_loop_seq
1303 {
1304 \tl_clear_new:N \l__phimisci_affiliation_ids_of_author_tl
1305 \tl_clear_new:N \l__phimisci_output_author_temp_tl
1306 \prop_get:NnN #2 { ##1 } \l__phimisci_affiliation_ids_of_author_tl
1307 \prop_get:NnN #1 { ##1 } \l__phimisci_output_author_temp_tl
1308 \tl_rescan:nx {} { \l__phimisci_output_author_temp_tl }
1309 \tl_if_empty:NF \l__phimisci_affiliation_ids_of_author_tl
1310 {
1311 \textsuperscript
1312 {
1313 \tl_use:N \l__phimisci_affiliation_ids_of_author_tl
1314 \str_if_eq:eeT \l__phimisci_output_author_temp_tl
1315 \l__phimisci_contact_author_tl
1316 { ,\,* }
1317 }
1318 }
1319 \phimisci_print_orcid:n { ##1 }
1320 \int_compare:nNnT { ##1 } < { \l__phimisci_output_authors_int + 1 }
1321 {
1322 \par
1323 }
1324 }
1325 }
1326 % \end{macrocode}
1327 % \begin{function}{\phimisci_output_affiliations:N}
1328 % \begin{arguments}
1329 % \item A property map that assigns each affiliation ID to the name of the
1330 % affiliation.
1331 % \end{arguments}
1332 % \end{function}
1333 % \begin{macrocode}
1334 \cs_new:Npn \phimisci_output_affiliations:N #1
1335 {
1336 \prop_map_inline:Nn #1
1337 {
1338 \group_begin:
1339 \usekomafont { PhiMiSciAffiliationItem }
1340 \textsuperscript
1341 {
1342 \tl_rescan:nn {} { ##2 }
1343 }
1344 \group_end:
1345 \group_begin:
1346 \__phimisci_affiliation_name_separator:
1347 \usekomafont { PhiMiSciAffiliationLine }
1348 \tl_rescan:nn {} { ##1 }
1349 \group_end:
1350 \__phimisci_affiliation_line_separator:
1351 }
1352 \par
1353 \tl_if_blank:nF { \l__phimisci_contact_tl }
1354 {
1355 \group_begin:
1356 \usekomafont { PhiMiSciAffiliationItem }
1357 *
1358 \group_end:
1359 \group_begin:
1360 \__phimisci_affiliation_name_separator:
1361 \usekomafont { PhiMiSciAffiliationLine }
1362 \tl_use:N \l__phimisci_locale_contact_tl
1363 \tl_use:N \l__phimisci_contact_tl
1364 \group_end:
1365 \par
1366 }
1367 }
1368 % \end{macrocode}
1369 % \begin{function}{\phimisci_print_orcid:n}
1370 % Outputs the ORCiD assigned to an author with the ID \marg{\#1}. No output
1371 % is given when the author is not assigned to an ORCiD (usually because none
1372 % was given in user input).
1373 %
1374 % The ORCiD is output as a hyperlinked icon using \cs{orcidlink} from the
1375 % \texttt{orcidlink} package. The color of that icon can be configured via
1376 % \cs{PhiMiSciSettings}\texttt{\{settings / orcid-color = \meta{HTML color code}\}}.
1377 % \end{function}
1378 % \begin{macrocode}
1379 \cs_new:Npn \phimisci_print_orcid:n #1
1380 {
1381 \prop_get:NnNT
1382 \l__phimisci_author_ids_to_orcids_prop
1383 { #1 }
1384 \l__phimisci_tmp_orcid_link_tl
1385 {
1386 \tl_if_empty:NF \l__phimisci_tmp_orcid_link_tl
1387 {
1388 \,
1389 \orcidlink{ \tl_use:N \l__phimisci_tmp_orcid_link_tl }
1390 }
1391 }
1392 }
1393 % \end{macrocode}
1394 % \subsection{Managing the title and a short title (\texttt{\textbackslash title})}
1395 % \begin{function}{\title}
1396 % \begin{syntax}
1397 % \cs{title} \oarg{abbreviated title} \marg{full title}
1398 % \end{syntax}
1399 % The \marg{full title} is printed as the document title as well as in the PDF
1400 % meta data. If an \oarg{abbreviated title} is given, this one is printed in
1401 % the running head. If none is supplied, the \marg{full title} is used there.
1402 % An \oarg{abbreviated title} should be used when the \marg{full title} is too
1403 % long to fit one line in the header.
1404 % \end{function}
1405 % \begin{macrocode}
1406 \tl_new:N \l_phimisci_document_title_tl
1407 \tl_new:N \l_phimisci_short_document_title_tl
1408 \RenewDocumentCommand {\title} { O{#2} m }
1409 {
1410 \tl_set:Nn \l_phimisci_document_title_tl { #2 }
1411 \tl_set:Nn \l_phimisci_short_document_title_tl { #1 }
1412 \RenewDocumentCommand {\@title} {} { #2 }
1413 }
1414 % \end{macrocode}
1415 % \subsection{Manage the abstract, keywords, contact details and information
1416 % about reviewed books}\label{sec:data:other}
1417 % \begin{function}{\contact}
1418 % \begin{syntax}
1419 % \cs{contact} \oarg{type} \Arg{contact~name} \marg{address}
1420 % \end{syntax}
1421 % Store the contact details given on the title page. The \marg{contact~name}
1422 % can be empty. When \marg{contact~name} matches one of the authors in
1423 % \cs{author}, an asterisk is placed after the author to indicate them as
1424 % the primary author.
1425 % The \marg{address} can be of different types. When \oarg{type} is not given
1426 % or set to \texttt{email}, \marg{address} will be handled as an e-mail
1427 % address and will be formatted appropriately as
1428 % \texttt{mailto:\meta{address}}. When \oarg{type} is set to \texttt{website},
1429 % the output will be formatted as the URL given in \marg{address}. When
1430 % \oarg{type} is set to an other value, the \marg{address} will be output as
1431 % free-form output without a link.
1432 % \end{function}
1433 % \begin{macrocode}
1434 \DeclareDocumentCommand {\contact} { O{email} m m }
1435 {%
1436 \bool_if:NT \l__phimisci_output_contact_bool
1437 {
1438 \tl_set:Nn \l__phimisci_contact_author_tl { #2 }
1439 \str_case:nnF { #1 }
1440 {
1441 {email}
1442 {
1443 \tl_set:Nn \l__phimisci_contact_tl
1444 {
1445 \href{mailto:#3}{#3}
1446 }
1447 }
1448 {website}
1449 {
1450 \tl_set:Nn \l__phimisci_contact_tl
1451 {
1452 \url{#3}
1453 }
1454 }
1455 }
1456 {
1457 \tl_set:Nn \l__phimisci_contact_tl { #3 }
1458 }
1459 }
1460 }
1461 % \end{macrocode}
1462 % \begin{function}{\abstract}
1463 % Store the abstract of the article.
1464 % \end{function}
1465 % \begin{macrocode}
1466 \DeclareDocumentCommand {\abstract} {+m}
1467 {%
1468 \tl_if_blank:nTF { #1 }
1469 {
1470 \bool_set_false:N \l__phimisci_output_abstract_bool
1471 }
1472 {
1473 \phimisci_check_abstract_length:n { #1 }
1474 \tl_set:Nn \l__phimisci_abstract_tl { #1 }
1475 \bool_set_true:N \l__phimisci_output_abstract_bool
1476 }
1477 }
1478 % \end{macrocode}
1479 % \begin{function}{\keywords}
1480 % Store a list of keywords, separated by a user-configurable input separator.
1481 % (\cs{l__phimisci_keywords_isep_tl}).
1482 % \end{function}
1483 % \begin{macrocode}
1484 \DeclareDocumentCommand {\keywords} {m}
1485 {%
1486 \tl_if_blank:nTF { #1 }
1487 {
1488 \bool_set_false:N \l__phimisci_output_keywords_bool
1489 }
1490 {
1491 \tl_set:No \l__phimisci_keywords_tl
1492 {
1493 \phimisci_process_keywords:n { #1 }
1494 }
1495 \bool_set_true:N \l__phimisci_output_keywords_bool
1496 \hypersetup { pdfkeywords = { #1 } }
1497 }
1498 }
1499 % \end{macrocode}
1500 %
1501 % \begin{function}{\dedication}
1502 % A user-interface for the authors to store the dedication for their article.
1503 % \end{function}
1504 % \begin{macrocode}
1505 \DeclareDocumentCommand {\dedication} { +m }
1506 {
1507 \tl_set:Nn \l__phimisci_dedication_tl { #1 }
1508 }
1509 % \end{macrocode}
1510 %
1511 % \begin{function}{\phimisci_check_abstract_length:n, \phimisci_process_keywords:n}
1512 % Functions to process the abstract and keyword.
1513 %
1514 % The length of the abstract is
1515 % estimated based on an average of eight characters per word. A warning is
1516 % issued if the function suspects that the abstract might be longer than the
1517 % journal's limit of 250 words. Long abstract can break the layout of the
1518 % title page, but this function can give false warnings.
1519 % \begin{macrocode}
1520 \cs_new:Npn \phimisci_check_abstract_length:n #1
1521 {
1522 \int_set:Nn \l__phimisci_abstract_length_int { \tl_count:o { #1 } }
1523 \int_compare:nNnT { \l__phimisci_abstract_length_int } < { 100 }
1524 { \AtEndDocument{ \ClassWarning {phimisci} {Very~short~abstract.} } }
1525 \int_compare:nNnT { \l__phimisci_abstract_length_int } > { 2000 }
1526 { \AtEndDocument { \ClassWarning {phimisci} {Very~long~abstract.} } }
1527 }
1528 \cs_new:Npn \phimisci_process_keywords:n #1
1529 {
1530 \seq_set_split:NVn \l__phimisci_keywords_seq
1531 \l__phimisci_keywords_isep_tl
1532 { #1 }
1533 \seq_use:Nn \l__phimisci_keywords_seq
1534 { \l__phimisci_keywords_osep_tl }
1535 }
1536 % \end{macrocode}
1537 % \end{function}
1538 % \begin{function}{\PhiMiSci@OutputMetadata}
1539 % Conditionally output meta data if supplied in the preamble. This function is
1540 % called by \cs{maketitle}.
1541 % \end{function}
1542 % \begin{macrocode}
1543 \NewDocumentCommand {\PhiMiSci@OutputMetadata} {}
1544 {
1545 \bool_if:nT
1546 {
1547 \l__phimisci_output_keywords_bool
1548 || \l__phimisci_output_abstract_bool
1549 }
1550 {
1551 \bool_if:NT \l__phimisci_output_abstract_bool
1552 {
1553 \subsubsection*{\tl_use:N \l__phimisci_locale_abstract_tl}
1554 \group_begin:
1555 \usekomafont{ PhiMiSciQuote }
1556 \tl_use:N \l__phimisci_abstract_tl
1557 \par
1558 \group_end:
1559 }
1560 \bool_if:NT \l__phimisci_output_keywords_bool
1561 {
1562 \vskip 1em
1563 \noindent
1564 \group_begin:
1565 \usekomafont{ PhiMiSciKeywords }
1566 \textbf{\tl_use:N \l__phimisci_locale_keywords_tl}
1567 \tl_use:N \l__phimisci_keywords_tl
1568 \par
1569 \group_end:
1570 }
1571 \clearpage
1572 }
1573 }
1574 % \end{macrocode}
1575 %
1576 % We make sure that the meta data is only provided in the preamble so that we
1577 % can process it before using \cs{maketitle}.
1578 % \begin{macrocode}
1579 \AtBeginDocument
1580 {
1581 \RenewDocumentCommand {\keywords} {m}
1582 {
1583 \ClassError {phimisci} {Command~can~only~be~used~in~preamble}
1584 {
1585 The command \string\keywords can only be used in the preamble.
1586 Please move your keywords before \string\begin\string{document\string}.
1587 }
1588 }
1589 }
1590 % \end{macrocode}
1591 % \subsection{Generate an auxiliary bibliography file}
1592 %
1593 % \begin{macrocode}
1594 \AtBeginDocument
1595 {
1596 \iow_open:Nn \l__phimisci_citation_file_stream
1597 { \l__phimisci_citation_file_name_tl }
1598 \iow_now:Nx \l__phimisci_citation_file_stream
1599 {
1600 @article{phimisci-current-article,\iow_newline:
1601 author = { \tl_use:N \l__phimisci_authors_citation_footer_tl },
1602 \iow_newline:
1603 year = { \int_use:N \l_phimisci_publication_year_int },
1604 \iow_newline:
1605 title = { {\exp_not:V \l_phimisci_document_title_tl} },
1606 \iow_newline:
1607 \tl_if_blank:VF \@subtitle
1608 {
1609 subtitle = { {\unexpanded\expandafter{\@subtitle}} },
1610 \iow_newline:
1611 }
1612 journal = { \tl_use:N \l__phimisci_journal_name_tl },
1613 \iow_newline:
1614 volume = { \tl_use:N \l_phimisci_volume_tl },
1615 \iow_newline:
1616 doi = { \tl_use:N \l_phimisci_doi_tl },
1617 \iow_newline:
1618 options = { dataonly = true }
1619 }
1620 }
1621 \iow_close:N \l__phimisci_citation_file_stream
1622 }
1623 \AtEndPreamble
1624 {
1625 \addbibresource { \tl_use:N \l__phimisci_citation_file_name_tl }
1626 }
1627 % \end{macrocode}
1628 % \subsection{Configure the document language}
1629 % The list passed as \cs{documentclass}\texttt{[language=\meta{list of
1630 % languages}]}\texttt{\{phimisci\}} is processed here. By \texttt{babel}'s
1631 % convention, if there is more than one language in the list, the last is
1632 % considered to be the main document language.
1633 % \begin{macrocode}
1634 \RequirePackage [ \clist_use:Nn \l__phimisci_languages_clist {,} ] {babel}
1635 \ExplSyntaxOff
1636 % \end{macrocode}
1637 % \section{Layout and design}
1638 % \subsection{Page geometry}
1639 % We configure the paper size and the type area through the margins.
1640 % \begin{macrocode}
1641 \RequirePackage[a4paper,
1642 landscape,
1643 twocolumn,
1644 hmargin=25mm,
1645 top=23.625mm,
1646 bottom=22.7375mm,
1647 footskip=0pt,
1648 columnsep=25mm,
1649 headsep=8.25mm,
1650 headheight=4.5mm
1651 ]
1652 {geometry}
1653 % \end{macrocode}
1654 %
1655 % \subsection{Journal color definitions}
1656 % \begin{function}{PhiMiSciHeadingBlue, PhiMiSciBlueTwo, PhiMiSciBlueThree,
1657 % PhiMiSciGrey}
1658 % The custom colors used in the journal's layout are:
1659 % \begin{itemize}
1660 % \item[] \fcolorbox{black}{PhiMiSciHeadingBlue}{\strut\hspace*{2em}}
1661 % \texttt{PhiMiSciHeadingBlue}, in titles
1662 % \item[] \fcolorbox{black}{PhiMiSciBlueTwo}{\strut\hspace*{2em}}
1663 % \texttt{PhiMiSciBlueTwo}, for hyperlinks
1664 % \item[] \fcolorbox{black}{PhiMiSciBlueThree}{\strut\hspace*{2em}}
1665 % \texttt{PhiMiSciBlueThree}, for subsections and the header line
1666 % \item[] \fcolorbox{black}{PhiMiSciGrey}{\strut\hspace*{2em}}
1667 % \texttt{PhiMiSciGrey}, for some text elements
1668 % \end{itemize}
1669 % \begin{macrocode}
1670 \definecolor{PhiMiSciHeadingBlue}{RGB}{10, 26, 97}
1671 \definecolor{PhiMiSciBlueTwo}{RGB}{19, 47, 178}
1672 \definecolor{PhiMiSciBlueThree}{RGB}{12, 30, 115}
1673 \definecolor{PhiMiSciGrey}{RGB}{157, 164, 196}
1674 % \end{macrocode}
1675 % \end{function}
1676 %
1677 % \subsection{Layout of section headings}
1678 % \begin{function}{\sectionformat, \subsectionformat, \subsubsectionformat,
1679 % \paragraphformat}
1680 % The section number width is set to 12.5mm, twice the \cs{parindent}, and
1681 % the section header follows after that.
1682 % \begin{macrocode}
1683 \renewcommand*{\sectionformat}
1684 {%
1685 \hbox to 12.5mm {\thesection\autodot}%
1686 }
1687 \renewcommand*{\subsectionformat}
1688 {%
1689 \hbox to 12.5mm {\thesubsection\autodot}%
1690 }
1691 \renewcommand*{\subsubsectionformat}
1692 {%
1693 \hbox to 12.5mm {\thesubsubsection\autodot}%
1694 }
1695 \renewcommand*{\paragraphformat}
1696 {%
1697 \hbox to 12.5mm {\theparagraph\autodot}%
1698 }
1699 % \end{macrocode}
1700 % \end{function}
1701 %
1702 % \begin{function}{\section, \subsection, \subsubsection}
1703 % Our layout uses a slightly larger spacing before section headings.
1704 % \begin{macrocode}
1705 \RedeclareSectionCommand[%
1706 afterindent=false, beforeskip=22bp plus 22bp, afterskip=8.5bp%
1707 ]{section}
1708 \RedeclareSectionCommand[%
1709 afterindent=false, beforeskip=13.5bp plus 13.5bp, afterskip=10bp%
1710 ]{subsection}
1711 \RedeclareSectionCommand[%
1712 afterindent=false, beforeskip=13.5bp plus 13.5bp, afterskip=10bp%
1713 ]{subsubsection}
1714 % \end{macrocode}
1715 % \end{function}
1716 %
1717 % \begin{function}{\paragraph}
1718 % We use \cs{paragraph} as a heading on the fourth level (e.g., 1.1.1.1).
1719 % The following settings follow an example from the KOMA manual.
1720 % \begin{macrocode}
1721 \RedeclareSectionCommand[%
1722 afterindent=false, afterskip=6.75bp, beforeskip=6.75bp plus 6.75bp,%
1723 indent=0pt, counterwithin=subsubsection, level=4%
1724 ]{paragraph}
1725 % \end{macrocode}
1726 % \end{function}
1727 %
1728 % \begin{variable}{secnumdepth, tocdepth}
1729 % We want \cs{paragraphs} to be numbered and listed in the table of contents
1730 % (i.e., in the PDF meta data). We set \texttt{secnumdepth} and
1731 % \texttt{tocdepth} accordingly.
1732 % \begin{macrocode}
1733 \setcounter{secnumdepth}{\paragraphnumdepth}
1734 \setcounter{tocdepth}{\paragraphtocdepth}
1735 % \end{macrocode}
1736 % \end{variable}
1737 %
1738 % \subsection{Footnotes}
1739 % These options configure how the footnotes are typed at the bottom of the
1740 % page.
1741 % \begin{macrocode}
1742 \setfootnoterule[0pt]{0pt}
1743 \deffootnote{3.125mm}{3.125mm}{%
1744 \makebox[3.125mm][r]{\textsuperscript{\thefootnotemark\ }}%
1745 }
1746 % \end{macrocode}
1747 % Automatically type a superscripted comma in case two \cs{footnote}s are
1748 % called immediately following each other.
1749 % \begin{macrocode}
1750 \KOMAoption{footnotes}{multiple}
1751 % \end{macrocode}
1752 % \subsection{Tolerances and penalties: Optimisation of line and page breaks}
1753 % Configure the penalties for widows and orphans, that is, for last lines of
1754 % paragraphs on new pages and for first lines of a paragraph at the end of a
1755 % page.
1756 % \begin{macrocode}
1757 \ExplSyntaxOn
1758 \clubpenalty = \int_use:N \l__phimisci_settings_orphan_penalty_int
1759 \widowpenalty = \int_use:N \l__phimisci_settings_widow_penalty_int
1760 % \end{macrocode}
1761 % The class has two ways to automatically treat widows and orphans. The first
1762 % is originally due to Donald Arseneau and selected via the
1763 % \texttt{settings/widow-control/arseneau} option. The code here follows
1764 % the implementation in the \texttt{memoir} class.
1765 % \begin{macrocode}
1766 \bool_if:NT \l__phimisci_settings_sloppybottom_bool
1767 {
1768 \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}
1769 \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip
1770 \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}
1771 }
1772 % \end{macrocode}
1773 %
1774 % The second automatic processing for widows and orphans is provided through
1775 % Max Chernoff's \texttt{lua-widow-control} package \cite{Chernoff2022}. It
1776 % adjusts interword spacing to reduce and remove orphans, widows and broken
1777 % hyphenation. It requires \LuaLaTeX{} but ensures flush page bottoms.
1778 % It can be enabled via the \texttt{settings/widow-control/chernoff} option.
1779 % \begin{macrocode}
1780 \bool_if:NT \l__phimisci_settings_luawidow_bool
1781 {
1782 \sys_if_engine_luatex:TF
1783 {
1784 \RequirePackage{lua-widow-control}
1785 \lwcsetup
1786 {
1787 emergencystretch=\int_use:N
1788 \l__phimisci_settings_emergencystretch_dim
1789 }
1790 }
1791 {
1792 \msg_fatal:nnn { phimisci } { wrong-tex-engine } { lualatex }
1793 }
1794 }
1795 % \end{macrocode}
1796 %
1797 % Footnotes should break across pages only if everything else fails. Set a high
1798 % penalty to accomplish this. Sometimes, breaking a footnote is more desirable
1799 % than having a sub-optimal break in the main text.
1800 % \begin{macrocode}
1801 \interfootnotelinepenalty=\int_use:N \l__phimisci_settings_footnote_penalty_int
1802 % \end{macrocode}
1803 % We set \cs{emergencystretch} for automatic treatment of overful lines. It
1804 % should be noted that overful lines can also be treated using better
1805 % \cs{hyphenation} patterns.
1806 % \begin{macrocode}
1807 \emergencystretch=\dim_use:N \l__phimisci_settings_emergencystretch_dim
1808 % \end{macrocode}
1809 % \LaTeX\ inserts a special spacing after punctuation by default. If requested
1810 % by the user, use the usual inter-word space after punctuation.
1811 % \begin{macrocode}
1812 \bool_if:NF \l__phimisci_settings_extra_sentence_spacing_bool
1813 { \frenchspacing }
1814 % \end{macrocode}
1815 %
1816 % \subsection{Float layout}
1817 %
1818 % All floats should be centered and use our custom font for float contents.
1819 % \begin{macrocode}
1820 \addto\@floatboxreset
1821 {%
1822 \centering%
1823 \usekomafont{PhiMiSciTableBody}%
1824 }
1825 % \end{macrocode}
1826 %
1827 % We would like the captions to be of width \cs{columnwidth}. This will not
1828 % change the default behaviour of regular floats, it changes the caption in
1829 % two-column floats.
1830 % \begin{macrocode}
1831 \setcapwidth{111mm}
1832 % \end{macrocode}
1833 %
1834 % Captions should not have hanging indent:
1835 % \begin{macrocode}
1836 \setcapindent{0pt}
1837 % \end{macrocode}
1838 %
1839 % \begin{variable}{\heavyrulewidth, \lightrulewidth}
1840 % We adjust the width of \cs{toprule} and \cs{bottomrule} from
1841 % \texttt{booktabs}. The width of \cs{midrule} is given as 5/8 of the other
1842 % rules
1843 % \begin{macrocode}
1844 \dim_set:Nn \heavyrulewidth { 0.25bp }
1845 \dim_set:Nn \lightrulewidth { 0.15625bp }
1846 \ExplSyntaxOff
1847 % \end{macrocode}
1848 % \end{variable}
1849 % \begin{variable}{\arrayrulecolor}
1850 % We set the color of rules in tables to our journal colors.
1851 % \begin{macrocode}
1852 \arrayrulecolor{PhiMiSciHeadingBlue}
1853 % \end{macrocode}
1854 % \end{variable}
1855 % \begin{variable}{\topfraction, ...}
1856 % More liberal values for the placement of floats. These liberal values
1857 % increase the likelihood that a float can be placed near the location
1858 % desired by the author(s).
1859 % \begin{macrocode}
1860 \renewcommand{\topfraction}{.9}
1861 \renewcommand{\dbltopfraction}{.8}
1862 \renewcommand{\bottomfraction}{.8}
1863 \renewcommand{\textfraction}{.1}
1864 \renewcommand{\floatpagefraction}{.75}
1865 \renewcommand{\dblfloatpagefraction}{.75}
1866 \setcounter{topnumber}{9}
1867 \setcounter{bottomnumber}{9}
1868 \setcounter{totalnumber}{20}
1869 \setcounter{dbltopnumber}{9}
1870 % \end{macrocode}
1871 % \end{variable}
1872 %
1873 % \subsection{Indentation after lists and quotations}
1874 % We add a hook to the end of \env{quote}, \env{quotation}, \env{itemize},
1875 % \env{description} and \env{enumerate} to suppress indentation in the
1876 % following paragraphs.
1877 % \begin{macrocode}
1878 \AfterEndEnvironment{quote}{\par\@afterindentfalse\@afterheading}
1879 \AfterEndEnvironment{quotation}{\par\@afterindentfalse\@afterheading}
1880 \AfterEndEnvironment{verse}{\par\@afterindentfalse\@afterheading}
1881 \AfterEndEnvironment{itemize}{\par\@afterindentfalse\@afterheading}
1882 \AfterEndEnvironment{enumerate}{\par\@afterindentfalse\@afterheading}
1883 \AfterEndEnvironment{description}{\par\@afterindentfalse\@afterheading}
1884 % \end{macrocode}
1885 %
1886 % \subsection{Bibliography layout}
1887 % We allow (almost) no breaking within entries in the list of references, and
1888 % we are especially tolerant regarding interword spacing to avoid overful
1889 % lines. These tolerances follow a post by Enrico Gregorio on TeX.SE.
1890 % \begin{macrocode}
1891 \defbibheading { bibliography } [ \refname ]
1892 {
1893 \addsec{ #1 }
1894 \clubpenalty=10000
1895 \@clubpenalty\clubpenalty
1896 \widowpenalty=10000
1897 \emergencystretch=3em
1898 }
1899 \AtBeginBibliography{\usekomafont{footnote}}
1900 \bibhang=6.25mm
1901 % \end{macrocode}
1902 % In citations, we prefer to have a non-breakable thin space between ``p.''
1903 % and the cited page number.
1904 % \begin{macrocode}
1905 \RenewDocumentCommand {\ppspace} {} {\addnbthinspace}
1906 % \end{macrocode}
1907 % \section{Document elements}
1908 % \subsection{The document title}
1909 % \begin{function}{\maketitle}
1910 % We customise the document title page to our layout. A title page following
1911 % this layout is produced through \cs{maketitle} in papers.
1912 % \end{function}
1913 % \begin{macrocode}
1914 \ExplSyntaxOn
1915 \RenewDocumentCommand {\maketitle} {}
1916 {%
1917 {
1918 \thispagestyle{plain.scrheadings}
1919 % \end{macrocode}
1920 % The header, including journal logo, title, volume number, and
1921 % publication year, is only printed for some publication stages. It is printed
1922 % for \texttt{final} and \texttt{draft} documents, but not for stages
1923 % \texttt{preparation} and \texttt{submission}.
1924 % \begin{macrocode}
1925 \bool_if:NT \l__phimisci_output_publication_header_footer_bool
1926 {
1927 \vspace*{-16.5mm}
1928 \raggedright
1929 % \end{macrocode}
1930 % The following box contains the journal title, the volume, and publication
1931 % year.
1932 % \begin{macrocode}
1933 \parbox[c]
1934 {
1935 \dim_eval:n
1936 {
1937 \columnwidth - 1cm - \l__phimisci_logo_width_dim
1938 }
1939 }
1940 {
1941 \vskip\baselineskip
1942 \raggedright
1943 \addfontfeature{LetterSpace=2.0}
1944 \normalfont\normalsize
1945 \color{PhiMiSciHeadingBlue}
1946 {
1947 \bfseries\fontsize{20bp}{24bp}\selectfont
1948 \tl_use:N \l__phimisci_journal_short_name_tl \par
1949 }
1950 {
1951 \fontsize{11.2bp}{16.8bp}\selectfont
1952 \tl_use:N \l__phimisci_journal_name_tl
1953 \space |\space
1954 \tl_use:N \l__phimisci_locale_volume_tl
1955 \space
1956 \tl_use:N \l_phimisci_volume_tl
1957 \space |\space
1958 \int_use:N \l_phimisci_publication_year_int\par
1959 }
1960 }
1961 \hskip 1cm
1962 % \end{macrocode}
1963 % The following box contains the journal logo. If a logo is not specified, the
1964 % box remains empty and a warning is issued to the user.
1965 % \begin{macrocode}
1966 \parbox[c]{\dim_use:N \l__phimisci_logo_width_dim}
1967 {
1968 \tl_if_blank:VTF \l__phimisci_branding_logo_tl
1969 {
1970 \msg_warning:nn { phimisci } { missing-logo-url }
1971 }
1972 {
1973 \includegraphics
1974 [ width=\dim_use:N \l__phimisci_logo_width_dim ]
1975 { \tl_use:N \l__phimisci_branding_logo_tl }
1976 }
1977 }
1978 }
1979 }
1980 % \end{macrocode}
1981 % The command \cs{and} to separate authors is merely a hook for our internal
1982 % processing (see our custom \cs{author} and auxiliary functions). We deactivate
1983 % it to avoid the effects of its standard definition.
1984 % \begin{macrocode}
1985 \let\and\relax
1986 \vskip 2.66\baselineskip
1987 % \end{macrocode}
1988 % After a vertical skip, print the document title and subtitle (if given).
1989 % \begin{macrocode}
1990 {
1991 \usekomafont{title}
1992 {
1993 \@title
1994 \par\vskip.5\baselineskip
1995 }
1996 }
1997 {
1998 \ifx\@subtitle\@empty
1999 \else
2000 \usekomafont{subtitle}\@subtitle\par\vskip.5\baselineskip
2001 \fi
2002 }
2003 \vskip .5em
2004 % \end{macrocode}
2005 % Output the author data, including affiliations. \cs{PhiMiSci@OutputAuthorData}
2006 % also outputs information about the special issue and/or book symposium, in
2007 % the article is part of one. Various \cs{enlargethispage} commands ensure there
2008 % is enough space for the footer.
2009 % \begin{macrocode}
2010 \PhiMiSci@OutputAuthorData{}
2011 \enlargethispage{-2.5\baselineskip}
2012 % \end{macrocode}
2013 % The right column on the title page, started by a \cs{pagebreak}, contains the
2014 % abstract and keywords.
2015 % \begin{macrocode}
2016 \newpage
2017 \vspace*{3.25\baselineskip}
2018 \enlargethispage{-4\baselineskip}
2019 \PhiMiSci@OutputMetadata{}
2020 % \end{macrocode}
2021 % Finally, ensure that the paper does not begin with a paragraph indent.
2022 % \begin{macrocode}
2023 \@afterindentfalse\@afterheading
2024 }
2025 % \end{macrocode}
2026 % \subsection{Epigraphs}
2027 % Epigraphs can be inserted at any point of the document text using \cs{dictum}
2028 % \oarg{source}\marg{text}. The command is inherited from \texttt{scrartcl}
2029 % \cite[\S3.17]{scrguide}.
2030 %
2031 % The optional \oarg{source} can contain a citation command.
2032 % The following settings are adjustments to fit the needs of the journal:
2033 %
2034 % \begin{macrocode}
2035 \RenewDocumentCommand { \dictumrule } {} { \smallskip }
2036 % \end{macrocode}
2037 %
2038 % \subsection{Block quotes}
2039 % Block quotes use a particular font in our layout. This setting
2040 % is used for the abstract, too.
2041 % \begin{macrocode}
2042 \AddToHook { env/quote/begin } { \usekomafont{PhiMiSciQuote} }
2043 \AddToHook { env/quotation/begin } { \usekomafont{PhiMiSciQuote} }
2044 % \end{macrocode}
2045 % We overwrite the layout of block quotes in footnotes. These are typeset
2046 % smaller than block quotes in the main text.
2047 % \begin{macrocode}
2048 \AddtoDoHook { footnote/text/begin }
2049 {
2050 \AddToHook { env/quote/begin } [ PhiMiSciFnQuoteFont ] { \footnotesize }
2051 \AddToHook { env/quotation/begin } [ PhiMiSciFnQuoteFont ] { \footnotesize }
2052 }
2053 % \end{macrocode}
2054 % The font setting for footnotes is cleaned up at the end of each footnote.
2055 % \begin{macrocode}
2056 \AddtoDoHook { footnote/text/end }
2057 {
2058 \RemoveFromHook { env/quote/begin } [ PhiMiSciFnQuoteFont ]
2059 \RemoveFromHook { env/quotation/begin } [ PhiMiSciFnQuoteFont ]
2060 }
2061 % \end{macrocode}
2062 %
2063 % \subsection{Lists}
2064 % In our layout, list labels are snug with the \cs{parindent}, which we achieve
2065 % using the \texttt{enumitem} package.
2066 % \begin{macrocode}
2067 \setlist[enumerate, itemize]
2068 {
2069 labelindent=\parindent,
2070 leftmargin=*
2071 }
2072 % \end{macrocode}
2073 %
2074 % \subsection{Headers \& footers}
2075 % There is a line between the header and paper content (though we use a custom
2076 % line, see \cs{PhiMiSci@HeaderSepLine}). The title page has an enlarged foot
2077 % height to accommodate citation recommendation and license information.
2078 % \begin{macrocode}
2079 \KOMAoptions
2080 {
2081 headsepline = true
2082 }
2083 \AddToLayerPageStyleOptions{plain.scrheadings}
2084 {
2085 onselect =
2086 {
2087 \setlength { \footheight } { 3.25\baselineskip }
2088 }
2089 }
2090 % \end{macrocode}
2091 % \begin{function}{\PhiMiSci@OneColumnLine}
2092 % A helper macro that generates a line spanning exactly the width of a
2093 % column, or \cs{columnwidth}. Its thickness can be set via
2094 % \texttt{settings/head-rule-thickness}. The line is spread evenly to height
2095 % and depth of the line.
2096 % \begin{macrocode}
2097 \NewDocumentCommand{\PhiMiSci@OneColumnLine} {}
2098 {
2099 \vrule \@width \dimexpr \columnwidth \relax
2100 \@height .5 \dimexpr \l__phimisci_head_rule_height_dim \relax
2101 \@depth .5 \dimexpr \l__phimisci_head_rule_height_dim \relax
2102 }
2103 % \end{macrocode}
2104 % \end{function}
2105 % \begin{function}{\PhiMiSci@HeaderSepLine}
2106 % Places two lines, each spanning a column. The margin between the
2107 % columns is filled with white space, and the current page number is
2108 % centered. ``Font'' options, such as colour of the line, are taken from
2109 % \meta{headsepline}. See \cs{PhiMiSci@OneColumnLine} for configuration of
2110 % the stroke thickness.
2111 % \end{function}
2112 % \begin{macrocode}
2113 \NewDocumentCommand{\PhiMiSci@HeaderSepLine} {}
2114 {
2115 \group_begin:
2116 \usekomafont{headsepline}
2117 {
2118 \vbox spread \z@
2119 {
2120 \PhiMiSci@OneColumnLine{}
2121 \hfill
2122 \lower .58ex \hbox{\thepage}
2123 \hfill
2124 \PhiMiSci@OneColumnLine{}
2125 \par
2126 }
2127 }
2128 \group_end:
2129 }
2130 % \end{macrocode}
2131 % Configure the page style to use \cs{PhiMiSci@HeaderSepLine} for KOMA's
2132 % \texttt{headsepline}.
2133 % \begin{macrocode}
2134 \DeclareLayer[
2135 background,
2136 hoffset=\sls@leftmargin{head},
2137 voffset=\sls@topmargin
2138 + \headheight
2139 - \ht\strutbox
2140 + \dimexpr \l__phimisci_head_rule_height_dim
2141 \relax,
2142 width=\sls@headwidth,
2143 height=0pt,
2144 align=tl,
2145 contents={{
2146 \normalfont
2147 \usekomafont{pageheadfoot}
2148 {
2149 \usekomafont{pagehead}
2150 {
2151 \PhiMiSci@HeaderSepLine{}
2152 }
2153 }
2154 }}
2155 ]{scrheadings.head.below.line}
2156 % \end{macrocode}
2157 % The optional arguments for \cs{cfoot} and \cs{chead} determine the footer and
2158 % header on pages with the style \texttt{plain} (typically the title page only).
2159 % The header and footer for all other pages is determined by the mandatory
2160 % argument of both commands. Note that the title page does not have a header,
2161 % but is configured with manual spacing due to the flexibility needed.
2162 % \begin{macrocode}
2163 \cfoot[\PhiMiSci@Footer*{}]{\PhiMiSci@Footer{}}
2164 \chead[]{\PhiMiSci@Header{}}
2165 % \end{macrocode}
2166 % \begin{function}{\PhiMiSci@Footer, \PhiMiSci@Footer*}
2167 % Two macros for the content of the footer. The starred variant is intended to
2168 % produce the footer on the title page. The base variant produces the footer on
2169 % all other pages --- which is empty except in the \texttt{draft} stage.
2170 % \end{function}
2171 % \begin{macrocode}
2172 \NewDocumentCommand {\PhiMiSci@Footer} { s }
2173 {%
2174 \IfBooleanTF {#1}
2175 {
2176 \bool_if:NTF \l__phimisci_output_publication_header_footer_bool
2177 {
2178 \begin{minipage} [b] {\columnwidth}
2179 \usekomafont{PhiMiSciFooter}
2180 \fullcite{phimisci-current-article}
2181 \end{minipage}\hfill
2182 \begin{minipage} [b] {\columnwidth}
2183 \usekomafont{PhiMiSciFooter}
2184 \bool_if:NT \l__phimisci_output_rights_bool
2185 {
2186 \copyright{}~\tl_use:N \l__phimisci_copyright_holder_tl.~
2187 \tl_use:N \l__phimisci_copyright_tl
2188 }
2189 \end{minipage}
2190 }
2191 {
2192 \tl_use:N \l__phimisci_submission_footer_tl
2193 }
2194 }
2195 {
2196 \bool_if:NT \l__phimisci_output_draft_footer_bool
2197 {
2198 \vskip 1cm
2199 \tl_use:N \l__phimisci_draft_footer_tl
2200 }
2201 }
2202 }
2203 % \end{macrocode}
2204 % \begin{function}{\PhiMiSci@Header}
2205 % A macro to produce the header on pages that are not \texttt{plain}, typically
2206 % all pages except the title page. The output differs depending on publication
2207 % stage --- author names and journal volume information are not given for stages
2208 % \texttt{submission} and \texttt{preparation}. A generic text is placed
2209 % instead, informing the reader about the article's status.
2210 % \end{function}
2211 % \begin{macrocode}
2212 \NewDocumentCommand {\PhiMiSci@Header} { }
2213 {%
2214 \bool_if:NTF \l__phimisci_output_publication_header_footer_bool
2215 {
2216 \tl_use:N \l__phimisci_journal_short_name_tl
2217 \c_space_token | \c_space_token
2218 \tl_use:N \l__phimisci_locale_volume_tl
2219 \c_space_token
2220 \tl_use:N \l_phimisci_volume_tl
2221 }
2222 {
2223 \tl_use:N \l__phimisci_submission_footer_tl
2224 }
2225 \hfill
2226 \Ifthispageodd
2227 {
2228 \tl_use:N \l_phimisci_short_document_title_tl
2229 }
2230 {
2231 \tl_use:N \l_phimisci_header_authors_tl
2232 }
2233 }
2234 % \end{macrocode}
2235 % \subsection{ORCiD logo settings}
2236 % \begin{function}{orcidlogocol}
2237 % The color used to print the ORCiD logo. ORCiD's policy prescribes this can
2238 % be either black or the ORCiD green, HTML code \texttt{A6CE39}. We use this
2239 % green by default.
2240 % \begin{macrocode}
2241 \definecolor{orcidlogocol}{HTML}{\tl_use:N \l__phimisci_orcid_color_tl}
2242 % \end{macrocode}
2243 % \end{function}
2244 % \begin{function}{\@OrigHeightRecip}
2245 % The ORCiD logo is slightly enlarged to match the layout of our printing of
2246 % authors on the title page.
2247 % \begin{macrocode}
2248 \renewcommand{\@OrigHeightRecip}{0.006}
2249 % \end{macrocode}
2250 % \end{function}
2251 % \subsection{Paragraph counting in the margin}
2252 % \begin{function}{\PhiMiSciParagraphNumber}
2253 % A dummy function to put paragraph numbers in the page margin. This feature is
2254 % not yet fully implemented and tested.
2255 % \begin{macrocode}
2256 \NewDocumentCommand{\PhiMiSciParagraphNumber}{m}
2257 {
2258 \makenote{ #1 }
2259 }
2260 % \end{macrocode}
2261 % \end{function}
2262 %
2263 % \subsection{Automatic paragraph numbering}\label{sec:parnumbering}
2264 % Passages in journal articles have traditionaly been identified by their page
2265 % number. As journals move to publication on the web alongside PDF distribution,
2266 % a different mechanic becomes necessary to identify passages in non-paginated
2267 % media, such as web sites. The predominant approach has been to number
2268 % paragraphs instead.
2269 %
2270 % The \texttt{phimisci} class offers mechanisms for automatic (as well as
2271 % manual) paragraph numbering. The classic implementation of this was described
2272 % by Nicola Talbot \cite[\S6.5]{Talbot2015}. This method uses
2273 % \cs{everypar}, a command that does not appear to be advisable any longer
2274 % \cite[1--3]{ltpara}. Instead, we implement a similar mechanism through
2275 % \LaTeX's new hook management \cite{lthooks, ltpara}.
2276 %
2277 % \begin{description}
2278 % \item[Note:] The implementation below is preliminary and subject to change in
2279 % future versions of our class. It is also not sufficiently tested for
2280 % production use.
2281 % \end{description}
2282 %
2283 % The environment \env{PhiMiSciNumberedParagraphs} automatically numbers
2284 % paragraphs according to the template \cs{PhiMiSci@PrintParNum}.
2285 % The \texttt{phimisci} class takes great care to exclude certain elements from
2286 % paragraph counting, such as the document's header and footer (via
2287 % \cs{PhiMiSci@DetectKomaHeader}) and from a pre-defined list of environments
2288 % (using \cs{PhiMiSci@ParNumSwitch}) as well as the sectioning commands
2289 % (\cs{section}, \cs{subsection} and \cs{subsubsection}). The user can extend
2290 % this list in case additional environments should be included:
2291 %
2292 % \begin{quote}
2293 % \cs{PhiMiSciSettings} \texttt{\{ settings /
2294 % paragraph-numbering-excluded-objects = \meta{list}\}}
2295 % \end{quote}
2296 %
2297 % \begin{variable}{\l__phimisci_parnum_excluded_objects_base_tl}
2298 % The following environments are excluded by default and do not need to be
2299 % added:
2300 % \end{variable}
2301 % \begin{itemize}
2302 % \item lists (\texttt{list}, \texttt{enumerate}, \texttt{itemize},
2303 % \texttt{description})
2304 % \item quotes (\texttt{quote}, \texttt{quotation})
2305 % \item floats (\texttt{figure}, \texttt{table})
2306 % \item \texttt{tabbing}
2307 % \item computer code (\texttt{verbatim}, \texttt{lstlisting})
2308 % \end{itemize}
2309 % By convention, these objects are either identified by their own identifier
2310 % or through the paragraph that preceedes them.
2311 %
2312 % \begin{variable}{PhiMiSci@Paragraph}
2313 % A paragraph counter. It is set to reset at every section, so that paragraphs
2314 % are not counted throughout the paper, but separately for each section.
2315 % \end{variable}
2316 % \begin{macrocode}
2317 \newcounter{ PhiMiSci@Paragraph } [ section ]
2318 % \end{macrocode}
2319 % \begin{function}{\PhiMiSci@PrintParNum}
2320 % Provides a template to print the current value of \cmd{PhiMiSci@Paragraph}.
2321 % \end{function}
2322 % \begin{macrocode}
2323 \NewDocumentCommand {\PhiMiSci@PrintParNum} {}
2324 {
2325 \makebox[0pt][r]{
2326 \color{gray}
2327 \oldstylenums{\thePhiMiSci@Paragraph\hspace*{1.5em}}
2328 }
2329 }
2330 % \end{macrocode}
2331 % \begin{function}{\PhiMiSci@AddParNum, \PhiMiSci@RemoveParNum}
2332 % Functions that add and remove counting to the hook \texttt{para/begin}.
2333 % \end{function}
2334 % \begin{macrocode}
2335 \NewDocumentCommand {\PhiMiSci@AddParNum} {}
2336 {
2337 \AddToHook {para/begin} [PhiMiSciParNumber]
2338 {
2339 \bool_if:NF \l__phimisci_koma_head_mode_bool
2340 {
2341 \refstepcounter{PhiMiSci@Paragraph}
2342 \PhiMiSci@PrintParNum{}
2343 }
2344 }
2345 }
2346
2347 \NewDocumentCommand {\PhiMiSci@RemoveParNum} {}
2348 {
2349 \RemoveFromHook {para/begin} [PhiMiSciParNumber]
2350 }
2351 % \end{macrocode}
2352 % \begin{function}{\PhiMiSci@ParNumSwitch}
2353 % \begin{syntax}
2354 % \cs{PhiMiSci@ParNumSwitch} \marg{comma~separated~list}
2355 % \end{syntax}
2356 % Functions to add hooks from the list of objects that are ignored for counting.
2357 % \end{function}
2358 % \begin{macrocode}
2359 \NewDocumentCommand {\PhiMiSci@ParNumSwitch} {m}
2360 {
2361 \AddToHook { #1/before } [PhiMiSciParNumber] { \PhiMiSci@RemoveParNum{} }
2362 \AddToHook { #1/after } [PhiMiSciParNumber] { \PhiMiSci@AddParNum{} }
2363 }
2364 % \end{macrocode}
2365 % \begin{function}{\PhiMiSci@ParNumSwitchDisable }
2366 % \begin{syntax}
2367 % \cs{PhiMiSci@ParNumSwitchDisable} \marg{comma~separated~list}
2368 % \end{syntax}
2369 % Functions to remove hooks from the list of objects that are ignored for
2370 % counting.
2371 % \end{function}
2372 % \begin{macrocode}
2373 \NewDocumentCommand {\PhiMiSci@ParNumSwitchDisable} {m}
2374 {
2375 \RemoveFromHook { #1/before } [PhiMiSciParNumber]
2376 \RemoveFromHook { #1/after } [PhiMiSciParNumber]
2377 }
2378 % \end{macrocode}
2379 % \begin{function}{\PhiMiSci@ParNumSwitchKOMA }
2380 % \begin{syntax}
2381 % \cs{PhiMiSci@ParNumSwitchKOMA} \marg{KOMA~hook}
2382 % \end{syntax}
2383 % Functions to add and remove hooks.
2384 % \end{function}
2385 % \begin{macrocode}
2386 \NewDocumentCommand {\PhiMiSci@ParNumSwitchKOMA} {m}
2387 {
2388 \AddtoDoHook { heading/begingroup/#1 } { \PhiMiSci@RemoveParNum{} }
2389 \AddtoDoHook { heading/endgroup/#1 } { \PhiMiSci@AddParNum{} }
2390 }
2391 % \end{macrocode}
2392 % \begin{function}{\PhiMiSci@DetectKomaHeader}
2393 % A macro that is executed in \cls{scrartcl}'s header and footer. It prevents
2394 % the paragraphs created there from being counted.
2395 % \end{function}
2396 % \begin{macrocode}
2397 \NewDocumentCommand{\PhiMiSci@DetectKomaHeader} {}
2398 {
2399 \bool_set_true:N \l__phimisci_koma_head_mode_bool
2400 }
2401 % \end{macrocode}
2402 % \begin{function}{PhiMiSciNumberedParagraphs}
2403 % An environment for encapsulating content in which the paragraphs are counted.
2404 % Initialisation is made through commands previously defined in this section.
2405 % \end{function}
2406 % \begin{macrocode}
2407 \NewDocumentEnvironment { PhiMiSciNumberedParagraphs } {}
2408 {%
2409 \tl_concat:NNN \l__phimisci_parnum_excluded_objects_combined_tl
2410 \l__phimisci_parnum_excluded_objects_base_tl
2411 \l__phimisci_parnum_excluded_objects_tl
2412 \parindent=0pt
2413 \parskip=.5\baselineskip
2414 \PhiMiSci@AddParNum{}
2415 \PhiMiSci@ParNumSwitch{env/quote}
2416 \PhiMiSci@ParNumSwitch{env/quotation}
2417 \PhiMiSci@ParNumSwitch{env/table}
2418 \PhiMiSci@ParNumSwitch{env/figure}
2419 \PhiMiSci@ParNumSwitch{env/list}
2420 \PhiMiSci@ParNumSwitch{env/enumerate}
2421 \PhiMiSci@ParNumSwitch{env/itemize}
2422 \PhiMiSci@ParNumSwitch{env/description}
2423 \PhiMiSci@ParNumSwitch{env/lstlisting}
2424 \PhiMiSci@ParNumSwitch{env/verbatim}
2425 \PhiMiSci@ParNumSwitch{env/tabbing}
2426 \PhiMiSci@ParNumSwitchKOMA{section}
2427 \PhiMiSci@ParNumSwitchKOMA{subsection}
2428 \PhiMiSci@ParNumSwitchKOMA{subsubsection}
2429 }
2430 {%
2431 \PhiMiSci@RemoveParNum{}
2432 \PhiMiSci@ParNumSwitchDisable{env/quote}
2433 \PhiMiSci@ParNumSwitchDisable{env/quotation}
2434 \PhiMiSci@ParNumSwitchDisable{env/table}
2435 \PhiMiSci@ParNumSwitchDisable{env/figure}
2436 \PhiMiSci@ParNumSwitchDisable{env/list}
2437 \PhiMiSci@ParNumSwitchDisable{env/enumerate}
2438 \PhiMiSci@ParNumSwitchDisable{env/itemize}
2439 \PhiMiSci@ParNumSwitchDisable{env/description}
2440 \PhiMiSci@ParNumSwitchDisable{env/lstlisting}
2441 \PhiMiSci@ParNumSwitchDisable{env/verbatim}
2442 \PhiMiSci@ParNumSwitchDisable{env/tabbing}
2443 }
2444 % \end{macrocode}
2445 % \begin{macrocode}
2446 \ExplSyntaxOff
2447 %</class>
2448 % \end{macrocode}
2449 % \section*{Acknowledgments}
2450 % \addcontentsline{toc}{section}{Acknowledgments}
2451 % The development of this class was funded by the DFG (project no. 514161146).
2452 % \printbibliography[heading=bibintoc]