27

I followed the steps in this answer to get multiple references to the same footnotes working. As shown in this minimal example, the solution is working great for footnotes in the text, also getting the correct hyper references in the compiled pdf.

But when using multiple footnotes in a table environment the solution doesn't work, for the second reference in the table environment I get "a^0" instead of another "^a". I guess the problem is that numbering consist of (a,b,...) instead of numbers but I'd like to keep that behavior.

How should I adapt the solution to work inside the table environment ??

\documentclass{article}
\usepackage{hyperref}
\usepackage{cleveref}
\crefformat{footnote}{#2\footnotemark[#1]#3}

\begin{document}

This is a paragraph\footnote{\label{first}some footnote}.

This is another paragraph\footnote{\label{second}another footnote}.

This is another paragraph using the first footnote\cref{first}.


\begin{table}
\caption{A table}
\begin{minipage}{\textwidth}
\begin{tabular}{r r r}
\hline
  E\footnote{\label{1sttablefoot}Some table footnote} & F\cref{1sttablefoot} & G \footnote{Another table footnote}  \\  \hline 

  1 & 2 & 3  \\ \hline

\end{tabular}
\end{minipage}
\end{table}

\end{document}

Can't attach the image result because of being new user :S

2
  • In short: Take a look on the package savefnmark, alas in MiKTeX without documentation, see mirror.ctan.org/macros/latex/contrib/savefnmark I don’t know, whether it works with cleveref. And defining 5 columns, but using only 3 is odd. See enhanced packages like array.
    – Speravir
    Jan 29, 2013 at 21:21
  • thanks for your comments, about the 5 columns, that come up wrong because of fast creating the example.
    – karamaz0v
    Jan 29, 2013 at 22:15

2 Answers 2

22

You could use my answer to the same question and use \footref provided by scrextend (part of the KOMA-Script bundle). This is at least working partially. For reasons I haven't figured out yet the hyperlink from \footref inside the table links to the table caption, though, instead of the footnote. I don't know if that is a failure of scrextend or hyperref

\documentclass{article}
% call `scrextend' before `hyperref'!
\usepackage{scrextend}
\usepackage{hyperref}

\begin{document}

This is a paragraph\footnote{\label{first}some footnote}.

This is another paragraph\footnote{\label{second}another footnote}.

This is another paragraph using the first footnote\footref{first}.


\begin{table}
\caption{A table}
\begin{minipage}{\textwidth}
\begin{tabular}{rrr}
 \hline
  E\footnote{\label{1sttablefoot}Some table footnote} &
  F\footref{1sttablefoot} &
  G \footnote{Another table footnote} \\
 \hline 
  1 & 2 & 3 \\
 \hline
\end{tabular}
\end{minipage}
\end{table}

\end{document}

enter image description here

11
  • thanks! this solution is working great, i missed this one in the other question. I don't mind about the linking to the caption, since the table and its foots are always on the same page in my case, there is no problem at all.
    – karamaz0v
    Jan 29, 2013 at 22:08
  • I am currently trying to deploy this nice solution to my document ([journal]{IEEEtran}), however, the latex compiler tells me that the reference "1sttablefoot" is undefined. Any ideas what could have gone wrong?
    – Emiswelt
    Dec 11, 2013 at 14:07
  • @Emiswelt That means you haven't placed \label{1sttablefoot} anywhere
    – cgnieder
    Dec 11, 2013 at 14:27
  • Thank you for your reply. In fact, I have placed the label. The workaround for me, however, was to use \footnotetext[1]{\label{1sttablefoot}...} before the table and \footnotemark[\ref{1sttablefoot}] inside the table.
    – Emiswelt
    Dec 12, 2013 at 12:22
  • 1
    @user321627 yes: don't use the minipage environment. :)
    – cgnieder
    Oct 17, 2019 at 4:24
0

Why not simply use \textsuperscript{\ref{...}} instead?

2
  • I suppose that won't work with hyperref? Feb 8, 2021 at 10:59
  • @ThomasAhle: It works for me with hyperref.
    – Housen
    Apr 5, 2021 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .