3

I want to use footnote inside a table and I have a table that looks like this (simplified for brevity):

\documentclass[a4paper]{paper}
\begin{document}

\begin{table}[h]
\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{|*{4}{c|}}
\hline
\multirowcell{3}{Work} & \multirowcell{3}{Language} & \multirowcell{3}{Prime} & \multirowcell{3}{Time (ms)} \\ 
\hline \hline
Microsoft \footnote{\url{https://github.com/Microsoft/PQCrypto-SIDH}} & C & $2^{372}3^{239} - 1$ &  \\ \hline
Cloudflare \footnote{\url{https://github.com/cloudflare/p751sidh}} & Go & $2^{372}3^{239} - 1$ &    \\ \hline
\end{tabular}}
\caption{Comparison}
\label{tab:comp}
\end{table}

\end{document}

This shows the footnote numbers, but the footnote text is not appearing at the bottom of the page. I tried some solutions from here, but didn't succeed with anything. Any ideas what the problem might be and how to correct it?

3

The main problem can be solved by using \footnotemark and \footnotetext separately.

Some other comments:

  • Several packages are missing

  • please do not use \resizebox for tables, choose an appropriate fontsize instead, see Why not scale elements that contain text for some explanation

  • your first row had too many entries, 4 times 3 = 12 cells!


\documentclass[a4paper]{paper}

\usepackage{url}
\usepackage{multirow}
\usepackage{makecell}

\newcounter{footnotesintable}

\begin{document}

\footnote{bla}

\begin{table}[htbp]
\centering
\setcounter{footnotesintable}{0}
\begin{tabular}{|*{4}{c|}}
\hline
\multirowcell{1}{Work} & \multirowcell{1}{Language} & \multirowcell{1}{Prime} & \multirowcell{1}{Time (ms)} \\ 
\hline \hline
Microsoft \addtocounter{footnote}{1}\addtocounter{footnotesintable}{1}\footnotemark[\thefootnote]  & C & $2^{372}3^{239} - 1$ &  \\ \hline
Cloudflare \addtocounter{footnote}{1}\addtocounter{footnotesintable}{1}\footnotemark[\thefootnote]  & Go & $2^{372}3^{239} - 1$ &    \\ \hline
\end{tabular}
\caption{Comparison}
\label{tab:comp}
\end{table}

\addtocounter{footnote}{-\thefootnotesintable}
\addtocounter{footnote}{1}\footnotetext[\thefootnote]{\url{https://github.com/Microsoft/PQCrypto-SIDH}}
\addtocounter{footnote}{1}\footnotetext[\thefootnote]{\url{https://github.com/cloudflare/p751sidh}}


\footnote{bla}
\end{document}
  • Thanks, this seems to work nicely, but I have previously used at some places \footnote, hence, is there any way with \foornotemark to continue from the last used footnote number, instead of manually specifying the footnote number? – pixel Apr 2 '18 at 13:58
  • @pixel please see my updated answer – user36296 Apr 2 '18 at 18:57
3

If you want the footnotes to appear with the table, you can include everything in a minipage of the appropriate width.

\documentclass[a4paper]{paper}
\usepackage{url}
\usepackage{multirow}
\usepackage{makecell}
\begin{document}
\begin{table}[h]
\begin{minipage}{\textwidth} % so footnote will appear
\renewcommand*\footnoterule{}
\centering
\begin{tabular}{|*{4}{c|}}
\hline
\multirowcell{1}{Work} & \multirowcell{1}{Language} & \multirowcell{1}{Prime} & \multirowcell{1}{Time (ms)} \\ 
\hline \hline
Microsoft\footnote{\url{https://github.com/Microsoft/PQCrypto-SIDH}}  & C & $2^{372}3^{239} - 1$ &  \\ \hline
Cloudflare\footnote{\url{https://github.com/cloudflare/p751sidh}}  & Go & $2^{372}3^{239} - 1$ &    \\ \hline
\end{tabular}
\end{minipage}
\caption{Comparison}
\label{tab:comp}
\end{table}
\end{document}

enter image description here

3

You can use a longtable environment. Don't use \resizebox for tables, as it leads to inconsistent font sizes. You can use tabularx or tabular* instead.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell, tablefootnote, longtable}
\usepackage{url}
\usepackage{hyperref}

 \begin{document}

 \vspace*{15cm}
{\setlength{\extrarowheight}{3pt}
\begin{longtable}{|*{4}{c|}}
\caption{Comparison}
\label{tab:comp}\\
\hline
\endfirsthead
\hline
\endfoot
\multirowcell{3}{Work} & \multirowcell{3}{Language} & \multirowcell{3}{Prime} & \multirowcell{3}{Time (ms)} \\
\hline \hline
Microsoft \footnote{\url{https://github.com/Microsoft/PQCrypto-SIDH}} & C & $2^{372}3^{239} - 1$ & \\ \hline
Cloudflare \footnote{\url{https://github.com/cloudflare/p751sidh}} & Go & $2^{372}3^{239} - 1$ &
\end{longtable}}

\end{document} 

enter image description here

  • Thanks for the nice answer. If I use tabularx or tabular*, then how can I use the footnotes? I mean do I also have to embed the longtable inside it? Since my tables are long (I partially removed them for brevity), I need a good way to fit them inside the margin. I didn't know that \resizebox is problematic. – pixel Apr 2 '18 at 14:08
  • For \ tabularx, you can load the ltablex` package, which makes tabularx a longtable, breakable across pages (not tested with footnotes, though). You'll find information on the various possibilities in the (short) documentation of the tablefootnote package. – Bernard Apr 2 '18 at 14:12

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.