summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hep-paper
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-14 20:59:04 +0000
committerKarl Berry <karl@freefriends.org>2020-03-14 20:59:04 +0000
commitde272326b469b79620b2e8418495d65508f8a9c9 (patch)
tree08a26a5c228148af779984a474c929bf412790d4 /Master/texmf-dist/tex/latex/hep-paper
parentaa84bd893660247ec1a588471915c8a28aacdff4 (diff)
hep-paper (14mar20)
git-svn-id: svn://tug.org/texlive/trunk@54300 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hep-paper')
-rw-r--r--Master/texmf-dist/tex/latex/hep-paper/hep-paper.sty617
1 files changed, 479 insertions, 138 deletions
diff --git a/Master/texmf-dist/tex/latex/hep-paper/hep-paper.sty b/Master/texmf-dist/tex/latex/hep-paper/hep-paper.sty
index 4ea1c73120b..e126a36b8a7 100644
--- a/Master/texmf-dist/tex/latex/hep-paper/hep-paper.sty
+++ b/Master/texmf-dist/tex/latex/hep-paper/hep-paper.sty
@@ -15,113 +15,193 @@
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{hep-paper}[2020/01/01 v1.1 Publications in High Energy Physics]
+\ProvidesPackage{hep-paper}[2020/03/01 v1.2 Publications in High Energy Physics]
-\DeclareOption{a4paper}{%
- \setlength\paperheight{297mm}%
- \setlength\paperwidth{210mm}%
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=hep,
+ prefix=hep@
}
-\DeclareOption{a5paper}{%
- \setlength\paperheight{210mm}%
- \setlength\paperwidth{148mm}%
-}
-\DeclareOption{b5paper}{%
- \setlength\paperheight{250mm}%
- \setlength\paperwidth{176mm}%
-}
-\DeclareOption{letterpaper}{%
- \setlength\paperheight{11in}%
- \setlength\paperwidth{8.5in}%
-}
-\DeclareOption{legalpaper}{%
- \setlength\paperheight{14in}%
- \setlength\paperwidth{8.5in}%
-}
-\DeclareOption{executivepaper}{%
- \setlength\paperheight{10.5in}%
- \setlength\paperwidth{7.25in}%
-}
-\DeclareOption{landscape}{%
- \setlength\@tempdima{\paperheight}%
- \setlength\paperheight{\paperwidth}%
- \setlength\paperwidth{\@tempdima}%
-}
-
-\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
-\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
-\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
-
-\DeclareOption{placement}{\def\@placement}
+\DeclareStringOption[a4]{paper}
+\DeclareStringOption[11pt]{font}
+\DeclareBoolOption[false]{defaults}
+\DeclareStringOption[british]{lang}
+\DeclareBoolOption[true]{parindent}
+\DeclareComplementaryOption{parskip}{parindent}
+\DeclareBoolOption[true]{serif}
+\DeclareComplementaryOption{sansserif}{serif}
+\DeclareBoolOption[false]{eqnarray}
+\DeclareStringOption[numeric-comp]{bibliography}
+\DeclareBoolOption[true]{glossaries}
+\DeclareBoolOption[false]{manualplacement}
+\DeclareBoolOption[true]{title}
+\DeclareBoolOption[false]{revtex}
+
+\ProcessKeyvalOptions*
+\ifhep@revtex
+ \setkeys{hep}{defaults, title=false, lang=american, bibliography=false}
+\fi
-\ExecuteOptions{a4paper,11pt}
-\ProcessOptions\relax
-\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}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
+\newif\ifxetexorluatex
+\ifxetex\xetexorluatextrue\else
+ \ifluatex\xetexorluatextrue
+ \else\xetexorluatexfalse
+ \fi
+\fi
-\RequirePackage[hscale=.76, vscale=.8, vmarginratio=3:4, includeheadfoot]{geometry}
+\RequirePackage{alphabeta}
+\ifxetexorluatex
+ \def\@encoding{TU}
+\else
+ \def\@encoding{T1}
+\fi
+\RequirePackage[\@encoding]{fontenc}
+\RequirePackage{lmodern}
+\RequirePackage{textcomp}
+\RequirePackage{microtype}
-\RequirePackage{ifluatex}
-\ifluatex
- \RequirePackage{fontspec}
- \defaultfontfeatures{Ligatures=TeX}
- \RequirePackage{polyglossia}
- \setmainlanguage{british}
+\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
+
+\ifxetexorluatex\else
\RequirePackage[utf8]{inputenc}
- \RequirePackage[T1]{fontenc}
- \RequirePackage{textcomp}
- \RequirePackage[british]{babel}
\fi
+
+\RequirePackage[\hep@lang]{babel}
\RequirePackage{csquotes}
-\RequirePackage{lmodern}
-\RequirePackage{microtype}
-\RequirePackage[all,british]{foreign}
+\ifhep@serif\else
+ \renewcommand\familydefault{\sfdefault}
+\fi
+
+\RequirePackage{soul}
+\let\underline\ul
+
+\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
+
+\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}}}}
\newcommand{\no}[1]{\textnumero~#1}
-\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{\texttt{#2}~#1}
-
-\def\sloppy{%
- \emergencystretch 3em \hfuzz .5\p@ \vfuzz\hfuzz%
+\RequirePackage{relsize}
+\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{%
+ {\smaller\textsc{#2}~#1}%
}
-\newcommand\no@break@before{%
- \relax\ifvmode\else%
- \ifhmode%
- \ifdim\lastskip > 0pt%
- \relax\unskip\nobreakspace%
- \fi%
- \fi%
- \fi%
-}
+\newcommand{\online}[2]{\href{#1}{\url{#2}}}
+
\RequirePackage[inline]{enumitem}
\newlist{inlinelist}{enumerate*}{1}
-\setlist*[inlinelist,1]{itemjoin={,\ }, itemjoin*={, and\ }, after=.}
+\setlist*[inlinelist,1]{%
+ label=\roman*), itemjoin={,\ }, itemjoin*={, and\ }, after=.%
+}
+\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}}
\let\@foot@note\footnote
\renewcommand{\footnote}[1]{\unskip\@foot@note{\ignorespaces#1}}
+\ifhep@defaults\else
+ \RequirePackage[\hep@paper paper]{geometry}
+ \geometry{hscale=.75, vscale=.8, vmarginratio=3:4, includeheadfoot}
+\fi
+
+\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
+
\RequirePackage{mathtools}
\RequirePackage{amssymb}
\allowdisplaybreaks[1]
\DeclareMathOperator{\diag}{diag}
-\AtEndOfClass{\let\i\undefined\DeclareMathOperator{\i}{i}}
+\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
+ }%
+}
-\RequirePackage{fixmath}
-\RequirePackage{alphabeta}
+\AtBeginDocument{\mathdef{\i}{\operatorname{i}}}
+
+\ifhep@eqnarray\else%
+ \let\eqnarray\@undefined
+ \let\endeqnarray\@undefined
+\fi
+
+\RequirePackage{bm}
+\let\mathbf\bm
+\g@addto@macro\bfseries{\boldmath}
+\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
+\RequirePackage{mathrsfs}
\RequirePackage{physics}
\RequirePackage{slashed}
@@ -130,65 +210,61 @@
\newcommand{\inv}[2][1]{#2\ensuremath{^{-#1}}}
\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}}
-\RequirePackage{bm}
-\let\mathbf\bm
-\g@addto@macro\bfseries{\boldmath}
-\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{\mddefault}{\sldefault}
-\SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}
-
\renewcommand{\textfraction}{0.01}
\setcounter{topnumber}{1}
\renewcommand{\topfraction}{.9}
\setcounter{bottomnumber}{0}
\renewcommand{\floatpagefraction}{.8}
-\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%
+\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
\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%
-}
\newenvironment{panels}[2][b]{%
+ \newcommand{\begin@subcaption@minipage}[2][b]{%
+ \caption@withoptargs\subcaption@minipage[##1]{##2}%
+ \centering\vskip 0pt%
+ }
\ifdim#2pt>1pt%
\newcommand{\panel}[1][b]{%
\endminipage\hfill\begin@subcaption@minipage[#1]{\linewidth/#2}%
@@ -200,34 +276,55 @@
}%
\begin@subcaption@minipage[#1]{#2\linewidth}%
\fi%
-}{%
- \endminipage%
-}
+}{\endminipage}
+
+\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
\RequirePackage{booktabs}
\RequirePackage{multirow}
\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}%
+}}
+\newcommand{\graphics}[1]{\graphicspath{{./#1/}}}
+\ifhep@title
\date{}
\author{}
\AtEndOfClass{\newcommand{\email}[1]{%
- \unskip\thanks{\href{mailto:#1}{\texttt{#1}}}%
+ \unskip\thanks{\online{mailto:#1}{#1}}
}}
\RequirePackage{authblk}
\renewcommand\Affilfont{\footnotesize}
-\newcommand{\affiliation}[2][]{\affil[#1]{\protecting{#2}}}
+\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}
\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}
@@ -240,42 +337,104 @@
\let\old@abstract\abstract
\renewcommand\abstract{\old@abstract\noindent\ignorespaces}
+\fi
-\RequirePackage[sorting=none,style=numeric-comp,giveninits=true]{biblatex}
+\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
+\RequirePackage[style=\hep@bibliography]{biblatex}
+\ExecuteBibliographyOptions{
+ sorting=none,
+ giveninits=true
+}
+\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]
+ }
}%
}
+
\renewbibmacro*{author}{%
- \iffieldundef{usera}{\printnames{author}}{\textbf{\printfield{usera}}}%
+ \iffieldundef{usere}{\printnames{author}}{\textbf{\printfield{usere}}}%
}
+
\renewbibmacro*{in:}{%
\iffieldundef{journal}{}{\printtext{\bibstring{in}\intitlepunct}}%
}
-\renewbibmacro*{finentry}{%
- \iffieldundef{userb}{}{%
- \textls[0]{\small{\textsc{%
- \newunitpunct\textnumero\intitlepunct\printfield{userb}%
- }}}%
- }\finentry%
+
+\providecommand{\letbibmacro}[2]{\csletcs{abx@macro@#1}{abx@macro@#2}}
+
+\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}}%
+ }}%
+}
+
+\DeclareFieldFormat{eprint:ctan}{%
+ CTAN\addcolon\space\ifhyperref{%
+ \href{https://ctan.org/pkg/#1}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
+}
+\DeclareFieldAlias{eprint:CTAN}{eprint:ctan}
+
+\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}
+
+\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}
+
+\DeclareFieldFormat{eprint:sourceforge}{%
+ SourceForge\addcolon\space\ifhyperref{%
+ \href{https://sourceforge.net/projects/#1}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
+}
+\DeclareFieldAlias{eprint:SourceForge}{eprint:sourceforge}
+
+\DeclareFieldFormat{eprint:hepforge}{%
+ HEPForge\addcolon\space\ifhyperref{%
+ \href{https://#1/hepforge.org/}{\nolinkurl{#1}}%
+ }{\nolinkurl{#1}}%
}
+\DeclareFieldAlias{eprint:HEPForge}{eprint:hepforge}
+
+\NewBibliographyString{erratum}
+\DefineBibliographyStrings{english}{erratum={Erratum:}}
+
\let\old@printbibliography\printbibliography
\renewcommand{\printbibliography}{\sloppy\old@printbibliography}
+\fi
\RequirePackage{hyperref}
\hypersetup{
- hidelinks,
- linktoc=all,
pdfencoding=auto,
psdextra,
+ hidelinks,
+ linktoc=all,
breaklinks=true,
pdfcreator={},
pdfproducer={}
@@ -288,24 +447,206 @@
\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
\RequirePackage[noabbrev, capitalize, nameinlink]{cleveref}
\crefname{enumi}{point}{points}
+\Crefname{enumi}{Point}{Points}
+
+\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
+ }%
+}
+
+\newcommand\no@break@before{%
+ \relax\ifvmode\else%
+ \ifhmode%
+ \ifdim\lastskip > 0pt%
+ \relax\unskip\nobreakspace%
+ \fi%
+ \fi%
+ \fi%
+}
+
+\let\old@ref\ref
+\AtBeginDocument{\renewcommand\ref{\no@break@before\labelcref}}
\renewcommand\eqref{\no@break@before\labelcref}
\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}
+
+\newcommand{\subcref}[1]{\cref{sub@#1}}
+
+\DeclareDocumentCommand{\eqcrefname}{mmo}{
+ \crefname{#1}{#2}{\IfValueTF{#3}{#3}{#2s}}
+ \creflabelformat{#1}{(##2##1##3)}
+}
+
+\DeclareRobustCommand{\labelcrefrange}[2]{%
+ \@crefrangenostar{labelcref}{#1}{#2}%
+}
\let\old@cite\cite
\renewcommand\cite{\no@break@before\old@cite}
-\DeclareRobustCommand{\labelcrefrange}[2]{\@crefrangenostar{labelcref}{#1}{#2}}
+\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
+\NewBibliographyString{refname}
+\NewBibliographyString{refsname}
+\DefineBibliographyStrings{english}{%
+ refname = {Reference},
+ refsname = {References}
+}
+\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}
+\fi
+
+\ifhep@glossaries
+\RequirePackage[nostyles]{glossaries-extra}
+\glsenableentrycount
+\glssetcategoryattribute{abbreviation}{entrycount}{1}
+\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}%
+ }%
+}
+\glssetcategoryattribute{abbreviation}{nohyperfirst}{true}
+\renewcommand*{\glsdonohyperlink}[2]{{%
+ \glsxtrprotectlinks\edef\fieldvalue{%
+ \glsxtrusefield{\glslabel}{hastarget}%
+ }%
+ \ifdefstring\fieldvalue{true}{#2}{%
+ \gGlsXtrSetField{\glslabel}{hastarget}{true}%
+ \glsdohypertarget{#1}{#2}%
+ }%
+}}
+
+\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}%
+}}
+
+\DeclareDocumentCommand{\acronym}{sommo}{
+ \newabbreviation[
+ longplural=\IfNoValueTF{#5}{#4s}{#5},
+ \glsshortpluralkey=\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}
+ ]{#3}{\IfNoValueTF{#2}{#3}{#2}}{#4}
+ \expandafter\newcommand\csname#3\endcsname{%
+ \if@begin@of@sentence{\cGls{#3}}{\cgls{#3}}\@\xspace%
+ }
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
+ \IfNoValueTF{#2}{#3}{#2} }%
+ }
+ \expandafter\mathdef\csname#3\endcsname{%
+ \text{\glsxtrshort{#3}}\glsunset{#3}%
+ }
+ \expandafter\newcommand\csname#3s\endcsname{%
+ \if@begin@of@sentence{\cGlspl{#3}}{\cglspl{#3}}\@\xspace%
+ }
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
+ }
+ \expandafter\mathdef\csname#3s\endcsname{%
+ \text{\glsxtrshortpl{#3}}\glsunset{#3}%
+ }
+}
+\DeclareDocumentCommand{\shortacronym}{somm}{
+ \newabbreviation[
+ \glsshortpluralkey=\IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}}
+ ]{#3}{\IfNoValueTF{#2}{#3}{#2}}{#4}
+ \expandafter\newcommand\csname#3\endcsname{\cgls*{#3}\@\xspace}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{%
+ \IfNoValueTF{#2}{#3}{#2} }%
+ }
+ \expandafter\mathdef\csname#3\endcsname{\text{\glsxtrshort*{#3}}}
+ \expandafter\newcommand\csname#3s\endcsname{\cglspl*{#3}\@\xspace}
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfBooleanTF{#1}{#3}{\IfNoValueTF{#2}{#3s}{#2s}} }%
+ }
+ \expandafter\mathdef\csname#3s\endcsname{\text{\glsxtrshortpl*{#3}}}%
+ \glsunset{#3}
+}
+\DeclareDocumentCommand{\longacronym}{sommo}{
+ \expandafter\newcommand\csname#3\endcsname{%
+ \if@begin@of@sentence{\MakeUppercase#4}{#4}\@\xspace%
+ }
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3\endcsname{#4 }}
+ \expandafter\newcommand\csname#3s\endcsname{%
+ \if@begin@of@sentence{%
+ \IfNoValueTF{#5}{\MakeUppercase#4s}{\MakeUppercase#5}%
+ }{%
+ \IfNoValueTF{#5}{#4s}{#5}}\@\xspace%
+ }
+ \pdfstringdefDisableCommands{\expandafter\def\csname#3s\endcsname{%
+ \IfNoValueTF{#5}{#4s}{#5} }%
+ }
+}
+\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
+ }{}%
+ }%
+}
+\newcommand{\resetacronym}[1]{\protect\glsreset{#1}}
+\newcommand{\dummyacronym}[1]{\protect\glsunset{#1}}
+\fi
\endinput
%%