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.


4 Answers 4


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

\usepackage{refcount}% http://ctan.org/pkg/refcount
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.}

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.


If you want a simple answer, that works such that you can simply add multiple marks in a paragraph and then add the texts for the footnotes in order after the paragraph, this might be a simple solution:

% Better footnote handling

Now, instead of calling \footnotemark and \footnotetext{...}, call \fnmark and \fntext{...}.


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


% First assign an identifier to note:

% Then typeset that note using its identifier:


\sepfootnotecontent{abc}{A footnote.}
\sepfootnotecontent{xyz}{Another footnote.}
Here is a footnote tagged as `xyz'.\sepfootnote{xyz}
Here is a footnote tagged as `abc'.\sepfootnote{abc}

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


I’m using the \label - \ref system, but do not use \footnotemark at all (someone recommended to me to use a hair space and superscript), and because of hyperref I cannot use \footnotetext either. I defined myself a variant of it that works (originally for use in tables and possibly minipages, but it will also work for you if you just want to define them separately). The nice part about it is that my \hyperfootnotemark does not leave vmode.

Complete answer with SSCCE


% \hyperfootnotetext is what \footnotetext is supposed to be:
% like \footnote except not rendering anything (it will not
% generate a paragraph if you append % to all lines)
 % new local scope
  % temporarily redefine this macro to empty
  % temporarily prevent leaving vmode
  % this also means we cannot create a(n empty) hyperlink
  % call the original \footnote macro
  % exit the local scope with the redefined macro
 % end of command

% for footnotes

Use as:

Some text\Hair\textsuperscript{\ref{fn:foo}}. Some more text.

 The footnote body.}%

You will usually want the \hyperfootnotetext call close to (and after) where you (first) use the footnote. For more details, read my other answer on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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