1

I am writing an article and when I create the next table I have a problem

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{multirow} % para las tablas
\usepackage{graphicx}
\usepackage{siunitx}% paquete para manejo de números y unidades
\sisetup{detect-weight, detect-display-math}
\sisetup{detect-inline-weight=math}
\sisetup{mode=text,per-mode=symbol}% modo de unidades con barra en lugar de fracción de tamaño reducido
\usepackage{multirow}% para tablas
\usepackage{makecell}% para tablas
\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
\usepackage{pgfplots}% figuras
\pgfplotsset{compat=1.15}
\usepackage{float}
\usepackage{natbib}
\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}
\begin{document}
\begin{table}[H]
\centering
\caption{Chemical properties of OS on dry basis}
\label{Chemical properties of OS on dry basis}
\resizebox{15cm}{1.2cm}{
\begin{tabular}{
        S[table-format=2.0]
        *{9}S[table-format=2.0]
    }
    \toprule
    & \multicolumn{2}{c}{\thead{Proximate analysis(wt.\%)}}  & 
    \multicolumn{7}{c}{\thead{Ultimate analysis}} \\
    \cmidrule(lr){2-6} \cmidrule(lr){7-9}
    {\thead{Sample}} & {\thead{C}}    & {\thead{H}}    & 
    {\thead{O$^a$}}    & {\thead{N}}    & {\thead{S}}    & {\thead{VM}}     & {\thead{FC$^b$}}     & {\thead{Ash}} & {\thead{HHV(MJ/kg)}} \\
    \midrule
     OS & 9.3 & 2.3 & 11.6 & 0.2 & 4.0 & 24.0 & 3.4 & 72.6 & 2.9 \\
    \bottomrule
\end{tabular}}\\\smallskip
\parbox{1\textwidth}{
    \scriptsize OS: oil shale; C: carbon; H: hidrogen; O: oxigen; N: nitrogen; S: sulfur; VM: volatile matter; FC: fixed carbon; HHV: high heating value.\\a-By difference: O\%= 100\%-C\%-H\%-N\%-S\%-Ash\%\\b-By difference: FC= 100\%-VM\%-Ash\%}
\end{table}
\end{document}

enter image description here

My problem is that the columns are not evenly distribute, could anybody help me?

Cheers!

  • 1
    Hi, can you turn your snippet into a complete example? I.e. add a documentclass, the packages that are required to run the code, and a document environment. – Torbjørn T. Nov 7 '17 at 16:33
  • Ready, i added the environment – Martín Torres Brunengo Nov 7 '17 at 16:48
  • 1
    Unrelated to your problem: Nearly all the packages you load are loaded more than once, which only contributes to cluttering your preamble. Might be a good idea to check whether you already load a package, before adding it in. – Torbjørn T. Nov 7 '17 at 16:56
  • and also check if all loaded package is necessary to demonstrate your problem. – Zarko Nov 7 '17 at 17:03
  • I deleted some usepackages, however my problem continues – Martín Torres Brunengo Nov 7 '17 at 17:27
1

Don't you want your \multicolumns to be 5 and 3 columns wide, rather than 2 and 7?

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{multirow} % para las tablas
\usepackage{graphicx}
\usepackage{siunitx}% paquete para manejo de números y unidades
\sisetup{detect-weight, detect-display-math}
\sisetup{detect-inline-weight=math}
\sisetup{mode=text,per-mode=symbol}% modo de unidades con barra en lugar de fracción de tamaño reducido
\usepackage{multirow}% para tablas
\usepackage{makecell}% para tablas
\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
\usepackage{pgfplots}% figuras
\pgfplotsset{compat=1.15}
\usepackage{float}
\usepackage{natbib}
\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}
\begin{document}
\begin{table}[H]
\centering
\caption{Chemical properties of OS on dry basis}
\label{Chemical properties of OS on dry basis}
\resizebox{15cm}{1.2cm}{
\begin{tabular}{
        S[table-format=2.0]
        *{9}S[table-format=2.0]
    }
    \toprule
    & \multicolumn{5}{c}{\thead{Proximate analysis(wt.\%)}}  & 
    \multicolumn{3}{c}{\thead{Ultimate analysis}} \\
    \cmidrule(lr){2-6} \cmidrule(lr){7-9}
    {\thead{Sample}} & {\thead{C}}    & {\thead{H}}    & 
    {\thead{O$^a$}}    & {\thead{N}}    & {\thead{S}}    & {\thead{VM}}     & {\thead{FC$^b$}}     & {\thead{Ash}} & {\thead{HHV(MJ/kg)}} \\
    \midrule
     OS & 9.3 & 2.3 & 11.6 & 0.2 & 4.0 & 24.0 & 3.4 & 72.6 & 2.9 \\
    \bottomrule
\end{tabular}}\\\smallskip
\parbox{1\textwidth}{
    \scriptsize OS: oil shale; C: carbon; H: hidrogen; O: oxigen; N: nitrogen; S: sulfur; VM: volatile matter; FC: fixed carbon; HHV: high heating value.\\a-By difference: O\%= 100\%-C\%-H\%-N\%-S\%-Ash\%\\b-By difference: FC= 100\%-VM\%-Ash\%}
\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.