I want to make below table using latex. But I don't know how to combine \multirow and \multicolumn. How can I make below table using latex?
Thank you very much.
I want to make below table using latex. But I don't know how to combine \multirow and \multicolumn. How can I make below table using latex?
Thank you very much.
There's no need for \multirow:
\documentclass{article}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{tabular}{|*{5}{C{.5in}|}}
\hline
& \multicolumn{2}{c|}{\bfseries 1} & \multicolumn{2}{c|}{\bfseries 2} \\
\cline{2-5}
& 1 & 2 & 1 & 2 \\
\hline
1 & A & A & A & A \\
\hline
2 & B & B & B & B \\
\hline
3 & C & C & C & C \\
\hline
\end{tabular}
\end{document}
Using \usepackage{tabularx,multirow}. Here is an example of a table mixing \multicolumn{numberOfColumns}{position}{text} and \multirow{numberOfrows}{*}{text} (* to use the natural width of the contents or directly enter the width of the cell).
\begin{table}[!ht]
\centering
\caption{caption}
\begin{tabular}{lc c r l r l}
\hline
col1 & col2 & col3 & \multicolumn{2}{c}{col4} & \multicolumn{2}{c}{col5} \\
\hline
\multirow{2}{*}{multirow1} & row1 & 1 & 1 & 2 & \multicolumn{2}{c}{--} \\
& row2 & 1 & 1 & 2 & 1 & 3 \\
\hline
\multirow{2}{*}{multirow2} & row1 & 1 & 1 & 2 & \multicolumn{2}{c}{--} \\
& row2 & 1 & 1 & 2 & 1 & 3 \\
\hline
\end{tabular}
\label{tab1}
\end{table}
\multirow. – egreg Sep 26 '16 at 17:29