% \iffalse meta-comment % % Copyright (C) 2019-2026 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 %\NeedsTeXFormat{LaTeX2e}[2021-11-15] %\ProvidesPackage{hep-text}[2026/08/01 v1.5 List and text extensions] %\ProvidesFile{hep-text-documentation.tex}[2026/08/01 v1.5 HEP-Text documentation] %\ProvidesFile{hep-text-text.tex}[2026/08/01 v1.5 HEP-Text tests] % %<*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} % %<*driver> \expandafter\newif\csname ifshort\endcsname \shortfalse \begin{document} \DocInput{hep-text-implementation.dtx} \end{document} % % % \fi % % \CheckSum{190} % % \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}{2021/09/01}{Created the dedicated text package with language and quotation support, foreign abbreviations, text helpers, list environments, and line-breakable underlining.} % \changes{v1.1}{2022/11/01}{Disabled styling of foreign abbreviations by default, made software names safe in PDF strings, added subsubparagraph, and tightened enumdescript internals.} % \changes{v1.2}{2023/07/01}{Updated documentation formatting, package metadata, and README wrapping.} % \changes{v1.3}{2024/11/01}{Switched line-breakable underlining from soulutf8 to soul and adjusted list example layout.} % \changes{v1.4}{2025/09/01}{Applied starred command definitions consistently.} % \changes{v1.5}{2026/08/01}{Raised the LaTeX format requirement, bumped release metadata, expanded the user documentation, README, and tests, and added no-indent-after-list handling.} % % \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 collects lightweight text utilities. It configures language-aware hyphenation, quotation marks, and Latin abbreviations through established \hologo{LaTeX} packages, adds helpers for software names, online references, email addresses, numero labels, prefix constructions, and line-breakable underlining, and defines compact inline and enumerated description lists based on \software{enumitem}. \end{abstract} Load the package with "\usepackage{hep-text}". \DescribeMacro{lang} The "lang" option selects the document language. It accepts the language names understood by \software{babel} \cite{babel}, which is loaded for hyphenation support. \software{csquotes} \cite{csquotes} provides context-sensitive quotation commands. \DescribeMacro{\enquote} \DescribeMacro{\MakeOuterQuote} The macros "\enquote"\marg{text} and "\MakeOuterQuote{}" leave the choice of quotation marks to \hologo{LaTeX}. The latter also allows \verb|"| to be used instead of the pair \verb|``| and \verb|''|. \DescribeMacro{\eg} \DescribeMacro{\ie} \DescribeMacro{\cf} \DescribeMacro{\vs} The \software{foreign} package \cite{foreign} defines common Latin abbreviations such as "\eg", "\ie", "\cf", and "\vs". They are typeset as \eg, \ie, \cf, and \vs with appropriate spacing. Redefine "\foreignabbrfont" to adjust their style, for example "\renewcommand\foreignabbrfont{\itshape}" for italic abbreviations. \DescribeMacro{\no} The "\no"\marg{number} macro prints a numero sign followed by a non-breaking space, as in \no{123}. \DescribeMacro{\software} The "\software"\oarg{version}\marg{name} macro typesets software names in small caps, with optional version information, as in \software[\fileversion]{HEP-Paper}. \DescribeMacro{\online} The "\online"\marg{url}\marg{text} macro links \meta{text} to \meta{url} when \software{hyperref} \cite{hyperref} is loaded and otherwise prints the text in a URL-like style, as in \online{https://ctan.org/pkg/hep-text}{ctan.org/pkg/hep-text}. \DescribeMacro{\email} The "\email"\marg{address} macro is shorthand for "\online"\marg{mailto:address}\marg{address}, as in \email{jan.hajer@tecnico.ulisboa.pt}. \DescribeMacro{\prefix} The "\prefix"\marg{prefix}\marg{word} macro typesets prefix constructions with a permissible line break after the prefix, as in \prefix{pre}{selection}. \DescribeMacro{\subsubparagraph} The "\subsubparagraph" macro starts an unnumbered paragraph-level break with the same vertical spacing as "\paragraph" but without a heading. \DescribeMacro{inlinelist} \DescribeMacro{enumdescript} The "inlinelist" and "enumdescript" environments are built with \software{enumitem} \cite{enumitem}. \\ \begin{columns} \begin{verbatim} The three main points are \begin{inlinelist} \item one \item two \item three \end{inlinelist} \end{verbatim} \column % \vspace{.1ex} 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 with \software{soul} \cite{soul} so that underlined text can break across lines. % \ifshort \printbibliography \end{document} % % % \fi % % \StopEventually{ % \PrintChanges % \printbibliography % } % % \appendix % % \section{Implementation} % %<*package> % % Load \software{kvoptions} \cite{kvoptions} and set up the "heptext" option namespace. % \begin{macrocode} \RequirePackage{kvoptions} \SetupKeyvalOptions{ family=heptext, prefix=heptext@ } % \end{macrocode} % % \begin{macro}{lang} % Define the "lang" option, which accepts the language names provided by \software{babel} \cite{babel}. % Use "british" as the default. % \begin{macrocode} \DeclareStringOption[british]{lang} % \end{macrocode} % \end{macro} % % \begin{macrocode} \ProcessKeyvalOptions* % \end{macrocode} % % Load \software{babel} \cite{babel} for hyphenation and \software{csquotes} \cite{csquotes} for quotation commands. % \begin{macrocode} \PassOptionsToPackage{\heptext@lang}{babel} \RequirePackage{babel} \PassOptionsToPackage{autostyle}{csquotes} \RequirePackage{csquotes} % \end{macrocode} % % \begin{macro}{\underline} % Load \software{soul} \cite{soul} for underlined text that can break across lines. % \begin{macrocode} \RequirePackage{soul} \let\underline\textul % \end{macrocode} % \end{macro} % % Use \software{pdftexcmds} \cite{pdftexcmds} to map the selected language to the option expected by \software{foreign}. % \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 \software{foreign} \cite{foreign} for common foreign abbreviations and vocabulary. % Add the missing "\vs" abbreviation. % \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 \software{csquotes}. % \begin{macrocode} \xspaceaddexceptions{\csq@qclose@i} % \end{macrocode} % %\begin{macro}{\no} % Define "\no"\marg{number} for \textnumero\ with appropriate spacing. % \begin{macrocode} \newcommand*{\no}[1]{\textnumero~#1} % \end{macrocode} % \end{macro} % %\begin{macro}{\software} % Define "\software"\linebreak[1]\oarg{version}\linebreak[1]\marg{name} for software names with optional version information, using \software{relsize} \cite{relsize} and \software{xparse} \cite{xparse}. % \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 "\online"\marg{url}\marg{text}, combining the link target of "\href" with the URL-style text of "\url". % Define "\email"\marg{address} as a convenience wrapper. % \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 "\prefix"\marg{prefix}\marg{word} with a controlled line break after the prefix. % \begin{macrocode} \newcommand*{\prefix}[2]{(#1\mbox{-)}\allowbreak #2} % \end{macrocode} % \end{macro} % % \begin{macro}{\subsubparagraph} % Define "\subsubparagraph", which starts a paragraph-level break without printing a 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 \software{enumitem} \cite{enumitem}. % \begin{macrocode} \PassOptionsToPackage{inline}{enumitem} \RequirePackage{enumitem} % \end{macrocode} % % \begin{environment}{inlinelist} % Define the 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 the enumerated description 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} % % Load \software{noindentafter} \cite{noindentafter} and suppress paragraph indentation after list environments. % \begin{macrocode} \RequirePackage{noindentafter} \NoIndentAfterEnv{itemize} \NoIndentAfterEnv{enumerate} \NoIndentAfterEnv{description} \NoIndentAfterEnv{enumdescript} \NoIndentAfterEnv{verbatim} % \end{macrocode} % % % % \section{Test} % %<*test> % % \begin{macrocode} \documentclass{article} \usepackage[lang=american]{hep-text} \usepackage{hyperref} \begin{document} \section{HEP-Text test} Language selection: \languagename. \MakeOuterQuote{"} Quotation commands: \enquote{quoted text} and "outer quoted text". Foreign abbreviations: \eg, \ie, \cf, and \vs. \begingroup \renewcommand\foreignabbrfont{\itshape} Styled foreign abbreviations: \eg, \ie, \cf, and \vs. \endgroup Numero labels: \no{123}. Software names: \software{HEP-Text} and \software[v1.5]{HEP-Text}. Online material: \online{https://ctan.org/pkg/hep-text} {ctan.org/pkg/hep-text}. Email addresses: \email{jan.hajer@tecnico.ulisboa.pt}. Prefix constructions: \prefix{pre}{selection} and \prefix{post}{processing}. \subsubparagraph This paragraph follows a heading-free paragraph-level break. \begin{itemize} \item An itemize entry. \end{itemize} This paragraph tests indentation after an itemize environment. \begin{enumerate} \item An enumerate entry. \end{enumerate} This paragraph tests indentation after an enumerate environment. \begin{description} \item[Term] A description entry. \end{description} This paragraph tests indentation after a description environment. Inline lists: \begin{inlinelist} \item first \item second \item third \end{inlinelist} \begin{enumdescript}[label=\Roman*)] \item{First} one \item{Second} two \item{Third} three \end{enumdescript} This paragraph tests indentation after an enumdescript environment. \noindent\begin{minipage}{.35\linewidth} \underline{This underlined sentence is long enough to wrap across multiple lines.} \end{minipage} \end{document} % \end{macrocode} % % % % \section{Readme} % %<*readme> % % \begin{macrocode} # The `hep-text` package List and text extensions ## Introduction The `hep-text` package collects lightweight text utilities. It configures language-aware hyphenation, quotation marks, and Latin abbreviations through established LaTeX packages; adds helpers for software names, online references, email addresses, numero labels, prefix constructions, and line-breakable underlining; and defines compact inline and enumerated description lists based on `enumitem`. Load the package with `\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} % % % % \Finale \endinput