Table: how to merge two cells?
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.