如何修复 LaTeX 在 tabular 环境中缺少脚注

问题:

你有在 \tabular 内包含 \footnote 的 LaTeX 代码,如下所示:

latex_tabular_footnote_example.tex
\documentclass{scrartcl}

\begin{document}
\begin{tabular}{p{2cm}|p{2cm}|}
\textbf{Column A\footnote{This is a footnote!}} & \textbf{Column B}\\
1 & 2\\
3 & 4\\
\end{tabular}
\end{document}

但 LaTeX/PDFLaTeX 没有显示你在 \tabular 环境内声明的任何脚注。

解决方案

在你的 \documentclass 声明之后使用此代码:

footnote_tabular_fix.tex
\usepackage{footnote}
\makesavenoteenv{tabular}

然后重新编译你的 LaTeX 代码。你的 tabular 内的脚注现在应该按预期出现。

注意如果你使用 \begin{tabular} 之外的其他环境,你可能需要为正确的环境添加更多 \makesavenoteenv 声明。tabularx 包中的 tabularx 环境开箱即用地支持脚注,无需任何额外的包!


Check out similar posts by category: LaTeX