1

I am writing an article, but I have a problem when I write this table

\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}

The title "weight %" don't appear centered in the multicolumn arrangement.

Could anybody help me to fix it?

Thank you very much!

  • 1
    welcome to tex.se! please. extend your table code to small, but complete document beginning with \documentclass{...} and ending with \end{document}`. help us to help you! – Zarko Nov 6 '17 at 23:10
  • if you like to have "weight" on the middle of columns with numbers, than you should write: `\multicolumn{13}{c}{\bfseries{Weight (\%)}}\` – Zarko Nov 6 '17 at 23:14
  • {\boldmath{C}} is the same as C as \boldmath is a declaration that makes any later math be bold but there is no math in the scope of the cell. – David Carlisle Nov 6 '17 at 23:26
0

let me elaborate my comment above:

\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}

enter image description here

  • Thank you very much! you answer was very useful! cheers!! – Martín Torres Brunengo Nov 7 '17 at 14:31
  • @MartínTorresBrunengo, you are welcome! however, here is policy to express thankfulness by voting (by clicking on up-pen at the top left side of answer) of question (for what you need reputation at least 15 points) and the accept this answer which you the most like (by clicking check mark) :-). – Zarko Nov 7 '17 at 14:38
0

Here you are:

\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} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.