| 1 |
Here Applies |
| 2 |
============ |
| 3 |
|
| 4 |
A LaTeX package for referencing groups of pages that share something in common |
| 5 |
|
| 6 |
|
| 7 |
Overview |
| 8 |
-------- |
| 9 |
|
| 10 |
**Here Applies** is a LaTeX package that allows to collect groups of labels and |
| 11 |
reference them altogether. It can be used for creating informal glossaries that |
| 12 |
cross-link concepts to their applications, or simply mentioning multiple pages |
| 13 |
that share something in common. |
| 14 |
|
| 15 |
The package offers two commands: `\hereapplies` and `\whereapplies` (plus their |
| 16 |
“starred” versions `\hereapplies*` and `\whereapplies*`). In both cases an |
| 17 |
identifier is passed as argument, and this can be any string invented in the |
| 18 |
moment (`\hereapplies` additionally supports more than one identifier in the |
| 19 |
form of a comma-separated list). |
| 20 |
|
| 21 |
Every time `\hereapplies` is invoked with known identifiers, the document is |
| 22 |
made aware that the place shares some kind of connection with other places in |
| 23 |
which the same identifiers were used. And so, every time the `\whereapplies` |
| 24 |
command is invoked with a known identifier, all occurrences of the latter |
| 25 |
within the entire document will be printed in the form of a linkable page list |
| 26 |
(e.g. “pp. 1, 5, 8–9, 14–20…”). |
| 27 |
|
| 28 |
As `\hereapplies` is designed to be invoked in the middle of a chapter or a |
| 29 |
section and that location must be made linkable, the `\phantomsection` |
| 30 |
directive is invoked by default before a label is added. To avoid calling |
| 31 |
`\phantomsection`, the “starred” command `\hereapplies*` is available. |
| 32 |
|
| 33 |
Finally, like `\whereapplies` resembles a pluralizable version of `\pageref`, |
| 34 |
its “starred” version `\whereapplies*` will resemble a pluralizable version of |
| 35 |
`\pageref*`. |
| 36 |
|
| 37 |
If you use LyX, the package ships a LyX module as well (please check the |
| 38 |
`lyx-module` subdirectory). |
| 39 |
|
| 40 |
|
| 41 |
Example usage |
| 42 |
------------- |
| 43 |
|
| 44 |
The following LaTeX manuscript |
| 45 |
|
| 46 |
``` tex |
| 47 |
\documentclass{article} |
| 48 |
|
| 49 |
\usepackage{hereapplies} |
| 50 |
|
| 51 |
\begin{document} |
| 52 |
|
| 53 |
\title{Some title} |
| 54 |
|
| 55 |
\author{Some author} |
| 56 |
|
| 57 |
\maketitle |
| 58 |
|
| 59 |
This is concept one. To find this concept applied, please |
| 60 |
see \whereapplies{conceptOne}. |
| 61 |
|
| 62 |
This is concept two. To find this concept applied, please |
| 63 |
see \whereapplies{conceptTwo}.\newpage |
| 64 |
|
| 65 |
\hereapplies{conceptOne} This is page \thepage. As you can see, |
| 66 |
``concept one'' applies here.\newpage |
| 67 |
|
| 68 |
\hereapplies{conceptTwo} This is page \thepage. As you can see, |
| 69 |
``concept two'' applies here.\newpage |
| 70 |
|
| 71 |
\hereapplies{conceptOne, conceptTwo} This is page \thepage. As you |
| 72 |
can see, both ``concept one'' and ``concept two'' apply here.\newpage |
| 73 |
|
| 74 |
\hereapplies{conceptTwo} This is page \thepage. As you can see, |
| 75 |
``concept two'' applies here.\newpage |
| 76 |
|
| 77 |
\hereapplies[myref]{conceptOne} This is page \thepage. As you can |
| 78 |
see, ``concept one'' applies here. This point in the document is |
| 79 |
labeled \texttt{myref}. |
| 80 |
|
| 81 |
\end{document} |
| 82 |
``` |
| 83 |
|
| 84 |
will generate the [`hereapplies-example.pdf`][1] document attached. |
| 85 |
|
| 86 |
|
| 87 |
A minimal tutorial |
| 88 |
------------------ |
| 89 |
|
| 90 |
### Command `\hereapplies[label]{identifiers}` |
| 91 |
|
| 92 |
The `\hereapplies` command notifies the document that one or more identifiers |
| 93 |
apply to a particular point and adds a label to it. |
| 94 |
|
| 95 |
If the optional argument is passed the label created will be named accordingly, |
| 96 |
otherwise an opaque name will be chosen for it. This argument may contain only |
| 97 |
what is legal for `\pageref`. |
| 98 |
|
| 99 |
The `identifiers` argument must be a comma-separated list of identifiers |
| 100 |
(leading and trailing spaces around each member will be ignored). Each of these |
| 101 |
strings will remain confined within the internal scope of the package and will |
| 102 |
not create conflicts with possible macros or labels of the same names. |
| 103 |
|
| 104 |
After storing some internal values, `\hereapplies` will expand exactly to |
| 105 |
|
| 106 |
``` tex |
| 107 |
\phantomsection\label{...} |
| 108 |
``` |
| 109 |
|
| 110 |
Its “starred” version (`\hereapplies*`) will not invoke the `\phantomsection` |
| 111 |
directive. |
| 112 |
|
| 113 |
|
| 114 |
### Command `\whereapplies{identifier}` |
| 115 |
|
| 116 |
The `\whereapplies` command prints all the occurrences of an identifier, in the |
| 117 |
form “p. …” or “pp. …” (with page range support). |
| 118 |
|
| 119 |
The `identifier` argument will remain confined within the internal scope of the |
| 120 |
package and will not create conflicts with possible commands or labels of the |
| 121 |
same name. Leading and trailing spaces around this string will be ignored. |
| 122 |
|
| 123 |
If the same `identifier` is not passed to `\hereapplies` at least once |
| 124 |
throughout the document, `\whereapplies` will print “**??**”. |
| 125 |
|
| 126 |
The “starred” version of this command (`\whereapplies*`) will use `\pageref*` |
| 127 |
instead of `\pageref` for generating the page list. |
| 128 |
|
| 129 |
|
| 130 |
Internationalization |
| 131 |
-------------------- |
| 132 |
|
| 133 |
Currently the localization of **Here Applies** is not automatic. It is possible |
| 134 |
however to control the strings generated by overwriting the four macros |
| 135 |
`\hapage`, `\hapages`, `\hadelimiter` and `\halastdelimiter`. For example, |
| 136 |
writing at the beginning of a document |
| 137 |
|
| 138 |
``` tex |
| 139 |
% German translation of **Here Applies** |
| 140 |
% English: "p.\ " |
| 141 |
\gdef\hapage{S.\ } |
| 142 |
% English: "pp.\ " |
| 143 |
\gdef\hapages{S.\ } |
| 144 |
% English: "\ and\ " |
| 145 |
\gdef\halastdelimiter{\ und\ } |
| 146 |
% English: ",\ " (exactly like in German -- leave it) |
| 147 |
%\gdef\hadelimiter{,\ } |
| 148 |
``` |
| 149 |
|
| 150 |
will translate “pp. 2, 4 and 6” into “S. 2, 4 und 6”. |
| 151 |
|
| 152 |
|
| 153 |
Get involved |
| 154 |
------------ |
| 155 |
|
| 156 |
If you wish to get involved, please do not hesitate to send [merge requests][2] |
| 157 |
or participate in the discussion. The package is also [available on |
| 158 |
**CTAN**][3] under [`macros/latex/contrib/hereapplies/`][4]. For any issue, |
| 159 |
please [drop a message][5]. |
| 160 |
|
| 161 |
|
| 162 |
Free software |
| 163 |
------------- |
| 164 |
|
| 165 |
**Here Applies** is free software. You can redistribute it and/or modify it |
| 166 |
under the terms of the **AGPL** license version 3 or any later version. See |
| 167 |
[`COPYING`][6] for details. |
| 168 |
|
| 169 |
|
| 170 |
[1]: hereapplies-example.pdf |
| 171 |
[2]: https://github.com/madmurphy/hereapplies.sty/pulls |
| 172 |
[3]: https://www.ctan.org/pkg/hereapplies |
| 173 |
[4]: https://www.ctan.org/tex-archive/macros/latex/contrib/hereapplies/ |
| 174 |
[5]: https://github.com/madmurphy/hereapplies.sty/issues |
| 175 |
[6]: COPYING |
| 176 |
|