我遇到了以下问题,我试图让表格的标题与表格本身一样大。 floatrow 包似乎可以解决这个问题。 但在我的例子中,由于某种我不理解的原因,标题总是稍微长一点——大约 0.2 厘米左右。 不知道如何改变这种情况,非常感谢您的帮助。
最小工作示例:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{siunitx}
\DeclareSIUnit\Molar{M}
\DeclareSIUnit\rpm{rpm}
\usepackage{caption}
\usepackage{floatrow}
\begin{document}
\begin{table}[!htb]
\ttabbox{
\caption{Concentrations used to prepare the sulfitolysis buffers. Literature references refer to the source of the
$Na_{2}SO_{3}$ and $Na_{2}S_{4}O_{3}$ concent...}
}{
\begin{tabular}{llllll}
\hline
Name & $Na_{2}S_{4}O_{3}$ & GuHCl & Urea & pH & Lit. \\
S1 & \SI{20}{\milli\Molar} & - & \SI{8}{\Molar} & 8.3 \\
S2 & \SI{80}{\milli\Molar} & \SI{7}{\Molar} & - & 7.3 \\
S3 & \SI{80}{\milli\Molar} & \SI{7}{\Molar} & - & 9.3 \\
\end{tabular}
}
\end{table}
\end{document}
答案1
您有未受保护的行尾,是我插入并标记的。
我还对表格做了一些更改,使用S
列并将单位移动到标题(可以随意撤消这些更改)并mhchem
与\ce
化学公式命令一起使用。
避免!
在位置说明符中并记得添加p
。
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{floatrow}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\DeclareSIUnit\Molar{M}
\DeclareSIUnit\rpm{rpm}
\begin{document}
\begin{table}[htbp]
\ttabbox{% <--- missing
\caption{Concentrations used to prepare the sulfitolysis buffers.
Literature references refer to the source of the
\ce{Na2SO3} and \ce{Na2S4O3} concent...}% <--- MISSING
}{% <--- MISSING
\begin{tabular}{
l
S[table-format=2.0]
S[table-format=1.0]
S[table-format=1.0]
S[table-format=1.1]
c
}
\toprule
Name & {\ce{Na2S4O3}} & {Gu\ce{HCl}} & {Urea} & {pH} & Lit. \\
& {(\si{\milli\Molar})} & {(\si{\Molar})} & {(\si{\Molar})} \\
\midrule
S1 & 20 & {--} & 8 & 8.3 \\
S2 & 80 & 7 & {--} & 7.3 \\
S3 & 80 & 7 & {--} & 9.3 \\
\bottomrule
\end{tabular}% <--- MISSING
}
\end{table}
\end{document}
可以用不太苛刻的方式获得相同的输出threeparttable
:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\DeclareSIUnit\Molar{M}
\DeclareSIUnit\rpm{rpm}
\begin{document}
\begin{table}[htbp]
\centering
\begin{threeparttable}
\caption{Concentrations used to prepare the sulfitolysis buffers.
Literature references refer to the source of the
\ce{Na2SO3} and \ce{Na2S4O3} concent...}
\begin{tabular}{
l
S[table-format=2.0]
S[table-format=1.0]
S[table-format=1.0]
S[table-format=1.1]
c
}
\toprule
Name & {\ce{Na2S4O3}} & {Gu\ce{HCl}} & {Urea} & {pH} & Lit. \\
& {(\si{\milli\Molar})} & {(\si{\Molar})} & {(\si{\Molar})} \\
\midrule
S1 & 20 & {--} & 8 & 8.3 \\
S2 & 80 & 7 & {--} & 7.3 \\
S3 & 80 & 7 & {--} & 9.3 \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}