为什么我的 threeparttable 表格的边框会突出?这里如何(自动)调整宽度?

为什么我的 threeparttable 表格的边框会突出?这里如何(自动)调整宽度?

为什么我的 threeparttable 表格的边框会突出?这里如何(自动)调整宽度?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{lipsum}
\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}



\lipsum[1]



\begin{table}
\centering
\begin{threeparttable}
\caption{Some long boring caption don't fall asleep 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{1a}} & {excl.\ Ingredients A\tnote{1b}} \\
\midrule
DDDDDDDDDDD & 36.1 & 22.0\\
GGGGGGGGGGGG & 30.9 & 20.0\\
GGGG\tnote{2} & 33.0 & 22.8\\
OOOO\tnote{2} & 33.766 & 24.643
\\ \bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{table}



\lipsum[2]



\end{document}

答案1

\tnote将其参数排版在零宽度框中,因此不会影响数据的排版。这可能在标题或描述中是不需要的;您可以添加一个模仿工作\tnote但使用全宽的命令。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{lipsum}
\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,
 round-precision=1,
 add-decimal-zero=true,
 add-integer-zero=true,
 round-integer-to-decimal}

% This is like `\tnote`, but uses the space of the argument    
\newcommand\stnote[1]{\textsuperscript{\TPTtagStyle{#1}}}

\begin{document}

\lipsum[1]

\begin{table}[ht]
\centering
\begin{threeparttable}
\caption{Some long boring caption don't fall asleep 2013}

\begin{tabulary}{\textwidth}{@{} L *{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\stnote{1a}} & {excl.\ Ingredients A\stnote{1b}} \\
\midrule
DDDDDDDDDDD   & 36.1   & 22.0   \\
GGGGGGGGGGGG  & 30.9   & 20.0   \\
GGGG\tnote{2} & 33.0   & 22.8   \\
OOOO\tnote{2} & 33.766 & 24.643 \\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{table}

\lipsum[2]

\end{document}

在此处输入图片描述

请注意,为了做一些明智的事情,tabulary您必须至少添加一个“未确定宽度的列”,LCRJ每个字符指定一个字符,表示列单元格中所需的对齐方式:左对齐(右侧参差不齐)、居中、右对齐(左侧参差不齐)、两端对齐。


稍微不同的定义允许\stnote在标题中使用而不出现在表格列表中:将定义更改\stnote

\usepackage{etoolbox}
\makeatletter
\apptocmd{\TPT@begintabbox}{\let\mTPTprint\@firstofone}{}{}
\apptocmd{\threeparttable}{\let\mTPTprint\relax}{}{}
\newcommand\stnote[1]{\protect\mTPTprint{\textsuperscript{\TPTtagStyle{#1}}}}
\newcommand\mTPTprint[1]{}
\makeatother

相关内容