1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
% \iffalse meta-comment
%
% Copyright (C) 2019 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}[2022/11/01 v1.1 Some text macros]
%<documentation>\ProvidesFile{hep-text-documentation.tex}[2022/11/01 v1.1 HEP-Text documentation]
%
%<*documentation>
\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{ltxdoc}
\AtBeginDocument{\DeleteShortVerb{\|}}
\AtBeginDocument{\MakeShortVerb{\"}}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\usepackage[parskip]{hep-paper}
\bibliography{bibliography}
\acronym{CM}{computer modern}
\acronym{LM}{latin modern}
\usepackage{hologo}
\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}
\MacroIndent=1.5em
\AtBeginEnvironment{macrocode}{\renewcommand{\ttdefault}{clmt}}
%</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}{2022/11/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
|