#StackBounty: #hyperref #footnotes #minipage #counters Special, pre-defined "out-of-order" footnotes for boilerplate text wit…

Bounty: 150

Inside minipage environments I repeatedly need a handful of predefined footnotes (with a fixed boilerplate text) that should use symbolic footnote marks (for better detectability) alongside “normal” footnotes that are numbered automatically.

Within the same minipage, such a “special” footnote might be referenced multiple times, but the footnote text should only appear once per minipage.

The association between a particular footnotemark and its text is fixed beforehand. As the number of these “special” footnotes is fixed and relatively small I thought I could use hard-coded negative values for the footnote counter (to avoid interference with the normal counting) and hard-coded symbols for the values of the counter (i.e. ddag, ast, and so on).

This MWE shows how far I came

documentclass{article}

usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
%usepackage{fnpct}
usepackage[unicode,final]{hyperref}

makeatletter

newcommand*{specialfnmark}{%
%count255=value@mpfn% Originally, @mpfn is stepped. Here, we save the old value and set @mpfn to 0, -1, -2, and so on.
%setcounter{@mpfn}{0}%
protected@xdef@thefnmark{ensuremath{ddag}}% Originally: protected@xdef@thefnmark{thempfn}
@footnotemark%
%setcounter{@mpfn}{count255}%  Restore old value
}

newcommand*{specialfntext}{%
protected@xdef@thefnmark{ensuremath{ddag}}% Originally: {protected@xdef@thefnmark{thempfn}
@footnotetext{A special footnote.}%
}

makeatother

begin{document}

begin{minipage}{textwidth}specialfntext
Lore ipsumfootnote{1st minipage, 1st footnote.}.
Lore ipsumspecialfnmark.
Lore ipsumfootnote{1st minipage, 2nd footnote.}.
end{minipage}

begin{minipage}{textwidth}specialfntext
Lore ipsumspecialfnmark.
Lore ipsumfootnote{2nd minipage, 1st footnote.}.
Lore ipsumspecialfnmark.
end{minipage}

end{document}

Please note that this MWE only use one type of special footnote (i.e. specialfnmark and specialfntext) for the sake of being a MWE. The full-fledged paper uses a couple of these footnotes (i.e. foofnmark, foofntext, thingyfnmark, thingyfntext) with macros coming in pairs.

This nearly does what I wanted to achieve, but two problems remain.

  1. PDF links from the footnote mark to the correct footnote text do not work. I get the following errors:
      Package hyperref Warning: Ignoring empty anchor on input line 28.
      pdfTeX warning (ext4): destination with the same identifier (name{Hfootnote.3}) has been already used, duplicate ignored
      pdfTeX warning (dest): name {Hfootnote.6} has been referenced but does not exist, replaced by a fixed one
      pdfTeX warning (dest): name{Hfootnote.4} has been referenced but does not exist, replaced by a fixed one
      pdfTeX warning (dest): name{Hfootnote.2} has been referenced but does not exist, replaced by a fixed one
    

    How do I make the macro definition compatible with hyperref? I already tried to tinker with the counter (see commented lines of the MWE) but have been unsuccessful.

  2. Is is possible to additionally make the definition compatible with the fnpct package such that the final period of the sentence and the footnote mark are re-ordered and horizontally adjusted?


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.