# Table columns merging when using fixed size

I'm writing a table that's too wide for the page, so I tried using a fixed width for the columns, but when I do that two columns merge into one:

And a MWE:

\documentclass[a4paper]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}

\begin{table}[]
\centering
\begin{tabular}{|r p{2cm} |c|c|}
\textbf{Controle no começo do jogo} \\
\hline
17 & 90110   & Monte Carlo \\
27 & 140253  & Monte Carlo \\
19 & 100284  & Monte Carlo \\
23 & 120247  & Monte Carlo \\
11 & 60366   & Monte Carlo \\
\end{tabular}
\caption{Durações das partidas} \label{montecarloduracoes}
\end{table}
\end{document}


Am I doing something wrong? Or do I have to use a different method to compress the table horizontally?

• It seems your table has 3 columns but you're defining 4 columns in your header : \begin{tabular}{|r p{2cm} |c|c|} (Bernard's solution corrected it without mentioning) – Christoph Frings Jun 16 '16 at 7:31
• @ChrisS and Mico : Yes you are right, it was more a comment than an answer, though OP asked "am I doing something wrong" and nobody pointed it out to him, unfortunately. I couldn't comment then, I can now. Story over, thx for your assistance. – Christoph Frings Jun 18 '16 at 19:18

You can do that with makecell, which allows for line breaks and a common formatting of cells introduced by the \thead or \makecell commands.

I replaced the abntex2 cls (not installed on my system) with report:

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{makecell} %
\usepackage{showframe}

\begin{document}
\vspace*{1cm}
\begin{table}[!ht]
\centering\setlength\extrarowheight{3pt}
\begin{tabular}{|r |c|c|}
\hline
\thead{Controle no começo\\ do jogo} \\
\hline
17 & 90110 & Monte Carlo \\
27 & 140253 & Monte Carlo \\
19 & 100284 & Monte Carlo \\
23 & 120247 & Monte Carlo \\
11 & 60366 & Monte Carlo \\ \hline
\end{tabular}
\caption{Durações das partidas} \label{montecarloduracoes}
\end{table}

\end{document}


I suggest you give your table an "open" and easily-accessible look by getting rid of the vertical bars. To further ease the readability of the numbers in the middle column, consider aligning them on the (implicit) decimal marker.

\documentclass[a4paper]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{siunitx,array,booktabs,ragged2e}
\newcolumntype{C}[1]{>{\Centering\arraybackslash}p{#1}}
\begin{document}

\begin{table}
\centering
\begin{tabular}{C{2cm} S[table-format=6.0] C{3cm}}
\multicolumn{1}{C{2cm}}{\textbf{Duração} (ms)}&
\textbf{Controle no começo do jogo} \\
\midrule
17 & 90110   & Monte Carlo \\
27 & 140253  & Monte Carlo \\
19 & 100284  & Monte Carlo \\
23 & 120247  & Monte Carlo \\
11 & 60366   & Monte Carlo \\
\end{tabular}
\caption{Durações das partidas}
\label{montecarloduracoes}
\end{table}
\end{document}