我正在使用 siunitx 和 booktabs,但我的单元之间需要更多的垂直空间。
这是我的问题的图片:
以下是 MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\sisetup{range-phrase=-,
detect-all,
decimalsymbol=comma,
round-mode=figures,
round-precision=3,
range-units=single,
per-mode=fraction,}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}[]{llr}
\toprule
Parameter & Symbol & Wert \\
\midrule
A &A2 &\SI{1096}{\kg \per \cubic \meter } \\
B &B2 &\SI{0,422}{\watt \per \meter \per \kelvin} \\
C &C2 &\SI{3220}{\joule \per \kg \per \kelvin} \\
D &D2 &\SI{0,0274}{\kg \per \meter \per \second} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
自动方式使用cellspace
包,确保最小带有特定字母前缀的说明符的列中单元格顶部和底部的垂直间距 - 默认值为S
,但当您加载 siunitx 时,我们必须使用另一个字母,可在加载时定义为选项。以下是您的表格的用法:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\sisetup{range-phrase=-,
detect-all,
decimalsymbol=comma,
round-mode=figures,
round-precision=3,
range-units=single,
per-mode=fraction,}
\usepackage{booktabs}
\usepackage[column=O]{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}[]{llOr}
\toprule
Parameter & Symbol & Wert \\
\midrule
A &A2 &\SI{1096}{\kg \per \cubic \meter } \\
B &B2 &\SI{0,422}{\watt \per \meter \per \kelvin} \\
C &C2 &\SI{3220}{\joule \per \kg \per \kelvin} \\
D &D2 &\SI{0,0274}{\kg \per \meter \per \second} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
Bernard 使用 给出了答案cellspace
。该包nicematrix
(提供多种工具来绘制表格和数学矩阵)的方法略有不同: 环境的所有列{NiceTabular}
都是nicematrix
“单元格空间”类型,并且有两个键cell-space-top-limit
和,cell-space-bottom-limit
类似于的参数\cellspacetoplimit
和。\cellspacebottomlimit
cellspace
\documentclass{article}
\usepackage{siunitx}
\sisetup{range-phrase=-,
detect-all,
decimalsymbol=comma,
round-mode=figures,
round-precision=3,
range-units=single,
per-mode=fraction}
\usepackage{nicematrix}
\usepackage{booktabs}
\begin{document}
\NiceMatrixOptions{cell-space-top-limit=3pt,cell-space-bottom-limit=3pt}
\begin{table}[htbp]
\centering
\begin{NiceTabular}[]{llr}
\toprule
Parameter & Symbol & Wert \\
\midrule
A &A2 &\SI{1096}{\kg \per \cubic \meter } \\
B &B2 &\SI{0,422}{\watt \per \meter \per \kelvin} \\
C &C2 &\SI{3220}{\joule \per \kg \per \kelvin} \\
D &D2 &\SI{0,0274}{\kg \per \meter \per \second} \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}
答案3
一种可能性是扩大`\arraystretch˙并改变书写单位的方式:
\documentclass{article}
\usepackage{siunitx}
\sisetup{range-phrase=-,
detect-all,
decimalsymbol=comma,
round-mode=figures,
round-precision=3,
range-units=single,
per-mode=symbol,} % <---
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\centering
\renewcommand\arraystretch{1.2} % <---
\begin{tabular}[]{llr}
\toprule
Parameter & Symbol & Wert \\
\midrule
A &A2 &\SI{1096}{\kg \per \cubic \meter } \\
B &B2 &\SI{0,422}{\watt \per \meter \per \kelvin} \\
C &C2 &\SI{3220}{\joule \per \kg \per \kelvin} \\
D &D2 &\SI{0,0274}{\kg \per \meter \per \second} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}