[Tex/LaTex] Footnote inside table

footnotestables

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?

Best Answer

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}