Debian Codegraph @

texmf-dist/source/latex/hep-title/hep-title-implementation.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2019-2023 by Jan Hajer
4 % -----------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3c
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3c or later is part of all distributions of LaTeX
14 % version 2005/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19
20 %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
21 %<package>\ProvidesPackage{hep-title}[2025/09/01 v1.4 Extend title page macros]
22 %<documentation>\ProvidesFile{hep-title-documentation.tex}[2025/09/01 v1.4 hep-title documentation]
23 %
24 %<*documentation>
25
26 \RequirePackage[l2tabu, orthodox]{nag}
27
28 \documentclass{ltxdoc}
29
30 \renewcommand*\theCodelineNo{\rmfamily\tstyle\footnotesize\arabic{CodelineNo}}
31 \AtBeginEnvironment{macrocode}{\renewcommand*{\ttdefault}{clmt}}
32 \renewcommand*{\MacroFont}{\codestyle}
33 \AtBeginDocument{\DeleteShortVerb{\|}}
34 \AtBeginDocument{\MakeShortVerb{\"}}
35 \EnableCrossrefs
36 \CodelineIndex
37 \RecordChanges
38
39 \usepackage{hologo}
40
41 \usepackage[parskip,oldstyle,font=10pt]{hep-paper}
42 \bibliography{bibliography}
43
44 \acronym{PDF}{portable document format}
45
46 %</documentation>
47
48 %<*driver>
49 \expandafter\newif\csname ifshort\endcsname
50 \shortfalse
51 \begin{document}
52 \DocInput{hep-title-implementation.dtx}
53 \end{document}
54 %</driver>
55 %
56 % \fi
57 %
58 % \CheckSum{1004}
59 %
60 % \CharacterTable
61 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
62 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
63 % Digits \0\1\2\3\4\5\6\7\8\9
64 % Exclamation \! Double quote \" Hash (number) \#
65 % Dollar \$ Percent \% Ampersand \&
66 % Acute accent \' Left paren \( Right paren \)
67 % Asterisk \* Plus \+ Comma \,
68 % Minus \- Point \. Solidus \/
69 % Colon \: Semicolon \; Less than \<
70 % Equals \= Greater than \> Question mark \?
71 % Commercial at \@ Left bracket \[ Backslash \\
72 % Right bracket \] Circumflex \^ Underscore \_
73 % Grave accent \` Left brace \{ Vertical bar \|
74 % Right brace \} Tilde \~}
75 %
76 % \changes{v1.0}{2021/09/01}{Initial version of the style file.}
77 % \changes{v1.1}{2022/11/01}{Bug fixes.}
78 % \changes{v1.2}{2023/07/01}{Bug fixes.}
79 % \changes{v1.3}{2024/11/01}{Bug fixes.}
80 % \changes{v1.4}{2025/09/01}{Bug fixes.}
81 %
82 % \ifshort
83 %<*documentation>
84 % \fi
85 %
86 \GetFileInfo{hep-title.sty}
87
88 \title{The \software{hep-title} package\thanks{This document corresponds to \software{hep-title}~\fileversion.}}
89 \subtitle{Extensions for the title page}
90 \author{Jan Hajer \email{[email protected]}}
91 \date{\filedate}
92
93 % \ifshort
94 \begin{document}
95 % \fi
96
97 \newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}
98
99 \maketitle
100
101 \begin{abstract}
102 The \software{hep-title} package extends the title macros of the standard classes with macros for a preprint, affiliation, editors, and endorsers.
103 \end{abstract}
104
105 To use the \software{hep-title} package include it with "\usepackage{hep-title}".
106
107 Most macros are intended for the use in the preamble.
108 They are implemented using the \software{titling} \cite{titling} and \software{authblk} \cite{authblk} packages.
109
110 \section{Macros}
111
112 If the \software{hyperref} package is loaded the \PDF meta information is set according to the "\title"\marg{text} and "\author"\marg{text} information.
113
114 \subsection{Title}
115
116 \DescribeMacro{\series}
117 \DescribeMacro{\title}
118 \DescribeMacro{\subtitle}
119 \DescribeMacro{\seriesfont}
120 \DescribeMacro{\titlefont}
121 \DescribeMacro{\subtitlefont}
122 The "\series"\marg{series} places a series title above the usual title generated via "\title"\marg{title}.
123 The "\subtitle"\marg{subtitle} macro places a subtitle below the usual title.
124 The fonts and their size can be adjusted using the "\seriesfont"\marg{font}, "\titlefont"\marg{font}, and "\subtitlefont"\marg{font} macros.
125
126 \subsection{Authors}
127
128 \DescribeMacro{\author}
129 \DescribeMacro{\authorfont}
130 \DescribeMacro{\email}
131 \DescribeMacro{\affiliation}
132 \DescribeMacro{\affiliationfont}
133 In order to facilitate multiple authors with different affiliations the \software{authblk} package \cite{authblk} is extended.
134 The author macro is extended to take a affiliation label "\author"\oarg{label}\marg{name}.
135 The affiliation macro takes the corresponding label "\affiliation"\oarg{label}\marg{institution}.
136 Additionally, the "\email{email}" macro places a link containing the email in typewrite font into a footnote.
137 The fonts can be adjusted using the "\authorfont"\marg{font} and "\affiliationfont"\marg{font} macros.
138 The following lines add \eg two authors with different affiliations
139 \begin{verbatim}
140 \author[affil1]{Author one \email{email one}}
141 \affiliation[affil1]{Affiliation one}
142 \author[affil2]{Author two \email{email two}}
143 \affiliation[affil1,affil2]{Affiliation two}
144 \end{verbatim}
145
146 \DescribeMacro{\editor}
147 \DescribeMacro{\endorser}
148 \DescribeMacro{\editorfont}
149 \DescribeMacro{\endorserfont}
150 Additionally the "\editor"\oarg{label}\marg{name} and "\endorser"\oarg{label}\marg{name} macros are provided that act similar to the "\author"\oarg{label}\marg{name} macros but place their content in a dedicated line.
151 Their font can be adjusted by the "\editorfont"\marg{font} and "\endorserfont"\marg{font}.
152 \DescribeMacro{\editortitle}
153 \DescribeMacro{\endorsertitle}
154 \DescribeMacro{\editortitlefont}
155 \DescribeMacro{\endorsertitlefont}
156 The titles of these lines can be adjusted using the "\editortitle"\marg{singluar}\marg{plural} and "\endorsertitle"\marg{singluar}\marg{plural} macros.
157 Their font can be adjust with the "\editortitlefont"\marg{font} and "\endorsertitlefont"\allowbreak\marg{font}.
158
159 \subsection{Abstract}
160
161 \DescribeEnv{abstract}
162 \DescribeEnv{abstract*}
163 The "abstract" environment is adjusted to not start with an indentation.
164 The "abstract*" environment takes care of placing the title as well.
165 This is used in "twocolumn" documents if the abstract should span both columns.
166
167 \subsection{Preprint}
168
169 \DescribeMacro{\preprint}
170 \DescribeMacro{\preprintfont}
171 The "\preprint"\marg{numer} macro places a pre-print number in the upper right corner of the title page.
172 The "\preprintfont" macro can be used to change the font of the preprint.
173
174 % \ifshort
175 \printbibliography
176
177 \end{document}
178 %
179 %</documentation>
180 % \fi
181 %
182 % \StopEventually{
183 % \printbibliography
184 % \PrintChanges
185 % }
186 %
187 % \appendix
188 %
189 % \section{Implementation}
190 %
191 %<*package>
192 %
193 % \begin{macro}{\online}
194 % \begin{macro}{\email}
195 % Provide the "\online"\marg{text}\marg{url} macro combining the features of the "\href" and the "\url" macros.
196 % Define a macro for typesetting emails.
197 % \begin{macrocode}
198 \providecommand*{\online}[2]{\texttt{#2}}%
199 \providecommand*{\hep@email}[1]{\online{mailto:#1}{#1}}
200 \providecommand*{\email}{\hep@email}
201 \AtBeginDocument{\@ifpackageloaded{hyperref}{%
202 \renewcommand*{\online}[2]{\href{#1}{\nolinkurl{#2}}}%
203 }{}
204 }
205 % \end{macrocode}
206 % \end{macro}
207 % \end{macro}
208 %
209 % \begin{macro}{\hep@multi@ref}
210 % Transform reference list to list of references.
211 % \begin{macrocode}
212 \newif\ifhep@first%
213 \newcommand*{\hep@multi@ref}[1]{%
214 \hep@firsttrue%
215 \forcsvlist{%
216 \ifhep@first\hep@firstfalse\else\textsuperscript,\fi\ref%
217 }{#1}%
218 }
219 % \end{macrocode}
220 % \end{macro}
221 %
222 % Redefine the email macro for the title page.
223 % \begin{macrocode}
224 \renewcommand*{\email}[2][]{\unskip\thanks[#1]{\hep@email{#2}}}%
225 \AtBeginDocument{
226 \let\hep@maketitle\maketitle
227 \renewcommand*\maketitle{\hep@maketitle\let\email\hep@email}
228 }
229 % \end{macrocode}
230 %
231 % \subsection{Preprint and title}
232 %
233 % \subsubsection{Preprint and Reprint}
234 %
235 % \begin{macro}{\reprintfont}
236 % Define the "\reprintfont" macro.
237 % \begin{macrocode}
238 \let\hep@reprint@font\relax
239 \newcommand*{\reprintfont}[1]{\def\hep@reprint@font{#1}}
240 \reprintfont{\scshape\small}
241 % \end{macrocode}
242 % \end{macro}
243 %
244 % \begin{macro}{\reprint}
245 % \begin{macro}{\doi}
246 % Define the "\preprint" macro using the \software{varwidth} package \cite{varwidth}.
247 % \begin{macrocode}
248 \let\hep@reprint\relax
249 \newcommand*\reprint[1]{
250 \@ifundefined{hep@reprint}{%
251 \gdef\hep@reprint{#1}%
252 }{%
253 \apptocmd{\hep@reprint}{\\#1}{}{}%
254 }%
255 }
256 \newcommand*\doi[1]{\reprint{\textsc{doi}: \online{https://doi.org/#1}{#1}}}
257 \newcommand*{\hep@reprint@box}{%
258 \begin{varwidth}{\textwidth}%
259 \hep@reprint@font\hep@reprint%
260 \end{varwidth}%
261 }
262 % \end{macrocode}
263 % \end{macro}
264 % \end{macro}
265 %
266 % \begin{macro}{\preprintfont}
267 % Define the "\preprintfont" macro.
268 % \begin{macrocode}
269 \let\hep@preprint@font\relax
270 \newcommand*{\preprintfont}[1]{\def\hep@preprint@font{#1}}
271 \preprintfont{\scshape\small\raggedleft}
272 % \end{macrocode}
273 % \end{macro}
274 %
275 % \begin{macro}{\preprint}
276 % \begin{macro}{\arxiv}
277 % Define the "\preprint" macro using the \software{varwidth} package \cite{varwidth}.
278 % \begin{macrocode}
279 \RequirePackage{etoolbox}
280 \let\hep@preprint\relax
281 \newcommand*\preprint[1]{%
282 \@ifundefined{hep@preprint}{%
283 \gdef\hep@preprint{#1}%
284 }{%
285 \apptocmd{\hep@preprint}{\\#1}{}{}%
286 }%
287 }
288 \newcommand*\arxiv[1]{%
289 \preprint{\textsc{arXiv}: \online{https://arxiv.org/abs/#1}{#1}}%
290 }
291 \RequirePackage{varwidth}
292 \newcommand*{\hep@preprint@box}{%
293 \begin{varwidth}{\textwidth}%
294 \hep@preprint@font\hep@preprint%
295 \end{varwidth}%
296 }
297 % \end{macrocode}
298 % \end{macro}
299 % \end{macro}
300 %
301 % \begin{macro}{\placepreprint}
302 % \begin{macro}{\placereprint}
303 % Places a preprint number in the top right corner of the title page using the \software{calc} \cite{calc}, \software{atbegshi} \cite{atbegshi}, and \software{picture} \cite{picture} packages.
304 % \begin{macrocode}
305 \RequirePackage{calc}
306 \RequirePackage{atbegshi}
307 \RequirePackage{picture}
308 \newcommand*{\placepreprint}{%
309 \AtBeginShipoutFirst{%
310 \put(
311 \textwidth+\oddsidemargin-\widthof{\hep@preprint@box},
312 -2pt-\topmargin-\heightof{\hep@preprint@box}
313 ){\normalfont\hep@preprint@box}
314 }
315 }
316 \newcommand*{\placereprint}{%
317 \AtBeginShipoutFirst{%
318 \put(
319 \oddsidemargin ,
320 -2pt-\topmargin-\heightof{\hep@reprint@box}
321 ){\normalfont\hep@reprint@box}
322 }
323 }
324 % \end{macrocode}
325 % \end{macro}
326 % \end{macro}
327 %
328 % \subsubsection{Series}
329 %
330 % \begin{macro}{\series}
331 % Define a series title.
332 % \begin{macrocode}
333 \newcommand{\preseries}[1]{\def\hep@pre@series{#1}}
334 \newcommand*{\series}[1]{\def\hep@series{#1}}
335 \newcommand{\postseries}[1]{\def\hep@post@series{#1}}
336 % \end{macrocode}
337 % \end{macro}
338 %
339 % \begin{macro}{\seriesfont}
340 % Allow to change the fontface of the series title.
341 % \begin{macrocode}
342 \let\hep@series@font\relax
343 \newcommand*{\seriesfont}[1]{\def\hep@series@font{#1}}
344 % \end{macrocode}
345 % \end{macro}
346 %
347 % Set the default series title layout.
348 % \begin{macrocode}
349 \preseries{\begin{center}\Large\hep@series@font}
350 \postseries{\par\end{center}}
351 % \end{macrocode}
352 %
353 % \subsubsection{Title}
354 %
355 % Extend the title using the \software{titling} package \cite{titling}.
356 % Fix the footnote indent.
357 % \begin{macrocode}
358 \RequirePackage{titling}
359 \setlength{\thanksmarkwidth}{1.5em}
360 % \end{macrocode}
361 %
362 % \begin{macro}{\maketitlehooka}
363 % Place the preprint and the series title using "\maketitlehooka".
364 % \begin{macrocode}
365 \renewcommand*{\maketitlehooka}{%
366 \placereprint\placepreprint\vspace{-\bigskipamount}%
367 \@ifundefined{hep@series}{}{%
368 \hep@pre@series\hep@series\hep@post@series%
369 }%
370 % \vspace{-\bigskipamount}%
371 }
372 % \end{macrocode}
373 % \end{macro}
374 %
375 % \begin{macro}{\titlefont}
376 % Allow to change the fontface of the the title.
377 % \begin{macrocode}
378 \let\hep@title@font\relax
379 \newcommand*{\titlefont}[1]{\def\hep@title@font{#1}}
380 % \end{macrocode}
381 % \end{macro}
382 % Set default title layout.
383 % \begin{macrocode}
384 \pretitle{\begin{center}\LARGE\hep@title@font}
385 \posttitle{\par\end{center}}
386 % \end{macrocode}
387
388 % \subsubsection{Subtitle}
389 %
390 % \begin{macro}{\subtitle}
391 % Define a subtitle.
392 % \begin{macrocode}
393 \newcommand{\presubtitle}[1]{\def\hep@pre@sub@title{#1}}
394 \newcommand*{\subtitle}[1]{\def\hep@sub@title{#1}}
395 \newcommand{\postsubtitle}[1]{\def\hep@post@sub@title{#1}}
396 % \end{macrocode}
397 % \end{macro}
398
399 % \begin{macro}{\subtitlefont}
400 % Allow to change the fontface of the subtitle.
401 % \begin{macrocode}
402 \let\hep@subtitle@font\relax
403 \newcommand*{\subtitlefont}[1]{\def\hep@subtitle@font{#1}}
404 % \end{macrocode}
405 % \end{macro}
406 %
407 % Set default subtitle layout.
408 % \begin{macrocode}
409 \presubtitle{\begin{center}\Large\hep@subtitle@font}
410 \postsubtitle{\par\end{center}}
411 % \end{macrocode}
412 %
413 % \subsection{Authors and Editors}
414 %
415 % \subsubsection{Editors}
416 %
417 % Define editors, similar to authors using the \software{authblk} package.
418 % Enable the handling of multiple authors with different affiliations using the \software{authblk} package \cite{authblk}.
419 % \begin{macrocode}
420 \RequirePackage{authblk}
421 \newcounter{editors}
422 \newcommand\hep@editorlist{}
423 \newcommand*\hep@editors{}
424 \@namedef{hep@editor@sep1}{}
425 \@namedef{hep@editor@sep2}{\Authand}
426 % \end{macrocode}
427 %
428 % \begin{macro}{\editor}
429 % Copy of the "authblk" author code adjusted for editors.
430 % \begin{macrocode}
431 \newcommand*\editor[2][]{%
432 \ifnewaffil%
433 \addtocounter{affil}{1}%
434 \edef\AB@thenote{\arabic{affil}}%
435 \fi%
436 \if\relax#1\relax%
437 \def\AB@note{\AB@thenote}%
438 \else%
439 \def\AB@note{#1}\setcounter{Maxaffil}{0}%
440 \fi%
441 \ifnum\value{editors}>1\relax%
442 \@namedef{hep@editor@sep\number\c@editors}{\Authsep}%
443 \fi%
444 \addtocounter{editors}{1}%
445 \begingroup%
446 \let\protect\@unexpandable@protect \let\and\AB@pand%
447 \def\thanks{\protect\thanks}\def\footnote{\protect\footnote}%
448 \@temptokena=\expandafter{\hep@editors}{%
449 \def\\{%
450 \protect\\[\@affilsep]\protect\Affilfont\protect\AB@resetsep%
451 }%
452 \xdef\hep@editor{\AB@blk@and#2}%
453 \ifnewaffil%
454 \gdef\AB@las{}\gdef\AB@lasx{\protect\Authand}\gdef\AB@as{}%
455 \xdef\hep@editors{\the\@temptokena\AB@blk@and}%
456 \else%
457 \xdef\hep@editors{\the\@temptokena\AB@as\AB@au@str}%
458 \global\let\AB@las\AB@lasx\gdef\AB@lasx{\protect\Authands}%
459 \gdef\AB@as{\Authsep}%
460 \fi%
461 \gdef\AB@au@str{#2}%
462 }%
463 \@temptokena=\expandafter{\hep@editorlist}%
464 \let\\=\editorcr%
465 \xdef\hep@editorlist{%
466 \the\@temptokena%
467 \protect\@nameuse{hep@editor@sep\number\c@editors}%
468 \protect\Authfont#2%
469 \if\relax#1\relax\else%
470 \protect\hep@multi@ref{\AB@note}%
471 \fi%
472 }%
473 \endgroup%
474 \ifnum\value{editors}>2\relax%
475 \@namedef{hep@editor@sep\number\c@editors}{\Authands}%
476 \fi%
477 \newaffilfalse%
478 }
479 % \end{macrocode}
480 % \end{macro}
481 %
482 % \begin{macro}{\editorfont}
483 % Allow to change the fontface of the editors.
484 % \begin{macrocode}
485 \let\hep@editor@font\relax
486 \newcommand*{\editorfont}[1]{\def\hep@editor@font{#1}}
487 % \end{macrocode}
488 % \end{macro}
489 %
490 % \begin{macro}{\preditor}
491 % \begin{macro}{\postditor}
492 % Set editor style.
493 % \begin{macrocode}
494 \newcommand{\preeditor}[1]{\def\hep@pre@editor{#1}}
495 \newcommand{\posteditor}[1]{\def\hep@post@editor{#1}}
496 \newcommand*{\editortitle}[2]{
497 \def\hep@editor@title{#1}
498 \def\hep@editor@title@pl{#2}
499 }
500 \newcommand*{\editortitlefont}[1]{\def\hep@editor@title@font{#1}}
501 \newcommand{\preeditortitle}[1]{\def\hep@pre@editor@title{#1}}
502 \newcommand{\posteditortitle}[1]{\def\hep@post@editor@title{#1}}
503 \editortitle{Editor}{Editors}
504 \editortitlefont{\itshape}
505 \preeditortitle{\hep@editor@title@font}
506 \posteditortitle{: }
507 \preeditor{%
508 \begin{center}%
509 \large\hep@editor@font\lineskip.5em%
510 \begin{tabular}[t]{c}{%
511 \hep@pre@editor@title%
512 \ifnum\value{editors}>1\relax%
513 \hep@editor@title@pl%
514 \else%
515 \hep@editor@title%
516 \fi%
517 \hep@post@editor@title%
518 }%
519 }
520 \posteditor{\end{tabular}\par\end{center}}
521 % \end{macrocode}
522 % \end{macro}
523 % \end{macro}
524 %
525 % \begin{macro}{\maketitlehookb}
526 % Show subtitle and editor.
527 % \begin{macrocode}
528 \renewcommand*{\maketitlehookb}{%
529 \@ifundefined{hep@sub@title}{}{%
530 \hep@pre@sub@title\hep@sub@title\hep@post@sub@title%
531 }%
532 \smallskip%
533 \ifx\hep@editorlist\AB@empty\else%
534 \hep@pre@editor\hep@editorlist\hep@post@editor%
535 \fi
536 }
537 % \end{macrocode}
538 % \end{macro}
539 %
540 % \subsubsection{Authors}
541 %
542 % \begin{macro}{\author}
543 % Allow absent author field.
544 % \begin{macrocode}
545 % \author{}
546 % \end{macrocode}
547 % \end{macro}
548 %
549 % Switch authblk to a label ref system for affiliations using the \software{xpatch} package \cite{xpatch}.
550 % \begin{macrocode}
551 \RequirePackage{xpatch}
552 \xpatchcmd{\author}{%
553 \protect\Authfont#2\AB@authnote{\AB@note}%
554 }{%
555 \protect\Authfont#2%
556 \if\relax#1\relax\else\unskip\protect\hep@multi@ref{\AB@note}\fi%
557 }{}{}
558 % \end{macrocode}
559 %
560 % \begin{macro}{\authorfont}
561 % Allow to change the fontface of the individual parts of the title.
562 % \begin{macrocode}
563 \let\hep@author@font\relax
564 \newcommand*{\authorfont}[1]{\def\hep@author@font{#1}}
565 \renewcommand*\Authfont{\hep@author@font}
566 % \end{macrocode}
567 % \end{macro}
568 %
569 % Set default author fontface.
570 % \begin{macrocode}
571 \newcommand*{\authortitle}[2]{
572 \def\hep@author@title{#1}
573 \def\hep@author@title@pl{#2}
574 }
575 \newcommand*{\authortitlefont}[1]{\def\hep@author@title@font{#1}}
576 \newcommand{\preauthortitle}[1]{\def\hep@pre@author@title{#1}}
577 \newcommand{\postauthortitle}[1]{\def\hep@post@author@title{#1}}
578 \authortitle{Author}{Authors}
579 \authortitlefont{\itshape}
580 \preauthortitle{\hep@author@title@font}
581 \postauthortitle{: }
582 \preauthor{%
583 \begin{center}%
584 \large\hep@author@font\lineskip.5em%
585 \begin{tabular}[t]{c}{%
586 \ifnum\value{editors}>0\relax%
587 \hep@pre@author@title%
588 \ifnum\value{authors}>1\relax%
589 \hep@author@title@pl\else\hep@author@title%
590 \fi\hep@post@author@title%
591 \fi%
592 }%
593 }
594 \postauthor{\end{tabular}\par\end{center}}
595 % \end{macrocode}
596 %
597 % \subsubsection{Endorser}
598 %
599 % \begin{macrocode}
600 \newcounter{endorsers}
601 \newcommand\hep@endorserlist{}
602 \newcommand*\hep@endorsers{}
603 \@namedef{hep@editor@sep1}{}
604 \@namedef{hep@editor@sep2}{\Authand}
605 % \end{macrocode}
606 %
607 % \begin{macro}{\endorser}
608 % Copy of the "authblk" author code adjusted for endorsers.
609 % \begin{macrocode}
610 \DeclareRobustCommand\endorser{%
611 \@ifnextchar[{\hep@@endorser}{\hep@@@endorser}%
612 }
613 \def\hep@@endorser[#1]#2{\hep@@@@endorser[#1]{#2}}
614 \def\hep@@@endorser#1{\hep@@@@endorser{#1}}
615 \newcommand*\hep@@@@endorser[2][]{%
616 \ifnewaffil%
617 \addtocounter{affil}{1}%
618 \edef\AB@thenote{\arabic{affil}}%
619 \fi%
620 \if\relax#1\relax%
621 \def\AB@note{\AB@thenote}%
622 \else%
623 \def\AB@note{#1}\setcounter{Maxaffil}{0}%
624 \fi%
625 \ifnum\value{endorsers}>1\relax%
626 \@namedef{hep@endorser@sep\number\c@endorsers}{\Authsep}%
627 \fi%
628 \addtocounter{endorsers}{1}%
629 \begingroup%
630 \let\protect\@unexpandable@protect \let\and\AB@pand%
631 \def\thanks{\protect\thanks}\def\footnote{\protect\footnote}%
632 \@temptokena=\expandafter{\hep@endorsers}{%
633 \def\\{%
634 \protect\\[\@affilsep]\protect\Affilfont\protect\AB@resetsep%
635 }%
636 \xdef\hep@endorser{\AB@blk@and#2}%
637 \ifnewaffil%
638 \gdef\AB@las{}\gdef\AB@lasx{\protect\Authand}\gdef\AB@as{}%
639 \xdef\hep@endorsers{\the\@temptokena\AB@blk@and}%
640 \else%
641 \xdef\hep@endorsers{\the\@temptokena\AB@as\AB@au@str}%
642 \global\let\AB@las\AB@lasx\gdef\AB@lasx{\protect\Authands}%
643 \gdef\AB@as{\Authsep}%
644 \fi%
645 \gdef\AB@au@str{#2}%
646 }%
647 \@temptokena=\expandafter{\hep@endorserlist}%
648 \let\\=\endorsercr%
649 \xdef\hep@endorserlist{%
650 \the\@temptokena%
651 \protect\@nameuse{hep@endorser@sep\number\c@endorsers}%
652 \protect\Authfont#2%
653 \if\relax#1\relax\else%
654 \protect\hep@multi@ref{\AB@note}%
655 \fi%
656 }%
657 \endgroup%
658 \ifnum\value{endorsers}>2\relax%
659 \@namedef{hep@endorser@sep\number\c@endorsers}{\Authands}%
660 \fi%
661 \newaffilfalse%
662 }
663 % \end{macrocode}
664 % \end{macro}
665 %
666 % \begin{macro}{\endorserfont}
667 % \begin{macro}{\preendorser}
668 % \begin{macro}{\postendorser}
669 % \begin{macrocode}
670 \let\hep@endorser@font\relax
671 \def\endorserfont#1{\def\hep@endorser@font{#1}}
672 \newcommand{\preendorser}[1]{\def\hep@pre@endorser{#1}}
673 \newcommand{\postendorser}[1]{\def\hep@post@endorser{#1}}
674 \def\endorsertitle#1#2{
675 \def\hep@endorser@title{#1}
676 \def\hep@endorser@title@pl{#2}
677 }
678 % \end{macrocode}
679 % \end{macro}
680 % \end{macro}
681 % \end{macro}
682 %
683 % \begin{macro}{\endorsertitlefont}
684 % \begin{macro}{\preendorsertitle}
685 % \begin{macro}{\postendorsertitle}
686 % \begin{macrocode}
687 \def\endorsertitlefont#1{\def\hep@endorser@title@font{#1}}
688 \newcommand{\preendorsertitle}[1]{\def\hep@pre@endorser@title{#1}}
689 \newcommand{\postendorsertitle}[1]{\def\hep@post@endorser@title{#1}}
690 \endorsertitle{Endorser}{Endorsers}
691 \endorsertitlefont{\itshape}
692 \preendorsertitle{\hep@endorser@title@font}
693 \postendorsertitle{: }
694 \preendorser{%
695 \begin{center}%
696 \large\hep@endorser@font\lineskip.5em%
697 \begin{tabular}[t]{c}{%
698 \hep@pre@endorser@title%
699 \ifnum\value{endorsers}>1\relax%
700 \hep@endorser@title@pl%
701 \else%
702 \hep@endorser@title%
703 \fi%
704 \hep@post@endorser@title%
705 }%
706 }
707 \postendorser{\end{tabular}\par\end{center}}
708 % \end{macrocode}
709 % \end{macro}
710 % \end{macro}
711 % \end{macro}
712 %
713 % \subsubsection{Affiliation}
714 %
715 % Patch the "\affiliation" macro to comply with the label ref system.
716 % \begin{macrocode}
717 \newcounter{affiliation}
718 \renewcommand*{\theaffiliation}{%
719 \textsuperscript{\normalfont\alph{affiliation}}%
720 }
721 \xpatchcmd{\affil}{%
722 \AB@affilnote{\AB@note}%
723 }{%
724 \protect\refstepcounter{affiliation}\protect\label{\AB@note}%
725 \if\relax#1\relax\else\protect\theaffiliation\fi%
726 }{}{}
727 % \end{macrocode}
728 %
729 % \begin{macro}{\affiliationfont}
730 % Allow to change the fontface of affiliation.
731 % \begin{macrocode}
732 \let\hep@affiliation@font\relax
733 \newcommand*{\affiliationfont}[1]{\def\hep@affiliation@font{#1}}
734 % \newif\ifhep@lining\hep@liningtrue
735 % \ifhep@lining
736 \renewcommand*{\Affilfont}{\small\hep@affiliation@font}
737 % \else
738 % \renewcommand*{\Affilfont}{\small\ostyle\hep@affiliation@font}
739 % \fi
740 % \end{macrocode}
741 % \end{macro}
742 %
743 % \begin{macro}{\affiliation}
744 % Define the "\affiliation" macro, ensure that linebreaks happen after a comma.
745 % \begin{macrocode}
746 \newcommand*\hep@penalty{\if@twocolumn85\else50\fi}
747 \newcommand*\hep@active@comma{,\penalty-\hep@penalty\relax}
748 \newcommand*\hep@cat@comma@active{\catcode`\,\active}
749 {\hep@cat@comma@active\gdef,{\hep@active@comma}}
750 \newcommand*\hep@affil[1]{%
751 \endgroup\@flushglue=0pt plus .5\linewidth\affil{#1}%
752 }
753 \def\hep@affil@opt[#1]#2{%
754 \endgroup\@flushglue=0pt plus .5\linewidth\affil[#1]{#2}%
755 }
756 \DeclareRobustCommand\hep@affiliation{%
757 \@ifnextchar[{\hep@affil@opt}{\hep@affil}%
758 }
759 \newcommand*{\affiliation}{%
760 \begingroup\hep@cat@comma@active\hep@affiliation%
761 }
762 % \end{macrocode}
763 % \end{macro}
764 %
765 % Place endorser and affiliation
766 % \begin{macrocode}
767 \renewcommand*{\maketitlehookc}{%
768 \ifx\hep@endorserlist\AB@empty\else%
769 \hep@pre@endorser\hep@endorserlist\hep@post@endorser%
770 \fi
771 % \\[\affilsep]
772 \ifx\AB@affillist\AB@empty\else%
773 \ifnum\value{affil}>\value{Maxaffil}
774 \begin{center}\AB@affillist\end{center}%
775 \fi%
776 \fi%
777 }
778 % \end{macrocode}
779 %
780 % \begin{macro}{\@author}
781 % Ensure that affiliation is not set directly below author
782 % \begin{macrocode}
783 \def\@author{%
784 \ifx\AB@affillist\AB@empty%
785 \AB@author%
786 \else%
787 \ifnum\value{affil}>\value{Maxaffil}
788 \def\rlap##1{##1}%
789 \AB@authlist%
790 % \\[\affilsep]\AB@affillist%
791 \else%
792 \AB@authors%
793 \fi%
794 \fi%
795 }
796 % \end{macrocode}
797 % \end{macro}
798 %
799 % \subsection{Date and Abstract}
800 %
801 % \subsubsection{Date}
802 %
803 % \begin{macro}{\date}
804 % Allow absent date field.
805 % \begin{macrocode}
806 \date{\vspace{-4ex}}
807 % \end{macrocode}
808 % \end{macro}
809 %
810 % \begin{macro}{\datefont}
811 % Allow to change the fontface of the individual parts of the title.
812 % \begin{macrocode}
813 \let\hep@date@font\relax
814 \newcommand*{\datefont}[1]{\def\hep@date@font{#1}}
815 % \end{macrocode}
816 % \end{macro}
817 %
818 % Set the default "date" fontface.
819 % \begin{macrocode}
820 \predate{\begin{center}\hep@date@font}
821 \postdate{\par\end{center}}
822 % \end{macrocode}
823 %
824 % \subsubsection{Abstract}
825 %
826 % \begin{environment}{abstract}
827 % Adjust the "abstract" environment to not start with indentation.
828 % \begin{macrocode}
829 \@ifundefined{abstract}{}{%
830 \let\hep@abstract\abstract%
831 \renewcommand*\abstract{\hep@abstract\noindent\ignorespaces}%
832 \let\hep@key@words\relax
833 \newcommand*{\keywords}[1]{\def\hep@key@words{#1}}
834 \AtBeginDocument{\@ifundefined{hep@key@words}{}{%
835 \let\hep@end@abstract\endabstract%
836 \renewcommand*\endabstract{
837 \par\medskip\noindent\textit{Keywords: \hep@key@words}%
838 \hep@end@abstract%
839 }%
840 }}
841 % \end{macrocode}
842 % \end{environment}
843 % \begin{environment}{abstract*}
844 % Add a "abstract*" environment for two column mode taking also care of placing the title using the \software{environ} \cite{environ} and \software{abstract} \cite{abstract} packages.
845 % \begin{macrocode}
846 \if@twocolumn
847 \RequirePackage{environ}
848 \RequirePackage{abstract}
849 \renewcommand*{\abstitleskip}{-3ex}
850 \NewEnviron{abstract*}{%
851 \twocolumn[\maketitle\vspace{-5ex}%
852 \begin{onecolabstract}\noindent\BODY\end{onecolabstract}%
853 \vspace{.5cm}]\saythanks%
854 }%
855 \else
856 \newenvironment{abstract*}{%
857 \maketitle\begin{abstract}%
858 }{%
859 \end{abstract}%
860 }
861 \fi
862 }
863 % \end{macrocode}
864 % \end{environment}
865 %
866 % \subsection{Thanks}
867 %
868 % \begin{macro}{\thanks} Redefine thank to have a optional argument for a reference label.
869 % \begin{macrocode}
870 \let\hep@thanks\thanks
871 \AtEndDocument{\let\thanks\hep@thanks}
872 \DeclareRobustCommand\thanks[2][]{%
873 \AfterEndPreamble{%
874 \if\relax#1\relax%
875 \footnotemark%
876 \else%
877 \renewcommand*\thefootnote{\textsuperscript{\@fnsymbol\c@footnote}}%
878 \protect\refstepcounter{footnote}\protect\label{#1}%
879 \renewcommand*\thefootnote{\@arabic\c@footnote}%
880 \fi%
881 \protected@xdef\@thanks{%
882 \@thanks\protect\footnotetext[\the\c@footnote]{#2}%
883 }
884 \if@twocolumn
885 \protected@xdef\@bs@thanks{%
886 \@bs@thanks\protect\footnotetext[\the\c@footnote]{#2}%
887 }%
888 \fi%
889 }%
890 }
891 % \end{macrocode}
892 % \end{macro}
893 %</package>
894 %
895 % \section{Test}
896 %
897 %<*testone|testtwo>
898 %
899 % \begin{macrocode}
900 %<testone>\documentclass{article}
901 %<testtwo>\documentclass[twocolumn]{article}
902
903 %% \usepackage[lang=english]{hep-paper}
904 \usepackage[math]{blindtext}
905 \usepackage{hep-title}
906 \usepackage{hyperref}
907 \def\BackrefFootnoteTag{}\usepackage{footnotebackref}
908
909 \doi{10.1234/5678}
910
911 \arxiv{1234.5678}
912
913 \preprint{Preprint}
914
915 \series{Series}
916
917 \title{Title}
918
919 \subtitle{Subtitle}
920
921 \editor[one]{First Editor}
922 \editor[one,two,second]{Second Editor}
923 \email[second]{[email protected]}
924 \editor[one,two,three]{Third Editor \email{[email protected]}}
925
926 \author[three,four]{First Author}
927 \author[fourth, two,four,thanks]{Second Author}
928 \email[fourth]{[email protected]}
929 \thanks[thanks]{Thanks}
930 \author[two,three,four]{Third Author \email{[email protected]}}
931 \author{Fourth Author}
932
933 \endorser[four]{First Endorser}
934 \endorser[five]{Second Endorser}
935 \endorser{Third Endorser}
936
937 \affiliation[one]{First Affiliation}
938 \affiliation[two]{Second Affiliation}
939 \affiliation[three]{Third Affiliation}
940 \affiliation[four]{Fourth Affiliation}
941 \affiliation[five]{Fifth Affiliation}
942
943 \date{Date}
944
945 \keywords{Keyword 1, keyword 2, keyword 3}
946
947 \begin{document}
948 %<testone>
949 %<testone> \maketitle
950
951 %<testone>\begin{abstract}
952 %<testtwo>\begin{abstract*}
953 \blindtext
954 %<testone>\end{abstract}
955 %<testtwo>\end{abstract*}
956
957 \noindent First page footnote.\footnote{Footnote}
958
959 \blinddocument
960
961 \end{document}
962 % \end{macrocode}
963 %
964 %</testone|testtwo>
965 %
966 % \section{Readme}
967 %
968 %<*readme>
969 %
970 % \begin{macrocode}
971 # The `hep-title` package
972
973 Extensions for the title page
974
975 ## Introduction
976
977 The `hep-title` package extends the title macros of the standard classes
978 with macros for a preprint, affiliation, editors, and endorsers.
979
980 To use the `hep-title` package include it with `\usepackage{hep-title}`.
981
982 ## Author
983
984 Jan Hajer
985
986 ## License
987
988 This file may be distributed and/or modified under the conditions of the
989 `LaTeX` Project Public License, either version 1.3c of this license or
990 (at your option) any later version. The latest version of this license is
991 in `http://www.latex-project.org/lppl.txt` and version 1.3c or later is
992 part of all distributions of LaTeX version 2005/12/01 or later.
993 % \end{macrocode}
994 %
995 %</readme>
996 %
997 % \Finale
998
999 \endinput
1000
1001 % \PrintIndex
1002 % makeindex -s gglo.ist -o hep-title-implementation.gls hep-title-implementation.glo
1003 % makeindex -s gglo.ist -o hep-title-implementation.ind hep-title-implementation.idx