I am wanting to create a table as a header in LaTeX. 3 columns, the first cell must span two rows, the second cell must span two rows and the third cell must be split between the two rows. So 4 cells total but 3 columns like the picture below. Im having trouble with the spacing when I try and split the last column into two rows.
How to split a cell in a table in latex?
One first sketch:
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
\multirow{2}{*}{Some text A} & \multirow{2}{*}{Some text B} & Some text C\\
\cline{3-3}
& & Some text D\\
\hline
\end{tabular}
\end{document}
This gives you:
It is not clear to me if you want your middle column to be larger than the two on the sides. Anyway, see this other answer of mine!
Many thanks. When using \centering for text C and D it shifts the clone to the first cell. Is there a fix for this? –
Poesy
@DuncanWilliamGibbons text C and text D are centered by default (check it with a longer text)...and I think \centering within one cell is not the way –
Orran
The tabularray
package makes merging cells very easy:
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\noindent%
\begin{tblr}{
colspec={lXc},
vlines,
hlines
}
\SetCell[r=2]{} some text & \SetCell[r=2]{} some long text some long text some long text & short text\\
&& short text\\
\end{tblr}
\end{document}
© 2022 - 2025 — McMap. All rights reserved.