%%
%% This is file `hep-paper.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hep-paper-implementation.dtx  (with options: `package')
%% This is a generated file.
%% Copyright (C) 2019-2020 by Jan Hajer
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt
%% 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}[2021/09/01 v2.0 Publications in High Energy Physics]

\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=hep,
  prefix=hep@
}
\DeclareStringOption[a4]{paper}
\DeclareStringOption[11pt]{font}
\DeclareStringOption[british]{lang}
\DeclareBoolOption[true]{serif}
\DeclareComplementaryOption{sansserif}{serif}
\DeclareBoolOption[true]{lining}
\DeclareComplementaryOption{oldstyle}{lining}
\DeclareBoolOption[true]{parindent}
\DeclareComplementaryOption{parskip}{parindent}
\DeclareStringOption[true]{symbols}
\DeclareBoolOption[false]{defaults}
\DeclareBoolOption[true]{title}
\DeclareBoolOption[true]{physics}
\DeclareStringOption[numeric-comp]{bibliography}
\DeclareBoolOption[true]{glossaries}
\DeclareBoolOption[true]{references}
\DeclareBoolOption[false]{beamer}
\DeclareBoolOption[false]{revtex}
\DeclareBoolOption[false]{jhep}
\DeclareBoolOption[false]{jcap}
\DeclareBoolOption[false]{pos}
\DeclareBoolOption[false]{springer}
\DeclareBoolOption[false]{amsart}
\DeclareBoolOption[true]{eqnarray}
\DeclareBoolOption[false]{manualplacement}
\ProcessKeyvalOptions*
\def\hep@get@class#1.cls#2\relax{\def\hep@class{#1}}
\def\hep@getclass{\expandafter\hep@get@class\@filelist\relax}
\hep@getclass
\@ifclasswith{\hep@class}{10pt}{\setkeys{hep}{font=10pt}}{}
\@ifclasswith{\hep@class}{12pt}{\setkeys{hep}{font=12pt}}{}
\@ifclasswith{\hep@class}{a5paper}{\setkeys{hep}{paper=a5}}{}
\@ifclasswith{\hep@class}{b5paper}{\setkeys{hep}{paper=b5}}{}
\@ifclasswith{\hep@class}{letterpaper}{\setkeys{hep}{paper=letter}}{}
\@ifclasswith{\hep@class}{legalpaper}{\setkeys{hep}{paper=legal}}{}
\@ifclasswith{\hep@class}{executivepaper}{%
  \setkeys{hep}{paper=executive}%
}{}
\@ifclassloaded{amsart}{\setkeys{hep}{amsart}}{}
\ifhep@amsart
  \setkeys{hep}{defaults, title=false}
  \RequirePackage{xpatch}
  \xpretocmd{\@adminfootnotes}{\let\@makefntext\BHFN@OldMakefntext}{}{}
\fi
\@ifclassloaded{svjour}{\setkeys{hep}{springer}}{}
\@ifclassloaded{svjour2}{\setkeys{hep}{springer}}{}
\@ifclassloaded{svjour3}{\setkeys{hep}{springer}}{}
\ifhep@springer
  \setkeys{hep}{defaults, title=false}
  \let\cl@chapter\undefined
\fi
\@ifclassloaded{PoS}{\setkeys{hep}{pos}}{}
\ifhep@pos
  \setkeys{hep}{defaults, title=false}
  \DeclareRobustCommand\boldmath{\@nomath\boldmath\mathversion{bold}}
\fi
\@ifclassloaded{beamer}{\setkeys{hep}{beamer}}{}
\ifhep@beamer
  \setkeys{hep}{defaults, title=false, references=false, sansserif}
  \@ifpackageloaded{beamerbasefont}{\usefonttheme{professionalfonts}}{}
  \setbeamertemplate{navigation symbols}{}
\fi
\@ifclassloaded{revtex4}{\setkeys{hep}{revtex}}{}
\@ifclassloaded{revtex4-1}{\setkeys{hep}{revtex}}{}
\@ifclassloaded{revtex4-2}{\setkeys{hep}{revtex}}{}
\ifhep@revtex
  \setkeys{hep}{defaults, title=false, bibliography=false, lang=american}
\fi
\@ifpackageloaded{jheppub}{\setkeys{hep}{jhep}}{}
\@ifpackageloaded{jcappub}{\setkeys{hep}{jcap}}{}
\newif\ifhep@sissa
\ifhep@jhep\hep@sissatrue
\else
  \ifhep@jcap\hep@sissatrue
  \else\hep@sissafalse
  \fi
\fi
\ifhep@sissa
  \setkeys{hep}{defaults, title=false, bibliography=false}
  \PassOptionsToPackage{
    colorlinks=true, linktocpage=true, pdfproducer=medialab, pdfa=true,
    urlcolor=blue, anchorcolor=blue, citecolor=blue, filecolor=blue,
    linkcolor=blue, menucolor=blue, pagecolor=blue
  }{hyperref}
  \AtBeginDocument{\renewcommand{\foreignabbrfont}{}}
\fi
\ifhep@serif\else
  \renewcommand{\familydefault}{\sfdefault}
\fi
\RequirePackage[lining=\ifhep@lining true\else false \fi]{hep-font}
\RequirePackage[symbols=\hep@symbols]{hep-math-font}
\ifhep@defaults\else
  \def\hep@remove@pt#1pt{#1}
  \edef\hep@pt@size{\expandafter\hep@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\hep@pt@size.clo}
