多列对齐

多列对齐

我正在写一篇文章,但是我在写这个表格的时候遇到了问题

\begin{table}[H]
    \centering
    \caption{atomic composition of the different points analyzed by the DES probe}
    \label{DES probe}
    \begin{tabular}{
                c
                *{13}S[table-format=2.1]
            }
            \toprule
            & \multicolumn{2}{c}{\bfseries{Weight\%}}\\
            \cmidrule(lr){2-14}
            {\bfseries{Point}} & {\boldmath{C}}    & {\boldmath{O}}    & 
            {\boldmath{Mg}}    & {\boldmath{Al}}    & {\boldmath{Si}}    & {\boldmath{S}}     & {\boldmath{K}}     & {\boldmath{Ca}} & {\boldmath{Ti}} & {\boldmath{Fe}} & {\boldmath{Zn}} & {\boldmath{Cu}} & {\boldmath{Pd}}  \\
            \midrule

            A & 0.0 & 50.5 & 1.6 & 7.4 & 24.3 & 7.9 & 0.0 & 0.0 & 0.0 & 6.2 & 0.6 & 0.0 & 1.5 \\

            B & 32.1 & 46.2 & 0.2 & 1.9 & 5.9 & 1.9 & 0.7 & 0.7 & 0.3 & 9.6 & 0.0 & 0.5 & 0.0\\

            C & 0.0 & 43.0 & 0.0 & 3.6 & 10.8 & 6.7 & 1.1 & 3.2 & 0.4 & 31.1 & 0.0 & 0.0 & 0.0 \\
            \bottomrule
    \end{tabular}
\end{table}

标题“重量%”没有在多列排列中居中显示。

有人能帮我修复它吗?

非常感谢!

答案1

让我详细阐述一下上面的评论:

\documentclass{article}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{booktabs, makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\usepackage[skip=1ex, labelfont=bf]{caption}

\begin{document}
    \begin{table}
    \centering
\caption{atomic composition of the different points analyzed by the DES probe}
\label{DES probe}
\begin{tabular}{@{} c
           *{13}S[table-format=2.1]
                @{} }
    \toprule
        & \multicolumn{13}{c}{\thead{Weight (\%)}}      \\
    \cmidrule(lr){2-14}
\thead{Point}   & {\thead{C}}   & {\thead{O}}   & {\thead{Mg}}    
                & {\thead{Al}}  & {\thead{Si}}  & {\thead{S}}   
                & {\thead{K}}   & {\thead{Ca}}  & {\thead{Ti}} 
                & {\thead{Fe}}  & {\thead{Zn}}  & {\thead{Cu}} 
                & {\thead{Pd}}                          \\
    \midrule
A & 0.0  & 50.5 & 1.6 & 7.4 & 24.3 & 7.9 & 0.0 & 0.0 & 0.0 &  6.2 & 0.6 & 0.0 & 1.5\\
B & 32.1 & 46.2 & 0.2 & 1.9 &  5.9 & 1.9 & 0.7 & 0.7 & 0.3 &  9.6 & 0.0 & 0.5 & 0.0\\
C & 0.0  & 43.0 & 0.0 & 3.6 & 10.8 & 6.7 & 1.1 & 3.2 & 0.4 & 31.1 & 0.0 & 0.0 & 0.0\\
    \bottomrule
\end{tabular}
    \end{table}
\end{document}

在此处输入图片描述

答案2

给你:

\documentclass{article}

\usepackage{array, caption, float, booktabs}
\usepackage{siunitx}
\usepackage{makecell}
\setcellgapes{5pt}
\makegapedcells

\begin{document}

\begin{table}[H] %
  \centering \caption{atomic composition of the different points analyzed by the DES probe} \label{DES probe}

  \begin{tabular}{c *{13}S[table-format=2.1] } %
    \toprule
                     & \multicolumn{13}{c}{\bfseries{Weight \%}} \\ %
    \cmidrule(lr){2-14}
    {\textbf{Point}} & {\textbf{C}} & {\textbf{O}} & {\textbf{Mg}} & {\textbf{Al}} & {\textbf{Si}} & {\textbf{S}} & {\textbf{K}} & {\textbf{Ca}} & {\textbf{Ti}} & {\textbf{Fe}} & {\textbf{Zn}} & {\textbf{Cu}} & {\textbf{Pd}} \\%
    \midrule
    A & 0.0 & 50.5 & 1.6 & 7.4 & 24.3 & 7.9 & 0.0 & 0.0 & 0.0 & 6.2 & 0.6 & 0.0 & 1.5 \\
    B & 32.1 & 46.2 & 0.2 & 1.9 & 5.9 & 1.9 & 0.7 & 0.7 & 0.3 & 9.6 & 0.0 & 0.5 & 0.0 \\
    C & 0.0 & 43.0 & 0.0 & 3.6 & 10.8 & 6.7 & 1.1 & 3.2 & 0.4 & 31.1 & 0.0 & 0.0 & 0.0 \\
    \bottomrule
  \end{tabular}

\end{table}
\end{document} 

在此处输入图片描述

相关内容