| 1 |
% Copyright (C) 2013-2024 Eduardo C. Lourenço de Lima |
| 2 |
% |
| 3 |
% This work may be distributed and/or modified under the |
| 4 |
% conditions of the LaTeX Project Public License, either |
| 5 |
% version 1.3 of this license or (at your option) any later |
| 6 |
% version. The latest version of this license is in |
| 7 |
% |
| 8 |
% http://www.latex-project.org/lppl.txt |
| 9 |
% |
| 10 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
% version 2005/12/01 or later. |
| 12 |
\documentclass{ltxdoc} |
| 13 |
\usepackage{sepfootnotes} |
| 14 |
\usepackage{color} |
| 15 |
\definecolor{myblue}{rgb}{0,0.2,0.6} |
| 16 |
|
| 17 |
\newenvironment{Description} |
| 18 |
{\par\medskip\noindent\ignorespaces}{} |
| 19 |
|
| 20 |
\newenvironment{synopsis} |
| 21 |
{\begin{list}{} |
| 22 |
{\setlength\parsep{0pt} |
| 23 |
\setlength\itemsep{0pt}}} |
| 24 |
{\end{list}} |
| 25 |
|
| 26 |
\newenvironment{syntax} |
| 27 |
{\par\noindent \textbf{Syntax:}\begin{list}{} |
| 28 |
{\setlength\parsep{0pt} |
| 29 |
\setlength\itemsep{0pt}}} |
| 30 |
{\end{list}} |
| 31 |
|
| 32 |
\newenvironment{example} |
| 33 |
{\par\noindent \textbf{Example:}\begin{list}{} |
| 34 |
{\setlength\parsep{0pt} |
| 35 |
\setlength\itemsep{0pt}}} |
| 36 |
{\end{list}} |
| 37 |
|
| 38 |
\newcounter{example} |
| 39 |
\newenvironment{Example}[1] |
| 40 |
{\stepcounter{example}\subsection*{Example \theexample}#1} |
| 41 |
{} |
| 42 |
|
| 43 |
\newenvironment{page} |
| 44 |
{\begin{center}\begin{minipage}[t]{0.5\linewidth}} |
| 45 |
{\end{minipage}\end{center}} |
| 46 |
\newcommand\TODO{\texttt{Todo:}} |
| 47 |
\newcommand\fileversion{0.3d} |
| 48 |
\newcommand\filedate{July 5, 2024} |
| 49 |
\begin{document} |
| 50 |
\title{The \textsf{\color{myblue} sepfootnotes} package,\thanks{This document corresponds to \textsf{sepfootnotes}~\fileversion, dated~\filedate. |
| 51 |
I am grateful to Michael Sellhoff, Sam Foster, Mats, David Carlisle, and schtandard for their valuable feedback on \texttt{sepfootnotes} and to Dan Luecking for the basic idea implemented in this package.}\\{or a footnote to Plato}} |
| 52 |
\author{Eduardo C. Louren\c{c}o de Lima \\ \texttt{[email protected]}} |
| 53 |
\maketitle |
| 54 |
|
| 55 |
|
| 56 |
\begin{abstract}\noindent This package supports footnotes and endnotes from separate files. This is achieved with commands |\sepfootnotecontent| and |\sepfootnote|; the former defines the content of a note, while the latter typesets that note.\end{abstract} |
| 57 |
|
| 58 |
\section*{Introduction} |
| 59 |
|
| 60 |
Standard |\footnote| and |\endnote| both take a note as a mandatory argument. Because notes have to be embedded in the paragraph to which they refer, sentences are often split up into two\footnote {This is precisely what this footnote does to the first paragraph of this document. There are more than thirty words between `two' and `or more' in the code of an otherwise short paragraph.} or more parts. Consequently, footnotes and endnotes may disrupt the flow of reading and editing {\LaTeX} prose.\footnote {In a posting to \texttt{texhax.tug.org} in April 2010, someone complained that using footnotes ``tends to disrupt the flow of the document on the screen and makes editing the text itself harder'', and asked about the possibility of ``putting all of the footnotes in a separate file''~\cite{Nicholas Cole}. Another user, back in 2004, remarked that the ``only thing I missed about word processors was the ability to keep footnote text at the bottom of the page, or in a separate window. I often have extensive footnotes, and don't want them cluttering up my main body text when I'm composing''~\cite{Luecking}.} This can be an issue for those who make extensive use of notes, such as philosophers and people from the humanities in general. |
| 61 |
|
| 62 |
The |sepfootnotes| package gets around this inconvenience by separating note input from usage. That is, it provides a command to define what a particular note says, and another command to insert that note in the document. |
| 63 |
|
| 64 |
Note definitions may be grouped together---in no particular order---in the preamble, at the beginning of chapters or sections, in a separate file, or even right after a paragraph. In that way, the main body is less cluttered. |
| 65 |
|
| 66 |
You may use |sepfootnotes| and standard |\footnote| simultaneously; the same goes for |\footcite| from |biblatex|. |
| 67 |
|
| 68 |
|
| 69 |
\newpage |
| 70 |
|
| 71 |
\section{Synopsis} |
| 72 |
|
| 73 |
|
| 74 |
\subsection*{Default footnote apparatus} |
| 75 |
|
| 76 |
\begin{synopsis} |
| 77 |
\item |\sepfootnotecontent| \marg{key} \marg{content} |
| 78 |
\item |\sepfootnote| \marg{key} |
| 79 |
\end{synopsis} |
| 80 |
|
| 81 |
|
| 82 |
\subsection*{User-defined footnote or endnote apparatus} |
| 83 |
|
| 84 |
\begin{synopsis} |
| 85 |
\item |\newfootnotes | \marg{prefix} |
| 86 |
\item |\newfootnotes*| \marg{prefix}\medskip |
| 87 |
\item |\newsymbolfootnotes| \oarg{master counter} \marg{prefix}\medskip |
| 88 |
\item |\newendnotes| \marg{prefix}\bigskip |
| 89 |
\item |\|\meta{prefix}|notecontent| \marg{key} \marg{content} |
| 90 |
\item |\|\meta{prefix}|note| \marg{key} |
| 91 |
\item |\|\meta{prefix}|notemark| \marg{key} |
| 92 |
\item |\|\meta{prefix}|notetext| \marg{key} |
| 93 |
\item |\print|\meta{prefix}|note| \marg{key}\medskip |
| 94 |
\item |\|\meta{prefix}|quicknote| \marg{content} |
| 95 |
\end{synopsis} |
| 96 |
|
| 97 |
\subsection*{Endnote-specific} |
| 98 |
|
| 99 |
\begin{synopsis} |
| 100 |
\item |\the|\meta{prefix}|notes| |
| 101 |
\item |\addto|\meta{prefix}|notes| \marg{text} |
| 102 |
\end{synopsis} |
| 103 |
|
| 104 |
\subsection*{Formatting} |
| 105 |
|
| 106 |
\begin{synopsis} |
| 107 |
\item |\renewcommand\the|\meta{prefix}|note| |
| 108 |
\item |\renewcommand\the|\meta{prefix}|mark| |
| 109 |
\item |\renewcommand\make|\meta{prefix}|mark| |
| 110 |
\item |\renewcommand\|\meta{prefix}|notesize| |
| 111 |
\item |\renewcommand\|\meta{prefix}|noteformat|\medskip |
| 112 |
\item |\renewenvironment {|\meta{prefix}|notes}| |
| 113 |
\end{synopsis} |
| 114 |
|
| 115 |
|
| 116 |
\section{Basic usage} |
| 117 |
|
| 118 |
|
| 119 |
\begin{Description} |
| 120 |
\DescribeMacro{\sepfootnotecontent} |
| 121 |
First define the \meta{content} of a footnote by |
| 122 |
assigning it a \meta{key} that uniquely identifies it: |
| 123 |
\begin{synopsis} |
| 124 |
\item |\sepfootnotecontent| \marg{key} \marg{content} |
| 125 |
\end{synopsis} |
| 126 |
\end{Description} |
| 127 |
|
| 128 |
|
| 129 |
\begin{Description} |
| 130 |
\DescribeMacro{\sepfootnote} |
| 131 |
Then insert that footnote anywhere in the main body by means of the |
| 132 |
same \meta{key} as used before: |
| 133 |
\begin{synopsis} |
| 134 |
\item |\sepfootnote| \marg{key} |
| 135 |
\end{synopsis} |
| 136 |
\end{Description} |
| 137 |
|
| 138 |
|
| 139 |
% ------------------------------ Intermediate --------------------------------- |
| 140 |
|
| 141 |
\section{Advanced usage} |
| 142 |
|
| 143 |
\begin{Description} |
| 144 |
\DescribeMacro{\newfootnotes} |
| 145 |
\DescribeMacro{\newfootnotes*} |
| 146 |
\DescribeMacro{\newsymbolfootnotes} |
| 147 |
\DescribeMacro{\newendnotes} |
| 148 |
The |sepfootnotes| apparatus described above is available by default. |
| 149 |
But you may create as many distinct and independent footnote or endnote apparatus as needed: |
| 150 |
\begin{synopsis} |
| 151 |
\item |\newfootnotes |\marg{prefix} |
| 152 |
|
| 153 |
Create an apparatus of footnote commands named after \meta{prefix} using the standard |footnote| counter.\bigskip |
| 154 |
|
| 155 |
\item |\newfootnotes* |\marg{prefix} |
| 156 |
|
| 157 |
Create an apparatus of footnote commands named after \meta{prefix} using its own counter.\bigskip |
| 158 |
|
| 159 |
\item |\newsymbolfootnotes| \oarg{master counter} \marg{prefix} |
| 160 |
|
| 161 |
Create an apparatus of symbol-footnote commands named after \meta{prefix} using its own counter. The optional argument \meta{master counter} can be anything like |page|, |section|, |chapter|, etc. The default master counter is |page|. The series of symbols is reset each new page, so that * marks the first symbol-footnote on any page, whereas $\dag$ marks the second, $\ddag$ the third, and so on.\bigskip |
| 162 |
|
| 163 |
\item |\newendnotes |\marg{prefix} |
| 164 |
|
| 165 |
Create an apparatus of endnote commands named after \meta{prefix} using its own counter. |
| 166 |
\end{synopsis} |
| 167 |
\end{Description} |
| 168 |
|
| 169 |
\begin{Description} |
| 170 |
\DescribeMacro{\<prefix>notecontent} |
| 171 |
This is how to typeset notes: once a note apparatus of any kind is created, you need to assign a \meta{key} to a \meta{content}: |
| 172 |
\begin{synopsis} |
| 173 |
\item |\|\meta{prefix}|notecontent| \marg{key} \marg{content} |
| 174 |
\end{synopsis} |
| 175 |
\end{Description} |
| 176 |
|
| 177 |
\begin{Description} |
| 178 |
\DescribeMacro{\<prefix>note} |
| 179 |
\DescribeMacro{\<prefix>notemark} |
| 180 |
\DescribeMacro{\<prefix>notetext} |
| 181 |
\DescribeMacro{\print<prefix>content} |
| 182 |
And then use the \meta{key} to typeset that content using any of the following: |
| 183 |
\begin{synopsis} |
| 184 |
\item |\|\meta{prefix}|note| \marg{key} |
| 185 |
|
| 186 |
Typeset a note identified by \meta{key}.\bigskip |
| 187 |
|
| 188 |
\item |\|\meta{prefix}|notemark| \marg{key} |
| 189 |
|
| 190 |
Typeset just the mark identified by \meta{key} without the corresponding note.\medskip |
| 191 |
|
| 192 |
\item |\|\meta{prefix}|notetext| \marg{key} |
| 193 |
|
| 194 |
Typeset just the note identified by \meta{key} without the corresponding mark.\medskip |
| 195 |
|
| 196 |
\item |\print|\meta{prefix}|note| \marg{key} |
| 197 |
|
| 198 |
Just print the \meta{content} identified by \meta{key}.\medskip |
| 199 |
|
| 200 |
\item |\|\meta{prefix}|quicknote| \marg{content} |
| 201 |
|
| 202 |
Typeset a note with \meta{content} without a key. |
| 203 |
This is similar to standard |\footnote| \marg{content}, |
| 204 |
and may be useful for short notes, such as ``Idem.'' |
| 205 |
\end{synopsis} |
| 206 |
\end{Description} |
| 207 |
|
| 208 |
\newpage |
| 209 |
|
| 210 |
\begin{Description} |
| 211 |
\DescribeMacro{\the<prefix>notes} |
| 212 |
\DescribeMacro{\addto<prefix>notes} |
| 213 |
\DescribeMacro{\<prefix>notesize} |
| 214 |
\DescribeEnv{<prefix>notes} |
| 215 |
\DescribeMacro{\the<prefix>note} |
| 216 |
\DescribeMacro{\the<prefix>mark} |
| 217 |
\DescribeMacro{\make<prefix>mark} |
| 218 |
\DescribeMacro{\<prefix>noteformat} |
| 219 |
These are endnote-specific: |
| 220 |
\begin{synopsis} |
| 221 |
\item |\the|\meta{prefix}|notes| |
| 222 |
|
| 223 |
Typeset the actual endnotes at the end of a chapter or section.\bigskip |
| 224 |
|
| 225 |
\item |\addto|\meta{prefix}|notes| \marg{text} |
| 226 |
|
| 227 |
Add \meta{text} to endnotes. |
| 228 |
|
| 229 |
Suggestion: |\subsection*|\bigskip |
| 230 |
|
| 231 |
\item |\renewcommand\|\meta{prefix}|notesize| |
| 232 |
|
| 233 |
Define the fontsize in which to typeset endnotes. |
| 234 |
|
| 235 |
Default: |\footnotesize|\bigskip |
| 236 |
|
| 237 |
\item |\renewenvironment {|\meta{prefix}|notes}| |
| 238 |
|
| 239 |
Define the environment in which endnotes are typeset. |
| 240 |
|
| 241 |
Default: |\|\meta{prefix}|notesize\setlength\parskip\footnotesep|\bigskip |
| 242 |
|
| 243 |
\item |\renewcommand\the|\meta{prefix}|note| |
| 244 |
|
| 245 |
Define how endnote numbers are typeset. |
| 246 |
|
| 247 |
Default: |\arabic {|\meta{prefix}|note}|\bigskip |
| 248 |
|
| 249 |
\item |\renewcommand\the|\meta{prefix}|mark| |
| 250 |
|
| 251 |
Define how endnote marks are typeset. |
| 252 |
|
| 253 |
Default: |\the|\meta{prefix}|note|\bigskip |
| 254 |
|
| 255 |
\item |\renewcommand\make|\meta{prefix}|mark| |
| 256 |
|
| 257 |
Define how a particular endnote mark is typeset. |
| 258 |
|
| 259 |
Default:\footnote{Adapted from the {\LaTeX2e} sources.} |\hbox {\normalfont\the|\meta{prefix}|mark.\ }|\bigskip |
| 260 |
|
| 261 |
\item |\renewcommand\|\meta{prefix}|noteformat| |
| 262 |
|
| 263 |
Define how a particular endnote is typeset. |
| 264 |
|
| 265 |
Default:\footnote{Adapted from the \texttt{endnotes} package.} |
| 266 |
|
| 267 |
|\noindent\rightskip\z@ \leftskip\z@|\newline |
| 268 |
|\leavevmode\llap{\make|\meta{prefix}|mark}| |
| 269 |
\end{synopsis} |
| 270 |
\end{Description} |
| 271 |
|
| 272 |
|
| 273 |
\section {Package options} |
| 274 |
|
| 275 |
\begin{list}{}{} |
| 276 |
\item[|after|] (experimental) Allow |\sepfootnotecontent| after |\sepfootnote|. Must compile twice. Implies |global|. See below. |
| 277 |
\item[|global|] Notes defined within environments and groups take global scope and become available throughout, as if they were defined in the preamble. |
| 278 |
\item[|error|] Print warning messages, halt, and wait for user input. |
| 279 |
\item[|quiet|] Suppress warning and error messages. |
| 280 |
\end{list} |
| 281 |
|
| 282 |
\section{Examples} |
| 283 |
|
| 284 |
% -------------------------------- Examples ----------------------------------- |
| 285 |
\begin{Example} |
| 286 |
{How to typeset `Socrates's pupil' as a footnote to Plato using the default |sepfootnotes| apparatus:} |
| 287 |
\begin{verbatim} |
| 288 |
\documentclass{article} |
| 289 |
\usepackage{sepfootnotes} |
| 290 |
\sepfootnotecontent{Plato}{Socrates's pupil.} |
| 291 |
\begin{document} |
| 292 |
This was first brought up by the great Plato.\sepfootnote{Plato} |
| 293 |
\end{document} |
| 294 |
\end{verbatim} |
| 295 |
\end{Example} |
| 296 |
|
| 297 |
\begin{Example} |
| 298 |
{How to typeset `Socrates's pupil' as a footnote to Plato using a \emph{user-defined} footnote apparatus with prefix |a-|} |
| 299 |
\begin{verbatim} |
| 300 |
\documentclass{article} |
| 301 |
\usepackage{sepfootnotes} |
| 302 |
\newfootnotes{a} |
| 303 |
\anotecontent{Plato}{Socrates's pupil.} |
| 304 |
\begin{document} |
| 305 |
This was first brought up by the great Plato.\anote{Plato} |
| 306 |
\end{document} |
| 307 |
\end{verbatim} |
| 308 |
\end{Example} |
| 309 |
|
| 310 |
\begin{Example} |
| 311 |
{How to typeset a footnote \emph{from a separate file} using a user-defined apparatus with prefix |b-|} |
| 312 |
\begin{itemize}\item mynotes.tex: |
| 313 |
\begin{verbatim} |
| 314 |
\bnotecontent{Plato}{Socrates's pupil.} |
| 315 |
\end{verbatim} |
| 316 |
\item document.tex: |
| 317 |
\begin{verbatim} |
| 318 |
\documentclass{article} |
| 319 |
\usepackage{sepfootnotes} |
| 320 |
\newfootnotes{b} |
| 321 |
\input{mynotes} |
| 322 |
\begin{document} |
| 323 |
This was first brought up by the great Plato.\bnote{Plato} |
| 324 |
\end{document} |
| 325 |
\end{verbatim} |
| 326 |
\end{itemize} |
| 327 |
\end{Example} |
| 328 |
|
| 329 |
\begin{Example} |
| 330 |
{How to typeset `Socrates's pupil' as a \emph{symbol-footnote} to Plato using a user-defined footnote apparatus with prefix |symbol-|} |
| 331 |
\begin{verbatim} |
| 332 |
\documentclass{article} |
| 333 |
\usepackage{sepfootnotes} |
| 334 |
\newsymbolfootnotes{symbol} |
| 335 |
\symbolnotecontent{Plato}{Socrates's pupil.} |
| 336 |
\begin{document} |
| 337 |
This was first brought up by the great Plato.\symbolnote{Plato} |
| 338 |
\end{document} |
| 339 |
\end{verbatim} |
| 340 |
\end{Example} |
| 341 |
|
| 342 |
\begin{Example} |
| 343 |
{How to typeset `Socrates's pupil' as an \emph{endnote} to Plato using a user-defined endnote apparatus with prefix |x-|} |
| 344 |
\begin{verbatim} |
| 345 |
\documentclass{article} |
| 346 |
\usepackage{sepfootnotes} |
| 347 |
\newendnotes{x} |
| 348 |
\xnotecontent{Plato}{Socrates's pupil.} |
| 349 |
\begin{document} |
| 350 |
This was first brought up by the great Plato.\xnote{Plato} |
| 351 |
\section*{Notes} |
| 352 |
\thexnotes |
| 353 |
\end{document} |
| 354 |
\end{verbatim} |
| 355 |
\end{Example} |
| 356 |
|
| 357 |
\begin{Example} |
| 358 |
{How to typeset a footnote to Plato \emph{and} an endnote to Homer from a separate file \emph{in no particular order}:} |
| 359 |
|
| 360 |
\begin{itemize} |
| 361 |
\item mynotes.tex: |
| 362 |
\begin{verbatim} |
| 363 |
\xnotecontent{Homer}{The greatest of ancient poets.} |
| 364 |
\anotecontent{Plato}{Socrates's pupil.} |
| 365 |
\end{verbatim} |
| 366 |
|
| 367 |
\item document.tex: |
| 368 |
\begin{verbatim} |
| 369 |
\documentclass{article} |
| 370 |
\usepackage{sepfootnotes} |
| 371 |
\newfootnotes{a} |
| 372 |
\newendnotes{x} |
| 373 |
\input{mynotes} |
| 374 |
\begin{document} |
| 375 |
This was first brought up by the great Plato.\anote{Plato} |
| 376 |
But an antecedent is to be found in Homer.\xnote{Homer} |
| 377 |
\section*{Notes} |
| 378 |
\thexnotes |
| 379 |
\end{document} |
| 380 |
\end{verbatim} |
| 381 |
\end{itemize} |
| 382 |
|
| 383 |
\end{Example} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
\begin{thebibliography}{1} |
| 388 |
|
| 389 |
\bibitem{Nicholas Cole} |
| 390 |
\texttt{http://tug.org/mailman/htdig/texhax/2010-April/014558.html} |
| 391 |
|
| 392 |
\bibitem{Luecking} |
| 393 |
\texttt{http://www.44342.com/tex-f809-t9440-p1.htm}. |
| 394 |
|
| 395 |
% \bibitem{Companion} |
| 396 |
% Frank Mittelbach, and Michel Goossens, with Johannes Braams, David Carlisle, |
| 397 |
% and Chris Rowley. |
| 398 |
% \newblock \emph{The {\LaTeX} Companion}. 2nd |
| 399 |
% \newblock Addison~Wesley, 2004. |
| 400 |
% \newblock ISBN~\mbox{0-201-36299-6}. |
| 401 |
|
| 402 |
\end{thebibliography} |
| 403 |
|
| 404 |
\end{document} |