# Is there a package or trick to collect all defined footnotes and print them with their page numbers on a certain location?

I am writing a software documentation. In the documentation I talk about new ideas that might be implemented in the next release of the software as well as bug issues. I think items related to new ideas and bug issues should be mentioned with \footnote to make the main text cleaner and they appear at the bottom.

However, someday I have to update the documentation so it will be tedious if I have to skim through all the pages to edit the footnotes to reflect the changes made in the software (or remove the irrelevant footnotes pertaining to fixed bugs).

So my idea is to collect all the footnotes and print them with their location (page numbers) on a certain location (probably in the appendix).

Is there such a package? If no, how to implement this in the simplest way?

-

If you never need the optional argument to \footnote, here's a modification of endnotes operations to do delayed writes instead of immediate writes, so the page number can be computed correctly.

\documentclass{article}
\usepackage{endnotes}
\makeatletter
\renewcommand\endnote{%
\@ifnextchar[\@xendnote{\stepcounter{endnote}\protected@xdef\@theenmark{\theendnote}%
%\@endnotemark % removed
\@endnotetext}%
}
\renewcommand\@endnotetext[1]{%
\if@enotesopen\else\@openenotes\fi
\begingroup\edef\x{\endgroup\write\@enotes{\noexpand\@doanenote{\@theenmark}}}\x
\begingroup
\def\next{#1}%
\newlinechar='40
\edef\x{\endgroup\write\@enotes{\meaning\next\space-- Page \noexpand\thepage}}\x
\begingroup\edef\x{\endgroup\write\@enotes{\@endanenote}}\x
}
\let\endnotes@theendnotes\theendnotes
\def\theendnotes{\clearpage\endnotes@theendnotes}
\makeatother

\newcommand\Footnote[1]{\footnote{#1}\endnote{#1}}
%\let\Footnote\footnote % for the final version

\begin{document}

abc\Footnote{abc}
def\Footnote{def}

\newpage

ghi\Footnote{ghi}

\theendnotes
\end{document}


When you don't need endnotes any more, just switch the final comments and remove the \theendnotes command.

-

You could use endnote to collect footnotes in the appendix.

But for your purpose I would recommend todonotes. The you could also separate bug fixes and ideas.

If you have already footnotes, you could replace footnote with todo:

\documentclass[english,11pt]{article} % use larger type; default would be 10pt
\usepackage[utf8]{inputenc}
\usepackage{todonotes}
\usepackage{babel,blindtext}

\let\footnote=\todo

\begin{document}
\listoftodos %All 'footnotes' with page.

\section{Start of document}
\blindtext\footnote{remark A}
\Blindtext\footnote{remark B}

\end{document}


If you still write your document, I would recommend to define new macros.

Here an example, how you can define \bug and \idea:

\documentclass[english,11pt]{article} % use larger type; default would be 10pt
\usepackage[utf8]{inputenc}
\usepackage{todonotes}
\usepackage{babel,blindtext}

\newcommand{\bug}[2][]{\todo[color=red,#1]{Bug: #2}}
\newcommand{\idea}[2][]{\todo[color=green,#1]{Idea: #2}}

\begin{document}
\listoftodos

\section{Start of document}
\blindtext\bug{remark A}
\Blindtext\idea{remark B}

\end{document}


You may also use the fixme-package. There is also the option footnote: Display note in a footnote. So you may switch between a footnote-like and a list of fixme.

An example with a list of all 'fixmes' and footnotes. Bugs are also marked in the margin. (see the options of the package and in \fxfatal):

\documentclass[english,11pt]{article}
\usepackage[draft,footnote,nomargin]{fixme}
\usepackage{babel,blindtext}

\newcommand{\bug}[2][]{\fxfatal[margin,#1]{Bug: #2}}
\newcommand{\idea}[2][]{\fxfatal[#1]{Idea: #2}}

\begin{document}
\listoffixmes

\section{Start of document}
\blindtext\bug{remark A}
\Blindtext\idea{remark B}

\end{document}

-
Including the page numbers in which the footnotes are defined? –  In PSTricks we trust Mar 18 '13 at 21:25
With todonotes: yes. I don't think, it is implemented for endnotes. I added an example. –  knut Mar 18 '13 at 21:29
Is it possible to use todonotes where the notes are put at the bottom of the pages (as what normal \footnote does)? –  In PSTricks we trust Mar 18 '13 at 21:33
I don't think. There is also the fixme package. Perhaps that's another possibility. –  knut Mar 18 '13 at 21:41
Could you show me how to use fixme? –  In PSTricks we trust Mar 18 '13 at 22:10

Here's a solution using todonotes with a bit of trickery:

\documentclass{article}
\usepackage[bordercolor=white,color=white]{todonotes}
\newcommand{\future}[1]{%
\footnote{Future: #1}
\todo[noline,noinline,caption={#1}]{}%
}
\begin{document}
Lala lala lala lala lala
lala lala\future{We might do this}
lala lala lala lala lala
lala lala lala lala lala
lala lala lala lala lala.

Lala lala lala lala lala
lala lala\future{or we might do that}

\listoftodos
\end{document}


This provides a \future{} macro which sets your text in a footnote and the list of todos, but in the text body it makes a marginal, all-white, invisible todo flag.

Of course, you can tweak this a number of ways, for example, to place a small coloured blob in the margin to draw attention.

-
It cannot contain $E=mc^2$, for example. –  In PSTricks we trust Mar 18 '13 at 22:09
Hmm, two comments: (a) it works if you use  as the math delimiters (but many people will tell you "Don't do that"); (b) Do you really want display-mode maths in a footnote???! –  Brent.Longborough Mar 18 '13 at 22:16
Yes. I really need it for some special cases. –  In PSTricks we trust Mar 18 '13 at 22:18