2

i am working with the following table and the first row is not aligned.

the exit that i have is the following

enter image description here

Could anybody help me to put the titles aligned?

\documentclass[preprint,12pt,authoryear]{elsarticle}
% !TeX spellcheck = en_US 
\usepackage{multirow} % para las tablas
\usepackage{siunitx}% paquete para manejo de números y unidades
\sisetup{detect-weight, detect-display-math}
\sisetup{detect-inline-weight=math}
% modo de unidades con barra en lugar de fracción de tamaño reducido
\sisetup{mode=text,per-mode=symbol}
\usepackage{booktabs}% para tablas
\usepackage{graphicx}% para gráficos
\usepackage{pgfplots}% para gráficos
\usepackage{pdflscape}% para gráficos
\pgfplotsset{compat=newest}% para gráficos
\usetikzlibrary{plotmarks}% para gráficos
\usetikzlibrary{arrows.meta}% para gráficos
\usepgfplotslibrary{patchplots}% para gráficos
\newlength\fwidth% definido en el código de Matlab
\setlength{\fwidth}{0.8\textwidth}% defino valor de parámetro fwidth de gráficos
\usepackage{tikzscale}% para gráficos
\pgfplotsset{plot coordinates/math parser=false}% para gráficos
\usepackage{overpic}% figuras
\usepackage{tikz}% figuras
\pgfplotsset{compat=1.15}
\usepackage{float}
\usepackage{etoolbox}
\usepackage{natbib}
\usepackage{hyperref,url}
\newcounter{bibcount}
\makeatletter
\patchcmd{\@lbibitem}{\item[}{\item[\hfil\stepcounter{bibcount}{\thebibcount.}}{}{}
\setlength{\bibhang}{2\parindent}
\renewcommand\NAT@bibsetup%
[1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\parindent}%
    \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
\makeatother
\bibliographystyle{agsm}
\usepackage[margin=2.5cm]{geometry}% setea márgenes de hoja
\usepackage{bicaption}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\usepackage[skip=1ex, labelfont=bf]{caption}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{amssymb}
\usepackage{url}
\usepackage{amsmath}
\def\UrlFont{\normalfont}
\begin{document}
    \begin{table}[H]
    \centering
    \caption{Chemical properties of differents OS of the world}
    \label{Chemical properties of OS on dry basis}
        \begin{tabular}{l
            *{10}S[table-format=2.0]
        }
        \toprule
        &\multicolumn{6}{l}{\bfseries{Ultimate analysis (wt.\%)}} 
            & \multicolumn{9}{l}{\bfseries{Proximate analysis (wt.\%)}} 
            & \multicolumn{11}{l}{\bfseries{Calorific value (MJkg$^{-1}$)}} \\
        \cmidrule(lr){2-6} \cmidrule(lr){7-9} \cmidrule(lr){10-11}
        {\bfseries{Region}} & {\bfseries{C}}    & {\bfseries{H}}    & 
        {\bfseries{O}}      & {\bfseries{N}}    & {\bfseries{S}}    & 
            {\bfseries{VM}}     & {\bfseries{FC$^\varphi$}}   & 
            {\bfseries{Ash}} & {\bfseries{HHV}} & {\bfseries{LHV}} \\
        \midrule
        Mangrullo $^a$ &  &  & &  &  &  &  &  &  & \\
        (Uruguay) &  &  &  &   &  & &  &  &\\\\
        Huadian$^b$ & 29.2 & 4.3 & * & 0.6 & 4.9 & 39.3 & 3.8 & 56.9 & * & 13.1 \\
        (China) &  &  &  & &  &  & &  &  &\\\\
        Irati$^c$ & 16.5 & 1.8 & * & 0.5 & 4.0 & * & 76.9 & * & * & *\\
        (Brazil) &  &  &  & &  &  & &  &  &\\\\
        Nongan$^b$ & 9.7 & 1.0 & * & 0.32 & 5.7 & 9.7 & 1.6 & 89.3 & * & 2.9\\
        (China) &  &  &  & &  &  & &  &  &\\\\
        Estonia$^d$ & 30.4 & 3.0 & * & 0.1 & 1.6 & 49.6 & 1.1 & 49.3 & 11.9 & 11.\\
        &  &  &  & &  &  & &  &  &\\\\
        Kentucky$^e$ & 10.3 & 1.3 & * & 0.4 & 2.7 & * & * & 83.6 & * & *\\
        (USA) &  &  &  & &  &  & &  &  &\\
        \bottomrule
    \end{tabular}\\\smallskip
    \parbox{0.9\textwidth}{
    \scriptsize.\\VM: volatile matter, FC: Fixed carbon. 
    All these values are expressed in dry basis\\ 
    $\varphi$: Determined by difference: FC= 100\%-VM\%-Ash\%\\
    a-obtained in this work\\
    b-\cite{bai2015thermal}\\ 
    c-\cite{carter1991testing}\\ 
    d-\cite{yoruk2016oxy}\\ 
    e-\cite{carter1985fluidized}\\ 
    {*}: no data reported\\}
\end{table}
\end{document}
  • 1
    do you really need all those packages? some of them are loaded twice, pgfplots load tikz etc. check preamble again – Zarko Mar 26 '18 at 5:12
  • Yes, i am writing an article. Ok I will check the preamble. Otherwise the problem continues – Martín Torres Brunengo Mar 26 '18 at 5:28
  • 1
    of course, that problem continue :-). your table has errors. first i try to repair them. – Zarko Mar 26 '18 at 5:36
  • Just out of idle curiosity: Should the third header say "caloric value" rather than "calorific value"? – Mico Mar 26 '18 at 8:09
  • The immediate issue is that you're setting up a table with 11 columns, but the three \multicolumn directives alone would require 26 columns. Why did you set the headers to span 6, 9, and 11 columns, respectively? – Mico Mar 26 '18 at 8:44
3

Something like this?

The main suggestion I have is that you use a tabularx environment instead of a tabular environment, to assure that the table will actually fit inside the textblock. I would also dispense with the use of bolding in the table's header: If the header is well-designed, it shouldn't be necessary to shout.

Note also that I've simplified the preamble to contain only essential matter; you really, really need to work on the preamble of your real document.

enter image description here

\documentclass[preprint,12pt,authoryear]{elsarticle}

\usepackage{siunitx}
\sisetup{per-mode=symbol}
\usepackage{booktabs}

\usepackage[margin=2.5cm]{geometry} 
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{amssymb,amsmath}

\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
\begin{table}
\setlength\tabcolsep{4pt} % default value is '6pt'
\caption{Chemical properties of different OS of the world}
\label{Chemical properties of OS on dry basis}
\begin{tabularx}{\textwidth}{@{}l *{10}{C} @{}}
\toprule
Region
& \multicolumn{5}{>{\hsize=\dimexpr5\hsize+8\tabcolsep\relax}C}{Ultimate analysis} 
& \multicolumn{3}{>{\hsize=\dimexpr3\hsize+4\tabcolsep\relax}C}{Proximate analysis} 
& \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep\relax}C@{}}{Calorific value} \\
& \multicolumn{5}{c}{(wt. \%)}
& \multicolumn{3}{c}{(wt. \%)}
& \multicolumn{2}{c@{}}{(\si{\mega\joule\per\kilo\gram})}\\
\cmidrule(lr){2-6} \cmidrule(lr){7-9} \cmidrule(l){10-11}
& C & H & O & N & S & VM & FC$^\varphi$ & Ash & HHV & LHV \\
\midrule
Mangrullo$^a$ &  &  &  &  &  &  &  &  &  & \\
(Uruguay)\\ \addlinespace
Huadian$^b$ & 29.2 & 4.3 & * & 0.6 & 4.9 & 39.3 & 3.8 & 56.9 & * & 13.1 \\
(China)\\ \addlinespace
Irati$^c$ & 16.5 & 1.8 & * & 0.5 & 4.0 & * & 76.9 & * & * & *\\
(Brazil)\\ \addlinespace
Nongan$^b$ & 9.7 & 1.0 & * & 0.32 & 5.7 & 9.7 & 1.6 & 89.3 & * & 2.9\\
(China)\\ \addlinespace
Estonia$^d$ & 30.4 & 3.0 & * & 0.1 & 1.6 & 49.6 & 1.1 & 49.3 & 11.9 & 11.\\ \addlinespace
Kentucky$^e$ & 10.3 & 1.3 & * & 0.4 & 2.7 & * & * & 83.6 & * & *\\
(USA)\\
\bottomrule
\end{tabularx}

