Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have been using \footnotemark and \footnotetext to write footnotes, primarily because its much easier to read and write paragraphs in TeX without footnote text scattered in the middle of my sentences.

However this means i have to manually number each footnote myself. As i go back and forth, writing new paragraphs, or changing the ordering of my text, it means I have to renumber all subsequent footnotes.

Is there a way around this? Ideally I would like to give each footnote a unique identifier, and have the numbering handled automatically by the compiler.

share|improve this question
1  
You may want to have a look at the sepfootnotes package –  cgnieder Nov 26 '13 at 11:23

2 Answers 2

up vote 4 down vote accepted

If you're following this route, I would suggest using the \label-\ref system and create your own macros to handle the labelling and cross-referencing. Here's one take on it that uses refcount to pass references as values to the footnote mechanism (which uses counters):

enter image description here

\documentclass{article}
\usepackage{refcount}% http://ctan.org/pkg/refcount
\newcounter{fncntr}
\newcommand{\fnmark}[1]{\refstepcounter{fncntr}\label{#1}\footnotemark[\getrefnumber{#1}]}
\newcommand{\fntext}[2]{\footnotetext[\getrefnumber{#1}]{#2}}
\begin{document}
Some text\fnmark{first-fn} and some more\fnmark{second-fn} text, 
and finally\fnmark{last-fn} this.

\fntext{first-fn}{First footnote.}
\fntext{second-fn}{Second footnote.}
\fntext{last-fn}{Last footnote.}
\end{document}

Each \fnmark{<label>} is supplied with a label, which is then synchronized with a \fntext{<label>}{<text>} somewhere else in the document. Since this uses the .aux file to store references, you're going to have to compile at least twice to start with (all footnotes will be 0, as per refcount's \setrefcountdefault{0}). However, subsequent runs will only require a single compile, until new footnotes are introduced, or the references change.

share|improve this answer

This elaborates on cgnieder's suggestion above. Use package: sepfootnotes

Syntax:

% First assign an identifier to note:
\sepfootnotecontent{<id>}{<text>}

% Then typeset that note using its identifier:
\sepfootnote{<id>}

Example:

\documentclass{article}
\usepackage{sepfootnotes}
\sepfootnotecontent{abc}{A footnote.}
\sepfootnotecontent{xyz}{Another footnote.}
\begin{document}
Here is a footnote tagged as `xyz'.\sepfootnote{xyz}
Here is a footnote tagged as `abc'.\sepfootnote{abc}
\end{document}

(Notice that xyz is defined after abc but it is typeset before it. In other words, the order doesn't matter at all)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.