Payload LogoOctree

LaTeX Table Spacing: Row and Column Separation

Date Published

Table Spacing in LaTeX

Create well-spaced, readable tables by controlling row and column separation.

Row Spacing

\arraystretch

Multiply all row heights:

\renewcommand{\arraystretch}{1.5}

\begin{tabular}{|c|c|} \hline Cell 1 & Cell 2 \\ \hline Cell 3 & Cell 4 \\ \hline \end{tabular}

Reset afterward:

\renewcommand{\arraystretch}{1.0}

Extra Space on Individual Rows

Add space after a row:

Row content \\[1ex]

The [1ex] adds 1ex of vertical space.

\addlinespace (booktabs)

\usepackage{booktabs}

\begin{tabular}{cc} \toprule A & B \\ \midrule 1 & 2 \\ \addlinespace 3 & 4 \\ \bottomrule \end{tabular}

Column Spacing

\tabcolsep

Space between columns (half the total gap):

\setlength{\tabcolsep}{10pt}

Default is 6pt.

@{} to Remove Padding

\begin{tabular}{@{}cc@{}}

Removes space at edges.

Custom Spacing Between Columns

\begin{tabular}{c@{\hspace{1cm}}c}

Adds 1cm between columns.

Cell Padding

Vertical Padding

Use \rule for invisible struts:

\rule{0pt}{3ex} — adds height above

\rule[-1ex]{0pt}{0pt} — adds depth below

Or use the cellspace package:

\usepackage{cellspace}

\begin{tabular}{S{c}S{c}}

Adds automatic padding.

Horizontal Padding

Use \hspace in cells:

\hspace{5pt}Content\hspace{5pt}

The array Package

Enhanced column types:

\usepackage{array}

\begin{tabular}{>{\hspace{1em}}c<{\hspace{1em}}}

Adds space before and after column content.

Professional Tables with booktabs

\usepackage{booktabs}

\begin{tabular}{lcc} \toprule Name & Value 1 & Value 2 \\ \midrule Item A & 10 & 20 \\ Item B & 15 & 25 \\ \bottomrule \end{tabular}

Key commands: \toprule — thick line at top \midrule — medium line for headers \bottomrule — thick line at bottom \cmidrule{2-3} — partial line

Fixed-Width Columns

p{width} — top-aligned paragraph m{width} — middle-aligned (requires array) b{width} — bottom-aligned

\begin{tabular}{p{3cm}p{3cm}}

Multirow and Multicolumn

Span Multiple Columns

\multicolumn{2}{c}{Spanning two columns}

Span Multiple Rows

\usepackage{multirow}

\multirow{2}{*}{Spanning}

Full Example

\renewcommand{\arraystretch}{1.3} \setlength{\tabcolsep}{12pt}

\begin{tabular}{lcc} \toprule \textbf{Item} & \textbf{Qty} & \textbf{Price} \\ \midrule Widget A & 10 & \$5.00 \\ Widget B & 25 & \$3.50 \\ \addlinespace \textbf{Total} & 35 & \$137.50 \\ \bottomrule \end{tabular}

Common Issues

Problem: Table too cramped Solution: Increase \arraystretch and \tabcolsep

Problem: Headers touching lines Solution: Add \\[0.5ex] after header row

Problem: Inconsistent spacing Solution: Use booktabs for professional look

Format Tables with Octree

Octree simplifies table creation:

- Visual table editor - Automatic spacing adjustment - Preview changes instantly - Export polished documents

Try it at https://useoctree.com