% \iffalse meta-comment
%
% Copyright (C) 2019-2023 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.
%
% \fi
%
% \iffalse

%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{hep-text}[2023/07/01 v1.2 Some text macros]
%<documentation>\ProvidesFile{hep-text-documentation.tex}[2023/07/01 v1.2 HEP-Text documentation]
%
%<*documentation>

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{ltxdoc}

\renewcommand\theCodelineNo{\rmfamily\tstyle\footnotesize\arabic{CodelineNo}}
\AtBeginEnvironment{macrocode}{\renewcommand{\ttdefault}{clmt}}
\renewcommand{\MacroFont}{\codestyle}
\AtBeginDocument{\DeleteShortVerb{\|}}
\AtBeginDocument{\MakeShortVerb{\"}}
\EnableCrossrefs
\CodelineIndex
\RecordChanges

\usepackage{hologo}

\usepackage[parskip,oldstyle,font=10pt]{hep-paper}
\bibliography{bibliography}

\acronym{CM}{computer modern}
\acronym{LM}{latin modern}

\newenvironment{columns}[1][.5]{%
  \par\vspace{-\bigskipamount}%
  \begin{minipage}[t]{\linewidth}%
  \begin{minipage}[t]{#1\linewidth}%
  \def\column{%
    \end{minipage}%
    \begin{minipage}[t]{\linewidth-#1\linewidth}%
  }%
}{\end{minipage}\end{minipage}\par}
%</documentation>

%<*driver>
\expandafter\newif\csname ifshort\endcsname
\shortfalse
\begin{document}
\DocInput{hep-text-implementation.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{129}
%
% \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
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0}{2019/01/01}{Initial version of the style file.}
% \changes{v1.1}{2023/07/01}{Bug fixes.}
%
% \ifshort
%<*documentation>
% \fi
%
\GetFileInfo{hep-text.sty}

\title{The \software{hep-text} package\thanks{This document corresponds to \software{hep-text}~\fileversion.}}
\subtitle{List and text extensions}
\author{Jan Hajer \email{jan.hajer@tecnico.ulisboa.pt}}
\date{\filedate}

% \ifshort
\begin{document}
% \fi

\newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}

\maketitle

\begin{abstract}
The \software{hep-text} package extends \hologo{LaTeX} lists using the \software{enumitem} package and provides some text macros.
\end{abstract}

The package can be loaded by "\usepackage{hep-text}".

\DescribeMacro{lang}
The "lang" option sets the used language and takes the values allowed by the \software{babel} package \cite{babel}, that is loaded for its hyphenation support.

Quotation commands are provided by the \software{csquotes} package \cite{csquotes}.
\DescribeMacro{\enquote}
\DescribeMacro{\MakeOuterQuote}
It provides the convenient macros "\enquote"\marg{text} and "\MakeOuterQuote{}" allowing to leave the choice of quotation marks to \hologo{LaTeX} and use \verb|"| instead of the pair \verb|``| and \verb|''|, respectively.

\DescribeMacro{\eg}
\DescribeMacro{\vs}
The \software{foreign} package \cite{foreign} defines macros such as "\eg", "\ie", "\cf", and "\vs" which are typeset as \eg, \ie, \cf, and \vs with the appropriate spacing.
Issuing "\renewcommand\foreignabbrfont{\itshape}" these abbreviations are typeset in italic.

\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}\allowbreak\marg{text}\allowbreak \cite{hyperref} and the "\url"\marg{text} \cite{url} macros, resulting in \eg \online{https://ctan.org/pkg/hep-text}{ctan.org/pkg/hep-text}.


\DescribeMacro{inlinelist}
\DescribeMacro{enumdescript}
The "inlinelist" and "enumdescript" environments are defined using the \software{enumitem} package \cite{enumitem}.
\begin{columns}
\begin{verbatim}
The three main points are
\begin{inlinelist}
  \item one
  \item two
  \item three
\end{inlinelist}
\end{verbatim}
\column
The three main points are
\begin{inlinelist}
 \item one
 \item two
 \item three
\end{inlinelist}
\end{columns}
\vspace{4ex}
\begin{columns}[.6]
\begin{verbatim}
\begin{enumdescript}[label=\Roman*)]
  \item{First} one
  \item{Second} two
  \item{Third} three
\end{enumdescript}
\end{verbatim}
\column
\begin{enumdescript}[label=\Roman*)]
 \item{First} one
 \item{Second} two
 \item{Third} three
\end{enumdescript}
\end{columns}

\DescribeMacro{\underline}
The "\underline" macro is redefined to allow line-breaks using the \software{soulutf8} package \cite{soulutf8}.

% \ifshort
\printbibliography

\end{document}
%
%</documentation>
% \fi
%
% \StopEventually{
% \printbibliography
% \PrintChanges
% }
%
% \appendix
%
% \section{Implementation}
%
%<*package>
%
% Load the \software{kvoptions} package \cite{kvoptions} and define a "heptext" namespace.
%    \begin{macrocode}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=heptext,
  prefix=heptext@
}
%    \end{macrocode}
%
% \begin{macro}{lang}
% Define the "lang" option, which takes the values provided by the \software{babel} package \cite{babel}.
% Make "british" the default language.
%    \begin{macrocode}
\DeclareStringOption[british]{lang}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\ProcessKeyvalOptions*
%    \end{macrocode}
%
% Load the \software{babel} package \cite{babel} for hyphenation and the recommended \software{csquotes} package \cite{csquotes}.
%    \begin{macrocode}
\PassOptionsToPackage{\heptext@lang}{babel}
\RequirePackage{babel}
\PassOptionsToPackage{autostyle}{csquotes}
\RequirePackage{csquotes}
%    \end{macrocode}
%
% \begin{macro}{\underline}
% Load the \software{soulutf8} package \cite{soulutf8} for hyphenable underlined text.
%    \begin{macrocode}
\RequirePackage{soulutf8}
\let\underline\textul
%    \end{macrocode}
% \end{macro}
%
% Check the "lang" option using the \software{pdftexcmds} package \cite{pdftexcmds}.
%    \begin{macrocode}
\RequirePackage{pdftexcmds}
\ifnum\pdf@strcmp{\heptext@lang}{american}=0
  \newcommand{\heptext@lang@foreign}{USenglish}