\smallskip\footnotesize
VM: volatile matter, FC: Fixed carbon. 
All values are expressed in dry basis.\\ 
$\varphi$: Determined by difference: 
$\text{FC}=100\%-\text{VM\%}-\text{Ash\%}$.\\
a -obtained in this work\\
b -\cite{bai2015thermal}\\ 
c -\cite{carter1991testing}\\ 
d -\cite{yoruk2016oxy}\\ 
e -\cite{carter1985fluidized}\\ 
{*}: no data reported
\end{table}
\end{document}
  • now i see, that i didn't understood question correctly :-(, however, it is still not clear to me why the state names are in the second column. do will ones contain data (in this case your writting of those rows is not correct, missed are ampersands) or names are in the second column that is more space for other columns. – Zarko Mar 26 '18 at 10:37
  • @Zarko - You ask some good questions. :-) (Hopefully, the OP is reading them too...) I left the country names in separate rows because I assume that the OP had done so in an attempt to prevent the first column from getting too wide. No other reason, really. – Mico Mar 26 '18 at 10:44
3

edit: now i see, that in the first version of my answer i didn't understood question correctly :-(. however, it is still not clear to me why the state names are in the second column. if reason for this is make more spaces for other columns, than van be enclosed not \makecell[tl]{<province>\\<state>} , as i assumed in renovated mwe below. in it now is corrected columns headers and tale notes:

