3

I would like your help to build the following table: My question is on the first line where the cells containing the BIAS and RMSE names are bigger than the cells of the lines below. Summing up the first line with 3 columns with the following lines are 5 columns. Thank you very much.enter image description here

2 Answers 2

15

To create these columns simply use

\multicolumn{2}{c}{<content of cell>}

This cell will span 2 columns and be centred horizontally.

Then proceed as usual.

Here's a complete example, based on the content which Wayne Tsai typed for you.

The code follows recommended guidelines, which eschew the use of vertical lines in tables; use heavier rules for top and bottom; minimise additional rules within the table body; increase spacing around rules; and align numerical values appropriately.

I use booktabs for the improved rules and spacing. Please read the documentation for advice on typesetting tables.

I use siunitx to align the content of the cells on the , which I assume to be the decimal marker.

These recommendations are intended to make tabular material easier to read and to produce publication-quality results.

\documentclass{article}
\usepackage{booktabs,siunitx}
\sisetup{%
  output-decimal-marker={,},
}
\begin{document}
\begin{tabular}{c*{4}{S}}
  \toprule
  \bfseries Index &  \multicolumn{2}{c}{\bfseries BIAS}  &  \multicolumn{2}{c}{\bfseries RMSE} \\
  \cmidrule(lr){1-5}
  \bfseries Models &  \multicolumn{1}{c}{\bfseries AGCM} & \multicolumn{1}{c}{\bfseries CGCM} & \multicolumn{1}{c}{\bfseries AGCM} & \multicolumn{1}{c}{\bfseries CGCM} \\
  \midrule
  SACZ-2005 & -1,7 & -2,0 & 7,0  & 5,9 \\
  SACZ-2006 & -0,6 & -0,7 & 4,3  & 4,1 \\
  SACZ-2007 & 1,6  & 2,0  & 5,4  & 5,6 \\
  SACZ-2008 & -1,4 & -2,8 & 10,7 & 9,2 \\
  \bottomrule
\end{tabular}
\end{document}

complete example

5

Use \multicolumn.

\documentclass{article}

\begin{document}

\begin{tabular}{|c|c|c|c|c|}
\hline 
Index &  \multicolumn{2}{c|}{BIAS}  &  \multicolumn{2}{c|}{RMSE} \\
\hline
Models &  AGCM & CGCM & AGCM & CGCM \\
\hline
SACZ-2005 & $-1,7$ & $-2,0$ & 7,0 & 5,9 \\
\hline
SACZ-2006 & $-0,6$ & $-0,7$ & 4,3 & 4,1 \\
\hline
SACZ-2007 & 1,6    & 2,0    & 5,4 & 5,6 \\
\hline
SACZ-2008 & $-1,4$ & $-2,8$ & 10,7 & 9,2 \\
\hline
\end{tabular}

\end{document}

enter image description here

7
  • Why are you forcing a line break and adding 4mm of space after the table? \\ should only be used to break lines in very specific contexts: inside tabular and array environments, for example. Otherwise, you get lots of bad box warnings. And you don't need the AMS packages here, either. Why do you think the OP needs support for commutative diagrams?
    – cfr
    Commented Aug 4, 2016 at 1:49
  • I hope you don't mind. I edited this so I could upvote it in good conscience ;).
    – cfr
    Commented Aug 4, 2016 at 1:51
  • @cfr Actually, I didn't notice the 4mm of space initially. This solution code is modified from other documents of mine. Thanks for reminding.
    – Wayne Tsai
    Commented Aug 4, 2016 at 1:53
  • That explains the packages. But you shouldn't be using \\ either!
    – cfr
    Commented Aug 4, 2016 at 1:56
  • 1
    \vspace{} or \vspace*{}? Or you can say, e.g. \bigskip or \medskip or \smallskip if you are then starting a new paragraph.
    – cfr
    Commented Aug 4, 2016 at 2:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .