Tabularx environment
Here are two solutions. The first uses a tabularx
environment, with all six columns using a centered version of the X column type. The second uses a tabular*
environment, with all six columns using the c
column type. Both solutions occupy the full width of the textblock.
Since \multicolumn{1}{l}{}
does nothing at all, you might as well omit those instructions.
\documentclass{article}
\usepackage{multirow,tabularx,booktabs}
\newcommand{\mr}[1]{\multirow{2}{*}{#1}} % handy shortcut macro
% centered version of X column type:
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[skip=0.333\baselineskip]{caption} % optional
\begin{document}
\begin{table}
%%\centering % <-- redundant
\caption{tabularx}
\begin{tabularx}{\textwidth}{@{} *{6}{C} @{}}
\toprule
1 & 2 & 3 & 4 & 5 & 6 \\
\midrule
\mr{Pepe} & \mr{a} & \mr{b} & \mr{c} & \mr{d} & e \\
& & & & & f \\
\midrule
& & & & & \\ % no need for "\multicolumn{1}{l}{}" stuff
\bottomrule
\end{tabularx}
\vspace{1cm} %
\setlength\tabcolsep{0pt}
\caption{tabular*}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{6}{c} }
\toprule
1 & 2 & 3 & 4 & 5 & 6 \\
\midrule
\mr{Pepe} & \mr{a} & \mr{b} & \mr{c} & \mr{d} & e \\
& & & & & f \\
\midrule
& & & & & \\ % no need for "\multicolumn{1}{l}{}" stuff
\bottomrule
\end{tabular*}
\end{table}
\end{document}
As @daleif mentioned you forgot to add the second bracket with your columns' specification {cccccc}
.
Probably there is a reason why you want to use the tabularx environment from the tabularx package.
The package defines an environment tabularx, an extension of tabular which has an additional column designator, X, which creates a paragraph-like column whose width automatically expands so that the declared width of the environment is filled. (Two X columns together share out the available space between them, and so on.)
I guess you want to adapt the width of the first column as shown in the following example.
I give you the according code as a MWE:
\documentclass{article}
\usepackage{tabularx}
\usepackage{multirow}
% The [following] package enhances the quality of tables [...]
\usepackage{booktabs}
% Macro to simplify the code
\newcommand{\mr}[1]{\multirow{2}{*}{#1}}
\begin{document}
\begin{table}
\caption{My caption}
\centering
\begin{tabularx}{.5\textwidth}{Xccccc}
\toprule
1 & 2 & 3 & 4 & 5 & 6 \\
\midrule
\mr{Pepe} & \mr{a} & \mr{b} & \mr{c} & \mr{d} & e \\
& & & & & f \\
\midrule
& & & & & \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
Supplement
Additionally, keep in mind that there is a package called tabu, which is more powerful than tabularx.
You do not need multicolumns in every cell, nor \multirow{2}{*}{...}
, nor tabularx
or tabular*
to extend the text width, nor empty rows. Here you have enough with m
columns (of array package) and, of course, with booktabs
: :)
\documentclass{article}
\usepackage{graphicx,array,booktabs}
\begin{document}
\begin{table}
\caption{My caption}
\newcolumntype{C}{>{\centering\arraybackslash}m{\dimexpr\linewidth/6-2\tabcolsep}}
\begin{tabular}{CCCCCC}\toprule
1 & 2 & 3 & 4 & 5 & 6 \\\midrule
Pepe & a & b & c & d &e\par f\\\bottomrule
\end{tabular}
\end{table}
\end{document}
By the way, I would not use columns of more two-three em
here. Widening the table as much as possible instead of a small centered table does not make it more beautiful, but ugly scattered.