我有一张包含多列的表格,其中的条目带有不确定性。是否可以将条目对齐到\pm
- 符号处?
\documentclass[12pt, a4paper]{article}
\usepackage[english]{babel}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[ht]
\centering
\resizebox{\columnwidth}{!}{%
\begin{tabular}{clllllllll}
\toprule
\multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} & \multicolumn{1}{c}{Column 4} & \multicolumn{1}{c}{Column 5} & \multicolumn{1}{c}{Column 6} & \multicolumn{1}{c}{Column 7} & \multicolumn{1}{c}{Column 8} & \multicolumn{1}{c}{Column 9} & \multicolumn{1}{c}{Column 10} \\
\midrule
A & 1.12 ± 2.32 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 & 0.00 ± 0.00 \\
B & -7.58 ± 24.03 & -12.89 ± 27.25 & -5.93 ± 26.02 & -2.50 ± 26.30 & -0.98 ± 25.44 & 2.61 ± 35.59 & -11.96 ± 12.19 & -2.64 ± 26.53 & -24.07 ± 19.40 \\
\end{tabular}%
}
\end{table}
\end{document}
编辑:我尝试使用siunitx
,但不确定性不会与小数点分隔符对齐
\documentclass[12pt, a4paper]{article}
\usepackage[english]{babel}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\begin{document}
\begin{landscape}
\begin{table}
\sisetup{separate-uncertainty=true}
\scriptsize
\centering
%\resizebox{\columnwidth}{!}{%
\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{
c
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
}
\toprule
{Column 1} & {Column 2} & {Column 3} & {Column 4} & {Column 5} & {Column 6} & {Column 7} & {Column 8} & {Column 9} & {Column 10} \\
\midrule
A & 1.12+-2.32 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 \\
B & -7.58+-24.03 & -12.89+-27.25 & -5.93+-26.02 & -2.50+-26.30 & -0.98+-25.44 & 2.61+-35.59 & -11.96+-12.19 & -2.64+-26.53 & -24.07+-19.40 \\
B & -7.58+-24.03 & -12.89+-27.25 & -5.93+-26.02 & -2.50+-26.30 & -0.98+-25.44 & 2.61+-35.59 & -11.96+-12.19 & -2.64+-26.53 & -24.07+-9.40 \\
\end{tabular}%
%}
\end{table}
\end{landscape}
\end{document}
如何对齐小数点分隔符处的不确定性?
答案1
您的不确定性在小数点后有两位数字,这意味着您需要使用
(2.2)
而不是(2)
分配table-format
足够的空间我们
\pm
或+-
表示您输入的不确定性与 LaTeX 无关,但请检查https://en.wikipedia.org/wiki/Significant_figures#Significant_figures_in_writing_uncertainty
\documentclass[12pt, a4paper]{article}
\usepackage[english]{babel}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\begin{document}
\begin{landscape}
\begin{table}
\sisetup{separate-uncertainty=true}
\scriptsize
\centering
%\resizebox{\columnwidth}{!}{%
\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{
c
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
S[table-format=-2.2(2.2)]
}
\toprule
{Column 1} & {Column 2} & {Column 3} & {Column 4} & {Column 5} & {Column 6} & {Column 7} & {Column 8} & {Column 9} & {Column 10} \\
\midrule
A & 1.12+-2.32 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 \\
B & -7.58+-24.03 & -12.89+-27.25 & -5.93+-26.02 & -2.50+-26.30 & -0.98+-25.44 & 2.61+-35.59 & -11.96+-12.19 & -2.64+-26.53 & -24.07+-19.40 \\
\end{tabular}%
%}
\end{table}
\end{landscape}
\end{document}
答案2
与@samcarter_is_at_topanswers.xyz 解决方案类似......不同之处在于:
- 书面都是公差,也
0.00
- 两个版本的
siunitx
设置(MSE 仅考虑表格的前六列) - 用于旋转的桌子使用
sidewaystable
的\rotating
包装
\documentclass{article}
\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{rotating}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{verbatim}
\begin{table}[ht]
\sisetup{separate-uncertainty,
retain-zero-uncertainty,
table-alignment-mode = format,
%tight-spacing,
}
\begin{tblr}{hlines, vlines,
colsep=3pt,
colspec = {Q[c] X[c, si={table-format=-1.2(2.2)}]
X[c, si={table-format=-2.2(2.2)}]
*{2}{X[c, si={table-format=-1.2(1.2)}]}
},
...
\end{verbatim}
\begin{table}[ht]
\sisetup{separate-uncertainty,
retain-zero-uncertainty,
table-alignment-mode = format,
%tight-spacing,
}
\begin{tblr}{hline{1,2,Z},
colsep=3pt,
colspec = {Q[c] X[c, si={table-format=-1.2(2.2)}]
X[c, si={table-format=-2.2(2.2)}]
*{2}{X[c, si={table-format=-1.2(2.2)}]}
},
row{1} = {guard, c, font=\bfseries}
}
column 1 & column 2 & column 3 & column 4 & column 5 \\
A & 1.12+-2.32 & 0.00+-1.1 & 0.00+-0.0 & 0.00 \\
B & -7.58+-24.03 & -12.89+-27.25 & -5.93+-26.02 & -2.50+-26.30 \\
\end{tblr}
\end{table}
%---------------------------------------------------------------%
\begin{verbatim}
\sisetup{mode=text,
retain-zero-uncertainty,
separate-uncertainty,
%tight-spacing,
}
\begin{tblr}{hline{1,2,Z},
colsep=3pt,
colspec = {c X[c, si={table-format=-1.2(4)}]
X[c, si={table-format=-2.2(4)}]
*{2}{X[c, si={table-format=-1.2(4)}]}
},
...
\end{verbatim}
\begin{table}[ht]
\sisetup{mode=text,
retain-zero-uncertainty,
separate-uncertainty,
%tight-spacing,
}
\begin{tblr}{hline{1,2,Z},
colsep=3pt,
colspec = {Q[c] X[c, si={table-format=-1.2(4)}]
X[c, si={table-format=-2.2(4)}]
*{2}{X[c, si={table-format=-1.2(4)}]}
},
row{1} = {guard, c, font=\bfseries}
}
column 1 & column 2 & column 3 & column 4 & column 5 \\
A & 1.12+-2.32 & 0.00+-1.1 & 0.00+-0.0 & 0.00 \\
B & -7.58+-24.03 & -2.89+-27.25 & -5.93+-26.02 & -2.50+-26.30 \\
\end{tblr}
\end{table}
%---------------------------------------------------------------%
\begin{sidewaystable}[ht]
\sisetup{mode=text,
retain-zero-uncertainty,
separate-uncertainty
}
\footnotesize
\begin{tblr}{hline{1,2,Z},
colsep=1pt,
colspec = {@{}
Q[c] X[c, si={table-format=-1.2(4)}]
X[c, si={table-format=-2.2(4)}]
*{3}{X[c, si={table-format=-1.2(4)}]}
X[c, si={table-format= 1.2(4)}]
*{3}{X[c, si={table-format=-2.2(4)}]}
@{}},
row{1} = {guard, c, font=\bfseries}
}
col. 1 & column 2 & column 3 & column 4 & column 5
& column 6 & column 7 & column 8 & column 9
& column 10 \\
A & 1.12+-2.32 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00
& 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00 & 0.00+-0.00
& 0.00+-0.00 \\
B & -7.58+-24.03 & -12.89+-27.25 & -5.93+-26.02 & -2.50+-26.30
& -0.98+-25.44 & 2.61+-35.59 & -11.96+-12.19 & -2.64+-26.53
& -24.07+-19.40 \\
\end{tblr}
\end{sidewaystable}
\end{document}