Underleaf Logo
Underleaf
BlogPricing
Log InTry Free

Learn LaTeX

Getting Started

  • What is LaTeX?
  • LaTeX for Beginners

Merging Table Cells in LaTeX: \multicolumn and \multirow

Horizontal merges are \multicolumn, built into LaTeX. Vertical merges are \multirow, from the package of the same name. They combine, with one non-obvious rule about empty placeholder cells that this page spells out. (New to tables entirely? Start with the tables guide.)

\multicolumn: spanning columns

Three arguments: how many columns to swallow, the alignment spec for the merged cell, the content. The second argument replaces the column spec for that stretch — including the vertical bars. That is why the example writes {|c|}: forget the bars and the table's border develops a gap exactly one header wide, which is the most common \multicolumn bug report.

A useful degenerate case: \multicolumn{1}{c}{...} overrides the alignment of a single cell — the standard way to center one header over a column of right-aligned numbers.

\multirow: spanning rows

The * in the width slot means "natural width" — right for short labels. Give a real width like {3cm} only when you want the cell's text to wrap.

The rule that trips people: the rows being spanned still need their cell in that column — an empty one, hence the bare & opening the second row above. \multirow only draws text across rows; the table grid underneath is unchanged, and every row must still account for every column.

Spanning rows AND columns

Wrap the \multirow inside the \multicolumn — that nesting order, not the other way around. The second row then needs an empty \multicolumn of the same width as a placeholder:

Miss the empty \multicolumn{2}{|c|}{} on the second row and the column count no longer adds up — you get Extra alignment tab has been changed to \cr, an error message with no obvious connection to its cause.

With booktabs: \cmidrule under spanning headers

In a booktabs table you do not run a full rule under a spanning header — you underline just its columns with \cmidrule(lr){2-3}. The (lr) trims the rule at both ends so adjacent rules do not fuse into one line:

This header pattern — grouped columns, trimmed partial rules, no vertical bars anywhere — is the standard for results tables in papers, and referees recognize it on sight.

When multirow's centering drifts

\multirow positions its content by assuming the spanned rows have normal height. A tall neighbor — a stacked fraction, an \includegraphics, a wrapped paragraph — stretches the rows and the label ends up visibly high or low. Escalate through these fixes:

  • Span more "virtual" rows or use the optional fixup argument: \multirow{2}[2]{*}{...} shifts the anchor by half-line steps (its exact meaning depends on bigstruts, but in practice you tune the integer until it sits right)
  • Brute-force the position: \multirow{2}{*}{\raisebox{-4pt}{Label}}
  • Rethink: move the tall content out of the spanned rows, or transpose the table so the merge becomes a \multicolumn

Full worked example

A grouped header spanning two columns plus a row label spanning two rows, in booktabs style — the shape most results tables reduce to:

Every merged-cell technique on this page appears here once: \multicolumn for the group header, \cmidrule trimmed under it, \multirow for the model names, and empty cells holding the grid together.

Frequently asked questions

How do I merge cells horizontally in a LaTeX table?

\multicolumn{2}{c}{Header} merges 2 cells with centered content. It is built into LaTeX — no package. The three arguments are: number of columns to span, the alignment spec for the merged cell (including any vertical bars, which you must restate), and the content.

How do I merge cells vertically in LaTeX?

\multirow{2}{*}{Label} from the multirow package spans 2 rows; the * lets the content set its own width. On the rows below, leave that column's cell empty — the text was already placed by \multirow, the empty cell just reserves the space.

Can a cell span both rows and columns?

Yes: wrap a \multirow inside a \multicolumn, e.g. \multicolumn{2}{c}{\multirow{2}{*}{Big cell}}. On the following row, put an empty \multicolumn{2}{c}{} in the same position so the column count still adds up.

Why is my multirow text not vertically centered?

\multirow centers based on its row-count argument assuming normal-height rows. Tall content in neighboring cells stretches the rows and the estimate drifts. Nudge it with the optional vpos/fixup arguments or wrap the content in \raisebox — or better, restructure so the tall content is not fighting the span.

Try it free

Skip the syntax — let AI write it.

Snap a photo of an equation, a table, or full handwritten notes and Underleaf turns it into clean, compilable LaTeX in seconds. 10 free credits every month, no credit card required.

Convert your page
Handwritten notes converted into a typeset LaTeX document

Merging Table Cells in LaTeX: \multicolumn and \multirow

