Debian Codegraph @

texmf-dist/doc/latex/hereapplies/hereapplies-doc.tex

raw
1 %% LyX 2.3.7 created this file. For more info, see http://www.lyx.org/.
2 %% Do not edit unless you really know what you are doing.
3 \documentclass[english]{article}
4 \usepackage[T1]{fontenc}
5 \usepackage[a4paper]{geometry}
6 \geometry{verbose,tmargin=3.25cm,bmargin=3.25cm,lmargin=3.25cm,rmargin=3.25cm}
7 \usepackage{babel}
8 \usepackage{url}
9 \usepackage{setspace}
10 \usepackage{microtype}
11 \onehalfspacing
12 \usepackage[unicode=true,
13 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
14 breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
15 {hyperref}
16 \hypersetup{pdftitle={The \textquotedblleft{}Here Applies\textquotedblright{} LaTeX Package},
17 pdfauthor={madmurphy},
18 pdfsubject={Package documentation},
19 pdfkeywords={Glossary, Index, LaTeX, LaTeX hyperref, LaTeX labels, LaTeX package, LyX, LyX module, TOC}}
20
21 \makeatletter
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
23 \usepackage{doc}
24 \usepackage{upquote}
25
26 \AtBeginDocument{%
27 % LyX should add automatically `\usepackage{listings}` to the preamble...
28 \lstset{%
29 language=TeX,
30 basicstyle=\footnotesize,
31 numbers=left,
32 stepnumber=1,
33 showstringspaces=false,
34 tabsize=1,
35 breaklines=true,
36 breakatwhitespace=false,
37 }%
38 }
39
40 \makeatother
41
42 \usepackage{listings}
43 \renewcommand{\lstlistingname}{Listing}
44
45 \begin{document}
46 \title{The \textbf{Here Applies} \LaTeX{} Package}
47
48 \maketitle
49 \bigskip{}
50
51 \begin{abstract}
52 A \LaTeX{} package for referencing groups of pages that share something
53 in common.
54 \end{abstract}
55 \vspace{2cm}
56
57
58 \section{Overview}
59
60 \textbf{Here Applies} is a \LaTeX{} package that allows to collect
61 groups of labels and reference them altogether. It can be used for
62 creating informal glossaries that cross-link concepts to their applications,
63 or simply mentioning multiple pages that share something in common.
64
65 The package offers two commands: \texttt{\textbackslash hereapplies}
66 and \texttt{\textbackslash whereapplies} (plus their ``starred''
67 versions \texttt{\textbackslash hereapplies{*}} and \texttt{\textbackslash whereapplies{*}}).
68 In both cases an identifier is passed as argument, and this can be
69 any string invented in the moment (\texttt{\textbackslash hereapplies}
70 additionally supports more than one identifier in the form of a comma-separated
71 list).
72
73 Every time \texttt{\textbackslash hereapplies} is invoked with known
74 identifiers, the document is made aware that the place shares some
75 kind of connection with other places in which the same identifiers
76 were used. And so, every time the \texttt{\textbackslash whereapplies}
77 command is invoked with a known identifier, all occurrences of the
78 latter within the entire document will be printed in the form of a
79 linkable page list (e.g. ``pp.\ 1, 5, 8--9, 14--20\dots '').
80
81 As \texttt{\textbackslash hereapplies} is designed to be invoked
82 in the middle of a chapter or a section and that location must be
83 made linkable, the \texttt{\textbackslash phantomsection} directive
84 is invoked by default before a label is added. To avoid calling \texttt{\textbackslash phantomsection},
85 the ``starred'' command \texttt{\textbackslash hereapplies{*}}
86 is available.
87
88 Finally, like \texttt{\textbackslash whereapplies} resembles a pluralizable
89 version of \texttt{\textbackslash pageref}, its ``starred'' version
90 \texttt{\textbackslash whereapplies{*}} will resemble a pluralizable
91 version of \texttt{\textbackslash pageref{*}}.
92
93 If you use LyX, the package ships a LyX module as well (please check
94 the \texttt{lyx-module} subdirectory).
95
96 \pagebreak{}
97
98 \section{Example usage}
99
100 The following \LaTeX{} manuscript
101
102 \vspace{3ex}
103
104 \lstinputlisting[language=TeX]{hereapplies-example.tex}
105
106 \vspace{3ex}
107
108 \noindent will generate the \url{hereapplies-example.pdf} document
109 attached.
110
111 \section{A minimal tutorial}
112
113 \begin{macro}{\hereapplies}
114
115 Syntax:
116
117 \bigskip{}
118
119 \texttt{\textbackslash hereapplies\enskip{}{[}$\langle$}\texttt{\textit{label}}\texttt{$\rangle${]}\enskip{}\{$\langle$}\texttt{\textit{identifiers}}\texttt{$\rangle$\}}
120
121 \texttt{\textbackslash hereapplies{*}\enskip{}{[}$\langle$}\texttt{\textit{label}}\texttt{$\rangle${]}\enskip{}\{$\langle$}\texttt{\textit{identifiers}}\texttt{$\rangle$\}}
122
123 \noindent \smallskip{}
124
125 \noindent The \texttt{\textbackslash hereapplies} command notifies
126 the document that one or more identifiers apply to a particular point
127 and adds a label to it.
128
129 If the optional argument is passed the label created will be named
130 accordingly, otherwise an opaque name will be chosen for it. This
131 argument may contain only what is legal for \texttt{\textbackslash pageref}.
132
133 The \texttt{\textit{identifiers}} argument must be a comma-separated
134 list of identifiers (leading and trailing spaces around each member
135 will be ignored). Each of these strings will remain confined within
136 the internal scope of the package and will not create conflicts with
137 possible macros or labels of the same names.
138
139 After storing some internal values, \texttt{\textbackslash hereapplies}
140 will expand exactly to
141
142 \smallskip{}
143
144 \begin{lstlisting}[language=TeX,numbers=none]
145 \phantomsection\label{...}
146 \end{lstlisting}
147
148 \smallskip{}
149
150 Its ``starred'' version (\texttt{\textbackslash hereapplies{*}})
151 will not invoke the \texttt{\textbackslash phantomsection} directive.
152
153 \end{macro}
154
155 \smallskip{}
156
157 \begin{macro}{\whereapplies}
158
159 Syntax:
160
161 \bigskip{}
162
163 \texttt{\textbackslash whereapplies\enskip{}\{$\langle$}\texttt{\textit{identifier}}\texttt{$\rangle$\}}
164
165 \texttt{\textbackslash whereapplies{*}\enskip{}\{$\langle$}\texttt{\textit{identifier}}\texttt{$\rangle$\}}
166
167 \noindent \smallskip{}
168
169 \noindent The \texttt{\textbackslash whereapplies} command prints
170 all the occurrences of an identifier, in the form ``p.\ \dots ''
171 or ``pp.\ \dots '' (with page range support).
172
173 The \texttt{\textit{identifier}} argument will remain confined within
174 the internal scope of the package and will not create conflicts with
175 possible commands or labels of the same name. Leading and trailing
176 spaces around this string will be ignored.
177
178 If the same \texttt{\textit{identifier}} is not passed to \texttt{\textbackslash hereapplies}
179 at least once throughout the document, \texttt{\textbackslash whereapplies}
180 will print ``\textbf{??}''.
181
182 The ``starred'' version of this command (\texttt{\textbackslash whereapplies{*}})
183 will use \texttt{\textbackslash pageref{*}} instead of \texttt{\textbackslash pageref}
184 for generating the page list.
185
186 \end{macro}
187
188 \section{Internationalization}
189
190 Currently the localization of \textbf{Here Applies} is not automatic.
191 It is possible however to control the strings generated by overwriting
192 the four macros \texttt{\textbackslash hapage}, \texttt{\textbackslash hapages},
193 \texttt{\textbackslash hadelimiter} and \texttt{\textbackslash halastdelimiter}.
194 For example, writing at the beginning of a document
195
196 \vspace{3ex}
197
198 \begin{lstlisting}[language=TeX]
199 % German translation of **Here Applies**
200 % English: "p.\ "
201 \gdef\hapage{S.\ }
202 % English: "pp.\ "
203 \gdef\hapages{S.\ }
204 % English: "\ and\ "
205 \gdef\halastdelimiter{\ und\ }
206 % English: ",\ " (exactly like in German -- leave it)
207 %\gdef\hadelimiter{,\ }
208 \end{lstlisting}
209
210 \vspace{3ex}
211
212 \noindent will translate ``pp.\ 2, 4 and 6'' into ``S.\ 2, 4
213 und 6''.
214
215 \section{Get involved}
216
217 If you wish to get involved, please do not hesitate to send \href{https://github.com/madmurphy/hereapplies.sty/pulls}{merge requests}
218 or participate in the discussion. The package is also \href{https://www.ctan.org/pkg/hereapplies}{available on \textbf{CTAN}}
219 under \href{https://www.ctan.org/tex-archive/macros/latex/contrib/hereapplies/}{\texttt{macros/latex/contrib/hereapplies/}}.
220 For any issue, please \href{https://github.com/madmurphy/hereapplies.sty/issues}{drop a message}.
221
222 \section{Free software}
223
224 \textbf{Here Applies} is free software. You can redistribute it and/or
225 modify it under the terms of the \textbf{AGPL} license version 3 or
226 any later version. See \url{COPYING} for details.
227
228 \newpage{}
229
230 \section*{Code appendix}
231
232 \addcontentsline{toc}{section}{Code appendix}
233
234 \lstinputlisting[language=TeX]{hereapplies.sty}
235 \end{document}