summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hep-paper/hep-paper.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/hep-paper/hep-paper.dtx')
-rw-r--r--macros/latex/contrib/hep-paper/hep-paper.dtx1498
1 files changed, 1179 insertions, 319 deletions
diff --git a/macros/latex/contrib/hep-paper/hep-paper.dtx b/macros/latex/contrib/hep-paper/hep-paper.dtx
index 880dbe4ea8..9ba0f10dcd 100644
--- a/macros/latex/contrib/hep-paper/hep-paper.dtx
+++ b/macros/latex/contrib/hep-paper/hep-paper.dtx
@@ -17,40 +17,59 @@
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
-%<package>\ProvidesPackage{hep-paper}[2020/01/01 v1.1 Publications in High Energy Physics]
-%
+%<package>\ProvidesPackage{hep-paper}[2020/03/01 v1.2 Publications in High Energy Physics]
+
%<*driver>
\documentclass{ltxdoc}
-\usepackage{hep-paper}
-\usepackage{parskip}
+\MacroIndent=1.5em
+
+% \makeatletter
+% \newenvironment{decl}[1][]%
+% {\par\small\addvspace{4.5ex plus 1ex}%
+% \vskip -\parskip
+% \ifx\relax#1\relax
+% \def\@decl@date{}%
+% \else
+% \def\@decl@date{\NEWfeature{#1}}%
+% \fi
+% \noindent\hspace{-\leftmargini}%
+% \begin{tabular}{|l|}\hline\ignorespaces}%
+% {\\\hline\end{tabular}\nobreak\@decl@date\par\nobreak
+% \vspace{2.3ex}\vskip -\parskip}
+% \makeatother
+
+\newenvironment{example}[1][.5]{%
+ \begin{minipage}[t]{\linewidth}%
+ \begin{minipage}[t]{#1\linewidth}
+ \newcommand{\second}{%
+ \end{minipage}%
+ \begin{minipage}[t]{\linewidth-#1\linewidth}%
+ }%
+}{\end{minipage}\end{minipage}}
+
+\usepackage[parskip]{hep-paper}
\bibliography{bibliography}
-\DeclareFieldFormat{eprint:ctan}{%
- CTAN\addcolon\space
- \ifhyperref{\href{https://ctan.org/pkg/#1}{\nolinkurl{#1}}}{\nolinkurl{#1}}
-}
-\DeclareFieldAlias{eprint:CTAN}{eprint:ctan}
+\acronym{PDF}{portable document format}
-\DeclareFieldFormat{eprint:github}{%
- GitHub\addcolon\space
- \ifhyperref{%
- \href{https://github.com/\thefield{eprintclass}/#1}{\nolinkurl{\thefield{eprintclass}/#1}}}%
- {\nolinkurl{\thefield{eprintclass}/#1}}%
- }
-\DeclareFieldAlias{eprint:GitHub}{eprint:github}
+\listfiles
+
+\usepackage{titletoc}
+\titlecontents{section}[0em]{\medskip\bfseries}{\thecontentslabel\hspace{.8em}}{}{\hfill\contentspage}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
+
\begin{document}
\DocInput{hep-paper.dtx}
\end{document}
%</driver>
% \fi
%
-% \CheckSum{442}
+% \CheckSum{0}
%
% \CharacterTable
% {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
@@ -68,19 +87,18 @@
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \changes{v1.0}{2019/01/01}{Initial version}
-% \changes{v1.1}{2020/01/01}{Minor tweaks}
+% \changes{v1.0}{2019/01/01}{Initial version of the style file}
+% \changes{v1.1}{2020/01/01}{Transition to documented \LaTeX\ source file}
+% \changes{v1.2}{2020/03/01}{Inclusion of package options}
%
% \GetFileInfo{hep-paper.sty}
%
-% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
-% \DoNotIndex{\@ne}
-% \DoNotIndex{\advance,\begingroup,\catcode,\closein}
-% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
+% \DoNotIndex{\,,\@}
+% \DoNotIndex{\@affiliation,\@affil@opt,\@affil}
%
-% \title{The |hep-paper| package\thanks{This document corresponds to \protecting{|hep-paper|}~\fileversion, % dated \filedate.}}
+% \title{The |hep-paper| package\thanks{This document corresponds to \protecting{|hep-paper|}~\fileversion.}}
% \author{Jan Hajer \email{jan.hajer@uclouvain.be}}
-% \affiliation{UCLouvain}
+% \affiliation{Centre for Cosmology, Particle Physics and Phenomenology, Université catholique de Louvain, Louvain-la-Neuve B-1348, Belgium}
% \preprint{Preprint-Number}
% \date{\today}
% \date{\normalsize\filedate}
@@ -89,37 +107,81 @@
%
% \begin{abstract}
% The |hep-paper| package aims to provide a single style file containing most configurations and macros necessary to write appealing publications in High Energy Physics.
-% Instead of reinventing the wheel by introducing newly created macros |hep-paper| preferably loads third party packages as long as they are light weight enough.
+% Instead of reinventing the wheel by introducing newly created macros |hep-paper| preferably loads third party packages as long as they are lightweight enough.
% \end{abstract}
%
% \clearpage\tableofcontents\clearpage
%
-% \newgeometry{scale=0.76,vmarginratio={3:4}, left=10em, marginparwidth=4.6cm, marginparsep=3mm}
+% \newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}
%
% \section{Introduction}
%
-% For usual publications it is enough to load additionally to the |article| class without optional arguments only the |hep-paper| package.
+% For usual publications it is enough to load additionally to the |article| class without optional arguments only the |hep-paper| package \cite{hep-paper}.
%
% | \documentclass{article}|\\
% | \usepackage{hep-paper}|
%
-% The most notable changes after loading the |hep-paper| package is the change of some LaTeX defaults.
+% The most notable changes after loading the |hep-paper| package is the change of some \LaTeX\ defaults.
% The paper and font sizes are set to A4 and \unit[11]{pt}, respectively.
% Additionally, the paper geometry is set to the values known from the (depreciated) |a4wide| package \cite{a4wide} using the |geometry| package \cite{geometry}.
-% \footnote{Starting from this page the text of this document is additionally shifted to the right in order to facilitate a large left margin required by the |ltxdoc| package.
-% This combination leads to a less than optimal page layout.}
-% The font is changed to |lmodern| \cite{lmodern} with |microtype| \cite{microtype} optimizations.
-% Hyperlinks of the |hyperref| package \cite{hyperref} are activated and hidden.
-% Hyphenation is provided by the |babel| \cite{babel} and |polyglossia| \cite{polyglossia} packages in the case of normal TeX and LuaTeX repectively.
-% Finally, quotation commands are provided by the recommended |csquotes| package \cite{csquotes}.
-% \DescribeMacro{\MakeOuterQuote}
-% The last package provides the convenient macro |\MakeOuterQuote{"}| allowing to simply use |"| instead of the pair |``| and |''|.
+% Finally, the font is changed to |lmodern| \cite{lmodern} with |microtype| \cite{microtype} optimizations.
+% \PDF hyperlinks are implemented with the |hyperref| package \cite{hyperref}.
+%
+% \subsection{Options}
+%
+% \DescribeMacro{paper}
+% The |paper=|\meta{format} option loads the specified paper format.
+% The possible \meta{formats} are:
+% |a0|, |a1|, |a2|, |a3|, |a4|, |a5|, |a6|,
+% |b0|, |b1|, |b2|, |b3|, |b4|, |b5|, |b6|,
+% |c0|, |c1|, |c2|, |c3|, |c4|, |c5|, |c6|,
+% |ansia|, |ansib|, |ansic|, |ansid|, |ansie|,
+% |letter|, |executive|, |legal|.
+%
+% \DescribeMacro{font}
+% The |font=|\meta{size} option loads the specified font size.
+% The possible \meta{sizes} are:
+% |8pt|, |9pt|, |10pt|, |11pt|, |12pt|, |14pt|, |17pt|, |20pt|.
+%
+% \DescribeMacro{defaults}
+% The |defaults| option prevents the adjustment of the page geometry and the font size set by the document class.
+%
+% \DescribeMacro{lang}
+% The |lang|=\meta{name} option switches the document language to the chosen value.
+% The possible values are given by the |babel| package \cite{babel}.
+% The default is |british|.
+%
+% \DescribeMacro{parskip}
+% The |parskip| option makes use of the |parskip| package \cite{parskip} and changes how two paragraphs are separated from each other.
+% The \LaTeX\ default is separation via indentation the |parskip| option switches to separation via vertical space.
+% \footnote{The |parskip| option is used for this document.}
+%
+% \DescribeMacro{sansserif}
+% The |sansserif| option switches the document including math to sans serif font shape.
+%
+% \DescribeMacro{title}
+% The |title=false| option deactivates the titlepage adjustments.
+%
+% \DescribeMacro{manualplacement}
+% The |manualplacement| option reactivates manual float placement.
+%
+% \DescribeMacro{bibliography}
+% The |bibliography|=\meta{key} option prevents the automatic loading of the |biblatex| package \cite{biblatex} for \meta{key}=|false| or passes the \meta{key} as |style| string to the |biblatex| package.
+%
+% \DescribeMacro{glossaries}
+% The |glossaries=false| option deactives the use of the |glossaries| package \cite{glossaries, glossaries-extra}.
+%
+% \DescribeMacro{revtex}
+% The |revtex| option switches the |hep-paper| package into a |revtex| \cite{revtex} compatibility mode.
+%
+% \DescribeMacro{eqnarray}
+% The |eqnarray| option reactivates the depreciated |eqnarray| environment.
%
% \section{Macros and environments}
%
% \subsection{Title page}
%
-% The macros of this section are supposed to be used within the preamble.
+% The \PDF meta information is set according to the |\title|\marg{text} and |\author|\marg{text} information.
% \DescribeMacro{\author}
% \DescribeMacro{\affiliation}
% \DescribeMacro{\email}
@@ -127,76 +189,172 @@
% The following lines add \eg two authors with different affiliations
%
% | \author[1]{Author one \email{Email one}}|\\
-% | \affiliation{Affiliation one}|\\
+% | \affiliation[1]{Affiliation one}|\\
% | \author[2]{Author two \email{Email two}}|\\
% | \affiliation[1,2]{Affiliation two}|
%
% \DescribeMacro{\preprint}
-% The |\preprint|\marg{text} macro places a preprint number in the upper right corner of the title page.
-% The PDF meta information is set according to the |\title|\marg{text} and |\author|\marg{text} information.
+% The |\preprint|\marg{numer} macro places a pre-print number in the upper right corner of the first page.
+%
% \DescribeEnv{abstract}
-% The |abstract| environment has been adjusted to not start with identation.
+% The |abstract| environment has been adjusted to not start with an indentation.
%
-% \subsection{References and footnotes}
+% \subsection{Text}
+%
+% \DescribeMacro{\enquote}
+% Hyphenation is provided by the |babel| package \cite{babel} and quotation commands are provided by the |csquotes| package \cite{csquotes} recommended by the |babel| package.
+% \DescribeMacro{\MakeOuterQuote}
+% The latter package provides the convenient macro |\MakeOuterQuote{"}| allowing to simply use |"| instead of the pair |``| and |''|.
%
% \DescribeMacro{\eg}
-% \DescribeMacro{\ie}
-% The |foreign| package \cite{foreign} defines macros such as |\eg|, |\ie|, and |\cf| which are typeset as \eg, \ie, and \cf.
-
-% \DescribeMacro{\ref}
-% \DescribeMacro{\cite}
-% References and citations are adjusted to not start on a new line in order to avoid the repeated use of |~\ref|\marg{text} and |~\cite|\marg{text}.
+% \DescribeMacro{\vs}
+% The |foreign| package \cite{foreign} defines macros such as |\eg|, |\ie|, |\cf|, and |\vs| which are typeset as \eg, \ie, \cf, and \vs.
+%
+% \DescribeMacro{\no}
+% The |\no|\marg{number} macro is typeset as \no{123}.
+%
+% \DescribeMacro{\software}
+% The |\software|\oarg{version}\marg{name} macro is typeset as \software[\fileversion]{HEP-Paper}.
+%
+% \DescribeMacro{\online}
+% The |\online|\marg{url}\marg{text} macro combines the features of the |\href|\marg{url}\marg{text} and the |\url|\marg{text} macros, resulting in \eg \online{https://ctan.org/pkg/hep-paper}{ctan.org/pkg/hep-paper}.
+%
+% \DescribeMacro{inlinelist}
+% Using the |enumitem| package \cite{enumitem} the |inlinelist|
+%
+% \begin{example}
+% |The three main points are|
+%
+% |\begin{inlinelist}|
+%
+% | \item one|
+%
+% | \item two|
+%
+% | \item three|
+%
+% |\end{inlinelist}|
+% \second
+% The three main points are
+% \begin{inlinelist}
+% \item one
+% \item two
+% \item three
+% \end{inlinelist}
+% \end{example}
+%
+% \DescribeMacro{enumdescript}
+% and the |enumdescript| environments are defined
+%
+% \begin{example}[.6]
+% |\begin{enumdescript}[label=\Roman*)]|
+%
+% | \item{First} one|
+%
+% | \item{Second} two|
+%
+% | \item{Third} three|
+%
+% |\end{enumdescript}|
+% \second
+% \begin{enumdescript}[label=\Roman*)]
+% \item{First} one
+% \item{Second} two
+% \item{Third} three
+% \end{enumdescript}
+% \end{example}
+%
+% \DescribeMacro{\textsc}
+% A sans serif version of \textsf{\textsc{Small Caps}} is provided.
+%
+% \DescribeMacro{\useparskip}
+% \DescribeMacro{\useparindent}
+% If the |parskip| option is activated the |\useparindent| macro switches back the usual parindent mode, while the |\useparskip| macro switches to the parskip mode.
+%
+% \subsubsection{References and footnotes}
%
% \DescribeMacro{\cref}
-% References are extended with the |cleveref| package \cite{cleveref}, which allows to \eg write just |\cref|\marg{figure} in order to get 'Figure 1'.
-% The |cleveref| package furthermore allows to reference multiple objects within one |\cref|\marg{text} (similar to the |\cite|\marg{text} macro).
+% References are extended with the |cleveref| package \cite{cleveref}, which allows to \eg just type |\cref|\marg{key} in order to write 'Figure 1'.
+% Furthermore, the |cleveref| package allows to reference multiple objects within one |\cref|\marg{key} (similar to the |\cite|\marg{key} macro).
+%
+% \DescribeMacro{\cite}
+% Citations are adjusted to not start on a new line in order to avoid the repeated use of |~\cite|\marg{key}.
%
+% \DescribeMacro{\ref}
% \DescribeMacro{\eqref}
-% The |\eqref|\marg{text} macro is also adjusted to not start on a new line and be able to reference multiple equations at once.
+% \DescribeMacro{\subref}
+% References are also adjusted to not start on a new line and are redefined in order to handle multiple references at once.
%
% \DescribeMacro{\footnote}
% Footnotes are adjusted to swallow white space before the footnote mark and at the beginning of the footnote text.
%
+% \subsubsection{Acronyms}
+%
+% \DescribeMacro{\acronym}
+% \DescribeMacro{\shortacronym}
+% \DescribeMacro{\longacronym}
+% The |\acronym|\meta{*}\oarg{typeset abbreviation}\marg{abbreviation}\marg{definition}\oarg{plural\linebreak[4]definition} macro generates the singluar |\|\meta{abbreviation} and plural |\|\meta{abbreviation}|s| macros.
+% The starred version does not add an \enquote{s} to the abbreviation plural.
+% The long form is only shown at the first appearance of these macros, later appearances generate the abbreviation with a hyperlink to the long form.
+% Capitalization at the beginning of paragraphs and sentences is ensured.
+% The |\shortacronym| and |\longacronym| macros only show the short or long form of their acronym.
+% \DescribeMacro{\resetacronym}
+% \DescribeMacro{\dummyacronym}
+% The first use form of the acronym can be enforced by resetting the acronym counter.
+% If the acronym counter equals one at the end of the document the short form of the acronym is not introduced.
+% Placing a |\dummyacronym|\marg{key} at the end of the document ensures that the short form is introduced.
+%
% \subsection{Math}
%
% The |mathtools| \cite{mathtools} and |amssymb| \cite{amsfonts} packages are loaded.
% They in turn load the |amsmath| \cite{amsmath} and |amsfonts| \cite{amsfonts} packages.
% \DescribeMacro{\mathbf}
-% Bold math, including |\mathbf| is provided by the |bm| package \cite{bm}.
-% Macros switching to |bfseries| such as |\title|\marg{text} and |\section|\marg{text} are ensured to also typeset math in bold.
+% Bold math, including |\mathbf| is provided by the |bm| package \cite{bm}, \ie ($ A b \Gamma \delta \mathbf A \mathbf b \mathbf \Gamma \mathbf \delta$).
+% Macros switching to |bfseries| such as |\section|\marg{text} are ensured to also typeset math in bold.
% This may cause trouble if bold symbols carry an additional non-implicit meaning.
-% \DescribeMacro{\mathsfit}
-% Add an additional math italic sf font $\mathsfit A \mathsfit B \mathsfit C$ $\bm {\mathsfit A} \bm{\mathsfit B} \bm{\mathsfit C}$
-%
% \DescribeMacro{\text}
-% The |\text|\marg{text} macro makes it possible to write text within math mode.
-% The often used |\mathrm|\marg{text} and |\rm|\marg{text} macros are \emph{not} the right tool for this purpose.
+% The |\text|\marg{text} macro makes it possible to write text within math mode, \ie ($ \text A \text b \text \Gamma \text \delta \text{\textbf A} \text{\textbf b} \text{\textbf \Gamma} \text{\textbf \delta}$).
+% The often used |\mathrm|\marg{text} and |\rm|\marg{text} macros are \emph{not} the correct tool for this purpose, as they switch to roman font shape.
+% This behaviour conflicts \eg with the |sansserif| package option.
+% \DescribeMacro{\mathsf}
+% The math sans serif alphabet is redefined to be italic sans serif if the main text is serif and italic serif if the main text is sans serif, \ie ($\mathsf A \mathsf b \mathsf \Gamma \mathsf \delta \mathbf{\mathsf A} \mathbf{\mathsf b} \mathbf{\mathsf \Gamma} \mathbf{\mathsf \delta}$).
+% Details about the font handling in \TeX\ can be found in \cite{fntguide}.
+% \DescribeMacro{\mathscr}
+% The |\mathcal| font \ie ($\mathcal{ABCD}$) is accompanied by the |\mathscr| font \ie ($\mathscr{ABCD}$).
%
% \DescribeMacro{\nicefrac}
% \DescribeMacro{\flatfrac}
-% The |\frac|\marg{number}\marg{number} macro is accompanied by |\nicefrac|\marg{number}\marg{number} and |\flatfrac|\marg{number}\marg{number}.
-% Providing the choices
+% The |\frac|\marg{number}\marg{number} macro is accompanied by |\nicefrac|\linebreak[1]\marg{number}\linebreak[1]\marg{number} and |\flatfrac|\marg{number}\marg{number}
% \begin{align}
% \frac12 \ ,&& \nicefrac 12 \ ,&& \flatfrac 12\ .
% \end{align}
+% \DescribeMacro{\diag}
+% A diagonal matrix operator is defined |\diag|.
+%
+% \DescribeMacro{\mathdef}
+% The |\mathdef|\marg{name}\oarg{arguments}\marg{code} macro (re-)defines macros only within math mode without changing the text mode definition.
+% \DescribeMacro{\i}
+% The imaginary unit $\i$ is defined using this functionality.
+%
% \DescribeMacro{\numberwithin}
-% For longer paper it can be useful to re-number the equation in accordance with the section |\numberwithin{equation}{section}|.
+% For longer paper it can be useful to re-number the equation in accordance with the section numbering |\numberwithin{equation}{section}|.
% \DescribeMacro{\subequations}
% In order to further reduce the size the of equation counter it can be useful to wrap |align| environments with multiple rows in a |subequations| environment.
%
+% \DescribeMacro{eqnarray}
+% The depreciated |eqnarray| environment is undefined as long this behaviour is not prevented by the |eqnarray| package option.
+% The |align| environment should be used instead.
+%
% \subsubsection{Physics}
%
-% Greek letters are adjusted to be italic and upright in math and text mode, respectively, using the |fixmath| \cite{fixmath} and |alphabeta| \cite{alphabeta} packages.
+% Greek letters are adjusted to always be italic and upright in math and text mode, respectively, using the |fixmath| \cite{fixmath} and |alphabeta| \cite{alphabeta} packages.
% This allows differentiations like
% \begin{align}
% \sigma &= \unit[5]{fb} \ , & &\text{at \unit[5]{\sigma} C.L.} \ , & \mu &= \unit[5]{cm} \ , & l &= \text{\unit[5]{\mu m}} \ ,
% \label{eq:greek}
% \end{align}
% and \eg to distinguish gauge $\nu$ and mass \nu\ eigenstates in models with massive light neutrinos.
-% Additionally, greek letters can now also typed directly using unicode.
-%
-% \DescribeMacro{\slashed}
-% The |\slashed|\marg{symbol} macro from the |slashed| \cite{slashed} package allows to use the Dirac slash notation.
+% Additionally, Greek letters can also be directly typed using Unicode.
%
% \DescribeMacro{\ev}
% \DescribeMacro{\pdv}
@@ -212,6 +370,9 @@
% &&\det(M)\ .
% \end{align}
%
+% \DescribeMacro{\slashed}
+% The |\slashed|\marg{character} macro from the |slashed| \cite{slashed} package allows to use the Dirac slash notation.
+%
% \DescribeMacro{\overleftright}
% A better looking over left right arrow is defined $\overleftright{\partial}$.
% \DescribeMacro{\unit}
@@ -223,8 +384,12 @@
%
% \DescribeEnv{figure}
% \DescribeEnv{table}
-% Manual float placement is deactivated and automatic float placement is adjusted to place one float at the top of pages and to reduce the number of float pages.
-% The most useful float placement is usually archived by placing the float \emph{in front} of the paragraph it is referenced first.
+% Automatic float placement is adjusted to place a single float at the top of pages and to reduce the number of float pages.
+% The most useful float placement is usually archived by placing the float \emph{in front} of the paragraph it is referenced in first.
+% Additionally, manual float placement is deactivated but can be reactivated using the |manualplacement| package option.
+% \DescribeMacro{\raggedright}
+% The float environments have been adjusted to center their content.
+% The usual behaviour can be reactivated using |\raggedright|.
%
% \begin{table}
% \begin{panels}{.6}
@@ -247,198 +412,313 @@
% % \caption{The \protecting{|booktabs|} and \protecting{|multirow|} features.}
% \label{tab:booktabs}
% \end{panels}
-% \caption{Example use of the \protecting{|panels|} environment in Panel \subref{tab:panels} and the features from the \protecting{|booktabs|} and \protecting{|multirow|} packages in Panel \subref{tab:booktabs}.}
-% \label{tab:table}
+% \caption{Example use of the \protecting{|panels|} environment in Panel \subref{tab:panels} and the features from the \protecting{|booktabs|} and \protecting{|multirow|} packages in Panel \subref{tab:booktabs}.
+% } \label{tab:table}
% \end{table}
%
% \DescribeEnv{panels}
% \DescribeMacro{\panel}
% The |panels| environment makes use of the |subcaption| package \cite{subcaption}.
-% It provides subfloats and takes as mandatory argument either the number of subfloats (default 2) or the width of the first subfloat as fraction of the |\linewidth|.
-% Within the |\begin{panels}|\oarg{vert}\marg{width} environment the |\panel| macro initiates a new subfloat, in case that the width of the first subfloat has been given as an optional argument to the |panels| environment the |\panel|\marg{width} macro takes the width of the next subfloat as mandatory argument.
+% It provides sub-floats and takes as mandatory argument either the number of sub-floats (default~2) or the width of the first sub-float as fraction of the |\linewidth|.
+% Within the |\begin{panels}|\oarg{vert}\marg{width} environment the |\panel| macro initiates a new sub-float.
+% In the case that the width of the first sub-float has been given as an optional argument to the |panels| environment the |\panel|\marg{width} macro takes the width of the next sub-float as mandatory argument.
% The example code is presented in \cref{tab:panels}.
%
% \DescribeEnv{tabular}
% The |booktabs| \cite{booktabs} and |multirow| \cite{multirow} packages are loaded enabling publication quality tabulars such as in \cref{tab:booktabs}.
%
% \DescribeMacro{\graphic}
-% \DescribeMacro{\graphicspath}
-% The |graphicx| package \cite{graphicx} is loaded and the |\graphic|\oarg{width}\marg{figure} macro is defined, which is a wrapper for the |\includegraphics|\marg{figure} macro and takes the figure width as fraction of the |\linewidth| as optional argument (default 1).
-% If the graphics are located in a subfolder its path can be indicated by |\graphicspath{{./|$\langle path\rangle$|/}}|.
-% \DescribeMacro{\raggedright}
-% The float environments have been adjusted to center their content.
-% The usual behaviour is reactived with |\raggedright|.
+% \DescribeMacro{\graphics}
+% The |graphicx| package \cite{graphicx} is loaded and the |\graphic|\oarg{width}\marg{figure} macro is defined, which is a wrapper for the |\includegraphics|\marg{figure} macro and takes the figure width as fraction of the |\linewidth| as optional argument (default~1).
+% If the graphics are located in a sub-folder its path can be indicated by |\graphics|\marg{subfolder}.
%
% \subsection{Bibliography}
%
% \DescribeMacro{\bibliography}
% \DescribeMacro{\printbibliography}
-% For bibliography management the |biblatex| package \cite{biblatex} is loaded and extended to be able to cope with the |collaboration| and |report| fields provided by |inspire|.
-% The user has to add the line |\bibliography|\marg{mybib} to the preamble of the document and |\printbibliography| at the end of the document.
+% The |biblatex| package \cite{biblatex} is loaded for bibliography management.
+% The user has to add the line |\bibliography|\marg{my.bib} to the preamble of the document and |\printbibliography| at the end of the document.
% The bibliography is generated by |biber| \cite{biber}.
+% |biblatex| is extended to be able to cope with the |collaboration| and |reportNumber| fields provided by \online{https://inspirehep.net}{inspirehep.net} and a bug in the volume number is fixed.
+% Additionally, \online{https://ctan.org}{ctan.org}, \online{https://github.com}{github.com}, \online{https://gitlab.com}{gitlab.com}, \online{https://sourceforge.net}{sourceforge.net}, and \online{https://hepforge.org}{hepforge.org} are recognized as |eprinttype|s.
+% \DescribeMacro{erratum}
+% Errata can be included using the |related| feature.
+%
+% | \article{|\meta{key1}|,|\\
+% | |\dots|,|\\
+% | relatedtype="erratum",|\\
+% | related="|\meta{key2}|",|\\
+% | }|\\
+% | \article{|\meta{key2}|,|\\
+% | |\dots|,|\\
+% | }|
%
% \section{Conclusion}
%
-% The majority of macros defined and packages loaded by this package are fairly lightweight and provide the author with the necessary tools to focus on the content instead of the layout.
+% The |hep-paper| package provides a matching selection of preloaded packages and additional macros enabling the user to focus on the content instead of the layout by reducing the amount of manual tasks.
+% The majority of the loaded packages are fairly lightweight, the others can be deactivated with package options.
%
% \DescribeMacro{arxiv-collector}
-% ArXiv requires the setup dependent |bbl| files instead of the original |bib| files, which causes trouble if the local LaTeX version differes from the one used by ArXiv.
-% The |arxiv-collector| python script \cite{arxiv-collector} alleviates this problem by collecting all files necessary for publication on ArXiv (including figures) .
+% ArXiv requires the setup dependent |bbl| files instead of the original |bib| files, which causes trouble if the local \LaTeX\ version differs from the one used by arXiv.
+% The |arxiv-collector| python script \cite{arxiv-collector} alleviates this problem by collecting all files necessary for publication on arXiv (including figures).
%
% \StopEventually{
% \printbibliography
+% \PrintChanges
% }
%
% \appendix
%
-% \section{Implementation}
-%
-% \subsection{Options}
-%
-% Redefine article options and choose sane values.
-%
-% \subsubsection{Paper size}
+% \section{Options}
%
-% Redefine the article paper sizes options without any changes.
-% \paragraph{A4 paper}
+% Load the |kvoptions| package and define a |hep| namespace.
+% \DoNotIndex{\RequirePackage,\SetupKeyvalOptions}
% \begin{macrocode}
-\DeclareOption{a4paper}{%
- \setlength\paperheight{297mm}%
- \setlength\paperwidth{210mm}%
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=hep,
+ prefix=hep@
}
% \end{macrocode}
%
-% \paragraph{A5 paper}
+% \begin{macro}{paper}
+% Define a |paper=|\meta{size} option.
+% Make A4 paper the default.
+% \DoNotIndex{\DeclareStringOption}
+% \begin{macrocode}
+\DeclareStringOption[a4]{paper}
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{font}
+% Define a |font=|\meta{size} option.
+% Make \unit[11]{pt} the default font size.
% \begin{macrocode}
-\DeclareOption{a5paper}{%
- \setlength\paperheight{210mm}%
- \setlength\paperwidth{148mm}%
-}
+\DeclareStringOption[11pt]{font}
% \end{macrocode}
+% \end{macro}
%
-% \paragraph{B5 paper}
+% \begin{macro}{defaults}
+% Define the |defaults| option which deactivates the |paper| and |font| options and prevents the change of the class defaults by this package.
+% \DoNotIndex{\DeclareBoolOption,\ifhep@defaults}
% \begin{macrocode}
-\DeclareOption{b5paper}{%
- \setlength\paperheight{250mm}%
- \setlength\paperwidth{176mm}%
-}
+\DeclareBoolOption[false]{defaults}
% \end{macrocode}
+% \end{macro}
%
-% \paragraph{Letter paper}
+% \begin{macro}{lang}
+% Define the |lang| option, which takes the values provided by the |babel| package \cite{babel}.
+% Make |british| the default language.
% \begin{macrocode}
-\DeclareOption{letterpaper}{%
- \setlength\paperheight{11in}%
- \setlength\paperwidth{8.5in}%
-}
+\DeclareStringOption[british]{lang}
% \end{macrocode}
+% \end{macro}
%
-% \paragraph{Legal paper}
+% \begin{macro}{parskip}
+% Define the option pair |parindent| and |parskip| controlling the separation of paragraphs.
+% \DoNotIndex{\DeclareComplementaryOption,\ifhep@parindent}
% \begin{macrocode}
-\DeclareOption{legalpaper}{%
- \setlength\paperheight{14in}%
- \setlength\paperwidth{8.5in}%
-}
+\DeclareBoolOption[true]{parindent}
+\DeclareComplementaryOption{parskip}{parindent}
% \end{macrocode}
+% \end{macro}
%
-% \paragraph{Executive paper}
+% \begin{macro}{sansserif}
+% Define the option pair |serif| and |sansserif| controling the font shape of the whole document.
+% \DoNotIndex{\ifhep@serif}
% \begin{macrocode}
-\DeclareOption{executivepaper}{%
- \setlength\paperheight{10.5in}%
- \setlength\paperwidth{7.25in}%
-}
+\DeclareBoolOption[true]{serif}
+\DeclareComplementaryOption{sansserif}{serif}
% \end{macrocode}
-% Define the landscape option
+% \end{macro}
+%
+% \begin{macro}{eqnarray}
+% Provide the option |eqnarray| for reactivating the |eqnarray| environment.
+% \DoNotIndex{\ifhep@eqnarray}
% \begin{macrocode}
-\DeclareOption{landscape}{%
- \setlength\@tempdima{\paperheight}%
- \setlength\paperheight{\paperwidth}%
- \setlength\paperwidth{\@tempdima}%
-}
+\DeclareBoolOption[false]{eqnarray}
% \end{macrocode}
-
-% \subsubsection{Font size}
+% \end{macro}
%
-% Redefine the article font sizes options.
+% \begin{macro}{bibliography}
+% Provide the option |bibliography| for passing a |style| string to the |biblatex| package \cite{biblatex} or disabling the automatic loading of |biblatex|.
% \begin{macrocode}
-\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
-\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
-\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
+\DeclareStringOption[numeric-comp]{bibliography}
% \end{macrocode}
-% Define the package option |placement|.
-
-% \subsubsection{Placement}
+% \end{macro}
%
+% \begin{macro}{glossaries}
+% Provide the option |glossaries| able to turn of the use of the |glossaries-extra| package \cite{glossaries-extra}.
+% \DoNotIndex{\ifhep@glossaries}
% \begin{macrocode}
-\DeclareOption{placement}{\def\@placement}
+\DeclareBoolOption[true]{glossaries}
% \end{macrocode}
-
-% \subsubsection{Execute options}
+% \end{macro}
%
-% Change the paper size to a4 and the font size to \unit[11]{pt}.
+% \begin{macro}{manualplacement}
+% Provide the |manualplacement| option for reactivating the manual placement of floats.
+% \DoNotIndex{\ifhep@manualplacement}
% \begin{macrocode}
-\ExecuteOptions{a4paper,11pt}
-\ProcessOptions\relax
+\DeclareBoolOption[false]{manualplacement}
% \end{macrocode}
+% \end{macro}
%
-% \subsection{Font size}
+% \begin{macro}{title}
+% Provide the option |title| for deactivating redefinition of title macros.
+% \DoNotIndex{\ifhep@title}
+% \begin{macrocode}
+\DeclareBoolOption[true]{title}
+% \end{macrocode}
+% \end{macro}
%
-% Undefine previously defined font sizes and load the LaTeX font size file corresponding to the font size option loaded before.
+% \begin{macro}{revtex}
+% Provide the option |revtex| for |revtex| \cite{revtex} compatibility mode.
% \begin{macrocode}
-\let\small\relax
-\let\footnotesize\relax
-\let\scriptsize\relax
-\let\tiny\relax
-\let\large\relax
-\let\Large\relax
-\let\LARGE\relax
-\let\huge\relax
-\let\Huge\relax
-\input{size1\@ptsize.clo}
+\DeclareBoolOption[false]{revtex}
% \end{macrocode}
+% \end{macro}
-% \subsection{Geometry}
+% \subsection{Process options}
%
-% Load the |geometry| package \cite{geometry} and adjust the text width and height to the values of the |a4wide| package \cite{a4wide}.
% \begin{macrocode}
-\RequirePackage[hscale=.76, vscale=.8, vmarginratio=3:4, includeheadfoot]{geometry}
+\ProcessKeyvalOptions*
+% \end{macrocode}
+% Set the |revtex| compatibility options.
+% \DoNotIndex{\ifhep@revtex,\setkeys,\fi}
+% \begin{macrocode}
+\ifhep@revtex
+ \setkeys{hep}{defaults, title=false, lang=american, bibliography=false}
+\fi
% \end{macrocode}
-% \subsection{Text}
+
+% \section{Engine}
%
-% Load the |ifluatex| package \cite{ifluatex} and check if |lualatex| is being used.
-% In this case load the |fontspec| package \cite{fontspec} and the default font features together with the |polyglossia| package \cite{polyglossia}.
-% In the case of traditional LaTeX load the |inputenc| \cite{inputenc}, |fontenc| \cite{fontenc}, and |textcomp| \cite{textcomp} packages, in order to set the input and output properties of the font encoding and extend the known characters.
-% Additionally, load the the |babel| package \cite{babel} for hyphenation.
-% In both cases load also the recommended |csquotes| package \cite{csquotes}.
+% \begin{macro}{\ifxetexorluatex}
+% Load the |ifluatex| \cite{ifluatex} and |ifxetex| \cite{ifxetex} packages.
+% Define the |\ifxetexorluatex| conditional.
+% \DoNotIndex{\newif,\ifxetex,\xetexorluatextrue,\else,\ifluatex,\xetexorluatexfalse,\fi}
% \begin{macrocode}
\RequirePackage{ifluatex}
-\ifluatex
- \RequirePackage{fontspec}
- \defaultfontfeatures{Ligatures=TeX}
- \RequirePackage{polyglossia}
- \setmainlanguage{british}
+\RequirePackage{ifxetex}
+\newif\ifxetexorluatex
+\ifxetex\xetexorluatextrue\else
+ \ifluatex\xetexorluatextrue
+ \else\xetexorluatexfalse
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}
+
+% \section{Text}
+%
+% Load |alphabeta| package \cite{alphabeta} first in order to archive the correct behaviour.
+% The |alphabeta| package provides upright Greek letters in text mode.
+% \begin{macrocode}
+\RequirePackage{alphabeta}
+% \end{macrocode}
+%
+% Pick the correct font encoding depending on the engine used and load the |fontenc| package \cite{fontenc} with this encoding.
+% For details of the font encoding see \cite{encguide}.
+% \DoNotIndex{\def,\@encoding}
+% \begin{macrocode}
+\ifxetexorluatex
+ \def\@encoding{TU}
\else
- \RequirePackage[utf8]{inputenc}
- \RequirePackage[T1]{fontenc}
- \RequirePackage{textcomp}
- \RequirePackage[british]{babel}
+ \def\@encoding{T1}
\fi
-\RequirePackage{csquotes}
+\RequirePackage[\@encoding]{fontenc}
% \end{macrocode}
-% Load the |lmodern| font, and the |microtype| font optimization.
+% Load the |lmodern| font \cite{lmodern}, the |textcomp| extension \cite{textcomp}, and the |microtype| font optimization \cite{microtype}.
% \begin{macrocode}
\RequirePackage{lmodern}
+\RequirePackage{textcomp}
\RequirePackage{microtype}
% \end{macrocode}
-% \subsubsection{Text macros}
+% Define sans serif small caps font shapes.
+% \DoNotIndex{\DeclareFontShape,\sffamily}
+% \begin{macrocode}
+\ifxetexorluatex
+ \DeclareFontShape{\@encoding}{lmss}{bx}{sc}{<->cmssbxcsc10}{}
+ \DeclareFontShape{\@encoding}{lmss}{m}{sc}{%
+ <-9>cmsscsc8<9-10>cmsscsc9<10->cmsscsc10%
+ }{}
+\else
+ \sffamily
+ \DeclareFontShape{\@encoding}{lmss}{bx}{sc}{<->ssub*xcmss/bx/sc}{}
+ \DeclareFontShape{\@encoding}{lmss}{m}{sc}{<->ssub*xcmss/m/sc}{}
+\fi
+% \end{macrocode}
+
+% Load the |inputenc| \cite{inputenc} package.
+% \begin{macrocode}
+\ifxetexorluatex\else
+ \RequirePackage[utf8]{inputenc}
+\fi
+% \end{macrocode}
+
+% Load the |babel| \cite{babel} package for hyphenation and the recommended |csquotes| package \cite{csquotes}.
+% \DoNotIndex{\hep@lang}
+% \begin{macrocode}
+\RequirePackage[\hep@lang]{babel}
+\RequirePackage{csquotes}
+% \end{macrocode}
+
+% Set the whole text to sans serif if requested.
+% \DoNotIndex{\ifhep@serif,\renewcommand,\familydefault,\sfdefault}
+% \begin{macrocode}
+\ifhep@serif\else
+ \renewcommand\familydefault{\sfdefault}
+\fi
+% \end{macrocode}
+
+% \begin{macro}{\underline}
+% Load the |soul| package \cite{soul} for hyphenable underlined text.
+% \DoNotIndex{\let}
+% \begin{macrocode}
+\RequirePackage{soul}
+\let\underline\ul
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Font size}
+%
+% Undefine previously defined font sizes and load the \LaTeX\ font size file corresponding to the font size option.
+% \DoNotIndex{\remove@pt,\edef,\@ptsize,\expandafter,\small,\relax,\footnotesize,\scriptsize}
+% \begin{macrocode}
+\ifhep@defaults\else
+ \def\remove@pt#1pt{#1}
+ \edef\@ptsize{\expandafter\remove@pt\hep@font}
+ \let\small\relax
+ \let\footnotesize\relax
+ \let\scriptsize\relax
+ \let\tiny\relax
+ \let\large\relax
+ \let\Large\relax
+ \let\LARGE\relax
+ \let\huge\relax
+ \let\Huge\relax
+ \input{size\@ptsize.clo}
+\fi
+% \end{macrocode}
+
+% \subsection{Text macros}
%
%\begin{macro}{\vs}
% Load the |foreign| package \cite{foreign} in order to highlight abbreviations and vocabularies from foreign languages.
% Add the missing |\vs| command.
+% \DoNotIndex{\DeclareRobustCommand,\xperiodafter,\foreignabbrfont,\pdf@strcmp,\hep@lang@foreign}
% \begin{macrocode}
-\RequirePackage[all,british]{foreign}
+\RequirePackage{pdftexcmds}
+\newcommand{\hep@lang@foreign}{british}
+\ifnum\pdf@strcmp{\hep@lang}{american}=0%
+ \renewcommand{\hep@lang@foreign}{USenglish}%
+\fi
+\ifnum\pdf@strcmp{\hep@lang}{USenglish}=0%
+ \renewcommand{\hep@lang@foreign}{USenglish}%
+\fi
+\RequirePackage[all, \hep@lang@foreign]{foreign}
\DeclareRobustCommand\vs{\xperiodafter{{\foreignabbrfont{vs}}}}
% \end{macrocode}
% \end{macro}
@@ -450,63 +730,110 @@
% \end{macrocode}
% \end{macro}
-%\begin{macro}{\software}\label{test}
-% Define a macro for software with optional version information |\software|\oarg{version}\marg{text}.
+%\begin{macro}{\software}
+% Define a macro for software with optional version information |\software|\linebreak[1]\oarg{version}\linebreak[1]\marg{name}, using the |relsize| package \cite{relsize}.
+% \DoNotIndex{\hspace,\fontdimen,\font,\smaller,\textsc}
% \begin{macrocode}
-\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{\texttt{#2}~#1}
+\RequirePackage{relsize}
+\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{%
+ {\smaller\textsc{#2}~#1}%
+}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\sloppy}
-% Redefine |sloppy| to be less invasive \cf |\printbibliography|
+% \begin{macro}{\online}
+% The |\online|\marg{text}\marg{url} macro combines the features of the |\href| and the |\url| macros.
+% \DoNotIndex{\href,\url}
% \begin{macrocode}
-\def\sloppy{%
- \emergencystretch 3em \hfuzz .5\p@ \vfuzz\hfuzz%
-}
+\newcommand{\online}[2]{\href{#1}{\url{#2}}}
% \end{macrocode}
% \end{macro}
-%\begin{macro}{\no@break@before}
-% Provide macro able to prevent line breaks.
+% \subsection{Lists}
+
+% Load the |enumitem| package \cite{enumitem}.
% \begin{macrocode}
-\newcommand\no@break@before{%
- \relax\ifvmode\else%
- \ifhmode%
- \ifdim\lastskip > 0pt%
- \relax\unskip\nobreakspace%
- \fi%
- \fi%
- \fi%
-}
+\RequirePackage[inline]{enumitem}
% \end{macrocode}
-% \end{macro}
-
-% \subsubsection{Lists}
%
% \begin{environment}{inlinelist}
-% Load the |enumitem| package \cite{enumitem} and define an inline list.
+% Define an inline list environment.
+% \DoNotIndex{\newlist,\setlist*,\ }
% \begin{macrocode}
-\RequirePackage[inline]{enumitem}
\newlist{inlinelist}{enumerate*}{1}
-\setlist*[inlinelist,1]{itemjoin={,\ }, itemjoin*={, and\ }, after=.}
+\setlist*[inlinelist,1]{%
+ label=\roman*), itemjoin={,\ }, itemjoin*={, and\ }, after=.%
+}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{enumdescript}
+% Define an enumdescript list environment.
+% \DoNotIndex{\arabic*,\old@item,\item,ifx,\textbf,\empty,\@ifnextchar,\par,\@gobble}
+% \begin{macrocode}
+\newlist{enum@descript}{enumerate}{2}
+\setlist[enum@descript]{label=\arabic*.}
+\newenvironment{enumdescript}[1][]{
+\begin{enum@descript}[#1]
+ \let\old@item\item
+ \renewcommand{\item}[2][]{
+ \ifx&##1&\old@item\else\old@item[##1]\fi
+ \textbf{##2}\ifx##2\empty\else~\fi\@ifnextchar\par\@gobble\relax
+ }
+}{\end{enum@descript}}
% \end{macrocode}
% \end{environment}
-% \subsubsection{Footnotes}
+% \subsection{Footnotes}
%
% \begin{macro}{\footnote}
% Ensure that no spaces appear before the footmark or at the beginning of the footnote.
+% \DoNotIndex{\unskip,\@foot@note,\ignorespaces}
% \begin{macrocode}
\let\@foot@note\footnote
\renewcommand{\footnote}[1]{\unskip\@foot@note{\ignorespaces#1}}
% \end{macrocode}
% \end{macro}
-% \subsection{Math}
+% \section{Geometry}
+%
+% Load the |geometry| package \cite{geometry} and adjust the text width and height to the values of the |a4wide| package \cite{a4wide}.
+% \DoNotIndex{\ifhep@defaults,\hep@paper,\geometry}
+% \begin{macrocode}
+\ifhep@defaults\else
+ \RequirePackage[\hep@paper paper]{geometry}
+ \geometry{hscale=.75, vscale=.8, vmarginratio=3:4, includeheadfoot}
+\fi
+% \end{macrocode}
+
+%\begin{macro}{\useparskip}
+%\begin{macro}{\useparindent}
+% Load the |parskip| package \cite{parskip} and provide two commands switching between the two paragraph modes.
+% \DoNotIndex{\ifhep@parindent,\setlength,\parskip,\baselineskip,\parindent}
+% \begin{macrocode}
+\ifhep@parindent\else
+\RequirePackage{parskip}
+\newcommand{\useparskip}{%
+ \setlength{\parskip}{.5\baselineskip plus 2pt}%
+ \setlength{\parindent}{0pt}%
+}
+\newcommand{\useparindent}{%
+ \setlength{\parskip}{0pt}%
+ \setlength{\parindent}{15pt}%
+ \if@twocolumn\setlength\parindent{1em}
+ \else\setlength\parindent{1.5em}
+ \fi
+}
+\fi
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+
+% \section{Math}
%
% Load the |mathtools| package \cite{mathtools} which loads the |amsmath| package \cite{amsmath}.
% Additionally, load the |amssymb| package \cite{amsfonts} which provides further math symbols and also loads the |amsfont| package \cite{amsfonts}.
-% Allow pagebreaks within equations if necessary.
+% Allow page breaks within equations if necessary.
% \begin{macrocode}
\RequirePackage{mathtools}
\RequirePackage{amssymb}
@@ -520,22 +847,79 @@
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\mathdef}
+% Define the |\mathdef|\marg{name}\oarg{arguments}\marg{macro} macro which (re-)defines macros in math mode only.
+% This macro is implemented using the |xparse| package \cite{xparse}.
+% \begin{macrocode}
+\RequirePackage{xparse}
+\DeclareDocumentCommand{\mathdef}{mO{0}m}{%
+ \expandafter\let\csname old\string#1\endcsname=#1
+ \expandafter\newcommand\csname new\string#1\endcsname[#2]{#3}
+ \DeclareRobustCommand#1{%
+ \ifmmode
+ \expandafter\let\expandafter\next\csname new\string#1\endcsname
+ \else
+ \expandafter\let\expandafter\next\csname old\string#1\endcsname
+ \fi
+ \next
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+
% \begin{macro}{\i}
-% Provide an upright imaginary unit. This will cause trouble in languages where the letter |\i| is used.
+% Provide an upright imaginary unit in math mode.
% \begin{macrocode}
-\AtEndOfClass{\let\i\undefined\DeclareMathOperator{\i}{i}}
+\AtBeginDocument{\mathdef{\i}{\operatorname{i}}}
% \end{macrocode}
% \end{macro}
-% \subsubsection{Greek letters}
+% \begin{macro}{eqnarray}
+% Undefine the |eqnarray| environment.
+% \begin{macrocode}
+\ifhep@eqnarray\else%
+ \let\eqnarray\@undefined
+ \let\endeqnarray\@undefined
+\fi
+% \end{macrocode}
+% \end{macro}
+
+% \subsection{Math fonts}
%
-% Load the |fixmath| package \cite{fixmath} which makes upper Greek letters in math mode italic and load the |alphabeta| package \cite{alphabeta} which allows upright italic letters in text mode.
+% \begin{macro}{\mathbf}
+% Load the |bm| package \cite{bm} for superior boldmath.
+% Make math symbols bold whenever they appear in bold macros such as |\section|\marg{text}.
% \begin{macrocode}
-\RequirePackage{fixmath}
-\RequirePackage{alphabeta}
+\RequirePackage{bm}
+\let\mathbf\bm
+\g@addto@macro\bfseries{\boldmath}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\mathsf}
+% Load the |fixmath| package \cite{fixmath} which ensures that upper Greek letters in math mode are italic.
+% Ensure that also math mode is sans serif using the |sfmath| package \cite{sfmath} if the option sans serif is passed to the package.
+% Ensure that |\mathsf| is italic as well as sans serif and sans for sans and sans serif documents, respectively.
+% \begin{macrocode}
+\ifhep@serif
+ \RequirePackage{fixmath}
+ \DeclareMathAlphabet{\mathsf}{OML}{cmbr}{m}{it}
+ \SetMathAlphabet{\mathsf}{bold}{OML}{cmbr}{bx}{it}
+\else
+ \RequirePackage[slantedGreek]{sfmath}
+ \DeclareMathAlphabet{\mathsf}{OML}{cmm}{m}{it}
+ \SetMathAlphabet{\mathsf}{bold}{OML}{cmm}{bx}{it}
+\fi
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\mathscr}
+% Load the |mathrsfs| package for the |\mathscr| math script font.
+% \begin{macrocode}
+\RequirePackage{mathrsfs}
% \end{macrocode}
+% \end{macro}
-% \subsubsection{Physics notation}
+% \subsection{Physics notation}
%
% \begin{macro}{\slashed}
% \begin{macro}{\units}
@@ -558,43 +942,25 @@
% \end{macro}
% \begin{macro}{\oset}
-% \begin{macro}{\overleftright}
-% Define a new overset macro |\oset|\oarg{offsest}\marg{over}\marg{base} and use it to define a over left right arrow |\overleftright|\marg{base}.
+% Define a new overset macro |\oset|\oarg{offset}\marg{over}\marg{base}
% \begin{macrocode}
\newcommand{\oset}[3][-1pt]{%
- \raisebox{1pt}{%
- \ensuremath{
- \mathop{#3}\limits^{\vbox to#1{\kern-2\ex@\hbox{$\scriptscriptstyle#2$}\vss}}%
- }%
- }%
+ \raisebox{1pt}{\ensuremath{\mathop{#3}\limits^{%
+ \vbox to#1{\kern-2\ex@\hbox{$\scriptscriptstyle#2$}\vss}%
+ }}}%
}
-\newcommand{\overleftright}[1]{\oset{\leftrightarrow}{#1}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-
-% \subsubsection{Math fonts}
-%
-% \begin{macro}{\mathsbf}
-% Load the |bm| package \cite{bm} for superior boldmath.
-% Make math symbols bold whenever they appear in bold macros such as title or subsection.
-% \begin{macrocode}
-\RequirePackage{bm}
-\let\mathbf\bm
-\g@addto@macro\bfseries{\boldmath}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\mathsfit}
-% Define a italc sf math font.
+% \begin{macro}{\overleftright}
+% Define a over left right arrow |\overleftright|\marg{base}.
% \begin{macrocode}
-\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{\mddefault}{\sldefault}
-\SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}
+\newcommand{\overleftright}[1]{\oset{\leftrightarrow}{#1}}
% \end{macrocode}
% \end{macro}
-% \subsection{Floats}
+% \section{Floats}
%
-% Adjust the LaTeX float placement defaults
+% Adjust the \LaTeX\ float placement defaults
% \begin{macrocode}
\renewcommand{\textfraction}{0.01}
\setcounter{topnumber}{1}
@@ -605,107 +971,146 @@
% \begin{environment}{figure}
% \begin{environment}{table}
-% Ignore the manual placement if the |placement| option is set.
+% Center the content of |figure| and |table| environments.
+% Ignore the manual placement if the |manualplacement| option is set to false.
% \begin{macrocode}
-\ifdefined\@placement%
- \let\@figure@\figure%
- \let\@end@figure@\endfigure%
+\let\@figure@\figure%
+\let\@end@figure@\endfigure%
+\let\@table@\table%
+\let\@end@table@\endtable%
+\ifhep@manualplacement%
\renewenvironment{figure}[1][tbp]{%
\@figure@[#1]\centering%
- }{%
- \@end@figure@%
- }%
- \let\@table@\table%
- \let\@end@table@\endtable%
+ }{\@end@figure@}%
\renewenvironment{table}[1][tbp]{%
\@table@[#1]\centering%
- }{%
- \@end@table@%
- }%
+ }{\@end@table@}%
\else%
- \let\@figure@\figure%
- \let\@end@figure@\endfigure%
\renewenvironment{figure}[1][]{%
\@figure@\centering%
- }{%
- \@end@figure@%
- }%
- \let\@table@\table%
- \let\@end@table@\endtable%
+ }{\@end@figure@}%
\renewenvironment{table}[1][]{%
\@table@\centering%
- }{%
- \@end@table@%
- }
+ }{\@end@table@}
\fi%
% \end{macrocode}
% \end{environment}
% \end{environment}
-% \subsubsection{Subfloats}
+% \subsection{Sub-floats}
%
-% \begin{environment}{panels}
-% \begin{macro}{\panel}
-% Load the |subcaption| package \cite{subcaption} and define the |panels| environment as well as the |\panel| macro.
+% Prevent the |caption| package \cite{caption} from complaining about the |revtex| class.
+% \begin{macrocode}
+\ifhep@revtex
+ \setlength\abovecaptionskip{\f@size\p@}
+ \setlength\belowcaptionskip{0\p@}
+ \long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip%
+ }
+\fi
+% \end{macrocode}
+%
+% Load the |subcaption| package \cite{subcaption}.
% \begin{macrocode}
\RequirePackage[subrefformat = parens]{subcaption}
\captionsetup{font=small}
\captionsetup[sub]{font=small}
-\newcommand{\begin@subcaption@minipage}[2][b]{%
- \caption@withoptargs\subcaption@minipage[#1]{#2}\centering\vskip 0pt%
-}
+% \end{macrocode}
+% \begin{environment}{panels}
+% \begin{macro}{\panel}
+% Load the |subcaption| package \cite{subcaption} and define the |panels| environment as well as the |\panel| macro.
+% \begin{macrocode}
\newenvironment{panels}[2][b]{%
+% \end{macrocode}
+% Define an internal macro for global behaviour.
+% \begin{macrocode}
+ \newcommand{\begin@subcaption@minipage}[2][b]{%
+ \caption@withoptargs\subcaption@minipage[##1]{##2}%
+ \centering\vskip 0pt%
+ }
+% \end{macrocode}
+% Define the |\panel| macro for the case that the number of panels is given.
+% \begin{macrocode}
\ifdim#2pt>1pt%
\newcommand{\panel}[1][b]{%
\endminipage\hfill\begin@subcaption@minipage[#1]{\linewidth/#2}%
}%
\begin@subcaption@minipage[#1]{\linewidth/#2}%
+% \end{macrocode}
+% Define the |\panel| macro for the case that the width of the panel is given.
+% \begin{macrocode}
\else%
\newcommand{\panel}[2][b]{%
\endminipage\hfill\begin@subcaption@minipage[#1]{##2\linewidth}%
}%
\begin@subcaption@minipage[#1]{#2\linewidth}%
\fi%
-}{%
- \endminipage%
-}
+}{\endminipage}
% \end{macrocode}
% \end{macro}
% \end{environment}
-% \subsubsection{Tables}
+% Reajust the captions to the revtex class.
+% \begin{macrocode}
+\ifhep@revtex
+ \renewcommand{\figurename}{Figure}
+ \renewcommand{\tablename}{Table}
+ \RequirePackage{ragged2e}
+ \DeclareCaptionFormat{revtex}{#1#2\justifying{#3}}
+ \captionsetup{font = small, format = revtex}
+ \captionsetup[sub]{font = footnotesize, format = plain}
+\fi
+% \end{macrocode}
+
+% \subsection{Tables}
%
% \begin{environment}{tabular}
-% Enhance tables using the |booktabs| and |multirow| packages \cite{booktabs, multirow}.
+% Enhance tabulars with the |booktabs| and |multirow| packages \cite{booktabs, multirow}.
% \begin{macrocode}
\RequirePackage{booktabs}
\RequirePackage{multirow}
% \end{macrocode}
% \end{environment}
-% \subsubsection{Figures}
+% \subsection{Figures}
%
% \begin{macro}{\graphic}
-% Provide the |graphic| macro for the inclusion of figures with the |graphicx| package \cite{graphicx}.
+% Provide the |\graphic| macro for the inclusion of figures using the |graphicx| package \cite{graphicx}.
% \begin{macrocode}
\RequirePackage{graphicx}
\providecommand{\tikzsetnextfilename}[1]{}
-\newcommand{\graphic}[2][1]{%
- \tikzsetnextfilename{#2}\centering\includegraphics[width=#1\linewidth]{#2}%
-}
+\newcommand{\graphic}[2][1]{\tikzsetnextfilename{#2}{%
+ \centering\includegraphics[width=#1\linewidth]{#2}%
+}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\graphics}
+% Provide the |\graphics| macro for the inclusion of figures located in a subfolder.
+% \begin{macrocode}
+\newcommand{\graphics}[1]{\graphicspath{{./#1/}}}
% \end{macrocode}
% \end{macro}
-% \subsection{Titlepage}
+% \section{Title page}
%
% \begin{macro}{\date}
% Allow empty date field.
% \begin{macrocode}
+\ifhep@title
\date{}
% \end{macrocode}
% \end{macro}
-% \subsubsection{Authors}
+% \subsection{Authors}
%
% \begin{macro}{\author}
% Allow empty author field.
@@ -717,31 +1122,47 @@
% Provide macro for the email of authors used as |\author{|$\langle name\rangle$| \email{|$\langle email\rangle$|}}|.
% \begin{macrocode}
\AtEndOfClass{\newcommand{\email}[1]{%
- \unskip\thanks{\href{mailto:#1}{\texttt{#1}}}%
+ \unskip\thanks{\online{mailto:#1}{#1}}
}}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\affiliation}
% Enable the handling of multiple authors with different affiliations using the |authblk| package \cite{authblk}.
% \begin{macrocode}
\RequirePackage{authblk}
\renewcommand\Affilfont{\footnotesize}
-\newcommand{\affiliation}[2][]{\affil[#1]{\protecting{#2}}}
+% \end{macrocode}
+%
+% \begin{macro}{\affiliation}
+% Define the |\affiliation| macro, ensure that linebreaks happen after a comma.
+% \begin{macrocode}
+\newcommand\active@comma{,\penalty-5\relax}
+\newcommand\cat@comma@active{\catcode`\,\active}
+{\cat@comma@active\gdef,{\active@comma}}
+\newcommand\@affil[1]{%
+ \endgroup\@flushglue=0pt plus .5\linewidth\affil{#1}%
+}
+\def\@affil@opt[#1]#2{%
+ \endgroup\@flushglue=0pt plus .5\linewidth\affil[#1]{#2}%
+}
+\DeclareRobustCommand\@affiliation{\@ifnextchar[{\@affil@opt}{\@affil}}
+\newcommand{\affiliation}{\begingroup\cat@comma@active\@affiliation}
% \end{macrocode}
% \end{macro}
-% \subsubsection{Preprint}
+% \subsection{Preprint}
%
% \begin{macro}{\preprint}
-% Places a preprint number in the top right corner of the titel page.
+% Places a preprint number in the top right corner of the first page.
% This code uses the |varwidth| \cite{varwidth}, |atbegshi| \cite{atbegshi}, and |picture| \cite{picture} packages.
% \begin{macrocode}
\let\@preprint\relax
\newcommand\preprint[1]{\long\gdef\@preprint{#1}}
\RequirePackage{varwidth}
\newcommand{\@preprint@box}{%
- \begin{varwidth}{\textwidth}\textsc{\small\@preprint}\end{varwidth}%
+ \begin{varwidth}{\textwidth}%
+ \textsc{\small\@preprint}%
+ \end{varwidth}%
}
\RequirePackage{atbegshi}
\RequirePackage{picture}
@@ -754,75 +1175,181 @@
% \end{macrocode}
% \end{macro}
-% \subsubsection{Abstract}
+% \subsection{Abstract}
%
% \begin{environment}{abstract}
-% Adjust the |abstract| environment to not start with identation.
+% Adjust the |abstract| environment to not start with indentation.
% \begin{macrocode}
\let\old@abstract\abstract
\renewcommand\abstract{\old@abstract\noindent\ignorespaces}
% \end{macrocode}
% \end{environment}
+% End of check for |title| option.
+% \begin{macrocode}
+\fi
+% \end{macrocode}
-% \subsection{Bibliography}
+% \section{Bibliography}
+%
+% Check if bibliography management is requested using the |pdftexcmds| package \cite{pdftexcmds}.
+% \begin{macrocode}
+\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
+% \end{macrocode}
%
% \begin{macro}{\bibliography}
% Load the |biblatex| package \cite{biblatex} with a JHEP like bibliography style.
-% Add the collaboration and preprint information if present.
% \begin{macrocode}
-\RequirePackage[sorting=none,style=numeric-comp,giveninits=true]{biblatex}
+\RequirePackage[style=\hep@bibliography]{biblatex}
+\ExecuteBibliographyOptions{
+ sorting=none,
+ giveninits=true
+}
+% \end{macrocode}
+% \end{macro}
+% Read the collaboration and pre-print information if present.
+% Move letters from the volume field to the journal field.
+% \begin{macrocode}
+\newcommand{\@reg@exp}{\regexp{\A(\p{L}+)?\d+(\p{L}+)?\Z}}
+\newcommand{\@reg@exp@}{\regexp{\A(\p{L}+)?(\d+)(\p{L}+)?\Z}}
\DeclareSourcemap{%
\maps[datatype=bibtex,overwrite=true]{%
\map{%
\step[fieldsource=Collaboration,final=true]%
- \step[fieldset=usera,origfieldval,final=true]
+ \step[fieldset=usere,origfieldval,final=true]
}%
\map{%
\step[fieldsource=reportNumber,final=true]%
- \step[fieldset=userb,origfieldval,final=true]
+ \step[fieldset=userf,origfieldval,final=true]
}%
+ \map[overwrite]{
+ \step[fieldsource=volume, match=\@reg@exp, final]
+ \step[fieldsource=volume, match=\@reg@exp@, replace={$2}]
+ \step[fieldsource=journal, fieldtarget=journaltitle]
+ \step[fieldset=journaltitle, fieldvalue={\space$1$2}, append=true]
+ }
}%
}
+% \end{macrocode}
+
+% Override the author information with collaboration information if present.
+% \begin{macrocode}
\renewbibmacro*{author}{%
- \iffieldundef{usera}{\printnames{author}}{\textbf{\printfield{usera}}}%
+ \iffieldundef{usere}{\printnames{author}}{\textbf{\printfield{usere}}}%
}
+% \end{macrocode}
+
+% Remove spurious `In:' if no journal is present.
+% \begin{macrocode}
\renewbibmacro*{in:}{%
\iffieldundef{journal}{}{\printtext{\bibstring{in}\intitlepunct}}%
}
-\renewbibmacro*{finentry}{%
- \iffieldundef{userb}{}{%
- \textls[0]{\small{\textsc{%
- \newunitpunct\textnumero\intitlepunct\printfield{userb}%
- }}}%
- }\finentry%
+% \end{macrocode}
+
+% Provide the |\letbibmacro| macro for old |biblatex| installations.
+% \begin{macrocode}
+\providecommand{\letbibmacro}[2]{\csletcs{abx@macro@#1}{abx@macro@#2}}
+% \end{macrocode}
+
+% Add the pre-print information if present.
+% \begin{macrocode}
+\letbibmacro{doi+eprint+url-old}{doi+eprint+url}
+\renewbibmacro*{doi+eprint+url}{%
+ \usebibmacro{doi+eprint+url-old}
+ \iffieldundef{userf}{}{\textls[0]{%
+ \newunitpunct\textnumero\intitlepunct%
+ \textsc{\small\printfield{userf}}%
+ }}%
}
% \end{macrocode}
-% \end{macro}
+
+% Add CTAN as a pre-print option
+% \begin{macrocode}
+\DeclareFieldFormat{eprint:ctan}{%
+ CTAN\addcolon\space\ifhyperref{%
+ \href{https://ctan.org/pkg/#1}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
+}
+\DeclareFieldAlias{eprint:CTAN}{eprint:ctan}
+% \end{macrocode}
+
+% Add GitHub as a pre-print option
+% \begin{macrocode}
+\DeclareFieldFormat{eprint:github}{%
+ GitHub\addcolon\space\ifhyperref{\href{%
+ https://github.com/\thefield{eprintclass}/#1%
+ }{\nolinkurl{\thefield{eprintclass}/#1}}%
+ }{\nolinkurl{\thefield{eprintclass}/#1}}%
+}
+\DeclareFieldAlias{eprint:GitHub}{eprint:github}
+% \end{macrocode}
+
+% Add GitLab as a pre-print option
+% \begin{macrocode}
+\DeclareFieldFormat{eprint:gitlab}{%
+ GitLab\addcolon\space\ifhyperref{\href{%
+ https://gitlab.com/\thefield{eprintclass}/#1%
+ }{\nolinkurl{\thefield{eprintclass}/#1}}%
+ }{\nolinkurl{\thefield{eprintclass}/#1}}%
+}
+\DeclareFieldAlias{eprint:GitLab}{eprint:gitlab}
+% \end{macrocode}
+
+% Add SourceForge as a pre-print option
+% \begin{macrocode}
+\DeclareFieldFormat{eprint:sourceforge}{%
+ SourceForge\addcolon\space\ifhyperref{%
+ \href{https://sourceforge.net/projects/#1}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
+}
+\DeclareFieldAlias{eprint:SourceForge}{eprint:sourceforge}
+% \end{macrocode}
+
+% Add HEPForge as a pre-print option
+% \begin{macrocode}
+\DeclareFieldFormat{eprint:hepforge}{%
+ HEPForge\addcolon\space\ifhyperref{%
+ \href{https://#1/hepforge.org/}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
+}
+\DeclareFieldAlias{eprint:HEPForge}{eprint:hepforge}
+% \end{macrocode}
+
+% Add new bibliography string \enquote{Erratum} for the use in the |relatedtype| field.
+% \begin{macrocode}
+\NewBibliographyString{erratum}
+\DefineBibliographyStrings{english}{erratum={Erratum:}}
+% \end{macrocode}
+
% \begin{macro}{\printbibliography}
-% Allow the bibliography to be printed sloppy \cf |\sloppy|
+% Allow the bibliography to be printed sloppy
% \begin{macrocode}
\let\old@printbibliography\printbibliography
\renewcommand{\printbibliography}{\sloppy\old@printbibliography}
% \end{macrocode}
% \end{macro}
+%
+% End check for bibliography option.
+% \begin{macrocode}
+\fi
+% \end{macrocode}
-% \subsection{Hyperlinks}
+% \section{Hyperlinks and References}
%
-% Load the |hyperref| package \cite{hyperref} enable unicode encoding and hide links.
+% Load the |hyperref| package \cite{hyperref} enable Unicode encoding and hide links.
%
% \begin{macrocode}
\RequirePackage{hyperref}
\hypersetup{
- hidelinks,
- linktoc=all,
pdfencoding=auto,
psdextra,
+ hidelinks,
+ linktoc=all,
breaklinks=true,
pdfcreator={},
pdfproducer={}
}
% \end{macrocode}
-% Set the PDF meta data according to the paper information and ensure that unnecessary information are suppressed.
+% Set the \PDF meta data according to the paper information and ensure that unnecessary information is suppressed.
%
% \begin{macrocode}
\pdfstringdefDisableCommands{\def\varepsilon{\textepsilon}}
@@ -833,54 +1360,387 @@
\pdfstringdefDisableCommands{\let\thanks\@gobble}
\pdfstringdefDisableCommands{\let\footnote\@gobble}
\pdfstringdefDisableCommands{\let\\\@gobble}
- \hypersetup{
- pdfauthor={\AB@authlist},
- pdftitle={\@title}
- }
}
+\AtBeginShipout{\hypersetup{pdftitle={\@title}}}
+\ifhep@title
+ \AtBeginDocument{\hypersetup{pdfauthor=\AB@authlist}}
+\else
+ \AtBeginDocument{\hypersetup{pdfauthor={\@author}}}
+\fi
% \end{macrocode}
-% \subsection{References}
-%
% \begin{macro}{\cref}
-% Improve reference using the |cleveref| package \cite{cleveref} and prevent preceding line breaks various reference macros.
+% Improve reference using the |cleveref| package \cite{cleveref}.
%
% \begin{macrocode}
\RequirePackage[noabbrev, capitalize, nameinlink]{cleveref}
\crefname{enumi}{point}{points}
+\Crefname{enumi}{Point}{Points}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\refstepcounter@...}
+% Adjust the |cleveref| |\refstepcounter@noarg| and |\refstepcounter@optarg| to use the |\@currentlabel| in order to fix problems with |\subref|.
+% \begin{macrocode}
+\def\refstepcounter@noarg#1{%
+ \cref@old@refstepcounter{#1}%
+ \cref@constructprefix{#1}{\cref@result}%
+ \@ifundefined{cref@#1@alias}%
+ {\def\@tempa{#1}}%
+ {\def\@tempa{\csname cref@#1@alias\endcsname}}%
+ \protected@edef\cref@currentlabel{%
+ [\@tempa][\arabic{#1}][\cref@result]%
+ \noexpand\@currentlabel%
+ }% changed
+}
+
+\def\refstepcounter@optarg[#1]#2{%
+ \cref@old@refstepcounter{#2}%
+ \cref@constructprefix{#2}{\cref@result}%
+ \@ifundefined{cref@#1@alias}%
+ {\def\@tempa{#1}}%
+ {\def\@tempa{\csname cref@#1@alias\endcsname}}%
+ \protected@edef\cref@currentlabel{%
+ [\@tempa][\arabic{#2}][\cref@result]%
+ \noexpand\@currentlabel% changed
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+
+%\begin{macro}{\no@break@before}
+% Provide macro able to prevent line breaks.
+% \DoNotIndex{\no@break@before,\ifvmode,\ifhmode,\ifdim,\lastskip,\unskip,\nobreakspace}
+% \begin{macrocode}
+\newcommand\no@break@before{%
+ \relax\ifvmode\else%
+ \ifhmode%
+ \ifdim\lastskip > 0pt%
+ \relax\unskip\nobreakspace%
+ \fi%
+ \fi%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\ref}
+% Adjust |\ref|\marg{key} in order to prevent preceding line breaks and to enable the possibility to reference multiple references at once.
+% \begin{macrocode}
+\let\old@ref\ref
+\AtBeginDocument{\renewcommand\ref{\no@break@before\labelcref}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\eqref}
-% Adjust |\eqref|\marg{ref} in order to prevent preceding line breaks and to enable the possibility to cite multiple equations at once.
+% Adjust |\eqref|\marg{key} in order to prevent preceding line breaks and to enable the possibility to reference multiple equations at once.
% \begin{macrocode}
\renewcommand\eqref{\no@break@before\labelcref}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\subref}
-% Adjust |\subref|\marg{ref} in order to prevent preceeding line breaks.
+% Adjust |\subref|\marg{key} in order to prevent preceding line breaks.
% \begin{macrocode}
\let\old@subref\subref
\renewcommand\subref{\no@break@before\old@subref}
+\renewcommand*\subcaption@ref[2]{\begingroup%
+ \caption@setoptions{sub}%
+ \subcaption@reffmt\p@subref{\old@ref#1{sub@#2}}%
+\endgroup}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\subcref}
+% Provide the |\subcref| macro.
+% \begin{macrocode}
+\newcommand{\subcref}[1]{\cref{sub@#1}}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\eqcrefname}
+% Define the |\eqcrefname| macro for named equation types.
+% \begin{macrocode}
+\DeclareDocumentCommand{\eqcrefname}{mmo}{
+ \crefname{#1}{#2}{\IfValueTF{#3}{#3}{#2s}}
+ \creflabelformat{#1}{(##2##1##3)}
+}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\labelcrefrange}
+% Define the missing |\labelcrefrange|\marg{key1}\marg{key2} macro.
+% \begin{macrocode}
+\DeclareRobustCommand{\labelcrefrange}[2]{%
+ \@crefrangenostar{labelcref}{#1}{#2}%
+}
% \end{macrocode}
% \end{macro}
+% \subsection{Citation macros}
+%
% \begin{macro}{\cite}
-% Adjust |\cite|\marg{ref} in order to prevent preceeding line breaks.
+% Adjust |\cite|\marg{key} in order to prevent preceding line breaks.
% \begin{macrocode}
\let\old@cite\cite
\renewcommand\cite{\no@break@before\old@cite}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\labelcrefrange}
-% Define the missing |\labelcrefrange|\marg{ref1}\marg{ref2} macro.
+% Begin of bibliography if.
+% \begin{macrocode}
+\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
+% \end{macrocode}
+% Define bibstrings for reference names.
+% \begin{macrocode}
+\NewBibliographyString{refname}
+\NewBibliographyString{refsname}
+\DefineBibliographyStrings{english}{%
+ refname = {Reference},
+ refsname = {References}
+}
+% \end{macrocode}
+% \begin{macro}{\ccite}
+% \begin{macro}{\Ccite}
+% Define \emph{clever} citation macros.
+% \begin{macrocode}
+\DeclareCiteCommand{\ccite}{%
+ \ifnum\thecitetotal=1%
+ \bibstring{refname}%
+ \else%
+ \bibstring{refsname}%
+ \fi%
+ \addnbspace\bibopenbracket%
+ \usebibmacro{cite:init}\usebibmacro{prenote}%
+}{\usebibmacro{citeindex}\usebibmacro{cite:comp}}{}{%
+ \usebibmacro{cite:dump}\usebibmacro{postnote}%
+ \bibclosebracket%
+}
+
+\newrobustcmd*{\Ccite}{\bibsentence\ccite}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% End of biblatex if.
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+
+% \section{Acronyms}
+%
+% Acronyms are implemented with the |glossaries-extra| package \cite{glossaries-extra} which is an extension of the |glossaries| package \cite{glossaries}.
+% \begin{macrocode}
+\ifhep@glossaries
+\RequirePackage[nostyles]{glossaries-extra}
+% \end{macrocode}
+% The entry count feature is used.
+% \begin{macrocode}
+\glsenableentrycount
+\glssetcategoryattribute{abbreviation}{entrycount}{1}
+% \end{macrocode}
+% Provide macros for older |glossaries-extra| installations.
+% \begin{macrocode}
+\providecommand{\glsxtrusefield}[2]{\@gls@entry@field{#1}{#2}}
+\providecommand{\glsxtrsetfieldifexists}[3]{\glsdoifexists{#1}{#3}}
+\providecommand{\gGlsXtrSetField}[3]{%
+ \glsxtrsetfieldifexists{#1}{#2}{%
+ \csgdef{glo@\glsdetoklabel{#1}@#2}{#3}%
+ }%
+}
+% \end{macrocode}
+% Hyperlinks from the abbreviation to their definition in the text are set.
+% \begin{macrocode}
+\glssetcategoryattribute{abbreviation}{nohyperfirst}{true}
+\renewcommand*{\glsdonohyperlink}[2]{{%
+ \glsxtrprotectlinks\edef\fieldvalue{%
+ \glsxtrusefield{\glslabel}{hastarget}%
+ }%
+ \ifdefstring\fieldvalue{true}{#2}{%
+ \gGlsXtrSetField{\glslabel}{hastarget}{true}%
+ \glsdohypertarget{#1}{#2}%
+ }%
+}}
+% \end{macrocode}
+
+% \begin{macro}{\if@begin@of@sentence}
+% Mark the beginning of a paragraph as if it would follow a full stop using the |everyhook| package \cite{everyhook}.
+% Provide a macro checking for the beginning of a sentence by examining the length of the preceeding space. (This breaks if |\frenchspacing| is activated)
+% \begin{macrocode}
+\usepackage[excludeor]{everyhook}
+\PushPostHook{par}{{\spacefactor=3000}}
+\newcommand{\if@begin@of@sentence}[2]{\leavevmode\protecting{%
+ \ifboolexpr{ test {\ifnumcomp{\spacefactor}{=}{3000}} or%
+ test {\ifnumcomp{\spacefactor}{=}{2000}}%
+ }{#1}{#2}%
+}}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\acronym}
+% The |\acronym|\meta{*}\oarg{typeset abbreviation}\marg{abbreviation}\marg{definition}\oarg{plural\linebreak[4] definition} macro is defined.
+% \begin{enumerate}[nosep, label=\#\arabic*]
+% \item star for omitting the \enquote{s} in the short plural
+% \item optional typeset abbreviation
+% \item mandatory abbreviation
+% \item mandatory long form
+% \item optional plural long form
+% \end{enumerate}
+% \begin{macrocode}
+\DeclareDocumentCommand{\acronym}{sommo}{
+ \newabbreviation[
+ longplural=\IfNoValueTF{#5}{#4s}{#5},
+ \glsshortpluralkey=\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}
+ ]{#3}{\IfNoValueTF{#2}{#3}{#2}}{#4}
+% \end{macrocode}
+% Provide the singular acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3\endcsname{%
+ \if@begin@of@sentence{\cGls{#3}}{\cgls{#3}}\@\xspace%
+ }
+% \end{macrocode}
+% Expand the singular acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
+ \IfNoValueTF{#2}{#3}{#2} }%
+ }
+% \end{macrocode}
+% Provide the singular acronym macro in math mode.
+% \begin{macrocode}
+ \expandafter\mathdef\csname#3\endcsname{%
+ \text{\glsxtrshort{#3}}\glsunset{#3}%
+ }
+% \end{macrocode}
+% Provide the plural acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3s\endcsname{%
+ \if@begin@of@sentence{\cGlspl{#3}}{\cglspl{#3}}\@\xspace%
+ }
+% \end{macrocode}
+% Expand the plural acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
+ }
+% \end{macrocode}
+% Provide the plural acronym macro in math mode.
+% \begin{macrocode}
+ \expandafter\mathdef\csname#3s\endcsname{%
+ \text{\glsxtrshortpl{#3}}\glsunset{#3}%
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\shortacronym}
+% The |\shortacronym| never expands into the long form.
% \begin{macrocode}
-\DeclareRobustCommand{\labelcrefrange}[2]{\@crefrangenostar{labelcref}{#1}{#2}}
+\DeclareDocumentCommand{\shortacronym}{somm}{
+ \newabbreviation[
+ \glsshortpluralkey=\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}
+ ]{#3}{\IfNoValueTF{#2}{#3}{#2}}{#4}
+% \end{macrocode}
+% Provide the singular acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3\endcsname{\cgls*{#3}\@\xspace}
+% \end{macrocode}
+% Expand the singular acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
+ \IfNoValueTF{#2}{#3}{#2} }%
+ }
+% \end{macrocode}
+% Provide the singular acronym macro in math mode.
+% \begin{macrocode}
+ \expandafter\mathdef\csname#3\endcsname{\text{\glsxtrshort*{#3}}}
+% \end{macrocode}
+% Provide the plural acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3s\endcsname{\cglspl*{#3}\@\xspace}
+% \end{macrocode}
+% Expand the plural acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
+ }
+% \end{macrocode}
+% Provide the plural acronym macro in math mode.
+% \begin{macrocode}
+ \expandafter\mathdef\csname#3s\endcsname{\text{\glsxtrshortpl*{#3}}}%
+ \glsunset{#3}
+}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\longacronym}
+% The |\longacronym| never shows the abbreviated form.
+% \begin{macrocode}
+\DeclareDocumentCommand{\longacronym}{sommo}{
+% \end{macrocode}
+% Provide the singular acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3\endcsname{%
+ \if@begin@of@sentence{\MakeUppercase#4}{#4}\@\xspace%
+ }
+% \end{macrocode}
+% Expand the singular acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{#4 }}
+% \end{macrocode}
+% Provide the plural acronym macro.
+% \begin{macrocode}
+ \expandafter\newcommand\csname#3s\endcsname{%
+ \if@begin@of@sentence{%
+ \IfNoValueTF{#5}{\MakeUppercase#4s}{\MakeUppercase#5}%
+ }{%
+ \IfNoValueTF{#5}{#4s}{#5}}\@\xspace%
+ }
+% \end{macrocode}
+% Expand the plural acronym macro in \PDF labels.
+% \begin{macrocode}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfNoValueTF{#5}{#4s}{#5} }%
+ }
+}
+% \end{macrocode}
+% \end{macro}
+% Silence warning if no acronyms are defined.
+% \begin{macrocode}
+\renewcommand*{\@gls@write@entrycounts}{%
+ \immediate\write\@auxout{%
+ \string\providecommand*{\string\@gls@entry@count}[2]{}
+ }%
+ \count@=0\relax
+ \forallglsentries{\@glsentry}{%
+ \glshasattribute{\@glsentry}{entrycount}{%
+ \ifglsused{\@glsentry}{%
+ \immediate\write\@auxout{%
+ \string\@gls@entry@count{\@glsentry}{%
+ \glsentrycurrcount{\@glsentry}%
+ }
+ }%
+ }{}\advance\count@ by \@ne
+ }{}%
+ }%
+}
+% \end{macrocode}
+% \begin{macro}{\resetacronym}
+% \begin{macro}{\dummyacronym}
+% Add two macros for acronym management.
+% \begin{macrocode}
+\newcommand{\resetacronym}[1]{\protect\glsreset{#1}}
+\newcommand{\dummyacronym}[1]{\protect\glsunset{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% End of glossaries if.
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+%
% \Finale
\endinput
+
+% \PrintIndex
+% makeindex -s gglo.ist -o hep-paper.gls hep-paper.glo
+% makeindex -s gglo.ist -o hep-paper.ind hep-paper.idx