Debian Codegraph @

texmf-dist/source/latex/pagenote/pagenote.dtx

raw
1 % \iffalse meta-comment
2 % pagenote.dtx
3 % Author: Peter Wilson (The Herries Press)
4 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
5 % Copyright 2004 Peter R. Wilson
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either
9 % version 1.3c of this license or (at your option) any
10 % later version: <http://www.latex-project.org/lppl.txt>
11 %
12 % This work has the LPPL maintenance status "maintained".
13 % The Current Maintainer of this work is Will Robertson.
14 %
15 % This work consists of the files listed in the README file.
16 %
17 %
18 %<*driver>
19 \documentclass{ltxdoc}
20 \EnableCrossrefs
21 \CodelineIndex
22 %%\OnlyDescription
23 \setcounter{StandardModuleDepth}{1}
24 \begin{document}
25 \DocInput{pagenote.dtx}
26 \end{document}
27 %</driver>
28 %
29 % \fi
30 %
31 % \CheckSum{251}
32 %
33 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
34 % \DoNotIndex{\@centercr,\@cite}
35 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
36 % \DoNotIndex{\@input,\@ixpt,\@m}
37 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
38 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
39 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
40 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
41 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
42 % \DoNotIndex{\advance,\Alph,\alph}
43 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
44 % \DoNotIndex{\bullet}
45 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
46 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
47 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
48 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
49 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
50 % \DoNotIndex{\fbox}
51 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
52 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
53 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
54 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
55 % \DoNotIndex{\input}
56 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
57 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
58 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
59 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
60 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
61 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
62 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
63 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
64 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
65 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
66 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
67 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
68 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
69 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
70 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
71 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
72 % \DoNotIndex{\wd,\xiipt,\year,\z@}
73 %
74 % \changes{v1.0}{2004/09/24}{First public release}
75 % \changes{v1.1}{2004/09/27}{Minor additions}
76 % \changes{v1.1a}{2009/09/03}{New maintainer (Will Robertson)}
77 %
78 % \def\dtxfile{pagenote.dtx}
79 % \def\fileversion{v1.0} \def\filedate{2004/09/24}
80 % \def\fileversion{v1.1} \def\filedate{2004/09/27}
81 % \def\fileversion{v1.1a} \def\filedate{2009/09/03}
82 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
83 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
84 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
85 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
86 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
87 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
88 %
89 % \title{The \Lpack{pagenote} package\thanks{This
90 % file (\texttt{\dtxfile}) has version number \fileversion, last revised
91 % \filedate.}}
92 %
93 % \author{
94 % Author: Peter Wilson, Herries Press \\
95 % Maintainer: Will Robertson \\
96 % \texttt{will dot robertson at latex-project dot org}
97 % }
98 % \date{\filedate}
99 % \maketitle
100 % \begin{abstract}
101 % The \Lpack{pagenote} package provides notes similar to footnotes
102 % except that they are typeset on a different page.
103 % These are often called end notes.
104 %
105 % Unless the memoir class is being used, the package requires the
106 % \Lpack{ifmtarg} package.
107 %
108 % \end{abstract}
109 % \tableofcontents
110 %
111 %
112 %
113 % \section{Introduction}
114 %
115 % End notes are often used instead of footnotes so as not to interrupt the
116 % flow of the main text. The \Lpack{pagenote} package provides for such notes.
117 % Although end notes are normally put at the end of the document, they may
118 % instead be put at the end of each chapter (or section if the document class
119 % does not support chapters).
120 %
121 % The simple use is like this:
122 % \begin{verbatim}
123 % \documentclass{...}
124 % \usepackage{pagenote}
125 % \makepagenote
126 % ...
127 % \begin{document}
128 % ...\pagenote{An end note} ...
129 % ...\pagenote{Another note} ...
130 % \chapter{Notes}
131 % \printnotes
132 % \end{document}
133 % \end{verbatim}
134 %
135 % Section~\ref{sec:usc} describes the usage of the \Lpack{pagenote}
136 % package and
137 % commented source code is in Section~\ref{sec:code}.
138 %
139 % This manual is typeset according to the conventions of the
140 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
141 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
142 %
143 % \section{The \Lpack{pagenote} package} \label{sec:usc}
144 %
145 % The general principal is that notes are written out to a file which
146 % is then input at the place where the notes are to be printed. The note
147 % file has an \file{ent} extension, like the table of contents file
148 % has a \texttt{toc} extension.
149 %
150 % \subsection{Options}
151 %
152 % The package has the following options.
153 %
154 % \begin{description}
155 % \item[\Lopt{continuous}] By default, note numbers are reset at each
156 % main division in the document. When the \Lopt{continuous} option is
157 % used, the numbering is continuous throughout the document.
158 %
159 % \item[\Lopt{page}] By default page numbers are not available for
160 % reference within the notes. When the \Lopt{page} option is used, the
161 % page number where a note was inserted is available. If this option
162 % is used, there must be a page break between the last note and the
163 % printed list of notes.
164 % \end{description}
165 %
166 % \subsection{Commands}
167 %
168 % Generally speaking, the following descriptions assume that a class
169 % that provides |\chapter|s has been used. If you use a class
170 % that only provides |\section|s, the details are in the source code
171 % in Section~\ref{sec:code} (the \Lpack{memoir} class provides |\chapter|s
172 % that look like |\section|s from the \Lpack{article} class).
173 %
174 % \DescribeMacro{\makepagenote}
175 % If you want to have page/end notes, the |\makepagenote| command must be
176 % put in the preamble. Among other things, this sets up the note \file{ent}
177 % file.
178 %
179 % \DescribeMacro{\printnotes}
180 % \DescribeMacro{\printnotes*}
181 % The |\printnotes| command will cause the \file{ent} file to be closed for
182 % any new notes, and then |\input| in order to print the collected notes.
183 % After |\printnotes| no more notes will be
184 % collected, so use it after all are done.
185 %
186 % Similarly, the starred version of the command causes the \file{ent}
187 % file to be closed and the |\input|, but afterwards a new set of notes
188 % may be saved in
189 % the \file{ent} file. For example, you could put |\printnotes*| at the
190 % end of each chapter.
191 %
192 % Because of how TeX writes information to files, when the \Lopt{page}
193 % option is used there must be no notes
194 % on the page where
195 % |\printnotes| or |\printnotes*| closes the \file{ent} file. If necessary,
196 % a |\clearpage| or similar must be used before the |\print...|.
197 %
198 % \DescribeMacro{\pagenote}
199 % There are two common methods of identifying an end note:
200 % \begin{itemize}
201 % \item Like a footnote, put a number in the text at the location
202 % of the note and use the same number to identify the note when it
203 % finally gets printed.
204 % \item Put no mark in the text, but when it is finally printed use a few
205 % words from the text to identify the origin of the note. The page number
206 % is often used as well with this method.
207 % \end{itemize}
208 %
209 % |\pagenote|\oarg{id}\marg{text} is used where you want a note to be inserted,
210 % although it will not be printed there. The \meta{text} argument is the
211 % contents of the note. The optional \meta{id} argument can be used if you
212 % want to use something other than a number to identify the source of
213 % the note when it finally gets printed.
214 %
215 % \DescribeMacro{\notenumintext}
216 % A counter, |pagenote|, may be used to indicate the location of a note
217 % in the text (like the |footnote| counter). The macro
218 % |\notenumintext|\marg{num} is called by |\pagenote| to print the
219 % |pagenote| number. By default it is printed as a superscript, but this can
220 % be changed, or even eliminated.
221 %
222 % In documents with |\chapter|s, the |pagenote| counter is reset for each
223 % chapter, otherwise it is reset for each |\section|.
224 %
225 % \DescribeMacro{\noteentry}
226 % The |\pagenote|\oarg{id}\marg{text} macro writes \\
227 % |\noteentry|\marg{notenum}\marg{id}\marg{text}\marg{pagenum} \\
228 % to the \file{ent} file, where \meta{notenum} is the note number (from
229 % the |pagenote| counter), \meta{id} and \meta{text} are as supplied to
230 % |\pagenote|, and if the \Lopt{page} option is used, \meta{pagenum} is the
231 % page number, otherwise it is empty. The |\noteentry|
232 % macro controls the typesetting of the note.
233 %
234 % \DescribeMacro{\prenoteinnotes}
235 % \DescribeMacro{\noteidinnotes}
236 % \DescribeMacro{\pageinnotes}
237 % \DescribeMacro{\noteinnotes}
238 % \DescribeMacro{\postnoteinnotes}
239 % The default definition of |\noteentry| is
240 % \begin{verbatim}
241 % \newcommand{\notentry}[4]{%
242 % \prenoteinnotes
243 % \noteidinnotes{#1}{#2}%
244 % \pageinnotes{#4}%
245 % \noteinnotes{#3}%
246 % \postnoteinnotes}
247 % \end{verbatim}
248 % The macros |\prenoteinnotes| and |\postnoteinnotes| are used to start
249 % and end the typesetting of the note --- effectively typesetting
250 % each note as a paragraph; their definitions can be changed if need be.
251 %
252 % The macro |\noteidinnotes|\marg{notenum}\marg{id} is designed to typeset
253 % the note number and/or the note id (from the optional \meta{id} argument
254 % to |\pagenote|).
255 %
256 % The macro |\pageinnotes|\marg{pagenum} is used for typesetting (or ignoring)
257 % the page number where the note was specified, and |\noteinnotes|\marg{text}
258 % sets the actual note \meta{text}.
259 %
260 % Any or all of these may be changed to suit your needs.
261 %
262 % \DescribeMacro{\notedivision}
263 % \DescribeMacro{\notesname}
264 % When |\printnotes| (or |\printnotes*|) is called the first thing it does is
265 % call the macro |\notedivision|. By default, for chaptered documents
266 % this is defined as: \\
267 % |\newcommand*{\notedivision}{\chapter{\notesname}}| \\
268 % with: \\
269 % |\newcommand*{\notesname}{Notes}| \\
270 % In other words, it will print out a heading for the notes that will be read
271 % from the \file{ent} file. |\print...| then closes the \file{ent} file
272 % for writing and after this |\input|s it to get and process the notes.
273 %
274 % \DescribeMacro{\addtonotes}
275 % \DescribeMacro{\pagenotesubhead}
276 % The macro |\addtonotes|\marg{text} inserts \meta{text} into the \file{ent}
277 % file. For example, before the first note in a chapter, |\addtonotes| is
278 % used to insert |\pagenotesubhead|\marg{num}\marg{title} into the file
279 % where \meta{num} is the new chapter number, and \meta{title} is either
280 % empty or, if the \Lpack{memoir} class is used, is the chapter title as
281 % it appears in the table of contents. This macro is used to typeset
282 % a heading for each set of notes. By default it will resolve to
283 % something like: \\
284 % |\subsection{Chapter 3 ...}|
285 %
286 % \textbf{Note:} As the argument to |\pagenote| and |\addtonotes|
287 % is moving you may have
288 % to |\protect| any fragile commands. If you get strange error messages, try
289 % using |\protect| and see if they go away.
290 %
291 % \DescribeMacro{\chaptername}
292 % \DescribeMacro{\sectionname}
293 % \DescribeMacro{\pagename}
294 % The command |\chaptername| is supplied by the LaTeX classes that
295 % provide |\chapter| divisions and is
296 % defined to produce `Chapter'. The macros |\sectionname| and
297 % |\pagename| are provided by this package, producing respectively
298 % `Section' and `page'.
299 %
300 % The package is set up under the assumption that notes will only be
301 % printed at the end of the document. If you intend to put them at the
302 % end of each chapter, then you will probably want to change the definitions
303 % of the |\notedivision| and |\pagenotesubhead| macros. For example:
304 % \begin{verbatim}
305 % \renewcommand*{\notedivision}{\section*{\notesname}}
306 % \renewcommand*{\pagenotesubhead}[2]{}
307 % \end{verbatim}
308 % and remember to use |\printnotes*| at each place you want the current set
309 % of notes to be printed.
310 %
311 %
312 %
313 %
314 % \StopEventually{
315 % \bibliographystyle{alpha}
316 % \begin{thebibliography}{GMS94}
317 % \bibitem[GMS94]{GOOSSENS94}
318 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
319 % \newblock {\em The LaTeX Companion}.
320 % \newblock Addison-Wesley Publishing Company, 1994.
321 % \end{thebibliography}
322 % }
323 %
324 %
325 %
326 % \section{The package code} \label{sec:code}
327 %
328 %
329 % \subsection{Preliminaries}
330 %
331 % Announce the name and version of the package, which requires
332 % \LaTeXe.
333 % \begin{macrocode}
334 %<*usc>
335 \NeedsTeXFormat{LaTeX2e}
336 \ProvidesPackage{pagenote}[2009/09/03 v1.1a page/end notes]
337 % \end{macrocode}
338 %
339 % The \Lpack{ifmtarg} package is required (which is included within the
340 % \Lpack{memoir} class).
341 % \begin{macrocode}
342 \@ifclassloaded{memoir}{}{\RequirePackage{ifmtarg}}
343
344 % \end{macrocode}
345 %
346 % The following |\if...| command is for distinguishing between
347 % chaptered and simpler documents. Page/end notes are more appropriate
348 % when there are chapters.
349 % \begin{macro}{\ifpnhaschapter}
350 % \begin{macrocode}
351 \newif\ifpnhaschapter
352 \@ifundefined{chapter}{\pnhaschapterfalse}{\pnhaschaptertrue}
353
354 % \end{macrocode}
355 % \end{macro}
356 %
357 % \begin{macro}{\f@rtoc}
358 % In the \Lpack{memoir} class this holds the chapter title as it should
359 % appear in the ToC. We need to make sure that it is defined.
360 % \begin{macrocode}
361 \providecommand{\f@rtoc}{}
362
363 % \end{macrocode}
364 % \end{macro}
365 %
366 % \subsection{Options}
367 %
368 % \begin{macro}{\ifpnpageopt}
369 % \begin{macro}{\ifpncontopt}
370 % We need two flags for the options.
371 % \begin{macrocode}
372 \newif\ifpnpageopt
373 \pnpageoptfalse
374 \newif\ifpncontopt
375 \pncontoptfalse
376
377 % \end{macrocode}
378 % \end{macro}
379 % \end{macro}
380 %
381 % Process the options.
382 %
383 % \begin{macrocode}
384 \DeclareOption{page}{\pnpageopttrue}
385 \DeclareOption{continuous}{\pncontopttrue}
386 \ProcessOptions
387
388 % \end{macrocode}
389 %
390 % \subsection{Main code}
391 %
392 % \begin{macro}{\c@pagenote}
393 % \begin{macro}{\thepagenote}
394 % We need a counter for the notes. Just how it is defined depends on the
395 % \Lopt{continuous} option or the class.
396 % \begin{macrocode}
397 \ifpncontopt
398 \newcounter{pagenote}
399 \else
400 \ifpnhaschapter
401 \newcounter{pagenote}[chapter]
402 \else
403 \newcounter{pagenote}[section]
404 \fi
405 \fi
406 \renewcommand{\thepagenote}{\arabic{pagenote}}
407 \setcounter{pagenote}{0}
408 % \end{macrocode}
409 % \end{macro}
410 % \end{macro}
411 %
412 % \begin{macro}{\c@pnotesavechap}
413 % We also need a counter for document divisions to check if we
414 % are in a new one. Initialise it to an `impossible' value.
415 % \begin{macrocode}
416 \newcounter{pnotesavechap}
417 \setcounter{pnotesavechap}{-1000}
418
419 % \end{macrocode}
420 % \end{macro}
421 %
422 % \begin{macro}{\ifmakingpagenotes}
423 % Need to check if notes are required.
424 % \begin{macrocode}
425 \newif\ifmakingpagenotes
426 \makingpagenotesfalse
427
428 % \end{macrocode}
429 % \end{macro}
430 %
431 % \begin{macro}{\makepagenote}
432 % This sets up the note file. At the end it emasculates itself so it can only
433 % be used once.
434 % \begin{macrocode}
435 \newcommand*{\makepagenote}{%
436 \newwrite\@notefile
437 \immediate\openout\@notefile=\jobname.ent
438 \makingpagenotestrue
439 % \end{macrocode}
440 % \begin{macro}{\pagenote}
441 % Make sure that this has a useful definition.
442 % \begin{macrocode}
443 \def\pagenote{\@bsphack\begingroup
444 \@sanitize
445 \@wrpnote}%
446 % \end{macrocode}
447 % \end{macro}
448 % \begin{macrocode}
449 \typeout{Writing note file \jobname.ent}%
450 \let\makepagenote\@empty}
451
452 % \end{macrocode}
453 % \end{macro}
454 %
455 %
456 % \begin{macro}{\immediate@protected@write}
457 % We might have to do some immediate writes. This is an immediate
458 % version of the kernel |\protected@write|.
459 % \begin{macrocode}
460 \newcommand{\immediate@protected@write}[3]{%
461 \begingroup
462 #2%
463 \let\protect\@unexpandable@protect
464 \edef\reserved@a{\immediate\write#1{#3}}%
465 \reserved@a
466 \endgroup
467 \if@nobreak\ifvmode\nobreak\fi\fi}
468
469 % \end{macrocode}
470 % \end{macro}
471 %
472 % \begin{macro}{\@pnwrite}
473 % If the \Lopt{page} option is used we cannot use an immeditae write
474 % because the page number is only known in the output routine.
475 % \begin{macrocode}
476 \ifpnpageopt
477 \let\@pnwrite\protected@write
478 \else
479 \let\@pnwrite\immediate@protected@write
480 \fi
481
482 % \end{macrocode}
483 % \end{macro}
484 %
485 % \begin{macro}{\@wrpnote}
486 % This writes the note information to the note file. It first increments the
487 % note counter and calls |\notenumintext| to handle its appearance in
488 % the body text.
489 % \begin{macrocode}
490 \newcommand{\@wrpnote}[2][]{%
491 \refstepcounter{pagenote}%
492 \notenumintext{\thepagenote}%
493 % \end{macrocode}
494 % Check if this is the first note in a division, and if so indicate this
495 % in the file.
496 % \begin{macrocode}
497 \ifpnhaschapter
498 \ifnum\value{pnotesavechap}=\value{chapter}\else
499 \setcounter{pnotesavechap}{\value{chapter}}%
500 \addtonotes{\pagenotesubhead{\thechapter}{\f@rtoc}}%
501 \fi
502 \else
503 \ifnum\value{pnotesavechap}=\value{section}\else
504 \setcounter{pnotesavechap}{\value{section}}%
505 \addtonotes{\pagenotesubhead{\thesection}{}}%
506 \fi
507 \fi
508 % \end{macrocode}
509 % Finally, write the entry.
510 % \begin{macrocode}
511 \@pnwrite\@notefile{}
512 {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}%
513 \endgroup
514 \@esphack}
515
516 % \end{macrocode}
517 % \end{macro}
518 %
519 % \begin{macro}{\pagenote}
520 % The user command to generate a note.
521 % \begin{macrocode}
522 \def\pagenote{\@bsphack\begingroup \@sanitize\@pagenote}
523
524 % \end{macrocode}
525 % \end{macro}
526 %
527 % \begin{macro}{\@pagenote}
528 % \begin{macrocode}
529 \newcommand{\@pagenote}[2][]{\endgroup\@esphack}
530
531 % \end{macrocode}
532 % \end{macro}
533 %
534 % \begin{macro}{\addtonotes}
535 % |\addtonotes|\marg{text} puts \meta{text} into the notes file.
536 % \begin{macrocode}
537 \newcommand{\addtonotes}[1]{%
538 \ifmakingpagenotes
539 \IfFileExists{\jobname.ent}{\@pnwrite\@notefile{}{#1}}{\pnofilewarn}%
540 \fi}
541
542 % \end{macrocode}
543 % \end{macro}
544 %
545 % \begin{macro}{\notenumintext}
546 % \begin{macro}{\notenuminnotes}
547 % |\notenumintext|\marg{notenum} typesets \meta{notenum} (in the body text).
548 % \begin{macrocode}
549 \newcommand{\notenumintext}[1]{%
550 \textsuperscript{#1}}
551 % \end{macrocode}
552 % |\notenuminnotes|\marg{notenum} typesets \meta{notenum} (as part of the note).
553 % \begin{macrocode}
554 \newcommand{\notenuminnotes}[1]{%
555 {\normalfont #1.} }
556 % \end{macrocode}
557 % \end{macro}
558 % \end{macro}
559 %
560 % \begin{macro}{\noteentry}
561 % |\noteentry|\marg{notenum}\marg{id}\marg{pagenum}\marg{text}
562 % typesets a note.
563 % \begin{macrocode}
564 \newcommand{\noteentry}[4]{%
565 \prenoteinnotes
566 \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}%
567 \postnoteinnotes}
568
569 % \end{macrocode}
570 % \end{macro}
571 %
572 % \begin{macro}{\textinnotes}
573 % |\textinnotes|\marg{id text} typesets the note's \meta{id text}.
574 % \begin{macrocode}
575 \newcommand{\textinnotes}[1]{%
576 [#1] }
577 % \end{macrocode}
578 % \end{macro}
579 %
580 % \begin{macro}{\noteidinnotes}
581 % |\noteidinnotes|\marg{notenum}\marg{id} is used to typeset the note
582 % identification (in the note listing). It is set so that it typesets the
583 % \meta{id} if it is not empty, otherwise it sets the \meta{notenum}.
584 % \begin{macrocode}
585 \newcommand{\noteidinnotes}[2]{%
586 \@ifmtarg{#2}{%
587 \notenuminnotes{#1}}{\textinnotes{#2}}}
588 % \end{macrocode}
589 % \end{macro}
590 %
591 % \begin{macro}{\pagename}
592 % \begin{macro}{\pageinnotes}
593 % |\pageinnotes|\meta{pagenum} is used to typeset the originating page number
594 % (in the note), but the page number is not trustworthy unless the
595 % \Lopt{page} option is used.
596 % \changes{v1.1}{2004/09/27}{Added \cs{pagename} for use in \cs{pageinnotes}}
597 % \begin{macrocode}
598 \providecommand*{\pagename}{page}
599 \newcommand{\pageinnotes}[1]{%
600 \ifpnpageopt (\pagename\ #1) \fi}
601 % \end{macrocode}
602 % \end{macro}
603 % \end{macro}
604 %
605 % \begin{macro}{\noteinnotes}
606 % |\noteinnotes|\marg{text} is used to typeset the note's text
607 % (in the note list).
608 % \begin{macrocode}
609 \newcommand{\noteinnotes}[1]{#1}
610
611 % \end{macrocode}
612 % \end{macro}
613 %
614 % \begin{macro}{\prenoteinnotes}
615 % \begin{macro}{\postnoteinnotes}
616 % These are called immediately before and after the note information is
617 % typeset.
618 % \begin{macrocode}
619 \newcommand{\prenoteinnotes}{\par\noindent}
620 \newcommand{\postnoteinnotes}{\par}
621
622 % \end{macrocode}
623 % \end{macro}
624 % \end{macro}
625 %
626 % \begin{macro}{\notesname}
627 % \begin{macro}{\notedivision}
628 % Heading for note list.
629 % \begin{macrocode}
630 \providecommand*{\notesname}{Notes}
631 \ifpnhaschapter
632 \newcommand*{\notedivision}{\chapter{\notesname}}
633 \else
634 \newcommand*{\notedivision}{\section{\notesname}}
635 \fi
636
637 % \end{macrocode}
638 % \end{macro}
639 % \end{macro}
640 %
641 %
642 % \begin{macro}{\printnotes}
643 % \begin{macro}{\printnotes*}
644 % User commands to print the note file.
645 % \begin{macrocode}
646 \newcommand*{\printnotes}{\@ifstar{\@sprintnotes}{\@printnotes}}
647 % \end{macrocode}
648 % \end{macro}
649 % \end{macro}
650 %
651 % \begin{macro}{\pnofilewarn}
652 % Warning when the notes file does not exist.
653 % \begin{macrocode}
654 \newcommand*{\pnofilewarn}{%
655 \PackageWarning{pagenote}{There is no .ent file}}
656 %
657 % \begin{macro}{\@sprintnotes}
658 % Macro implementing |\printnotes*|.
659 % \begin{macrocode}
660 \newcommand*{\@sprintnotes}{%
661 \ifmakingpagenotes
662 \notedivision
663 \IfFileExists{\jobname.ent}{%
664 \immediate\closeout\@notefile
665 \input{\jobname.ent}%
666 \immediate\openout\@notefile=\jobname.ent%
667 }{%
668 \pnofilewarn
669 }%
670 \fi}
671
672 % \end{macrocode}
673 % \end{macro}
674 %
675 % \begin{macro}{\@printnotes}
676 % Macro implementing |\printnotes|.
677 % \begin{macrocode}
678 \newcommand*{\@printnotes}{%
679 \ifmakingpagenotes
680 \notedivision
681 \IfFileExists{\jobname.ent}{%
682 \immediate\closeout\@notefile
683 \input{\jobname.ent}%
684 }{%
685 \pnofilewarn
686 }
687 \fi}
688
689 % \end{macrocode}
690 % \end{macro}
691 %
692 % \begin{macro}{\chapterame}
693 % \begin{macro}{\sectionname}
694 % \begin{macro}{\pagenotesubhead}
695 % The section heading before each set of notes.
696 % \changes{v1.1}{2004/09/27}{Added \cs{sectionname} for use in \cs{pagenotesubhead}}
697 % \begin{macrocode}
698 \providecommand*{\chaptername}{Chapter}
699 \providecommand*{\sectionname}{Section}
700 \ifpnhaschapter
701 \DeclareRobustCommand{\pagenotesubhead}[2]{%
702 \subsection*{\chaptername\ #1 #2}}
703 \else
704 \DeclareRobustCommand{\pagenotesubhead}[2]{%
705 \subsection*{\sectionname\ #1}}
706 \fi
707
708 % \end{macrocode}
709 % \end{macro}
710 % \end{macro}
711 % \end{macro}
712 %
713 %
714 % The end of this package.
715 % \begin{macrocode}
716 %</usc>
717 % \end{macrocode}
718 %
719 %
720 %
721 %
722 % \Finale
723 % \PrintIndex
724 %
725 \endinput
726
727 %% \CharacterTable
728 %% {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
729 %% 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
730 %% Digits \0\1\2\3\4\5\6\7\8\9
731 %% Exclamation \! Double quote \" Hash (number) \#
732 %% Dollar \$ Percent \% Ampersand \&
733 %% Acute accent \' Left paren \( Right paren \)
734 %% Asterisk \* Plus \+ Comma \,
735 %% Minus \- Point \. Solidus \/
736 %% Colon \: Semicolon \; Less than \<
737 %% Equals \= Greater than \> Question mark \?
738 %% Commercial at \@ Left bracket \[ Backslash \\
739 %% Right bracket \] Circumflex \^ Underscore \_
740 %% Grave accent \` Left brace \{ Vertical bar \|
741 %% Right brace \} Tilde \~}
742
743