有没有一种简单、优雅的解决方案可以在表格中添加脚注(tabular
)?最好该解决方案还可以支持该cleveref
软件包。
编辑:我想要的效果是,脚注应该显示在页面底部,就像普通脚注一样。但是,我检查了ctable
软件包,但没有找到这样的功能。我是不是漏掉了什么?
答案1
通常的建议是不要在表格中使用“标准”脚注:如果浮动最终出现在与脚注不同的页面上,那么事情就会非常混乱。有了这个重要的条件,可以采取的方法是将脚注保存在表格环境中,然后重新插入。您可以覆盖标准宏\footnote
来执行此操作,但我觉得最好不要这样做。一种可能的方法:
\documentclass{article}
\newcommand*{\savedfootnotes}{}
\newcommand*{\resetsavedfootnotes}{\global\let\savedfootnotes\empty}
\newcommand{\tablefootnote}[1]%
{%
\footnotemark
\xdef\savedfootnotes%
{\unexpanded\expandafter{\savedfootnotes}\noexpand\footnotetext{#1}}%
}
\edef\endtable%
{%
\aftergroup\noexpand\savedfootnotes
\aftergroup\noexpand\resetsavedfootnotes
\unexpanded\expandafter{\endtable}%
}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{table}
\begin{tabular}{c}
A \\
B\tablefootnote{Stuff} \\
\end{tabular}
\end{table}
\end{document}
答案2
使用表脚注包装及\tablefootnote{...}
内部表格:
\documentclass{article}
\usepackage{hyperref}
\usepackage{tablefootnote}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ c c }
Test1\tablefootnote{Footnote 1} & Test2\tablefootnote{Footnote 2} \\
\end{tabular}
\caption{This is a table.\label{FirstTable}}
\end{table}
A pagebreak:
\pagebreak
and a second page, so that you can see that the hyperlinks really work.
\end{document}
\listfiles
结果:
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
float.sty 2001/11/08 v1.3d Float enhancements (AL)
placeins.sty 2005/04/18 v 2.2
rotating.sty 2009/03/28 v2.16a rotated objects in LaTeX
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/message (HO)
ltxcmds.sty 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
hyperref.sty 2011/12/04 v6.82m Hypertext links for LaTeX
hobsub-hyperref.sty 2011/04/23 v1.4 Subsetting bundle oberdiek (HO)
hobsub-generic.sty 2011/04/23 v1.4 Bundle oberdiek, subset generic (HO)
hobsub.sty 2011/04/23 v1.4 Subsetting bundle oberdiek (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifvtex.sty 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
intcalc.sty 2007/09/27 v1.1 Expandable calculations with integers (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2011/06/15 v1.14 Key value parser (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty 2011/07/28 v0.19 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2011/04/04 v1.12 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2011/01/30 v1.2 Expandable calculations on big integers (HO)
bitset.sty 2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty 2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty 2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
hopatch.sty 2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty 2011/01/30 xcolor patch
atveryend.sty 2011/04/23 v1.7 Hooks at very end of document (HO)
atbegshi.sty 2011/01/30 v1.15 At begin shipout hook (HO)
refcount.sty 2011/06/22 v3.3 Data extraction from label references (HO)
hycolor.sty 2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
kvoptions.sty 2010/12/23 v3.10 Keyval support for LaTeX options (HO)
pd1enc.def 2011/12/04 v6.82m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2006/04/12 v3.3 Verb mode for urls, etc.
hpdftex.def 2011/12/04 v6.82m Hyperref driver for pdfTeX
rerunfilecheck.sty 2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
tablefootnote.sty 2012/01/01 v1.0f Table foot notes (HMM)
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
supp-pdf.mkii
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Managing graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
nameref.sty 2010/04/30 v2.40 Cross-referencing by name of section
gettitlestring.sty 2010/12/03 v1.4 Cleanup title references (HO)
答案3
使用 韓國包裹:
\documentclass{article}
\let\mytabular\tabular
\let\endmytabular\endtabular
\usepackage{ftnxtra}
\let\tabular\mytabular
\let\endtabular\endmytabular
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|}\hline
One&Two\\ \hline
Three\footnote{This is a footnote.}&Four\\ \hline
\end{tabular}
\caption{This is a table.}
\end{table}
\end{document}