Horizontal merges are \multicolumn, built into LaTeX. Vertical merges are \multirow, from the package of the same name. They combine, with one non-obvious rule about empty placeholder cells that this page spells out. (New to tables entirely? Start with the tables guide.)

\multicolumn: spanning columns

Three arguments: how many columns to swallow, the alignment spec for the merged cell, the content. The second argument replaces the column spec for that stretch — including the vertical bars. That is why the example writes {|c|}: forget the bars and the table's border develops a gap exactly one header wide, which is the most common \multicolumn bug report.

A useful degenerate case: \multicolumn{1}{c}{...} overrides the alignment of a single cell — the standard way to center one header over a column of right-aligned numbers.

\multirow: spanning rows

The * in the width slot means "natural width" — right for short labels. Give a real width like {3cm} only when you want the cell's text to wrap.

The rule that trips people: the rows being spanned still need their cell in that column — an empty one, hence the bare & opening the second row above. \multirow only draws text across rows; the table grid underneath is unchanged, and every row must still account for every column.

Spanning rows AND columns

Wrap the \multirow inside the \multicolumn — that nesting order, not the other way around. The second row then needs an empty \multicolumn of the same width as a placeholder:

Miss the empty \multicolumn{2}{|c|}{} on the second row and the column count no longer adds up — you get Extra alignment tab has been changed to \cr, an error message with no obvious connection to its cause.

With booktabs: \cmidrule under spanning headers

In a booktabs table you do not run a full rule under a spanning header — you underline just its columns with \cmidrule(lr){2-3}. The (lr) trims the rule at both ends so adjacent rules do not fuse into one line:

This header pattern — grouped columns, trimmed partial rules, no vertical bars anywhere — is the standard for results tables in papers, and referees recognize it on sight.

When multirow's centering drifts

\multirow positions its content by assuming the spanned rows have normal height. A tall neighbor — a stacked fraction, an \includegraphics, a wrapped paragraph — stretches the rows and the label ends up visibly high or low. Escalate through these fixes:

  • Span more "virtual" rows or use the optional fixup argument: \multirow{2}[2]{*}{...} shifts the anchor by half-line steps (its exact meaning depends on bigstruts, but in practice you tune the integer until it sits right)
  • Brute-force the position: \multirow{2}{*}{\raisebox{-4pt}{Label}}
  • Rethink: move the tall content out of the spanned rows, or transpose the table so the merge becomes a \multicolumn

Full worked example

A grouped header spanning two columns plus a row label spanning two rows, in booktabs style — the shape most results tables reduce to:

Every merged-cell technique on this page appears here once: \multicolumn for the group header, \cmidrule trimmed under it, \multirow for the model names, and empty cells holding the grid together.

Frequently asked questions

How do I merge cells horizontally in a LaTeX table?

\multicolumn{2}{c}{Header} merges 2 cells with centered content. It is built into LaTeX — no package. The three arguments are: number of columns to span, the alignment spec for the merged cell (including any vertical bars, which you must restate), and the content.

How do I merge cells vertically in LaTeX?

\multirow{2}{*}{Label} from the multirow package spans 2 rows; the * lets the content set its own width. On the rows below, leave that column's cell empty — the text was already placed by \multirow, the empty cell just reserves the space.

Can a cell span both rows and columns?

Yes: wrap a \multirow inside a \multicolumn, e.g. \multicolumn{2}{c}{\multirow{2}{*}{Big cell}}. On the following row, put an empty \multicolumn{2}{c}{} in the same position so the column count still adds up.

Why is my multirow text not vertically centered?

\multirow centers based on its row-count argument assuming normal-height rows. Tall content in neighboring cells stretches the rows and the estimate drifts. Nudge it with the optional vpos/fixup arguments or wrap the content in \raisebox — or better, restructure so the tall content is not fighting the span.

Underleaf Logo
Underleaf

Empowering students and researchers with AI-powered tools for academic writing.

Go to appContact us

Company

PricingBlogTutorialsConference TemplatesConference Deadlines

Free Tools

Image to LaTeXExcel to LaTeXArXiv to LaTeXTikZ GeneratorLaTeX Table GeneratorCitation GeneratorThesis GeneratorChrome ExtensionAll Tools

Ask AI about Underleaf

Ask ChatGPTAsk ClaudeAsk Perplexity

© 2026 Underleaf. All rights reserved.