Sometimes I find footnotes either annoying or distracting when trying to edit the body of a text: particularly one which is heavily annotated with footnotes. One solution I've come up with is to gather my footnotes together into files organized to mirror to the file/directory structure I'm using for the overall document.
Each footnote is given its own unique(ish) macro. Here is an example of the sort of code I use to define a footnote macro:
\makeatletter
%% #1 = footnote identifier
%% #2 = footnote content
\long\def\setfootnote#1#2{%%
\expandafter\long\expandafter\def\csname ae@footnote@#1@ftnt@\endcsname{#2}}
\def\aefootnote#1{\footnote{\csname ae@footnote@#1@ftnt@\endcsname}}
\makeatother
This is a bit flattened from how I typically define my footnote commands, but my file/directory structure is beyond the scope of this question and would unduly complicate this example.
For the MWE I have three files:
footnote.tex
\setfootnote{first footnote}{This is just an example footnote.}
\setfootnote{another footnote}{sf;ksdf sf;lskf s;df spewr po s;fksf; sdkf.}
main_matter.tex
\input{footnotes}
Here is an illustration of using my footnotes.\aefootnote{first footnote}
This is another footnoted sentence.\aefootnote{another footnote}
master_doc.tex
\documentclass{article}
\makeatletter
%% #1 = footnote identifier
%% #2 = footnote content
\long\def\setfootnote#1#2{%%
\expandafter\long\expandafter\def\csname ae@footnote@#1@ftnt@\endcsname{#2}}
\def\aefootnote#1{\footnote{\csname ae@footnote@#1@ftnt@\endcsname}}
\makeatother
\begin{document}
\input{main_matter}
\end{document}
This works pretty well for me. It cleans up the content of the master document. I can see where the footnotes are, but I don't have to be distracted by their content when writing and editing the main matter.
But memory-wise this is an extremely wasteful approach. If I have a long document, then I'm forcing LaTeX to know and remember my footnotes for the entire life of the document.
I could implement a garbage collection system. That is, I could track the macros for my footnotes by the file currently being compiled by storing their names in a macro such as \ae@garbage@collection
. When I'm done compiling that file I could then do something along the following lines
\expandafter\let\csname ae@footnote@.....@ftnt@\endcsname\ae@undefined@macro
where .....
is the identifier for each footnote note macro I'm deleting. This could be automated through a macro \ae@delete@garbage
.
In other words, I'm saying I know ways to get around cluttering up LaTeX's memory with things it only really needs once.
What I'm interested in knowing is whether someone has suggestions for a better approach. Is there a more efficient way of managing footnotes which nevertheless avoids cluttering up the source file(s) for the master document?
emacs
(withAUCTeX
):M-x TeX-fold-mode
to get started, thenC-c C-o C-b
to fold all foldable items in the current buffer according toTeX-fold-type-list
(notably footnotes);C-c C-o C-r
does 'region', andC-c C-o C-p
does paragraph. See the AUCTeX page on folding.sepfootnotes
package ;)clipboard
package nor thesepfootnotes
package (which are from the same author, by the way) change the memory point, though. Theclipboard
package provides simple wrappers around\input
,\@namedef
and\@nameuse
. Thesepfootnotes
package also saves each footnote as a macro. I'm not convinced that memory really is a big issue, or is it?clipboard
norsepfootnotes
resolved the memory issue. But, as you say, memory is probably not such a big issue. I hadn't been aware of either of these packages previously. Of the two,sepfootnotes
is very similar to my approach. As for `clipboard, I'm not so sure I like the idea of having to compile two files.