Debian Codegraph @

texmf-dist/doc/latex/enotez/enotez_en.tex

raw
1 % !arara: pdflatex
2 % !arara: biber
3 % arara: pdflatex
4 % arara: pdflatex
5 % --------------------------------------------------------------------------
6 % the ENOTEZ package
7 %
8 % Endnotes for LaTeX2e
9 %
10 % --------------------------------------------------------------------------
11 % Clemens Niederberger
12 % Web: http://www.mychemistry.eu/forums/forum/enotez/
13 % E-Mail: [email protected]
14 % --------------------------------------------------------------------------
15 % Copyright 2012--2022 Clemens Niederberger
16 %
17 % This work may be distributed and/or modified under the
18 % conditions of the LaTeX Project Public License, either version 1.3c
19 % of this license or (at your option) any later version.
20 % The latest version of this license is in
21 % http://www.latex-project.org/lppl.txt
22 % and version 1.3c or later is part of all distributions of LaTeX
23 % version 2008/05/04 or later.
24 %
25 % This work has the LPPL maintenance status `maintained'.
26 %
27 % The Current Maintainer of this work is Clemens Niederberger.
28 % --------------------------------------------------------------------------
29 % The enotez package consists of the files
30 % - enotez.sty, enotez_en.tex, enotez_en.pdf, README
31 % --------------------------------------------------------------------------
32 % If you have any ideas, questions, suggestions or bugs to report, please
33 % feel free to contact me.
34 % --------------------------------------------------------------------------
35 \documentclass[load-preamble+]{cnltx-doc}
36 \usepackage{enotez}
37
38 \setcnltx{
39 package = enotez ,
40 info = {Endnotes for \LaTeXe} ,
41 authors = Clemens Niederberger ,
42 email = [email protected] ,
43 url = https://github.com/cgnieder/enotez/ ,
44 pre-output = \setfnpct{dont-mess-around} ,
45 add-cmds = {
46 @endnotemark,
47 endnote ,
48 endnotemark ,
49 endnotetext ,
50 enmark ,
51 enmarkstyle ,
52 enotezwritemark ,
53 NewSplitTitleTag ,
54 printendnotes ,
55 setenotez ,
56 splitendnotes ,
57 theendnote
58 } ,
59 add-silent-cmds = {
60 @currentlabel ,
61 appendix ,
62 cs ,
63 DeclareInstance ,
64 DeclareTemplateInterface ,
65 DeclareTranslation ,
66 kant
67 } ,
68 index-setup = {
69 othercode = \footnotesize ,
70 level = \addsec ,
71 % noclearpage
72 } ,
73 makeindex-setup = {
74 columns = 3 ,
75 columnsep = 1em
76 }
77 }
78 \setenotez{mark-cs=\textsu,backref}
79 \DeclareInstance{enotez-list}{addsec}{paragraph}{heading=\addsec{#1}}
80
81 \defbibheading{bibliography}{\addsec{References}}
82
83 \usepackage{kantlipsum}
84 \usepackage{enumitem}
85
86 \begin{document}
87
88 \section{Licence and Requirements}
89 \license
90
91 \enotez\ needs and loads the following packages:
92 \bnd{l3kernel}~\cite{bnd:l3kernel}, \pkg{xparse}, \pkg{xtemplate} and
93 \pkg{l3keys2e} from the \bnd{l3packages} bundle~\cite{bnd:l3packages} and
94 \pkg{translations}~\cite{pkg:translations}.
95
96 \section{Motivation}
97 \enotez\ is a new implementation of endnotes for \LaTeXe\ since the
98 \pkg{endnotes} package~\cite{pkg:endnotes} has some deficiencies. Nested
99 endnotes, for example, are not supported, neither is
100 \pkg{hyperref}~\cite{pkg:hyperref}. The \pkg{sepfootnotes}
101 package~\cite{pkg:sepfootnotes} also provides means for endnotes but actually
102 has a different purpose: to separate input and usage both of footnotes and
103 endnotes. So it might not be the best solution in every case\footnote{You
104 have to write the actual notes in the preamble or a separate file and
105 reference them in the text.}. It also does not allow nested endnotes.
106
107 While \enotez\ worked in tests nicely with the
108 \cls{memoir}~\cite{cls:memoir} class please keep in mind that
109 \cls{memoir} provides its own endnote mechanism.
110
111 \enotez\ enables nested endnotes properly and has another mechanism of
112 customizing the list of endnotes which is easily extendable. One of the main
113 features of \enotez\ is a split list of endnotes in which the notes are
114 automatically separated by the sections or chapters they were set in, see
115 section~\ref{sec:split} for more information.
116
117 \section{Usage}
118 \subsection{Placing the Notes}
119 The usage is simple: use \cs{endnote} in the text where you want to place the
120 note mark.
121 \begin{commands}
122 \command{endnote}[\oarg{mark}\marg{text}]
123 Add an endnote in the text.
124 \command{endnotemark}[\oarg{mark}]
125 \sinceversion{0.9}Add an endnotemark.
126 \command{endnotetext}[\marg{text}]
127 \sinceversion{0.9}Add text to an endnote placed with \cs{endnotemark}.
128 % \command{refendnote}[\marg{label name}]
129 % \sinceversion{0.10}This command can be used to create an endnote mark by
130 % referencing an earlier endnote which has been marked with \cs*{label}.
131 \end{commands}
132 \begin{example}
133 This is some text.\endnote{With an endnote.}
134 \end{example}
135 There's not really much more to it. It is possible to add a custom mark by
136 using the optional argument but that shouldn't be needed too often. Endnotes
137 can also be nested.
138
139 \begin{example}
140 This is some text.\endnote{With another endnote.\endnote{This is a
141 nested\endnote{And another level deeper\ldots} endnote!}}
142 % uses package `kantlipsum' to produce dummy text:
143 Of course you can have several paragraphs\endnote{\kant[1-3]} in an endnote.
144 \end{example}
145
146 The marks of the endnotes in the running text are printed through the command
147 \cs{enotezwritemark} which defaults to \cs*{textsuperscript}. Its argument
148 contains the current mark which is preceded by \cs{enmarkstyle}. Both of
149 these commands can be redefined of course to adapt to custom settings. This
150 can also be done using options, see section~\ref{sec:options}. The mark of
151 the endnote that has been set last is stored in
152 \verbcode+\@currentlabel+.\sinceversion{0.6}
153
154 Endnotes can also be labelled and later be referred to:
155 \begin{example}
156 The next endnote\endnote{This endnote gets a label.}\label{en:test} has
157 the number~\ref{en:test}. Let's now test
158 \cs{endnotemark}\endnotemark[\ref{en:test}].
159 \end{example}
160
161 \subsection{Printing the Notes}
162 The notes are printed by using the command \cs{printendnotes}.
163 \begin{commands}
164 \command{printendnotes}[\sarg\oarg{style}]
165 Print the list of endnotes. \meta{style} is one of the instances
166 explained in section~\ref{sec:customizing_the_list}.
167 \end{commands}
168 If used without argument it prints all notes set so far with \cs{endnote}. The
169 current list will then be cleared. All endnotes set after it are stored again
170 for the next usage of \cs{printendnotes}. The starred version will print
171 \emph{all} endnotes but shouldn't be used more than once if you have nested
172 endnotes. \emph{Unfortunately the starred version also does not work together
173 with the \option{split} option.}
174
175 It may take several compilation runs until all notes are printed correctly.
176 In a first run they are written to the \code{aux} file. In the second run
177 they are available to \cs{printendnotes}. If you have nested endnotes they
178 will be written to the \code{aux} file the first time they're printed with
179 \cs{printendnotes} which means you might have to compile your file once more.
180 If you change any of the endnotes or add another one you again will need at
181 least two runs, maybe more. \enotez\ tries to warn you in these cases by
182 invoking the warning
183 \begin{flushleft}
184 \ttfamily
185 Endnotes may have changed. Rerun to get them right.
186 \end{flushleft}
187 but may not catch all cases.
188
189 \enotez\ provides two commands that allow to set some kinds of preamble and
190 postamble to a list, either to every list or only to the next one:
191 \begin{commands}
192 \command{AtEveryEndnotesList}[\marg{text}]
193 \sinceversion{0.5}inserts \meta{text} between heading and the actual notes
194 every time \cs{printendnotes} is used.
195 \command{AtNextEndnotesList}[\marg{text}]
196 \sinceversion{0.5} inserts \meta{text} between heading and the actual
197 notes the next time \cs{printendnotes} is used. This overwrites a
198 possible preamble set with \cs{AtEveryEndnotesList} for this instance of
199 \cs{printendnotes}.
200 \command{AfterEveryEndnotesList}[\marg{text}]
201 \sinceversion{0.5} inserts \meta{text} after the notes list every time
202 \cs{printendnotes} is used.
203 \command{AfterNextEndnotesList}[\marg{text}]
204 \sinceversion{0.5} inserts \meta{text} after the notes list the next time
205 \cs{printendnotes} is used. This overwrites a possible postamble set with
206 \cs{AfterEveryEndnotesList} for this instance of \cs{printendnotes}.
207 \end{commands}
208 If something is inserted with one of these commands the inserted \meta{text}
209 will be followed by a \cs*{par} and a vertical skip for the preamble. The
210 postambles follow a \cs*{par} and a vertical skip. The skips can be set using
211 an option, see section~\ref{sec:options}.
212
213 \section{Options}\label{sec:options}
214 \subsection{Package Options}
215 \enotez\ has a few package options which should be pretty self-explanatory.
216 They can be set with the setup command\footnote{Earlier versions allowed to
217 use them as package options. This is not possible any more since
218 version~0.10.}.
219 \begin{commands}
220 \command{setenotez}[\marg{options}]
221 Setup command for setting \enotez' options.
222 \end{commands}
223 \begin{options}
224 \keyval{list-name}{list name}\Default{Notes}
225 The name of the notes list. This name is used for the heading of the
226 list.
227 \keybool{reset}\Default{false}
228 If set to \code{true} the notes numbers will start from 1 again after
229 \cs{printendnotes} has been invoked.
230 \keychoice{counter-format}{arabic,alph,Alph,roman,Roman,symbols}\Default{arabic}
231 Change the format of the endnote counter. Please be aware that there are
232 only 26 alphabetic counter symbols (options \code{alph} and \code{Alph}
233 and \emph{only 9} symbols (option \code{symbols}).
234 \keyval{mark-format}{code}\Default
235 Redefine \cs{enmarkstyle} to execute \meta{code}. This command is placed
236 directly before the endnote mark in the text.
237 \keyval{mark-cs}{command}\Default{\cs*{textsuperscript}}
238 Lets \cs{enotezwritemark} to be equal to \meta{command}. This command
239 is used to typeset the endnote marks in the text and should take one
240 argument.
241 \keybool{backref}\Default{false}\label{key:backref}
242 \sinceversion{0.7}If set to \code{true} and \pkg{hyperref} has been
243 loaded backlinks from the notes in the list to the marks in the text are
244 added.
245 \keychoice{totoc}{subsection,section,chapter,part,\default{auto},false}%
246 \Default{false}\label{key:totoc}
247 Add\changedversion{0.10} an entry to the table of contents. When used
248 with no value the value \code{auto} is chosen and \enotez\ tries to detect
249 the correct level by itself. If this fails the option will be ignored and
250 a warning is written to the log file.
251 \keyval{list-heading}{sectioning command including argument}
252 You can use this option to manually set the list heading command, \eg,
253 \keyis{list-heading}{\cs{chapter}\Marg{\#1}} for a numbered heading. The
254 default depends upon if the class you're using provides \cs*{chapter} or
255 not. It either uses \cs*{chapter}\sarg\ or \cs*{section}\sarg. You can
256 see that you have to refer to the actual heading with \code{\#1}.
257 \keyval{list-style}{style}\Default{plain}
258 Sets the default list style, see section~\ref{sec:customizing_the_list}
259 for details.
260 \keyval{list-preamble-skip}{skip}\Default{\cs*{medskipamount}}
261 \sinceversion{0.5}Sets the vertical skip (a rubber length) that is
262 inserted if a list preamble is inserted by using either
263 \cs{AtNextEndnotesList} or \cs{AtEveryEndnotesList}. It's default is set
264 equal to \cs*{medskipamount}.
265 \keyval{list-postamble-skip}{skip}\Default{\cs*{medskipamount}}
266 \sinceversion{0.5}Sets the vertical skip (a rubber length) that is
267 inserted if a list postamble is inserted by using either
268 \cs{AfterNextEndnotesList} or \cs{AfterEveryEndnotesList}. It's default
269 is set equal to \cs*{medskipamount}.
270 \end{options}
271
272 \subsection{Customizing the List}\label{sec:customizing_the_list}
273 The list is typeset with \pkg{xtemplate}'s possibilities. \enotez\ declares
274 the object \code{enotez-list} and two templates for it, the template
275 \code{paragraph} and the template \code{list}.
276
277 \subsubsection{The \code{paragraph} Template}
278 The \code{paragraph} template's interface is defined as follows:
279 \begin{sourcecode}
280 \DeclareTemplateInterface{enotez-list}{paragraph}{1}
281 {
282 % parameter : type = default
283 heading : function 1 = \section*{#1} ,
284 format : tokenlist = \footnotesize ,
285 number : function 1 = \enmark{#1} ,
286 number-format : tokenlist = \normalfont ,
287 notes-sep : length = .5\baselineskip ,
288 }
289 \end{sourcecode}
290 The parameters functions are these:
291 \begin{description}[style=nextline]
292 \item[\code{heading}] The command with which the heading is typeset.
293 \item[\code{format}] The format of the whole list.
294 \item[\code{number}] The command that is used to typeset the numbers of the
295 notes. The command \cs{enmark} is explained soon.
296 \item[\code{numbers-format}] The format of the numbers.
297 \item[\code{notes-sep}] Additional space between the notes.
298 \end{description}
299
300 \enotez\ uses this template to define the instance \code{plain}:
301 \begin{sourcecode}
302 \DeclareInstance{enotez-list}{plain}{paragraph}{}
303 \end{sourcecode}
304 This is the default style of the list.
305
306 You can easily define your own instances, though:
307 \begin{sourcecode}
308 \DeclareInstance{enotez-list}{custom}{paragraph}
309 {
310 heading = \chapter*{#1} ,
311 notes-sep = \baselineskip ,
312 format = \normalfont ,
313 number = \textsuperscript{#1}
314 }
315 \end{sourcecode}
316 This would use a chapter heading for the title, separate the notes with
317 \cs*{baselineskip} and typeset them with \cs*{normalfont}. The numbers would
318 be typeset with \cs*{textsuperscript}. You could now use it like this:
319 \begin{sourcecode}
320 \printendnotes[custom]
321 \end{sourcecode}
322
323 If you wanted superscripted numbers, you could also redefine \cs{enmark}.
324 \begin{commands}
325 \command{enmark}
326 this command is initially defined like this:
327 \verbcode=\newcommand*\enmark[1]{#1.}=
328 \end{commands}
329
330 \subsubsection{The \code{list} Template}
331 The \code{list} template's interface is defined as follows:
332 \begin{sourcecode}
333 \DeclareTemplateInterface{enotez-list}{list}{1}
334 {
335 % parameter : type = default
336 heading : function 1 = \section*{#1} ,
337 format : tokenlist = \footnotesize ,
338 number : function 1 = \enmark{#1} ,
339 number-format : tokenlist = \normalfont ,
340 list-type : tokenlist = description ,
341 }
342 \end{sourcecode}
343 This template uses a list to typeset the notes. As you can see the default
344 list is a \code{description} list.
345
346 \enotez\ defines two instances of this template:
347 \begin{sourcecode}
348 \DeclareInstance{enotez-list}{description}{list}{}
349 \DeclareInstance{enotez-list}{itemize}{list}{list-type = itemize}
350 \end{sourcecode}
351 They're available through \cs{printendnotes}\Oarg{description} and
352 \cs{printendnotes}\Oarg{itemize}, respectively.
353
354 Again you can define your own instances using whatever list you want, possibly
355 one defined with the power of \pkg{enumitem}.
356
357 \section{Collect Notes Section-wise and Print List Stepwise}\label{sec:split}
358 \emph{This feature is experimental and surely has some limitations. Please
359 let me know if something doesn't work as expected}.
360
361 Not to be misunderstood: you can use \cs{printendnotes} as often as you like,
362 possibly after each section. That is \emph{not} what is meant here. Let's
363 suppose you are writing a book and have many endnotes in many chapters. It
364 would be nice if the list of endnotes at the end of the book could be split
365 into parts for each chapter. This section describes how you can achieve that
366 with \enotez.
367
368 First of all \enotez\ will rely on the fact that you use \cs{printendnotes}
369 only \emph{once}! If you call it more times nobody knows what will
370 happen\ldots
371
372 You'll need to tell \enotez\ that you want to split the notes into groups.
373 \begin{options}
374 \keychoice{split}{section,chapter,false}\Default{false}
375 Enable the automatic splitting.
376 \keyval{split-sectioning}{csname}\Default
377 \emph{This option is deprecated and may be dropped in future versions!}
378 The command that is used to display the titles between the splits. It
379 needs to be a command that takes one argument and should be entered
380 without the leading backslash. If the option is not used \enotez\ will
381 choose \code{subsection*} for \keyis{split}{section} and \code{section*}
382 for \keyis{split}{chapter}.
383 \keyval{split-heading}{sectioning command including argument}
384 \sinceversion{0.3}The command that is used to display the titles between
385 the splits. It is entered with argument and the actual title is referred
386 to with \code{\#1}, \eg,
387 \keyis{split-heading}{\cs*{subsection}\sarg\Marg{\#1}}. If the option is
388 not used \enotez\ will choose \cs*{subsection}\sarg\Marg{\#1} for
389 \keyis{split}{section} and \cs*{section}\sarg\Marg{\#1} for
390 \keyis{split}{chapter}.
391 \keyval{split-title}{tokenlist}\Default{Notes for <name> <ref>}
392 The title that will be inserted between the splits. \code{<name>} is
393 replaced by \code{section} for \keyis{split}{section} and \code{chapter}
394 for \keyis{split}{chapter}. \code{<ref>} is replaced by the corresponding
395 \cs*{thesection} or \cs*{thechapter}.
396 \end{options}
397 Set the \option{split} option:
398 \begin{sourcecode}
399 \setenotez{split=section}
400 \end{sourcecode}
401 Well -- that's it, basically. You'll have to be careful, though: if you're
402 having nested endnotes the nested ones appear first in the ``Notes'' section
403 (or chapter, respectively). In this case you should have a numbered section
404 title for the notes, presumably in the appendix. You'll need to create a new
405 list style:
406 \begin{sourcecode}
407 % preamble:
408 \usepackage{enotez}
409 \DeclareInstance{enotez-list}{section}{paragraph}{heading=\section{#1}}
410 \setenotez{list-style=section,split=section}
411 % document:
412 \appendix
413 \printendnotes
414 \end{sourcecode}
415
416 Please beware that the option \option{reset} also impacts here: the numbering
417 will be reset for each section or chapter, depending on the choice you made
418 for \option{split}.
419
420 There are additional commands:
421 \begin{commands}
422 \command{AtEveryListSplit}[\marg{code}]
423 Inserts\sinceversion{0.7} \meta{code} before each sub-heading in a
424 splitted list.
425 \command{AfterEveryListSplit}[\marg{code}]
426 Inserts\sinceversion{0.7} \meta{code} after each sub-heading in a splitted
427 list.
428 \command{EnotezCurrentSplitTitle}
429 Holds\sinceversion{0.7} the current sub-heading in a splitted list and may
430 be used in \cs{AtEveryListSplit} and \cs{AfterEveryListSplit}.
431 \command{NewSplitTitleTag}[\marg{tag}\marg{replacement}]
432 In\sinceversion{0.8} the sub-headings of a splitted list, the tags
433 \code{<ref>}, \code{<name>} and \code{<split-level-id>} can be used per
434 default. This command allows to define additional tags.
435 \end{commands}
436
437 The tags that can be used for setting the sub-headings of a splitted list have
438 the following meaning:
439 \begin{description}
440 \item[\code{<ref>}] The counter representation of the current section or
441 chapter, \ie, either the corresponding expansion of \cs*{thesection} or
442 \cs*{thechapter}, depending on the split-level.
443 \item[\code{<name>}] The name of the split-level, \ie, either ``section'' or
444 ``chapter'', depending on the split-level. This is language sensitive
445 (see section~\ref{sec:language-support}). The corresponding translation
446 ids are \code{enotez-section} and \code{enotez-chapter}, respectively.
447 \item[\code{<split-level-id>}] The number of the current section or chapter,
448 \ie, either the corresponding expansion of \verbcode+\arabic{section}+ or
449 \verbcode+\arabic{chapter}+, depending on the split-level.
450 \end{description}
451 The command \cs{NewSplitTitleTag} let's you define your own. You can use the
452 three existing tags inside the replacement. Note that the \meta{tag} argument
453 is input without opening \code{<} and closing \code{>}!
454 \cs{NewSplitTitleTag}\Marg{own}\Marg{...} would define the tag \code{<own>}.
455
456 \enotez\ comes with an example document for a split list which you should find
457 in the same folder as this documentation.
458
459 \section{Language Support}\label{sec:language-support}
460 \enotez\ uses the \pkg{translations} package~\cite{pkg:translations} to
461 translate language dependent strings. The advantage of this is that language
462 settings with \pkg{babel}~\cite{pkg:babel} or
463 \pkg{polyglossia}~\cite{pkg:polyglossia} are detected automatically. However,
464 the available translations are somewhat limited due to my limited language
465 knowledge. If you find missing or wrong translations you can try to add or
466 correct them by adding the corresponding versions of the following lines to
467 your preamble:
468 \begin{sourcecode}
469 \DeclareTranslation{English}{enotez-title}{Notes}
470 % ``<name> <ref>'' is a placeholder for e.g. ``section 1'':
471 \DeclareTranslation{English}{enotez-splitted-title}{Notes for <name> <ref>}
472 \DeclareTranslation{English}{enotez-section}{section}
473 \DeclareTranslation{English}{enotez-chapter}{chapter}
474 \end{sourcecode}
475 If you like you can also drop me an email at
476 \href{mailto:[email protected]}{[email protected]} and I'll add the
477 correct translations to \enotez.
478
479 \section{hyperref Support}
480 If \pkg{hyperref} is loaded and you are using the option \option{totoc} (see
481 page~\pageref{key:totoc}) the list title is linked via a \cs*{phantomsection}.
482
483 If \pkg{hyperref} is used with \code{hyperfootnotes} set to \code{true} the
484 endnote marks are linked to the respective entries in the
485 list\changedversion{0.7}. If you also set \enotez' option \option{backref}
486 (see page~\pageref{key:backref}) the notes in the list are themselves linked
487 to the marks in the text.
488
489 \AtNextEndnotesList{This is an example of a preamble to the list set with
490 \cs{AtNextEndnotesList}.}
491 \AfterEveryEndnotesList{\noindent This is an example of a postamble to the
492 list set with \cs{AfterEveryEndnotesList}. Note that it would have started
493 with a paragraph indent which was prevented here by using \cs*{noindent}.}
494 \printendnotes[addsec]
495
496 \end{document}