Different column number in rows
The following provides a much cleaner interface, if you're interested in spreading out the contents beyond column 1 evenly:
\documentclass{article}
\usepackage{booktabs,multirow,tabularx}% http://ctan.org/pkg/{booktabs,multirow,tabularx}
\newcommand{\makecell}[2][@{}c@{}]{\begin{tabular}{#1}#2\end{tabular}}
\usepackage[margin=1in]{geometry}% Just for this example
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
\begin{tabularx}{\linewidth}{c X}
\toprule
xxxxxxx &
\hfill yyyyyyyyyyyyyy \hfill\null \\
\midrule
\makecell{aaaaaaa \\ $E = \lambda \cdot x$} &
\hfill bbbbbbbbbbbbbb \hfill\null \\
\midrule
\makecell{cccccccc \\ $P = \beta \cdot x$} &
\hfill \makecell{ddddddddddddddddddd \\ (4)}
\hfill \makecell{eeeeeeeeeeeeeeeee \\ (3)}
\hfill \makecell{fffffffffffffff \\ (1)} \hfill\null \\
\makecell{gggggggggg \\ $I = \gamma \cdot x$} &
\hfill \makecell{gggggggg \\ (6)}
\hfill \makecell{ddddddddd \\ (5)}
\hfill \makecell{ggggggggg \\ (3)}
\hfill \makecell{dsdsdsds \\ (1)} \hfill\null \\
\makecell{Calidad canal \\ $\Delta = \delta \cdot x$} &
\hfill \makecell{aaaaaaaaaaaa \\ (5)}
\hfill \makecell{hhhhhhhhhhhhhhhhhhhhhh \\ (3)}
\hfill \makecell{rrrrrrrrrrrrrrrr \\ (1)} \hfill\null \\
\bottomrule
\end{tabularx}
\end{document}
The entire structure is set in a tabularx
consisting of two columns. The second X
-column removes the guesswork of trying to figure out how many columns to use and how wide the table should be. \hfill
s spread the content evenly within the column, while \makecell
(similar in definition to that provided by the makecell
package) stacks elements vertically.
The above code is clean and allows customization by changing the definition of \makecell
(if needed).
To vertically center the H2 cell, you will need to also use the multirow
package.
\documentclass[a4paper]{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{ c c c c c }
H1 & \multicolumn{4}{c}{\multirow{2}{*}{H2}} \\
T1 \\
T1 & test & \multicolumn{2}{c}{text} & text \\
T1 & \multicolumn{2}{c}{text} & \multicolumn{2}{c}{text} \\
T1 & text & text & text & text \\
\end{tabular}
This code will produce:
To make the row with 3 text's have evenly sized tables, I assumed 13 cells would be required. However, the sizing was still unusual until I added a row of blank cells to the bottom.
\begin{tabular}{ c c c c c c c c c c c c c }
H1 & \multicolumn{12}{c}{\multirow{2}{*}{H2}} \\
T1 \\
T1 & \multicolumn{4}{c}{text} & \multicolumn{4}{c}{text} & \multicolumn{4}{c}{text} \\
T1 & \multicolumn{6}{c}{text} & \multicolumn{6}{c}{text} \\
T1 & \multicolumn{3}{c}{text} & \multicolumn{3}{c}{text} & \multicolumn{3}{c}{text} & \multicolumn{3}{c}{text} \\
& & & & & & & & & & & & \\
\end{tabular}
This produces:
There were a few wrong \multicolumn
commands in your code.
Hope this is what you wanted
Code:
\documentclass{article}
\usepackage{multirow,booktabs}
\begin{document}
\begin{table}[!hbt]
\centering
\caption{caption} \label{tab:table}
\begin{tabular}{c c c c c c c c c c c c c}
\toprule
xxxxxxx & \multicolumn{12}{c}{yyyyyyyyyyyyyy} \\
\midrule
aaaaaaa & \multicolumn{12}{c}{\multirow{2}{*}{bbbbbbbbbbbbbb}} \\
$E=\lambda \cdot x$ & \multicolumn{12}{c}{} \\
\midrule
cccccccc & \multicolumn{4}{c}{ddddddddddddddddddd} & \multicolumn{4}{c}{eeeeeeeeeeeeeeeee} & \multicolumn{4}{c}{fffffffffffffff} \\
$P=\beta \cdot x$ & \multicolumn{4}{c}{(4)} & \multicolumn{4}{c}{(3)} & \multicolumn{4}{c}{(1)}\\
gggggggggg & \multicolumn{2}{c}{gggggggg} & \multicolumn{2}{c}{ddddddddd} & \multicolumn{4}{c}{ggggggggg} & \multicolumn{4}{c}{dsdsdsds} \\
$I=\gamma \cdot x$ & \multicolumn{2}{c}{(6)} & \multicolumn{2}{c}{(5)} & \multicolumn{4}{c}{(3)} & \multicolumn{4}{c}{(1)} \\
Calidad canal & \multicolumn{4}{c}{aaaaaaaaaaaa} & \multicolumn{4}{c}{hhhhhhhhhhhhhhhhhhhhhh} & \multicolumn{4}{c}{rrrrrrrrrrrrrrrr} \\
$\Delta = \delta \cdot x$ & \multicolumn{4}{c}{(5)} & \multicolumn{4}{c}{(3)} & \multicolumn{4}{c}{(1)} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}