Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % Copyright 2025 Michael E. Hammer
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Michael E. Hammer.
16 %
17 % This file is part of the "fhj-script bundle" and all files in that
18 % bundle must be distributed together.
19 %
20 % \fi
21 % \iffalse
22 %<*driver>
23 \ProvidesFile{fhjpaper.dtx}
24 %</driver>
25 %<class>\NeedsTeXFormat{LaTeX2e}[2023-11-01]
26 %<class>\ProvidesClass{fhjpaper}
27 %<*class>
28 [2026-02-25 v4.2c A class for formatting papers in the FHJ style]
29 %</class>
30 %
31 %<*driver>
32 \documentclass[a4paper]{ltxdoc}
33 \EnableCrossrefs
34 \CodelineIndex
35 \RecordChanges
36 \OnlyDescription % We only want the description
37 \begin{document}
38 \DocInput{fhjpaper.dtx}
39 \end{document}
40 %</driver>
41 % \fi
42 %
43 % \GetFileInfo{fhjpaper.dtx}
44 % \newcommand{\classname}{fhjpaper}
45 %
46 % \changes{v4.0}{2025/08/03}{Initial package version}
47 %
48 % \title{The \textsf{\classname} class\thanks{This document
49 % corresponds to \textsf{\classname}~\fileversion,
50 % dated \filedate.}}
51 % \author{Michael E. Hammer \\ \texttt{[email protected]}}
52 %
53 % \maketitle
54 %
55 % \begin{abstract}
56 % This class is used to format papers in the FH Joanneum style.
57 % It is based on the \textsf{scrartcl} class and provides a set of
58 % commands to define the title, author, and other information.
59 % It is mainly used to create the expose for a master thesis.
60 % \end{abstract}
61 %
62 % \tableofcontents
63 %
64 % \section{Configuration and styling}
65 %
66 % This class is based on the \textsf{scrartcl} class and we support forwarding
67 % options to the base class (except the hardcoded options from below).
68 %
69 % \begin{macrocode}
70 \newcommand{\@ClassName}{fhjpaper}
71 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
72 \ProcessOptions\relax
73 % \end{macrocode}
74 %
75 % We load the \textsf{scrartcl} class with the following options:
76 %
77 % \begin{itemize}
78 % \item \texttt{a4paper}: We want to use A4 paper size
79 % \item \texttt{twocolumn}: The document should be typeset in two columns
80 % \item \texttt{fontsize=9pt}: The font size should be 9pt to increase density for
81 % shorter papers and abstracts
82 % \item \texttt{DIV=16}: The DIV parameter should be set to 16 to ensure a good
83 % balance between text width and height
84 % \end{itemize}
85 %
86 % \begin{macrocode}
87 \LoadClass[a4paper,twocolumn,fontsize=9pt,DIV=16]{scrartcl}
88 % \end{macrocode}
89 %
90 % \subsection{Used packages}
91 %
92 % For the styling of the document we use the following packages and therefore they are
93 % preloaded and you might not load them again in your document:
94 %
95 % \begin{macrocode}
96 \RequirePackage{fhjcommon}
97 \RequirePackage{etoolbox}
98 \PassOptionsToPackage{pagestyleset=standard}{scrlayer-scrpage}
99 \RequirePackage{scrlayer-scrpage}
100 \PassOptionsToPackage{hidelinks}{hyperref}
101 \RequirePackage{hyperref}
102 % \end{macrocode}
103 %
104 % \section{Title}
105 %
106 % To support in the creation of the title and abstract on the first page we provide a
107 % set of macros.To have the correct name for the study program typeset on the document, you
108 % need to define it with the macro from \texttt{fhjcommon} package (see the according
109 % documentation):
110 %
111 % \begin{quote}
112 % |\FHJProgram{DAT}|
113 % \end{quote}
114 %
115 % \DescribeMacro{\title}
116 % This command defines the title of your document and is placed on top of the first page.
117 % on the according position. It is supported to use line breaks in the title, so you can
118 % have multiple lines but we clearly recommend to limit it to three lines maximum.
119 %
120 % \DescribeMacro{\shorttitle}
121 % This command defines the short title of your document which is used in the footer.
122 % This supports the reader if multiple documents are printed together in a single
123 % collection.
124 %
125 % \begin{macrocode}
126 \renewcommand*{\title}[1]{\renewcommand*{\@title}{{#1}}}
127 \newcommand{\shorttitle}[1]{\newcommand{\@shorttitle}{{#1}}}
128 % \end{macrocode}
129 %
130 % \subsection{Authors and Affiliations}
131 %
132 % This code is based on APA 7th edition style guide without including the deprecated
133 % commands. \par
134 %
135 % \begin{itemize}
136 % \item \DescribeMacro{\authorsnames}|\authorsnames|
137 % \oarg{comma separated list of superscripts}
138 % \marg{comma separated list of authors name(s)}: Authors names
139 % \end{itemize}
140 %
141 % Where \marg{authors names} is a comma separated list of authors in display order
142 % and \oarg{superscripts} is an optional comma separated list of affiliation superscripts.
143 % If there are multiple superscripts for one author, put the set of superscripts within |{ }|.
144 %
145 % \begin{itemize}
146 % \item
147 % \DescribeMacro{\authorsaffiliations}|\authorsaffiliations|\marg{comma separated list
148 % of affiliation(s)}: Author affiliation(s). Put each affiliation within |{ }| and
149 % separate each affiliation with a comma.
150 % \end{itemize}
151 %
152 % \noindent \textbf{Examples:} \par
153 % \noindent One author, one affiliation \par
154 % |\authorsnames{Maggie C. Leonard}| \par
155 % |\authorsaffiliations{{Department of Psychology,%| \par
156 % \hspace*{2em}|George Mason University}}| \par
157 % \noindent One author, two affiliations \par
158 % |\authorsnames{Andrew K. Jones-Willoughby}| \par
159 % |\authorsaffiliations{{School of Psychology,%| \par
160 % \hspace*{2em}|University of Sydney},| \par
161 % \hspace*{2em}|{Center for Behavioral Neuroscience, American University}}| \par
162 % \noindent Two authors, shared affiliation \par
163 % |\authorsnames{Mackenzie J. Clement,Talia R. Cummings}| \par
164 % |\authorsaffiliations{{College of Nursing,%| \par
165 % \hspace*{2em}|Michigan State University}}| \par
166 % \noindent Two authors, different affiliations \par
167 % |\authorsnames[1,2]{Wilhelm T. Webber,Latasha P. Jackson}| \par
168 % |\authorsaffiliations{%| \par
169 % \hspace*{2em}|{Max Planck Institute for Human Development, Berlin, Germany},%| \par
170 % \hspace*{2em}|{College of Education, University of Georgia}}| \par
171 % \noindent Three or more authors, different affiliations \par
172 % |\authorsnames[1,{2,3},1]{%| \par
173 % \hspace{2em}|Savannah C. St. John,%| \par
174 % \hspace{2em}|Fen-Lei Chang,%| \par
175 % \hspace{2em}|Carlos O. Vásquez III}| \par
176 % |\authorsaffiliations{%| \par
177 % \hspace{2em}|{Education Testing Service, Princeton, New Jersey, ...},| \par
178 % \hspace{2em}|{MRC Cognition and Brain Science Unit, Cambridge, England},| \par
179 % \hspace{2em}|{Department of Psychology, University of Cambridge}}| \par
180 %
181 % \subsection{Page style}
182 %
183 % The footer contains the short title of the document and the header contains the
184 % long title of the study program. The section counter is limited to two levels
185 % (|subsection| maximum).
186 %
187 % \begin{macrocode}
188 \ofoot{\@shorttitle}
189 \ifoot{\FHJProgramLong}
190 \setcounter{secnumdepth}{2}
191 % \end{macrocode}
192 %
193 % \MaybeStop{\PrintChanges}
194 %
195 % \section{Implementation}
196 %
197 % \begin{macrocode}
198
199 %%-------------------------------------------------------------------------------------
200 %% authors handling
201 %% Taken von apa7 class --> See: https://ctan.org/tex-archive/macros/latex/contrib/apa7
202
203 %% German and English!
204 \newcommand*{\lastauthorseparator}{UNDEF}
205 \iflanguage{english}{\renewcommand*{\lastauthorseparator}{and}}{}
206 \iflanguage{ngerman}{\renewcommand*{\lastauthorseparator}{und}}{}
207
208
209 \newcommand*\listauthors{}
210 \newcommand*\listsuperscripts{}
211 \newcommand*\listaffiliations{}
212 \newcounter{NumberOfAuthors}
213 \newcounter{NumberOfSuperscripts}
214
215 \newcommand*{\authorsnames}[2][]{%
216 \def\def@multipleauthors{\@multipleauthorsmode} %
217 \renewcommand*\listauthors{}
218 \renewcommand*\listsuperscripts{}
219 \setcounter{NumberOfAuthors}{0}
220 \setcounter{NumberOfSuperscripts}{0}
221 \forcsvlist{\stepcounter{NumberOfAuthors}\listadd\listauthors}{#2}
222 \forcsvlist{\stepcounter{NumberOfSuperscripts}\listadd\listsuperscripts}{#1}
223 }
224
225 \newcounter{NumberOfAffiliations}
226 \newcommand*{\authorsaffiliations}[1]{%
227 \def\def@multipleaffils{\@multipleaffilsmode} %
228 \renewcommand*\listaffiliations{}
229 \setcounter{NumberOfAffiliations}{0}
230 \forcsvlist{\stepcounter{NumberOfAffiliations}\listadd\listaffiliations}{#1}
231 }
232
233 %% \makeatletter
234 %% \catcode`\|=3
235
236 \def\looptwo#1#2{%
237 \edef\tmp{\noexpand\xtwo%
238 \unexpanded\expandafter{#1}\relax % no added delimiter here
239 \unexpanded\expandafter{#2}\relax % no added delimiter here
240 } \tmp%
241 }%
242
243 \def\xtwo#1|#2\relax#3|#4\relax{%
244 \dotwo{#1}{#3}%
245 \def\tmp{#2}%
246 \ifx\empty\tmp%
247 \expandafter\@gobble%
248 \else%
249 \expandafter\@firstofone%
250 \fi%
251 {\xtwo#2\relax#4\relax}%
252 }%
253
254 %% \catcode`\|=12
255
256 \newcommand*{\dotwo}[2]{}
257
258 \newcommand*{\authorsep}{}%
259 \newcommand*{\lastauthor}{}%
260 \newcommand*{\prelastauthor}{}%
261 \newcommand*{\prelastauthorsep}{}%
262
263 \newcommand{\displayauthors}{%
264 \renewcommand*{\authorsep}{}%
265 \renewcommand*{\lastauthor}{}%
266 \renewcommand*{\prelastauthor}{}%
267 \renewcommand*{\prelastauthorsep}{}%
268 \ifnum\value{NumberOfSuperscripts}=0% If no superscripts are specified, print authors without superscripts.
269 \renewcommand*{\do}[1]{%
270 \authorsep%
271 \lastauthor%
272 \renewcommand{\lastauthor}{%
273 \renewcommand{\authorsep}{,
274 \renewcommand*{\prelastauthorsep}{,}}%
275 \renewcommand{\prelastauthor}{\prelastauthorsep\ \lastauthorseparator\ }% Terminated commands with \ to preserve following space
276 ##1%
277 }%
278 }%
279 \dolistloop{\listauthors}%
280 \else
281 \renewcommand*{\dotwo}[2]{%
282 \authorsep%
283 \lastauthor%
284 \renewcommand{\lastauthor}{%
285 \renewcommand{\authorsep}{,
286 \renewcommand*{\prelastauthorsep}{,}}%
287 \renewcommand{\prelastauthor}{\prelastauthorsep\ \lastauthorseparator\ }% Terminated commands with \ to preserve following space
288 ##1\textsuperscript{##2}%
289 }%
290 }%
291 \looptwo\listauthors\listsuperscripts%
292 \fi
293 \prelastauthor \lastauthor%
294 }
295
296 \newcommand{\displayaffiliations}{%
297 \ifnum\value{NumberOfSuperscripts}=0% If no superscripts are specified, print affiliations without superscripts.
298 \renewcommand*{\do}[1]{%
299 ##1\\%
300 }%
301 \else
302 \newcounter{AffiliationNumber}
303 \renewcommand*{\do}[1]{%
304 \stepcounter{AffiliationNumber}
305 \textsuperscript{\arabic{AffiliationNumber}}##1\\%
306 }%
307 \fi
308 \dolistloop{\listaffiliations}%
309 }
310
311 \newcommand{\check@title}{%
312 \@ifundefined{@title}{%
313 \ClassWarningNoLine{fhjpaper}{Title not defined \title{Title}}}
314 \@ifundefined{@shorttitle}{%
315 \ClassWarningNoLine{fhjpaper}{Shorttitle not defined \shorttitle{Shorttitle}}}
316 }
317
318 \newcommand{\check@author}{%
319 \@ifundefined{def@multipleauthors}{%
320 \ClassWarningNoLine{fhjpaper}{Author not defined \authorsnames{Author}}}
321 \@ifundefined{def@multipleaffils}{%
322 \ClassWarningNoLine{fhjpaper}{Affiliation not defined \authorsaffiliations{Affiliation}}}
323 \@ifundefined{def@multipleauthors}{}{%
324 \ifnum\value{NumberOfSuperscripts}=0%
325 % do nothing. If no superscripts are specified, print authors and affiliations without superscripts.
326 \else%
327 \ifnum\value{NumberOfAuthors}=\value{NumberOfSuperscripts}%
328 % do nothing
329 \else
330 \ClassError{fhjpaper}{Number of Authors does not match number of Superscripts}%
331 {Please provide an equal number of authors and superscripts.}%
332 \fi
333 \fi
334 }%
335 }
336
337 %%-------------------------------------------------------------------------------------
338 %% Make title
339 \renewcommand*{\@maketitle}{
340 \cleardoublepage
341 \check@author
342 \check@title
343 % title
344 \begin{minipage}{\textwidth}\begin{center}
345 \fontsize{14}{18}\selectfont
346 \textbf{\@title}
347 \vspace{1em}
348 \end{center}\end{minipage}
349 % authors
350 \begin{minipage}{\textwidth}\begin{center}
351 \displayauthors
352 \vspace{1em}
353 \end{center}\end{minipage}
354 % affiliations
355 \begin{minipage}{\textwidth}\begin{center}
356 \displayaffiliations
357 \vspace{2em}
358 \end{center}\end{minipage}
359 }
360 % \end{macrocode}
361 %
362 % \Finale
363 %
364 \endinput