我正在使用 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
伯納德使用 給出了答案cellspace
。該套件(提供了幾種繪製表格和數學矩陣的工具)的方法略有不同:環境的nicematrix
所有列都是“cellspace”類型,並且您有兩個鍵,類似於的參數和。{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}