1

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 ipsum\footnote{1st minipage, 1st footnote.}.
Lore ipsum\specialfnmark.
Lore ipsum\footnote{1st minipage, 2nd footnote.}.
\end{minipage}

\begin{minipage}{\textwidth}\specialfntext
Lore ipsum\specialfnmark.
Lore ipsum\footnote{2nd minipage, 1st footnote.}.
Lore ipsum\specialfnmark.
\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?

1

As you want to use the footnotemark more than once you will have to add more than one anchor to the specialtext. hyperref doesn't do this by default. You will have to record the destination names. The \specialfntext is issued at the end of the minipage to avoid to have to go through the aux-file.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{fnpct}
\usepackage{expl3}

\makeatletter
\ExplSyntaxOn
\seq_new:N\l_nagmat_fndest_seq

\newcommand*{\specialfnmark}
  {
    \protected@xdef\@thefnmark{\ensuremath{\ddag}}
    \@footnotemark\relax
    \seq_put_right:Nx\l_nagmat_fndest_seq
      {
       \Hy@footnote@currentHref
      }
  }

\AdaptNoteMark \specialfnmark %add to fnpct.

\newcommand*{\specialfntext}
  {
    \protected@xdef\@thefnmark{\ensuremath{\ddag}}
    \H@@mpfootnotetext
      { 
        \seq_map_inline:Nn\l_nagmat_fndest_seq
          {
           \Hy@raisedlink{\hypertarget{##1}{\relax}}
          }
        A special footnote.
      }
  }
\ExplSyntaxOff
\makeatother

\usepackage[unicode,final]{hyperref}



\begin{document}

\begin{minipage}{\textwidth}
Lore ipsum\footnote{1st minipage, 1st footnote.}.
Lore ipsum\specialfnmark.
Lore ipsum\footnote{1st minipage, 2nd footnote.}.
\specialfntext
\end{minipage}

\begin{minipage}{\textwidth}
Lore ipsum\specialfnmark.
Lore ipsum\footnote{2nd minipage, 1st footnote.}.
Lore ipsum\specialfnmark.
\specialfntext
\end{minipage}

\end{document}

enter image description here

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.