按小数点显示列的中心部分

按小数点显示列的中心部分

我真的很难制作一个表格,我希望标签居中,但值以小数点为中心。我尝试了各种方法,但都失败了。这是我目前最实用的版本(中间列居中)。

\begin{table}[]
\centering
\caption{My caption}
\begin{tabular}{rcccl}
\hline \addlinespace
\ch{Zn_{$x$}H_{$y$}VPO4F}           & Phase 1    & Phase 2       & Phase 3       &     \\ \addlinespace \hline \addlinespace
space group:     & $P\bar1$ (No. 2) & $C2/c$ (No. 15) & $C2/c$ (No. 15) &     \\
\textit{a} =             & 5.188(4)   & 7.327(3)      & 7.169(1)      &  Å  \\
\textit{b} =              & 5.255(2)   & 7.952(2)      & 7.085(3)      & Å   \\
\textit{c} =              & 7.391(2)   & 7.441(7)      & 7.183(4)      & Å   \\
$\alpha$ =          & 111.65(6)  & 90.0          & 90.0          & ° \\
$\beta$ =           & 111.71(8)  & 118.17(1)     & 117.44(2)     & ° \\
$\gamma$ =          & 82.41(5)   & 90.0          & 90.0          & ° \\
\textit{V} =              & 174.0(3)   & 382.2(1)      & 323.8(2)      & Å$^3$  \\
Bragg \textit{R}-factor = & 0.99       & 0.72          & 0.91          &     \\ \addlinespace \hline \addlinespace
\multicolumn{5}{c}{Global weighted $\chi^2$ = 4.83}                     \\ \addlinespace \hline
\end{tabular}
\label{tab:LeBail}
\end{table}

答案1

您没有提供完整的工作示例。下次请包含 MWE 所需的组件。我不得不猜测一个化学式包。

至于表格,siunitx-column S-type 可以根据设置格式化数字,例如小数点标记。有一个手动的,您可能应该熟悉它。确保将列设置为时S,任何非数字内容都包装在里面{}

另外,我建议使用 中定义的规则,这些规则会增加间距,因此可以避免booktabs所有 的情况。您可以通过更改和 的值来改变顶部和底部的间隙。\addlinespace\aboverulesep\belowrulesep

\documentclass[12pt]{book}
\usepackage{booktabs}
\usepackage{chemformula}
\usepackage{siunitx}

\setlength\aboverulesep{5pt}
\setlength\belowrulesep{6pt}


\begin{document}
\begin{table}[]
  \centering
  \caption{My caption}
  \begin{tabular}{
    r *3{S[table-format=3.3]}
    l}
    \toprule
    \ch{Zn_{$x$}H_{$y$}VPO4F} & {Phase 1}          & {Phase 2}         & {Phase 3}         &   \\ \midrule
    space group:              & {$P\bar1$ (No. 2)} & {$C2/c$ (No. 15)} & {$C2/c$ (No. 15)} &   \\
    \textit{a} =              & 5.188(4)           & 7.327(3)          & 7.169(1)          & Å \\
    \textit{b} =              & 5.255(2)           & 7.952(2)          & 7.085(3)          & Å \\
    \textit{c} =              & 7.391(2)           & 7.441(7)          & 7.183(4)          & Å \\
    $\alpha$ =                & 111.65(6)          & 90.0              & 90.0              & ° \\
    $\beta$ =                 & 111.71(8)          & 118.17(1)         & 117.44(2)         & ° \\
    $\gamma$ =                & 82.41(5)           & 90.0              & 90.0              & ° \\
    \textit{V} =              & 174.0(3)           & 382.2(1)          & 323.8(2)          & Å$^3$ \\
    Bragg \textit{R}-factor = & 0.99               & 0.72              & 0.91              & \\ \midrule
    \multicolumn{5}{c}{Global weighted $\chi^2$ = 4.83}                     \\ \bottomrule
  \end{tabular}
  \label{tab:LeBail}
\end{table}
\end{document}

在此处输入图片描述

答案2

使用siunitx

\documentclass{article}
\usepackage{booktabs,siunitx,caption}
\usepackage{chemformula}

\begin{document}

\begin{table}[htp]
\centering
\caption{My caption}
\label{tab:LeBail}

\begin{tabular}{
  @{}
  l
  *{3}{S[table-format=3.3(1)]}
  c
  @{}
}
\toprule
\ch{Zn_{$x$}H_{$y$}VPO4F} & {Phase 1} & {Phase 2} & {Phase 3} & \\
\midrule
space group: & {$P\bar1$ (No.\ 2)} & {$C2/c$ (No.\ 15)} & {$C2/c$ (No.\ 15)} &   \\
\cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4}
$a$          &   5.188(4)          &   7.327(3)         &   7.169(1)         & Å \\
$b$          &   5.255(2)          &   7.952(2)         &   7.085(3)         & Å \\
$c$          &   7.391(2)          &   7.441(7)         &   7.183(4)         & Å \\
$\alpha$     & 111.65(6)           &  90.0              &  90.0              & ° \\
$\beta$      & 111.71(8)           & 118.17(1)          & 117.44(2)          & ° \\
$\gamma$     &  82.41(5)           &  90.0              &  90.0              & ° \\
$V$          & 174.0(3)            & 382.2(1)           & 323.8(2)           & Å$^3$ \\
\midrule
Bragg $R$-factor & {0.99} & {0.72} & {0.91} & \\
\midrule
\multicolumn{5}{@{}l@{}}{Global weighted $\chi^2$ = 4.83} \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

相关内容