Debian Codegraph @

texmf-dist/source/latex/hep-text/hep-text-implementation.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2019-2023 by Jan Hajer
4 % -----------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3c
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3c or later is part of all distributions of LaTeX
14 % version 2005/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19
20 %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
21 %<package>\ProvidesPackage{hep-text}[2025/09/01 v1.4 Some text macros]
22 %<documentation>\ProvidesFile{hep-text-documentation.tex}[2025/09/01 v1.4 HEP-Text documentation]
23 %
24 %<*documentation>
25
26 \RequirePackage[l2tabu, orthodox]{nag}
27 \documentclass{ltxdoc}
28
29 \renewcommand*\theCodelineNo{\rmfamily\tstyle\footnotesize\arabic{CodelineNo}}
30 \AtBeginEnvironment{macrocode}{\renewcommand*{\ttdefault}{clmt}}
31 \renewcommand*{\MacroFont}{\codestyle}
32 \AtBeginDocument{\DeleteShortVerb{\|}}
33 \AtBeginDocument{\MakeShortVerb{\"}}
34 \EnableCrossrefs
35 \CodelineIndex
36 \RecordChanges
37
38 \usepackage{hologo}
39
40 \usepackage[parskip,oldstyle,font=10pt]{hep-paper}
41 \bibliography{bibliography}
42
43 \acronym{CM}{computer modern}
44 \acronym{LM}{latin modern}
45
46 \newenvironment{columns}[1][.5]{%
47 \par\vspace{-\bigskipamount}%
48 \begin{minipage}[t]{\linewidth}%
49 \begin{minipage}[t]{#1\linewidth}%
50 \def\column{%
51 \end{minipage}%
52 \begin{minipage}[t]{\linewidth-#1\linewidth}%
53 }%
54 }{\end{minipage}\end{minipage}\par}
55 %</documentation>
56
57 %<*driver>
58 \expandafter\newif\csname ifshort\endcsname
59 \shortfalse
60 \begin{document}
61 \DocInput{hep-text-implementation.dtx}
62 \end{document}
63 %</driver>
64 %
65 % \fi
66 %
67 % \CheckSum{129}
68 %
69 % \CharacterTable
70 % {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
71 % 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
72 % Digits \0\1\2\3\4\5\6\7\8\9
73 % Exclamation \! Double quote \" Hash (number) \#
74 % Dollar \$ Percent \% Ampersand \&
75 % Acute accent \' Left paren \( Right paren \)
76 % Asterisk \* Plus \+ Comma \,
77 % Minus \- Point \. Solidus \/
78 % Colon \: Semicolon \; Less than \<
79 % Equals \= Greater than \> Question mark \?
80 % Commercial at \@ Left bracket \[ Backslash \\
81 % Right bracket \] Circumflex \^ Underscore \_
82 % Grave accent \` Left brace \{ Vertical bar \|
83 % Right brace \} Tilde \~}
84 %
85 % \changes{v1.0}{2019/01/01}{Initial version of the style file.}
86 % \changes{v1.1}{2022/11/01}{Bug fixes.}
87 % \changes{v1.2}{2023/07/01}{Bug fixes.}
88 % \changes{v1.3}{2024/11/01}{Bug fixes.}
89 % \changes{v1.4}{2025/11/01}{Bug fixes.}
90 %
91 % \ifshort
92 %<*documentation>
93 % \fi
94 %
95 \GetFileInfo{hep-text.sty}
96
97 \title{The \software{hep-text} package\thanks{This document corresponds to \software{hep-text}~\fileversion.}}
98 \subtitle{List and text extensions}
99 \author{Jan Hajer \email{[email protected]}}
100 \date{\filedate}
101
102 % \ifshort
103 \begin{document}
104 % \fi
105
106 \newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}
107
108 \maketitle
109
110 \begin{abstract}
111 The \software{hep-text} package extends \hologo{LaTeX} lists using the \software{enumitem} package and provides some text macros.
112 \end{abstract}
113
114 The package can be loaded by "\usepackage{hep-text}".
115
116 \DescribeMacro{lang}
117 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.
118
119 Quotation commands are provided by the \software{csquotes} package \cite{csquotes}.
120 \DescribeMacro{\enquote}
121 \DescribeMacro{\MakeOuterQuote}
122 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.
123
124 \DescribeMacro{\eg}
125 \DescribeMacro{\vs}
126 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.
127 Issuing "\renewcommand\foreignabbrfont{\itshape}" these abbreviations are typeset in italic.
128
129 \DescribeMacro{\no}
130 The "\no"\marg{number} macro is typeset as \no{123}.
131
132 \DescribeMacro{\software}
133 The "\software"\oarg{version}\marg{name} macro is typeset as \software[\fileversion]{HEP-Paper}.
134
135 \DescribeMacro{\online}
136 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}.
137
138
139 \DescribeMacro{inlinelist}
140 \DescribeMacro{enumdescript}
141 The "inlinelist" and "enumdescript" environments are defined using the \software{enumitem} package \cite{enumitem}.
142 \\
143 \begin{columns}
144 \begin{verbatim}
145 The three main points are
146 \begin{inlinelist}
147 \item one
148 \item two
149 \item three
150 \end{inlinelist}
151 \end{verbatim}
152 \column
153 % \vspace{.1ex}
154 The three main points are
155 \begin{inlinelist}
156 \item one
157 \item two
158 \item three
159 \end{inlinelist}
160 \end{columns}
161 \vspace{4ex}
162 \begin{columns}[.6]
163 \begin{verbatim}
164 \begin{enumdescript}[label=\Roman*)]
165 \item{First} one
166 \item{Second} two
167 \item{Third} three
168 \end{enumdescript}
169 \end{verbatim}
170 \column
171 \begin{enumdescript}[label=\Roman*)]
172 \item{First} one
173 \item{Second} two
174 \item{Third} three
175 \end{enumdescript}
176 \end{columns}
177
178 \DescribeMacro{\underline}
179 The "\underline" macro is redefined to allow line-breaks using the \software{soul} package \cite{soul}.
180
181 % \ifshort
182 \printbibliography
183
184 \end{document}
185 %
186 %</documentation>
187 % \fi
188 %
189 % \StopEventually{
190 % \printbibliography
191 % \PrintChanges
192 % }
193 %
194 % \appendix
195 %
196 % \section{Implementation}
197 %
198 %<*package>
199 %
200 % Load the \software{kvoptions} package \cite{kvoptions} and define a "heptext" namespace.
201 % \begin{macrocode}
202 \RequirePackage{kvoptions}
203 \SetupKeyvalOptions{
204 family=heptext,
205 prefix=heptext@
206 }
207 % \end{macrocode}
208 %
209 % \begin{macro}{lang}
210 % Define the "lang" option, which takes the values provided by the \software{babel} package \cite{babel}.
211 % Make "british" the default language.
212 % \begin{macrocode}
213 \DeclareStringOption[british]{lang}
214 % \end{macrocode}
215 % \end{macro}
216 %
217 % \begin{macrocode}
218 \ProcessKeyvalOptions*
219 % \end{macrocode}
220 %
221 % Load the \software{babel} package \cite{babel} for hyphenation and the recommended \software{csquotes} package \cite{csquotes}.
222 % \begin{macrocode}
223 \PassOptionsToPackage{\heptext@lang}{babel}
224 \RequirePackage{babel}
225 \PassOptionsToPackage{autostyle}{csquotes}
226 \RequirePackage{csquotes}
227 % \end{macrocode}
228 %
229 % \begin{macro}{\underline}
230 % Load the \software{soul} package \cite{soul} for hyphenable underlined text.
231 % \begin{macrocode}
232 \RequirePackage{soul}
233 \let\underline\textul
234 % \end{macrocode}
235 % \end{macro}
236 %
237 % Check the "lang" option using the \software{pdftexcmds} package \cite{pdftexcmds}.
238 % \begin{macrocode}
239 \RequirePackage{pdftexcmds}
240 \ifnum\pdf@strcmp{\heptext@lang}{american}=0
241 \newcommand*{\heptext@lang@foreign}{USenglish}
242 \else
243 \ifnum\pdf@strcmp{\heptext@lang}{USenglish}=0
244 \newcommand*{\heptext@lang@foreign}{USenglish}
245 \else
246 \newcommand*{\heptext@lang@foreign}{british}
247 \fi
248 \fi
249 % \end{macrocode}
250 %
251 %\begin{macro}{\vs}
252 % Load the \software{foreign} package \cite{foreign} in order to highlight abbreviations and vocabularies from foreign languages.
253 % Add the missing "\vs" command.
254 % \begin{macrocode}
255 \PassOptionsToPackage{all, \heptext@lang@foreign}{foreign}
256 \RequirePackage{foreign}
257 \renewcommand*\foreignabbrfont{}
258 \DeclareRobustCommand\vs{\xperiodafter{{\foreignabbrfont{vs}}}}
259 % \end{macrocode}
260 % \end{macro}
261 %
262 % The \software{foreign} package relies on the \software{xspace} package \cite{xspace}.
263 % Ensure that "\xspace" is compatible with the "\enquote" macro from the \software{csquote} package.
264 % \begin{macrocode}
265 \xspaceaddexceptions{\csq@qclose@i}
266 % \end{macrocode}
267 %
268 %\begin{macro}{\no}
269 % Define the macro "\no"\marg{number} for the use of \textnumero\ with appropriate spacing.
270 % \begin{macrocode}
271 \newcommand*{\no}[1]{\textnumero~#1}
272 % \end{macrocode}
273 % \end{macro}
274 %
275 %\begin{macro}{\software}
276 % 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.
277 % \begin{macrocode}
278 \RequirePackage{relsize}
279 \newcommand*{\software}[2][\hspace{-\fontdimen2\font}]{%
280 {\smaller[.5]\textsc{#2}~#1}%
281 }
282 \RequirePackage{xparse}
283 \NewExpandableDocumentCommand\hep@gobble@opt@arg{om}{#2}
284 \AtBeginDocument{\@ifpackageloaded{hyperref}{%
285 \pdfstringdefDisableCommands{\let\software\hep@gobble@opt@arg}%
286 }{}}
287 % \end{macrocode}
288 % \end{macro}
289 %
290 % \begin{macro}{\online}
291 % \begin{macro}{\email}
292 % Define the "\online"\marg{text}\marg{url} macro combining the features of the "\href" and the "\url" macros.
293 % Define a macro for typesetting emails.
294 % \begin{macrocode}
295 \providecommand*{\online}[2]{\texttt{#2}}%
296 \providecommand*{\hep@email}[1]{\online{mailto:#1}{#1}}
297 \providecommand*{\email}{\hep@email}
298 \AtBeginDocument{\@ifpackageloaded{hyperref}{%
299 \renewcommand*{\online}[2]{\href{#1}{\nolinkurl{#2}}}%
300 }{}}
301 % \end{macrocode}
302 % \end{macro}
303 % \end{macro}
304 %
305 % \begin{macro}{\prefix}
306 % Define the "\prefix"\marg{prefix}\marg{word} macro ensuring the correct linebreak in \prefix{prefix}{word}.
307 % \begin{macrocode}
308 \newcommand*{\prefix}[2]{(#1\mbox{-)}\allowbreak #2}
309 % \end{macrocode}
310 % \end{macro}
311 %
312 % \begin{macro}{\subsubparagraph}
313 % Define the "\subsubparagraph" macro starting a new paragraph with the same spacing as the paragraph macro but without title.
314 % \begin{macrocode}
315 \newcommand*\subsubparagraph{%
316 \@tempskipa 3.25ex \@plus 1ex \@minus .2ex\relax%
317 \addpenalty\@secpenalty\addvspace\@tempskipa%
318 \everypar{\setbox\z@\lastbox\everypar{}}%
319 }
320 % \end{macrocode}
321 % \end{macro}
322 %
323 % \subsection{Lists}
324 %
325 % Load the \software{enumitem} package \cite{enumitem}.
326 % \begin{macrocode}
327 \PassOptionsToPackage{inline}{enumitem}
328 \RequirePackage{enumitem}
329 % \end{macrocode}
330 %
331 % \begin{environment}{inlinelist}
332 % Define an inline list environment.
333 % \begin{macrocode}
334 \newlist{inlinelist}{enumerate*}{1}
335 \setlist*[inlinelist,1]{%
336 label=\roman*), itemjoin={,\ }, itemjoin*={, and\ }, after=.%
337 }
338 % \end{macrocode}
339 % \end{environment}
340 %
341 % \begin{environment}{enumdescript}
342 % Define an enumdescript list environment.
343 % \begin{macrocode}
344 \newlist{enumdesc}{enumerate}{2}
345 \setlist[enumdesc]{label=\arabic*.}
346 \newenvironment{enumdescript}[1][]{
347 \begin{enumdesc}[#1]
348 \let\hep@item\item
349 \renewcommand*{\item}[2][]{%
350 \ifx&##1&\hep@item\else\hep@item[##1]\fi%
351 \textbf{##2}\ifx##2\empty\else\hspace{1em}\fi%
352 \@ifnextchar\par\@gobble\relax%
353 }
354 }{\end{enumdesc}}
355 % \end{macrocode}
356 % \end{environment}
357 %
358 %</package>
359 %
360 % \section{Readme}
361 %
362 %<*readme>
363 %
364 % \begin{macrocode}
365 # The `hep-text` package
366
367 List and text extensions
368
369 ## Introduction
370
371 The `hep-text` package extends `LaTeX` lists using the `enumitem package
372 and provides some text macros.
373
374 The package can be loaded by `\usepackage{hep-text}`.
375
376 ## Author
377
378 Jan Hajer
379
380 ## License
381
382 This file may be distributed and/or modified under the conditions of the
383 `LaTeX` Project Public License, either version 1.3c of this license or
384 (at your option) any later version. The latest version of this license is
385 in `http://www.latex-project.org/lppl.txt` and version 1.3c or later is
386 part of all distributions of LaTeX version 2005/12/01 or later.
387 % \end{macrocode}
388 %
389 %</readme>
390 %
391 % \Finale
392
393 \endinput
394
395 % \PrintIndex
396 % makeindex -s gglo.ist -o hep-text-implementation.gls hep-text-implementation.glo
397 % makeindex -s gglo.ist -o hep-text-implementation.ind hep-text-implementation.idx