表 - siunitx、對齊方式、列

表 - siunitx、對齊方式、列

我正在嘗試對齊該表的標題,但到目前為止沒有成功,任何人都可以告訴我我做錯了什麼,拜託!

\documentclass[a4paper,12pt]{report}
\usepackage{multirow}
\usepackage{siunitx,booktabs}%for table decimals number
\usepackage[export]{adjustbox}

\begin{document}
\begin{table}[!htbp]
\centering
\begin{tabular}{p{2cm}p{2cm}p{2cm}}
\toprule
  \multicolumn{1}{l}{\textbf{Res.}}  
& \multicolumn{1}{l}{\textbf{$\boldsymbol{\beta}$}} 
& \multicolumn{1}{c}{\textbf{$\boldsymbol{\chi^{2}}$}} \\
\midrule
\textbf{1}      & -0.61$\pm$0.32    & 9.1$\times$10$^{7}$\\
\textbf{2}      & -0.37$\pm$0.12    & 2.5$\times$10$^{6}$\\
\textbf{3}      & -0.39$\pm$0.19    & 1.0$\times$10$^{7}$\\
\textbf{4}      & -0.14$\pm$0.13    & 8.0$\times$10$^{6}$\\
\textbf{5}      & -0.10$\pm$0.12    & 2.3$\times$10$^{6}$\\
\textbf{6}      & -0.44$\pm$0.13    & 1.8$\times$10$^{6}$\\
\textbf{7}      & -0.55$\pm$0.16    & 2.0$\times$10$^{6}$\\
\textbf{8a}     & -0.54$\pm$0.16    & 1.9$\times$10$^{6}$\\
\bottomrule
\end{tabular}
\caption[$\beta$ results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV]{The $\beta$ parameter results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV.}
 \label{table:120}
\end{table}
\end{document}

答案1

像這樣?

在此輸入影像描述

我建議使用siunitx包。使用其列類型S和輸入數字的方式可以顯著簡化您的表格代碼:

\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
    \begin{table}[!htbp]
\sisetup{separate-uncertainty}%
\centering
\begin{tabular}{>{\bfseries}l 
                            S[table-format=-1.2(2)]
                            S[table-format=-1.1e1]
                }  
    \toprule
Res.    & {$\boldsymbol{\beta}$}    & {$\boldsymbol{\chi^{2}}$}    \\
\midrule
1       & -0.61(32)                 & 9.1e7     \\
2       & -0.37(12)                 & 2.5e6     \\
3       & -0.39(19)                 & 1.0e7     \\
4       & -0.14(13)                 & 8.0e6     \\
5       & -0.10(12)                 & 2.3e6     \\
6       & -0.44(13)                 & 1.8e6     \\
7       & -0.55(16)                 & 2.0e6     \\
8a      & -0.54(16)                 & 1.9e6     \\
    \bottomrule
\end{tabular}
\caption[$\beta$ results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV]{The $\beta$ parameter results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV.}
 \label{table:120}
    \end{table}
\end{document}

如果您想要加寬第二列和第三列,那麼您可以像在p{...}列類型中指定它們的寬度:sisetup新增所需的列寬度,如下所示:

\sisetup{separate-uncertainty,
         table-column-width = 22mm}%

在這種情況下表變成:

在此輸入影像描述

答案2

如果要對齊表格中的數字,請使用siunitx。我建議您查看文檔,特別是第 §§ 3.6 和 5.14,板狀材料

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{amsmath}

\usepackage{cellspace}
\setlength{\cellspacetoplimit}{6pt}
\setlength{\cellspacebottomlimit}{6pt}

\usepackage{makecell}
\newcommand*{\topdblline}{\Xhline{0.15ex}\\[-2.6ex]\hline}
\newcommand*{\botdblline}{\hline\\[-2.6ex]\Xhline{0.15ex}}

\begin{document}

\begin{table}[!htbp]
 \centering\sisetup{separate-uncertainty, table-figures-uncertainty =2}
  \begin{tabular}{ > {\bfseries}lS[table-format =-1.2(2)]S[table-figures-exponent =1]} \toprule
 \multicolumn{1}{l}{Res.}
&{$ \boldsymbol{\beta} $} & {$\boldsymbol{\chi^{2}}$} \\%
 \midrule%
  1 & -0.61(32) & 9.1e7\\%
 2 & -0.37(12) & 2.5e6\\%
  3 & -0.39(19) & 1.0e7\\%
 4 & -0.14(13) & 8.0e6\\%
  5 & -0.10(12) & 2.3e6\\%
  6 & -0.44(13)& 1.8e6\\%
  7 & -0.55(16) & 2.0e6 \\%
  8a & -0.54(16) & 1.9e6\\%
  \bottomrule
  \end{tabular}
 \caption[$\beta$ results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV]{The $\beta$ parameter results measured in this work for the 3d $Mg^{+}$ in the $hv$ range between 54.50 and 57.45 eV.}
\label{table:120}
\end{table}

\end{document} 

在此輸入影像描述

相關內容