# Table: how to merge two cells?

I can't figure out how to merge two rows as in figure below.

This is my code:

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,italian]{babel}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}

\begin{document}
\title{Title}
\author{Me}
%\date{10 dicembre 2015}

\maketitle

\begin{center}
\begin{tabular}{|c|c|}
\hline
Text & \\
\hline
Diametro fori (mm) & 4\\
\hline
Passo x (mm) & 24\\
\hline
Passo y (mm) & 24\\
\hline
Altezza canale (mm) & 10\\
\hline
Lunghezza canale (mm) & 146\\
\hline
Numero fori & 39\\
\hline
\end{tabular}
\captionof{table}{Caratteristiche della piastra e del canale}
\label{tab:dati_canale-piastra}
\end{center}

\end{document}


• You actually merge cels from two adjacent columns (concluded from your picture) Dec 13 '15 at 18:25
– user31729
Feb 9 '18 at 21:45

Try \multicolumn{2}{|l|}{Text} \tabularnewline in the relevant row. \multicolumn{n}{q}{foo} merges n cells with type q and places foo as content.

Side note: Using booktabs and vertical lines in a table is not the best design. I would also use left alignment for the first column.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,italian]{babel}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}

\begin{document}
\title{Title}
\author{Me}
%\date{10 dicembre 2015}

\maketitle

\begin{center}
\begin{tabular}{|c|c|}
\hline
\multicolumn{2}{|l|}{Text} \tabularnewline
\hline
Diametro fori (mm) & 4 \tabularnewline
\hline
Passo x (mm) & 24\tabularnewline
\hline
Passo y (mm) & 24\tabularnewline
\hline
Altezza canale (mm) & 10\tabularnewline
\hline
Lunghezza canale (mm) & 146\tabularnewline
\hline
Numero fori & 39\tabularnewline
\hline
\end{tabular}
\captionof{table}{Caratteristiche della piastra e del canale}
\label{tab:dati_canale-piastra}
\end{center}
\end{document}


Since you're already loading the booktabs package, you should give serious thought to improving the overall "look" of the table by (a) getting rid of all vertical lines, (b) getting rid of most horizontal lines, and (c) using the macros \toprule, \midrule, and \bottomrule of the booktabs package for the remaining three horizontal lines. With these changes in place, figuring out how to get rid of the unwanted central vertical divider in the header row becomes unnecessary. Note that, in the table below, I also suggest not using c (centering) for both columns; instead, I recommend l (left-alignment) for the first column and r (right-alignment) for the second column.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,italian]{babel}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[bindingoffset=1.5cm, margin=3cm]{geometry}

\begin{document}

\begin{center}
\begin{tabular}{@{} lr @{}}
\toprule
Text  \\
\midrule
Diametro fori (mm) & 4\\
Passo x (mm) & 24\\
Passo y (mm) & 24\\
Altezza canale (mm) & 10\\
Lunghezza canale (mm) & 146\\
Numero fori & 39\\
\bottomrule
\end{tabular}
\captionof{table}{Caratteristiche della piastra e del canale}
\label{tab:dati_canale-piastra}
\end{center}

\end{document}


You have to use multicolumn command:

\documentclass{book}
\begin{document}

\begin{table}
\begin{tabular}{|c|c|}
\multicolumn{2}{|c|}{\textbf{TITLE}} \\\hline
Value1 & Value2 \\\hline
Value1 & Value2 \\\hline
Value1 & Value2 \\\hline
\end{tabular}
\end{table}

\end{document}


UPDATE: As correctly mentioned below, you don't need the multirow package to use the multicolumn command.

• For multicolumn you not need multirow package ... Dec 13 '15 at 18:24
• The c specifier should be |c| most likely
– user31729
Dec 13 '15 at 18:31
• Good points! You are right! Dec 13 '15 at 18:43
• @MarcoMoschettini: Well, there's no multicolumn package ;-)
– user31729
Dec 13 '15 at 18:49
• You may also want to explain in more detail your choice of using a table environment where the OP used a center environment, as well as the choice not to center the contents of the table` environment.
– Mico
Dec 13 '15 at 18:50