编辑稍微简单一点的例子。我可以去掉booktabs
并避免\tnote
,但仍然会遇到问题。我也可以改threeparttablex
回默认threeparttable
。threeparttable
不过,去掉可以消除问题,所以我在新版本中保留了threeparttable
和。enumitem
我使用threeparttable
和以及使用 和 创建的表格的threeparttablex
自定义环境。我的自定义环境的一个特点是它在 中设置注释。另一个特点是它不需要我手动对注释进行编号。(也就是说,注释会自动编号,并且符合的意义。)tablenotes
tabular
tabularx
\footnotesize
referable
threeparttablex
但是,我不知道如何在tabular
/tabularx
和之间获得均匀的垂直间距tablenotes
。
我使用enumitem
创建自定义tablenotes
环境,我可以放置before={\footnotesize}
,例如,作为字体。如果我这样做,间距对于tabular
s 来说似乎是正确的,但对于 s 来说则完全错误tabularx
。
如果我使用before={\unskip\medskip\footnotesize}
或更改topsep
为\medskipamount
,间距似乎对tabularx
s 来说是正确的,但实际上对 s 来说不正确tabular
。更重要的是,额外的空间被添加到两个都情况下,因此tabular
s 和tabularx
s 在相关方面仍然看起来不一样。
无论如何,我都没有得到制服印刷一致性所要求的间距。
如何确保一致性,同时保持较小的字体大小?(我也想保留自动编号,但据我所知,这与这里并不相关。)
\documentclass{article}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{enumitem}
\makeatletter
\renewlist{tablenotes}{enumerate}{1}
\setlist[tablenotes]{label=\textsuperscript{\alph*},ref=\alph*,itemsep=\z@,topsep=\z@skip,partopsep=\z@skip,parsep=\z@,itemindent=\z@,labelindent=\tabcolsep,labelsep=.2em,leftmargin=*,align=left,before={\footnotesize}}
\makeatother
\parindent=0pt
\begin{document}
\begin{table}
\begin{threeparttable}
\caption{Initial Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Initial Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\makeatletter
\setlist[tablenotes]{label=\textsuperscript{\alph*},ref=\alph*,itemsep=\z@,topsep=\z@skip,partopsep=\z@skip,parsep=\z@,itemindent=\z@,labelindent=\tabcolsep,labelsep=.2em,leftmargin=*,align=left,before={\unskip\medskip\footnotesize}}
\makeatother
\begin{table}
\begin{threeparttable}
\caption{Second Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Second Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\makeatletter
\setlist[tablenotes]{%
label=\textsuperscript{\alph*},%
ref=\alph*,%
itemsep=\z@,%
topsep=\medskipamount,%
partopsep=\z@skip,%
parsep=\z@,%
itemindent=\z@,%
labelindent=\tabcolsep,%
labelsep=.2em,%
leftmargin=*,%
align=left,%
before={\footnotesize}%
}
\makeatother
\begin{table}
\begin{threeparttable}
\caption{Third Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Third Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
[编辑删除之前编辑中添加的更多最小案例,事实证明这些案例更加最小,但并非实际案例。
答案1
这是tabular
宽度测量代码的threeparttable
作用。(tabular*
并且tabularx
具有明确的宽度,因此threeparttable
只使用指定的宽度,并且在这些情况下不测量任何东西。)
以下更改通过保留值来消除更改,\prevdepth
因此以下文本(示例中的注释)的基线计算不受影响。
现有代码明确将设置\prevdepth
为 0pt,因此显然是故意的,但没有记录。我在这里做了修改,但作者threeparttable
对 TeX 框操作的理解往往是正确的,所以也许我遗漏了一些东西。然而......
\documentclass{article}
\usepackage{tabularx}
\usepackage{threeparttable}
\makeatletter
\def\TPT@measurement{%
\ifdim\wd\@tempboxb<\TPTminimum
\hsize \TPTminimum
\else
\hsize\wd\@tempboxb
\fi
\xdef\TPT@hsize{\hsize\the\hsize \noexpand\@parboxrestore}\TPT@hsize
\ifx\TPT@docapt\@undefined\else
\TPT@docapt \vskip.2\baselineskip
\fi \par
\dimen@\dp\@tempboxb % new
\box\@tempboxb
\ifvmode \prevdepth\dimen@ \fi% was \z@ not \dimen@
}
\makeatother
\usepackage{enumitem}
\makeatletter
\renewlist{tablenotes}{enumerate}{1}
\setlist[tablenotes]{label=\textsuperscript{\alph*},ref=\alph*,itemsep=\z@,topsep=\z@skip,partopsep=\z@skip,parsep=\z@,itemindent=\z@,labelindent=\tabcolsep,labelsep=.2em,leftmargin=*,align=left,before={\footnotesize}}
\makeatother
\parindent=0pt
\begin{document}
\begin{table}
\begin{threeparttable}
\caption{Initial Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Initial Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\makeatletter
\setlist[tablenotes]{label=\textsuperscript{\alph*},ref=\alph*,itemsep=\z@,topsep=\z@skip,partopsep=\z@skip,parsep=\z@,itemindent=\z@,labelindent=\tabcolsep,labelsep=.2em,leftmargin=*,align=left,before={\unskip\medskip\footnotesize}}
\makeatother
\begin{table}
\begin{threeparttable}
\caption{Second Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Second Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\makeatletter
\setlist[tablenotes]{%
label=\textsuperscript{\alph*},%
ref=\alph*,%
itemsep=\z@,%
topsep=\medskipamount,%
partopsep=\z@skip,%
parsep=\z@,%
itemindent=\z@,%
labelindent=\tabcolsep,%
labelsep=.2em,%
leftmargin=*,%
align=left,%
before={\footnotesize}%
}
\makeatother
\begin{table}
\begin{threeparttable}
\caption{Third Attempt: Case 1}
\begin{tabularx}\linewidth{Xl}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabularx}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}
\begin{threeparttable}
\caption{Third Attempt: Case 2}
\begin{tabular}{ll}
\hline
here is some test & and some more stuff here\\
\hline
\end{tabular}
\begin{tablenotes}
\item Yertle the turtle was King of the Pond \dots.
\item I'm OK.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}