\else
  \ifnum\pdf@strcmp{\heptext@lang}{USenglish}=0
    \newcommand{\heptext@lang@foreign}{USenglish}
  \else
    \newcommand{\heptext@lang@foreign}{british}
  \fi
\fi
%    \end{macrocode}
%
%\begin{macro}{\vs}
% Load the \software{foreign} package \cite{foreign} in order to highlight abbreviations and vocabularies from foreign languages.
% Add the missing "\vs" command.
%    \begin{macrocode}
\PassOptionsToPackage{all, \heptext@lang@foreign}{foreign}
\RequirePackage{foreign}
\renewcommand\foreignabbrfont{}
\DeclareRobustCommand\vs{\xperiodafter{{\foreignabbrfont{vs}}}}
%    \end{macrocode}
% \end{macro}
%
% The \software{foreign} package relies on the \software{xspace} package \cite{xspace}.
% Ensure that "\xspace" is compatible with the "\enquote" macro from the \software{csquote} package.
%    \begin{macrocode}
\xspaceaddexceptions{\csq@qclose@i}
%    \end{macrocode}
%
%\begin{macro}{\no}
% Define the macro "\no"\marg{number} for the use of \textnumero\ with appropriate spacing.
%    \begin{macrocode}
\newcommand{\no}[1]{\textnumero~#1}
%    \end{macrocode}
% \end{macro}
%
%\begin{macro}{\software}
% Define a macro for software with optional version information "\software"\linebreak[1]\oarg{version}\linebreak[1]\marg{name}, using the \software{relsize} \cite{relsize} and \software{xparse} \cite{xparse} packages.
%    \begin{macrocode}
\RequirePackage{relsize}
\newcommand{\software}[2][\hspace{-\fontdimen2\font}]{%
  {\smaller[.5]\textsc{#2}~#1}%
}
\RequirePackage{xparse}
\NewExpandableDocumentCommand\hep@gobble@opt@arg{om}{#2}
\AtBeginDocument{\@ifpackageloaded{hyperref}{%
  \pdfstringdefDisableCommands{\let\software\hep@gobble@opt@arg}%
}{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\online}
% \begin{macro}{\email}
% Define the "\online"\marg{text}\marg{url} macro combining the features of the "\href" and the "\url" macros.
% Define a macro for typesetting emails.
%    \begin{macrocode}
\providecommand{\online}[2]{\texttt{#2}}%
\providecommand{\hep@email}[1]{\online{mailto:#1}{#1}}
\providecommand\email{\hep@email}
\AtBeginDocument{\@ifpackageloaded{hyperref}{%
  \renewcommand{\online}[2]{\href{#1}{\nolinkurl{#2}}}%
}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\prefix}
% Define the "\prefix"\marg{prefix}\marg{word} macro ensuring the correct linebreak in \prefix{prefix}{word}.
%    \begin{macrocode}
\newcommand{\prefix}[2]{(#1\mbox{-)}\allowbreak #2}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subsubparagraph}
% Define the "\subsubparagraph" macro starting a new paragraph with the same spacing as the paragraph macro but without title.
%    \begin{macrocode}
\newcommand\subsubparagraph{%
  \@tempskipa 3.25ex \@plus 1ex \@minus .2ex\relax%
  \addpenalty\@secpenalty\addvspace\@tempskipa%
  \everypar{\setbox\z@\lastbox\everypar{}}%
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Lists}
%
% Load the \software{enumitem} package \cite{enumitem}.
%    \begin{macrocode}
\PassOptionsToPackage{inline}{enumitem}
\RequirePackage{enumitem}
%    \end{macrocode}
%
% \begin{environment}{inlinelist}
% Define an inline list environment.
%    \begin{macrocode}
\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{%
  label=\roman*), itemjoin={,\ }, itemjoin*={, and\ }, after=.%
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{enumdescript}
% Define an enumdescript list environment.
%    \begin{macrocode}
\newlist{enumdesc}{enumerate}{2}
\setlist[enumdesc]{label=\arabic*.}
\newenvironment{enumdescript}[1][]{
\begin{enumdesc}[#1]
  \let\hep@item\item
  \renewcommand{\item}[2][]{%
    \ifx&##1&\hep@item\else\hep@item[##1]\fi%
    \textbf{##2}\ifx##2\empty\else\hspace{1em}\fi%
    \@ifnextchar\par\@gobble\relax%
  }
}{\end{enumdesc}}
%    \end{macrocode}
% \end{environment}
%
%</package>
%
% \section{Readme}
%
%<*readme>
%
%    \begin{macrocode}
# The `hep-text` package

List and text extensions

## Introduction

The `hep-text` package extends `LaTeX` lists using the `enumitem package
and provides some text macros.

The package can be loaded by `\usepackage{hep-text}`.

## Author

Jan Hajer

## License

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.
%    \end{macrocode}
%
%</readme>
%
% \Finale

\endinput

% \PrintIndex
% makeindex -s gglo.ist -o hep-text-implementation.gls hep-text-implementation.glo
% makeindex -s gglo.ist -o hep-text-implementation.ind hep-text-implementation.idx