
我想知道是否有辦法為表的每一列使用 \sisetup{} 的不同參數。例如,我想使用:
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 6,
scientific-notation = fixed,
}
對於我的表格的第一列及其略有不同的版本:
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 8,
scientific-notation = fixed,
}
對於後者的第二列。
前任:
\begin{table}[H]
\centering
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 6,
scientific-notation = fixed,
}
\sisetup{round-mode=places,
round-precision=2,
fixed-exponent = 8,
scientific-notation = fixed,
}
\begin{tabular}{SSS}
\hline A & a & b \\ \hline
$B$ & -8940513.51965462 & -393467529.743240\\
$C$ & -8295841.85412406 & -365095852.079073 \\ \hline
\end{tabular}
\end{table}
答案1
歡迎來到 TeX.SE!
您可以分為sisetup
兩部分:
S
common(全域),所有列都使用哪些設置- 本地,您可以在需要的地方添加或覆蓋常用設定:
\documentclass{article}
\usepackage{booktabs} % added
\usepackage{siunitx}
\begin{document}
\begin{table}[ht]
\sisetup{round-mode=places, % common settings
round-precision=2,
fixed-exponent = 6,
scientific-notation = fixed,
}
\begin{tabular}{l S[fixed-exponent = 8] % <--- local
S}
\toprule
A & {a} & {b} \\
\midrule
$B$ & -8940513.51965462 & -393467529.743240 \\
$C$ & -8295841.85412406 & -365095852.079073 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
您希望對整個表使用一些通用設置,對特定列使用一些本地設置。您還需要指定位數,以便正確放置標題並且間距達到最佳。當然會進行這樣的設置後驗的,在查看表格實際產生的內容後。
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}[htp]
% common settings for this table
\sisetup{
round-mode=places,
round-precision=2,
scientific-notation = fixed,
}
\begin{tabular}{
l
S[fixed-exponent = 8,table-format=-1.2e1]
S[fixed-exponent = 6,table-format=-3.2e1]
}
\toprule
A & {a} & {b} \\
\midrule
$B$ & -8940513.51965462 & -393467529.743240 \\
$C$ & -8295841.85412406 & -365095852.079073 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}