Debian Codegraph @

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

raw
1
2 %!TEX program = lualatex
3
4 \documentclass[10pt]{article}
5 %\usepackage[USenglish,english]{babel}
6 \usepackage[USenglish]{babel}
7 %\selectlanguage{USenglish}
8 %\usepackage[no-math]{fontspec}
9 \usepackage[oldstyle]{Alegreya}
10 \usepackage[]{AlegreyaSans}
11 \setmonofont[Scale=MatchLowercase]{IBM Plex Mono}
12
13 %\defaultfontfeatures{Ligatures=TeX}
14 %\def\MinionDefaults{%
15 % SizeFeatures = {
16 % {Size = -8.41, OpticalSize = 8, Numbers = Lining},
17 % {Size = 8.41-13.1, OpticalSize = 11},
18 % {Size = 13.1-20.0, OpticalSize = 19},
19 % {Size = 20.0-, OpticalSize = 72}},
20 % Numbers = {OldStyle,Monospaced}}
21 %\setmainfont[\MinionDefaults,
22 % BoldFont = {Minion Pro Semibold}]{Minion Pro}
23 %\setsansfont[Scale=MatchLowercase, BoldFont = {Myriad Pro Semibold}]{Myriad Pro}
24 %\setmonofont[Scale=MatchLowercase]{Consolas}
25
26 \usepackage{amsmath}
27 \usepackage{parnotes}
28 \usepackage{xcolor}
29 \usepackage[colorlinks]{hyperref}
30 \hypersetup{allcolors=blue}
31 \usepackage{varwidth}
32 \usepackage{accsupp}
33
34 %\DeclareRobustCommand\squelch[1]{%
35 % \BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}}
36 %\def\squelchstyle{%
37 % \BeginAccSupp{method=plain,ActualText={}}%
38 % \aftergroup\aftersquelchstyle}
39 %\def\aftersquelchstyle{\EndAccSupp{}}
40
41 \usepackage{fancyhdr}
42 \fancypagestyle{plain}{%
43 \fancyhf{}%
44 % \fancyfoot[C]{\squelch{\thepage}}%
45 \fancyfoot[C]{\thepage}%
46 \renewcommand{\headrulewidth}{0pt}%
47 \renewcommand{\footrulewidth}{0pt}%
48 }
49 \pagestyle{plain}
50 \usepackage{listings}
51 %\lstset{numbers=left,basicstyle={\small\ttfamily},numberstyle={\squelchstyle\color{gray}}}
52 \lstset{numbers=left,basicstyle={\scriptsize\ttfamily},numberstyle={\color{gray}}}
53 \usepackage{booktabs}
54 \usepackage{microtype}
55
56 \title{The \textsf{parnotes} package\parnote{This is rev.~3c, last modified 2024/06/12.}}
57 \author{Chelsea Hughes\parnote{See \texttt{parnotes.sty} for copyright details. The package has currently no maintainer.}}
58 \date{June 12, 2024}
59
60 \renewcommand{\parnotefmt}[1]{\centerline{\colorbox{black!10}{\parbox{0.82\textwidth}{\footnotesize\sffamily\noindent #1}}}}
61
62 \begin{document}
63 \maketitle
64 \parnotes
65 The \textsf{parnotes} package adds a new note type, \verb+\parnote+. Parnotes are set as normal, running paragraphs and may be placed two ways:
66 \begin{itemize}
67 \item Automatically, at the end of the paragraph
68 \item Manually, using the \verb+\parnotes+ command
69 \end{itemize}
70 This package was inspired by a question on the \TeX\ Stack Exchange\parnote{``Placing footnotes or endnotes at the end of the current paragraph'' at
71 \url{http://tex.stackexchange.com/questions/34746}} that asked for notes
72 which are placeable immediately after the paragraph in which they are mentioned, to avoid
73 the interruption posed by footnotes.
74
75 \parnotes
76 \bigskip
77 \section{Usage}
78 Load parnotes normally:
79
80 \medskip\fbox{\texttt{\textbackslash{}usepackage[}$\langle$\textit{options}$\rangle$\texttt{]\{parnotes\}}}
81
82 \medskip\noindent The package options are described in section 2.1.
83
84 \medskip\fbox{\texttt{\textbackslash{}parnote\{}$\langle$\textit{text}$\rangle$\texttt{\}}}
85
86 \medskip\noindent Place a parnote mark and assign it note $\langle$\textit{text}$\rangle$. This mark is placeable within headings but will not appear in the table of contents.
87
88 \medskip\fbox{\texttt{\textbackslash{}parnote[}$\langle$\textit{mark}$\rangle$\texttt{]\{}$\langle$\textit{text}$\rangle$\texttt{\}}}
89
90 \medskip\noindent As above, but use $\langle$\textit{mark}$\rangle$ instead of the standard auto-incrementing parnote mark.
91
92 \medskip\fbox{\begin{varwidth}{\textwidth}\texttt{\textbackslash{}begin\{autopn\}\\\textbackslash{}end\{autopn\}}\end{varwidth}}
93
94 \medskip\noindent Parnotes within an \texttt{autopn} environment are set automatically at the end of every paragraph. This behavior does not carry into nested environments. To set parnotes inside another environment, nest \texttt{autopn} within it or use \verb+\parnotes+.
95
96 \medskip\fbox{\texttt{\textbackslash{}parnotes}}
97
98 \medskip\noindent Place all parnotes immediately. Use it after every paragraph for \texttt{autopn}-like behavior outside \texttt{autopn} (or where \texttt{autopn} doesn’t apply).
99
100 \medskip\fbox{\texttt{\textbackslash{}parnotereset}}
101
102 \medskip\noindent Reset the parnote number. This maps to \verb+\setcounter{parnotemark}{1}+.
103
104 \medskip\fbox{\texttt{\textbackslash{}parnoteclear}}
105
106 \medskip\noindent Reset the parnote number and also delete any pending parnotes.
107
108 \medskip\fbox{\texttt{\textbackslash{}parnoteref\{$\langle$\textrm{\textit{label}}$\rangle$\}}}
109
110 \medskip\noindent Refer to previous parnote mark $\langle$\textit{label}$\rangle$. Use the standard \LaTeX\ macro \verb+\label+ within a parnote to assign it a label. You may also use the standard \LaTeX\ reference macros \verb+\ref+ and \verb+\pageref+.
111
112 \section{Configuration}
113 Configure \textsf{parnotes} using package options, or manually using format macros.
114
115 \subsection{Package options}
116 The following options are provided:
117
118 \noindent\begin{tabbing}
119 \texttt{restart}\hspace{0.75in}\=Reset the parnote number each time parnotes are placed.\\
120 \texttt{reset}\>Alias name for \texttt{restart} to match what other packages use.\\
121 \texttt{roman}\>Use lowercase Roman numerals instead of Arabic numerals for\\
122 \>parnote marks. Specify this if you mix parnotes with footnotes.\\
123 \texttt{alph}\>Use lowercase alphabet characters instead.\\
124 \texttt{symbol}\>Use footnote symbols instead instead.\\
125 \texttt{breakwithin}\>Place a line break after every parnote.\\
126 \texttt{indentafter}\>Allow indentation in the paragraph following a parnote.\\
127 \texttt{narrower}\>Give parnotes an increased margin, like block quotes.\\
128 \texttt{nomultiple}\>Disable special behavior for multiple consecutive parnotes.\\[1ex]
129 The following options change the font used within parnotes:\\[1ex]
130 \texttt{notesrm}\>Roman. Default.\\
131 \texttt{notesit}\>Italic.\\
132 \texttt{notessf}\>Sans-serif.
133 \end{tabbing}
134
135 \subsection{Format macros}
136 Five internal macros control formatting for parnotes and parnote marks:
137
138 \medskip\fbox{\begin{varwidth}{\textwidth}\texttt{\textbackslash{}parnotefmt\{}$\langle$\textit{text}$\rangle$\texttt{\}\\
139 \textbackslash{}theparnotemark\\
140 \textbackslash{}parnotevskip\\
141 \textbackslash{}parnoteintercmd\\
142 \textbackslash{}parnotecusmarkfmt\{}$\langle$\textit{mark}$\rangle$\texttt{\}}\end{varwidth}}
143
144 \medskip\noindent Parnote text is set using \verb+\parnotefmt+, and parnote marks using \verb+\parnotecusmarkfmt+.
145 When the optional argument of \verb+\parnote+ is \emph{not} used, \verb+\theparnotemark+ is used to get
146 the parnote mark for formatting.
147 At least \verb+\parnotevskip+ vertical space appears before and after the parnote text. The macro
148 \verb+\parnoteintercmd+ is executed between all consecutive parnotes.
149
150 \textsf{parnotes} rev.~1 had a different macro, \verb+\parnotemarkfmt+, to control parnote marks.
151 Unfortunately, the definition of this macro is incompatible with the new feature in rev.~2 allowing for manually-specified parnote marks,
152 so it had to be split into two macros \verb+\parnotecusmarkfmt+ and \verb+\theparnotemark+. This is a breaking change.
153
154 Table~1 shows these macros' default values. Note that the package options \texttt{narrower},
155 \texttt{notesrm}, \texttt{notesit}, and \texttt{notessf} modify \verb+\parnotefmt+.
156 The option \texttt{roman} modifies \verb+\theparnotemark+.
157 The option \texttt{breakwithin} changes \verb+\parnoteintercmd+ into a line break.
158
159 \begin{table}[t]
160 \centering
161 \caption{Default values for format macros.}
162 \smallskip
163 \begin{tabular}{ll}
164 \toprule
165 Macro & Default value \\
166 \midrule
167 \verb+\parnotefmt+ & \verb+\footnotesize\rmfamily\noindent #1+ \\
168 \verb+\theparnotemark+ & \verb+\arabic{parnotemark}+ \\
169 \verb+\parnotevskip+ & \verb+\medskipamount+ \\
170 \verb+\parnoteintercmd+ & \verb+\hspace{1em plus 0.3em minus 0.2em}+ \\
171 \verb+\parnotecusmarkfmt+ & \verb+\textsuperscript{#1}+ \\
172 \bottomrule
173 \end{tabular}
174 \end{table}
175
176 Redefine these macros using \verb+\renewcommand+ to fine-tune \textsf{parnotes}'s formatting. For
177 example, to set parnotes in a sans-serif font, load \textsf{parnotes} as follows:
178 \begin{lstlisting}
179 \usepackage{parnotes}
180 \renewcommand{\parnotefmt}[1]{\footnotesize\sffamily\noindent #1}
181 \end{lstlisting}
182 This is the same as specifying the \texttt{notessf} package option.
183
184 To have parnotes set as \textit{completely normal text}, but one size smaller than their surroundings (using \verb+\smaller+ from \textsf{relsize}):
185 \begin{lstlisting}
186 \usepackage{relsize}
187 \usepackage[indentafter]{parnotes}
188 \renewcommand{\parnotefmt}[1]{\smaller #1}
189 \renewcommand{\parnotevskip}{0pt}
190 \end{lstlisting}
191 Or to set parnotes in a block set off by rules, with each parnote separated by a bullet:
192 \begin{lstlisting}
193 \usepackage{parnotes}
194 \renewcommand{\parnotevskip}{0pt}
195 \renewcommand{\parnotefmt}[1]{\footnotesize\rmfamily
196 \noindent\rule{\linewidth}{1pt}\\
197 \noindent #1\par
198 \noindent\rule{\linewidth}{1pt}
199 }
200 \renewcommand{\parnoteintercmd}{\;$\bullet$\;}
201 \end{lstlisting}
202
203 Note that since \verb+\parnotefmt+ is redefined, adding the package option \texttt{narrower} to this example will not work;
204 instead, \verb+\narrower+ must be placed manually within the new definition for \verb+\parnotefmt+.
205
206 \section{Changelog}
207 {\raggedright
208 \noindent\textbf{Revision 3c, released on June 12, 2024 (Frank Mittelbach)}
209 \begin{itemize}
210 \item Avoid an unnecessary warning about \verb=\theparnotemark=
211 \end{itemize}
212 \noindent\textbf{Revision 3b, released on July 23, 2019 (Frank Mittelbach)}
213 \begin{itemize}
214 \item Added options \texttt{reset}, \texttt{alph} and \texttt{symbol}.
215 \item Changed documentation to use feely available fonts only.
216 \end{itemize}
217 \noindent\textbf{Revision 3, released on Aug 15, 2016}
218 \begin{itemize}
219 \item Bug fix: Use \verb+\protected@edef+ to expand the parnote counter (fixes incompatibility with \textsf{BiocStyle})
220 \end{itemize}
221 \noindent\textbf{Revision 2, released on Jul 26, 2016}
222 \begin{itemize}
223 \item \textbf{Breaking change:} You can no longer redefine \verb+\parnotemarkfmt+. Use \verb+\theparnotemark+ and \verb+\parnotecusmarkfmt+ instead. See section~2.2 for details.
224 \item Bug fix: \verb+\parnotefmt+ no longer changes the font to \verb+\rmfamily+ by default.
225 \item \verb+\parnote+ now behaves more like \verb+\footnote+:
226 \begin{itemize}
227 \item It respects \verb+\spacefactor+
228 \item It no longer inserts \verb+\unskip+
229 \end{itemize}
230 \item The parnote mark counter may be reset using standard LaTeX macros, e.g., \verb+\setcounter{parnotemark}{5}+
231 \item \verb+\label+ now works within parnote text; \verb+\ref+ returns the parnote label, \verb+\pageref+ returns the page where the note \emph{text} is set, and \verb+\parnoteref+ returns the parnote label formatted as a mark.
232 \item Implemented the system for separators between multiple footnotes from \textsf{footmisc} and \textsf{manyfoot} and added package option \texttt{nomultiple} to disable.
233 \item Internal: The package now uses a single counter (\verb+\c@parnotemark+) for marks.
234 \end{itemize}
235 \noindent\textbf{Revision 1, released on Jan 3, 2012}
236 \begin{itemize}
237 \item Initial release.
238 \end{itemize}}
239
240 \section{Example}
241 The following pages show a typeset example using \textsf{parnotes}, including interactions with lists,
242 headings, and environments (here, multicolumn text from the \textsf{multicol} package).
243 \begin{lstlisting}
244 \documentclass{article}
245 \usepackage{multicol} % for demonstration
246 \usepackage{lipsum} % for demonstration
247 \usepackage[narrower,notessf]{parnotes}
248
249 \begin{document}
250 \begin{autopn}
251 \begin{abstract}
252 \begin{autopn}
253 Since this is in an environment, \texttt{autopn} must be nested within
254 it.\parnote{If \texttt{autopn} \emph{weren't} nested, I could've used
255 \texttt{\textbackslash parnotes} here to set parnotes manually.}
256 \end{autopn}
257 \end{abstract}
258 \tableofcontents
259 \section{On parnotes\parnote{Parnote marks will display in a heading,
260 but not within the table of contents. In \texttt{autopn}, parnotes will
261 display right after the heading.}}
262
263 This is a paragraph with a parnote\parnote{See? And it's long enough
264 to push the \emph{next} parnote nearer the end of the line.}. Actually,
265 it has two.\parnote{By default, parnotes are set in a continuous
266 paragraph with 1~em of space between each note.} This sentence ends
267 the paragraph, but it doesn't have a parnote.
268
269 This is a normal paragraph. Note that it isn't indented since the
270 parnotes make it obvious where the paragraph boundaries are. To change
271 this behavior, use the \texttt{indentafter} option.
272
273 This paragraph's indentation isn't changed.
274
275 Here's an environment with a nested \texttt{autopn}:
276 \begin{multicols}{2}
277 \begin{autopn}
278 Since parnotes are set within the normal paragraph flow, they interact
279 well with environments\parnote{Like this multicolumn environment from
280 \textsf{multicols} -- it will break columns and pages along with
281 the normal text within the environment.}.
282
283 This is just filler text without any parnotes.
284 \end{autopn}
285 \end{multicols}
286 Here's an environment without a nested \texttt{autopn}:
287 \begin{multicols}{2}
288 Without a nested \texttt{autopn}, any parnotes\parnote{Like this one.}
289 will be set after the end of the next paragraph \emph{outside} this
290 environment. If \texttt{\textbackslash parnotes} is called just before
291 the environment ends, then the parnotes will be set within that
292 environment. This is useful for, say, multi-paragraph quotes.
293
294 This environment always specifies that it ends a paragraph, so
295 parnotes will always be set after it if needed. In some other
296 circumstances, \texttt{autopn} may not ``see'' that there's a
297 paragraph break after the environment, so
298 \texttt{\textbackslash parnotes} will have to be called after the
299 environment ends.
300 \end{multicols}
301
302 Here's an extra-long parnote\parnote{\lipsum[1]}, to show that parnotes
303 can break pages. In fact, \TeX\ should prefer to break the page within
304 the parnotes rather than between this text and the start of the
305 parnotes.
306 \end{autopn}
307
308 In some circumstances, it's best to forego \texttt{autopn} altogether
309 -- for example, if parnotes\parnote{Like this one.} should only be
310 set after several paragraphs. Then just call
311 \texttt{\textbackslash parnotes} wherever the parnotes should be set.
312
313 The same applies if parnotes are to be placed only at the end of a
314 section, or at a ``scene break.''
315 \parnotes
316
317 The only limiting factor is that \texttt{\textbackslash parnotes} must
318 be executed after the parnotes it refers to. Here's a table with notes
319 in an adjacent minipage:\\[0.5in]
320 \hspace*{\fill}
321 \begin{tabular}{|c|c|}
322 \hline a & b\parnote{Note 1} \\ \hline c\parnote{Note 2} & d \\ \hline
323 \end{tabular}
324 \hspace{1in}
325 \begin{minipage}{3in}
326 % locally redefining format macros so the notes are on separate
327 % lines, with no vertical space
328 \renewcommand{\parnoteintercmd}{\\}
329 \renewcommand{\parnotevskip}{0pt}
330 \textbf{Notes:}
331 \parnotes
332 \end{minipage}\\[0.5in]
333 Now for a list:
334 \begin{enumerate}
335 \begin{autopn}
336 \item This item has no parnote.
337 \item This one does\parnote{See? But notice that
338 \texttt{\textbackslash narrower} doesn't work in lists, so
339 this is set flush with the list's margin}.
340 \item This one has a parnote\parnote{Would I ever lie to you?} in its
341 first paragraph\dots
342
343 But not in its second.
344 \end{autopn}
345 \end{enumerate}
346 New features in \textsf{parnotes} rev.~2: Multiple parnote marks%
347 \parnote{Parnote 1}\parnote{Parnote 2}.
348 Manually-specified marks\parnote[aaa]{Parnote with special mark%
349 \label{pn:special}} and references (see~\ref{pn:special},
350 p.~\pageref{pn:special}), allowing you to re-use parnote marks%
351 \parnotemark{\ref{pn:special}}.
352 \parnotes
353 \end{document}
354 \end{lstlisting}
355 \end{document}