enter image description here

  • for table the most of package loaded in your document preamble are not relevant. all of them i remove from preamble of my mwe
  • it is not clear, how should table looks. i assume, that the rows beginning with name of states are superfluous (wrong assumption, now is corrected).
  • since you have in table notes, i add threepartable and use its \note command

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage[margin=25mm]{geometry}
\usepackage{siunitx}% paquete para manejo de números y unidades
\sisetup{detect-weight,
         detect-display-math,
         detect-inline-weight=math,
         mode=text,
         per-mode=symbol}% modo de unidades con barra en lugar de fracción de tamaño reducido
\usepackage[skip=1ex, labelfont=bf]{caption}
\usepackage{booktabs, makecell, multirow, threeparttable}% para tablas
\renewcommand\theadfont{\bfseries\footnotesize}
\renewcommand\theadgape{}
\setcellgapes{3pt}

\begin{document}
    \begin{table}[ht]
\caption{Chemical properties of differents OS of the world}
\label{Chemical properties of OS on dry basis}
    \centering
    \setlength\tabcolsep{3pt}
    \makegapedcells
    \begin{threeparttable}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                             l
                        *{10}S[table-format=2.1]
                            @{}}
        \toprule
\thead[l]{Region}
    &   \multicolumn{5}{c}{\thead{Proximate analysis\\ (wt.\%)}}
        &   \multicolumn{3}{c}{\thead{Ultimate analysis\\ (wt.\%)}}
            &   \multicolumn{2}{c}{\thead{Calorific value\\ (MJkg$^{-1}$)}}\\
    \cmidrule(lr){2-6} \cmidrule(lr){7-9} \cmidrule(lr){10-11}
    & {\thead{C}}    & {\thead{H}} & {\thead{O}} & {\thead{N}} & {\thead{S}}
    & {\thead{VM}}   & {\thead{FC$^\varphi$}} & {\thead{Ash}}
    & {\thead{HHV}} & {\thead{LHV}} \\
    \midrule
\makecell[tl]{Mangrullo\tnote{a}\\ (Uruguay)}
    &       &       &     &       &
    &       &       &
    &       &                   \\
\makecell[tl]{Huadian\tnote{b}\\ (China)}
    & 29.2  & 4.3   & {*} & 0.6   & 4.9
    & 39.3  & 3.8 & 56.9
    & {*} & 13.1              \\
\makecell[tl]{Irati\tnote{c}\\ (Brazil)}
    & 16.5  & 1.8   & {*} & 0.5   & 4.0
    & {*} & 76.9  & *
    & {*} & {*} \\
\makecell[tl]{Nongan\tnote{b}\\ (China)}
    & 9.7   & 1.0   & {*} & 0.32  & 5.7
    & 9.7   & 1.6   & 89.3
    & {*} & 2.9              \\
\makecell[tl]{Estonia\tnote{d}}
    & 30.4  & 3.0   & {*} & 0.1   & 1.6
    & 49.6  & 1.1 & 49.3
    & 11.9  & 11.               \\
\makecell[tl]{Kentucky\tnote{e}\\ (USA)}
    & 10.3  & 1.3   & {*} & 0.4   & 2.7
    & {*} & {*} & 83.6
    & {*} & {*} \\
    \bottomrule
\end{tabular*}
\begin{tablenotes}[flushleft]\footnotesize
    \item[]    VM: volatile matter, FC: Fixed carbon.¸All these values are expressed in dry basis
    \item[]$\varphi$:   Determined by difference:
                        $\text{FC} = \SI{100}{\%} - \text{VM}\,\% - \text{Ash}\,\%$
    \item[a] obtained in this work
    \item[b] \cite{bai2015thermal}
    \item[c] \cite{carter1991testing}
    \item[d] \cite{yoruk2016oxy}
    \item[e] \cite{carter1985fluidized}
    \item[*] no data reported
\end{tablenotes}
\end{threeparttable}
    \end{table}

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.