0

This question already has an answer here:

I am using a footnote inside makecell inside a longtable and while the footnote's counter is displayed, the text does not appear at the end of the page. Here's a MWE

\documentclass{article}

\usepackage{longtable}
\usepackage{makecell}

\title{A longtable example}

\begin{document}

\begin{center}
\begin{longtable}{|l|l|l|}
\caption{A sample long table.} \label{tab:long} \\

\hline \multicolumn{1}{|c|}{\textbf{First column}} & \multicolumn{1}{c|}{\textbf{Second column}} & \multicolumn{1}{c|}{\textbf{Third column}} \\ \hline 
\endfirsthead

One & \makecell{abcdef\footnote{Test2} \\ ghjijklmn} & 123.456778 \\

\end{longtable}
\end{center}

\end{document}

marked as duplicate by TeXnician, Stefan Pinnow, Zarko, Henri Menke, Mike Renfro Jun 28 '17 at 23:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I can verify the problem. – Dr. Manuel Kuehner Jun 28 '17 at 18:59
  • Replace \footnote{Test} with \footnotemark and write outside the longtable (after \end{longtable}) \footnotetext{Test}. – Bobyandbob Jun 28 '17 at 19:20
  • 1
    @Bobyandbob I considered that but the issue is I need multiple footnotes in the makecell. Multiple footnotemarks/footnotetext does not yield correct numbering for the footnotes. – Pdksock Jun 28 '17 at 19:30
  • 1
    The makecell package documentation states that I can use \footnote inside \makecell so there must be something else that is wrong. Also doing it in the way suggested in your comment does not preserve hyperlinks in pdftex. – Pdksock Jun 28 '17 at 19:51
  • 1
    @Samidh T: Yes, but maybe not in a longtable, which has its own management of footnotes. I guess the problem comes from this. Please see my workaround. – Bernard Jun 28 '17 at 20:36
1

The problem comes from \makecell: it seems that, for some reason, it behaves like the cells before \endhead or \endfoot in long table. The workaround consists, as explained in the longtable documentation, in using \footnotemark, and \footnotetext in any other ‘normal’ cell that will fall in the same page.

Since you load makecell,I took the opportunity to simplify the code for your column heads, using the \thead command. I also added some padding for the footnote with the \gape command. \documentclass{article}

\usepackage{longtable}
\usepackage{makecell}
\title{A longtable example}
\renewcommand\theadfont{\normalsize\bfseries}

\begin{document}
\vspace*{12cm}

\setlength\extrarowheight{3pt}
\begin{longtable}{|l|l|l|}
\caption{A sample long table.} \label{tab:long} \\

\hline \thead{First column} & \thead{Second column} & \thead{Third column} \\ \hline
\endfirsthead

One & \makecell{abcdef\gape{\footnotemark} \\ ghjijklmn} & \footnotetext{Test2}123.456778 \footnote{Test3} \\

\hline
\end{longtable}

\end{document} 

enter image description here

  • I was able to achieve this using the footnotemark/footnotetext combination but this doesn't keep the hyperlinks which footnote does. Also, the solution becomes messy when I need multiple footnotemarks in makecell. I think tabularx might be a better option here. – Pdksock Jun 28 '17 at 21:08
  • If it's a long tabularx, you can try the ltablex package. – Bernard Jun 28 '17 at 21:22

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