aoarzot8 Mult-column and mult-row calls in LaTeX table ~ texblog
About Code Snippets Consulting LaTeX Installation
Posting Questions TeX/LaTeX Resources
texblog
because LaTeX matters
Multi-column and multi-row cells in
LaTeX tables
21. December 2012 by tom — 60 Comments
| always forget how to do this. If you have the same problem, here is a quick post for
your bookmarks.
Basic commands
%multi-column
\multicolumn{number cols}{align}{text} % align: 1,c,r
Xmulti-row
\usepackage{multirow}
Nousune
\multirow{number rows}{width}{text}
Using * as width in the multirow command, the text argument's natural width is
used (multirow package documentation)
Multiple columns
ntps:exblog.org/2012/12/21/mut-column-and-muli-ow-cels-r-latextablos! 140aojarzo18
Mult-column and mult-row calls in LaTeX table ~ texblog
1| \documentclass[11pt] {article}
2) \begin{document }
3
4 | \begin{table}[ht]
5 | \caption{multi-column table}
6 | \begin{center}
7'| \begin{tabular}{cc}
8 \hline
9 \multicolumn{2}{¢}{Multi-column}\\
18 X&X\\
1 \hline
12 | \end{tabular}
13 | \end{center}
14) \label{tab:multicol}
15 | \end{table}
16
17 | \end{document}
Multi-column
Multiple rows
1 | \documentclass[11pt] {article}
2| \usepackage{multirow}
3 | \begin{document }
4
5 | \begin{table}[ht]
6 | \caption{multi-row table}
7| \begin{center}
8 | \begin{tabular}{cc}
9 \hline
18 \multirow{2}{*}{Multirow}&Xx\\
11 &X\\
12 \hline
13 | \end{tabular}
14) \end{center}
15 | \label{tab:multicol}
16 | \end{table}
17
18 | \end{document}
-ntps:texblog.org/2012/12/21/mut-column-and-muli-ow-cels-r-latextablos! 2140aoarzot8 Mult-column and mult-row calls in LaTeX table ~ texblog
Multirow —
Multiple rows and columns
\documentclass[11pt]{article}
\usepackage{multirow}
\begin{document}
1
2
3
4
5 | \begin{table}[ht]
6 | \caption{Multi-column and multi-row table}
7
8
9
\begin{center}
\begin{tabular}{ecc}
\hline
10 \multicolumn{2}{c}{\multirow{2}{*}{Multi-col-row}}&X\\
11 \multicolumn{2}{c}{}&X\\
12 \hline
13 XBX8X\\
14 \hline
15 | \end{tabular}
16 | \end{center}
17 | \label{tab:multicol}
18 | \end{table}
20 | \end{document}
Multi-col-row
The examples provided are very basic. Drop me a comment below in case you are
having problems with a more complex table. Also, the color is just for ilustration
purposes and for simplicity reasons not part of the minimal working examples above.
See here for how to color table columns or rows.
Partial horizontal line
-ntps:texblog.org/2012/12/21/mut-column-and-muli-ow-cels-r-latextablos! 3140,