我想在表格中使用脚注,并且我有一个如下所示的表格(为简洁起见已简化):
\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}
这显示了脚注编号,但脚注文本未显示在页面底部。我尝试了一些解决方案这里,但什么都没成功。您知道问题可能出在哪里以及如何解决吗?
答案1
\footnotemark
分别使用和可以解决主要问题\footnotetext
。
其他一些评论:
缺少几个包
请不要用于
\resizebox
表格,而是选择合适的字体大小,参见为什么不缩放包含文本的元素一些解释你的第一行有太多条目,4 乘以 3 = 12 个单元格!
\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}
答案2
如果您希望脚注与表格一起出现,则可以将所有内容包含在minipage
适当宽度的表格中。
\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}
答案3
您可以使用longtable
环境。不要用于\resizebox
表格,因为这会导致字体大小不一致。您可以使用tabularx
或tabular*
代替。
\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}