\fi
\ifhep@defaults\else
  \RequirePackage{geometry}
  \geometry{\hep@paper paper, includeheadfoot}
  \if@twocolumn
    \geometry{hscale=.85, vscale=.925, vmarginratio=1:1}
    \geometry{headsep=2ex, footskip=6ex}
    \setlength{\columnsep}{1.1em}
  \else
    \geometry{hscale=.75, vscale=.8, vmarginratio=3:4}
  \fi
\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[lang=\hep@lang]{hep-text}
\ifhep@physics\RequirePackage{hep-math}\fi
\RequirePackage[
  manualplacement=\ifhep@manualplacement true\else false \fi
]{hep-float}
\newif\ifhep@journal
\ifhep@sissa\hep@journaltrue
\else\ifhep@revtex\hep@journaltrue
  \else\ifhep@pos\hep@journaltrue
    \else\ifhep@springer\hep@journaltrue
      \else\hep@journalfalse
      \fi
    \fi
  \fi
\fi
\ifhep@journal
  \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
\ifhep@revtex
  \RequirePackage{ragged2e}
  \DeclareCaptionFormat{revtex}{#1#2\justifying{#3}}
  \captionsetup{font=small, format=revtex}
  \captionsetup[sub]{font=footnotesize, format=plain}
  \renewcommand{\figurename}{Figure}
  \renewcommand{\tablename}{Table}
\fi
\ifhep@title\RequirePackage{hep-title}\fi
\RequirePackage{pdftexcmds}
\ifnum\pdf@strcmp{\hep@bibliography}{false}=0\else
  \RequirePackage[style=\hep@bibliography]{hep-bibliography}
\fi

\RequirePackage{hyperref}
\hypersetup{
  pdfencoding=auto, psdextra,
  hidelinks, linktoc=all, breaklinks=true,
  pdfcreator={}, pdfproducer={}
}
\pdfstringdefDisableCommands{\def\varepsilon{\textepsilon}}
\pdfstringdefDisableCommands{\def\to{\textrightarrow}}
\AtBeginDocument{
  \pdfstringdefDisableCommands{\let\ensuremath\@gobble}
  \pdfstringdefDisableCommands{\let\mathsurround\@gobble}
  \pdfstringdefDisableCommands{\let\unskip\@gobble}
  \pdfstringdefDisableCommands{\let\thanks\@gobble}
  \pdfstringdefDisableCommands{\let\footnote\@gobble}
  \pdfstringdefDisableCommands{\let\\\@gobble}
}
\ifhep@revtex
  \AtBeginShipout{\hypersetup{pdftitle={\@title}}}
\else
  \ifhep@beamer\else
    \AtBeginDocument{\hypersetup{pdftitle={\@title}}}
  \fi
\fi
\ifhep@title
  \AtBeginDocument{\hypersetup{pdfauthor=\AB@authlist}}
\else
  \ifhep@beamer\else
    \ifhep@pos\else\AtBeginDocument{\hypersetup{pdfauthor={\@author}}}\fi
  \fi
\fi

\def\BackrefFootnoteTag{}
\RequirePackage{footnotebackref}
\let\@foot@note\footnote
\renewcommand{\footnote}[1]{\unskip\@foot@note{\ignorespaces#1}}

\ifhep@references
\RequirePackage[noabbrev, nameinlink]{cleveref}
\newcommand{\creflastconjunction}{, and\nobreakspace}
\crefname{enumi}{point}{points}
\crefname{inlinelisti}{point}{points}
\newcommand\no@break@before{%
  \relax\ifvmode\else%
    \ifhmode%
      \ifdim\lastskip > 0pt%
        \relax\unskip\nobreakspace%
      \fi%
    \fi%
  \fi%
}
\let\hep@ref\ref
\AtBeginDocument{\renewcommand\ref{\no@break@before\hep@ref}}
\renewcommand\eqref{\no@break@before\labelcref}
\let\hep@subref\subref
\renewcommand\subref{\no@break@before\hep@subref}
\renewcommand*\subcaption@ref[2]{\begingroup%
  \caption@setoptions{sub}%
  \subcaption@reffmt\p@subref{\hep@ref#1{sub@#2}}%
\endgroup}
\newcommand{\subcref}[1]{\cref{sub@#1}}
\NewDocumentCommand{\eqcrefname}{mmo}{
  \crefname{#1}{#2}{\IfValueTF{#3}{#3}{#2s}}
  \creflabelformat{#1}{(##2##1##3)}
}
\DeclareRobustCommand{\labelcrefrange}[2]{%
  \@crefrangenostar{labelcref}{#1}{#2}%
}
\ifhep@title
  \labelcrefmultiformat{affiliation}{#2#1#3}{%
    \textsuperscript,#2#1#3}{\textsuperscript,#2#1#3%
  }{%
    \textsuperscript,#2#1#3%
  }
  \labelcrefrangeformat{affiliation}{#3#1#4\textsuperscript{--}#5#2#6}
\fi
\fi

\let\hep@cite\cite
\renewcommand\cite{\no@break@before\hep@cite}
\ifhep@glossaries\RequirePackage{hep-acronym}\fi

\endinput
%%
%% End of file `hep-paper.sty'.
