Tables

LaTeX Table Formatting: Fonts, Sizes and Styles

Change LaTeX table fonts, sizes and styles: shrink table text, make cells bold or italic, switch font families, and scale whole tables down to fit.

On this page
  1. Which font LaTeX uses by default
  2. Font families, series and shapes
  3. Style text inside cells
  4. Making table font smaller
  5. Resizing a whole table
  6. Column widths and row height
  7. Fonts you can use in LaTeX
  8. Captions and table labels
  9. Quick reference

Tables in LaTeX inherit the fonts of the surrounding document. To change how a table looks, you adjust its font size, family, weight or style, either for the whole table or for single cells. You can also change column widths, row heights and the size of the table as a whole. This guide covers each of those, with examples for a standard article document.

Which font LaTeX uses by default

LaTeX doesn’t use Word’s fonts. Unless you change it, the standard document classes set text in Computer Modern, and tables use that font too.

The base font size comes from the class option in \documentclass. The standard article, report and book classes accept 10pt, 11pt and 12pt, and 10pt is the default. Size commands are relative to that base size, so the exact point size depends on the option. With the default 10pt, \small sets text at 9pt.

Font families, series and shapes

LaTeX’s font system describes each font with three settings. Knowing them makes the commands easier to remember.

Setting Options Declarations
Family Roman (serif), sans serif, typewriter (monospace) \rmfamily, \sffamily, \ttfamily
Series Medium (normal), bold \mdseries, \bfseries
Shape Upright, italic, slanted, small caps \upshape, \itshape, \slshape, \scshape

Declarations such as \bfseries last until the end of the current group. To limit the change to one cell, use braces or a text command such as \textbf{...}. If a combination is not available in the current font, LaTeX substitutes a similar shape and prints a font warning.

Style text inside cells

The text commands \textbf, \textit, \textsc and \texttt style only their argument:

\begin{tabular}{lcc}
  \hline
  \textbf{Item} & \textbf{Unit} & \textbf{Code} \\
  \hline
  Apples & kg & \texttt{AP-01} \\
  Pears & kg & \texttt{PE-02} \\
  \hline
\end{tabular}

\emph{...} is also useful for emphasis. It switches to italic in upright text and back to upright inside italic text.

To style a whole column, add the declaration to its column type with the array package. The >{...} part runs before each cell in that column, and the header row is included:

\usepackage{array}

\begin{tabular}{>{\bfseries}l c}
  Item & Count \\
  Apples & 12 \\
\end{tabular}

For colored text, the xcolor package provides \textcolor{red}{...}, which works inside cells the same way as \textbf. If a bold header spans several columns, put the style inside the merged cell’s content, for example \multicolumn{2}{|c|}{\textbf{Header}}. The merge cells guide explains the \multicolumn syntax.

Making table font smaller

To make table font smaller, wrap the tabular in a size command inside braces. The braces keep the change inside the group, so the caption and the text around the table stay at normal size.

\begin{table}[ht]
  \centering
  {\small
  \begin{tabular}{lrr}
    \hline
    Item & Count & Price \\
    \hline
    Apples & 12 & 3.50 \\
    Pears & 7 & 4.20 \\
    \hline
  \end{tabular}
  }
  \caption{Fruit prices with smaller table text.}
\end{table}

Without the braces, \small stays in effect for the rest of the float, so the caption shrinks too. Use \footnotesize or \scriptsize for a larger reduction. Very small sizes can be hard to read in print, so check the printed output.

Resizing a whole table

Size commands change the text but not the rules or the spacing between rows. To shrink everything, including the lines, scale the table. The graphicx package provides \resizebox:

\usepackage{graphicx}

\begin{table}[ht]
  \centering
  \resizebox{\textwidth}{!}{%
    \begin{tabular}{lrrr}
      \hline
      Item & Count & Price & Total \\
      \hline
      Apples & 12 & 3.50 & 42.00 \\
      \hline
    \end{tabular}%
  }
  \caption{Fruit totals.}
\end{table}

The ! keeps the table’s proportions. \resizebox also enlarges a table that is narrower than the target width, and it scales the text along with everything else, so a very wide table can end up hard to read. \scalebox{0.8}{...} scales by a fixed factor instead. The adjustbox package has a max width option, as in \begin{adjustbox}{max width=\textwidth}, which shrinks a table only when it is too wide.

Column widths and row height

A p column type sets a fixed width and wraps the text, for example p{4cm}. The m and b types from array vertically center or bottom-align the cell. The tabularx package provides X columns that stretch to fill a set total width.

\arraystretch controls the space between rows. Its default is 1. \tabcolsep controls the padding on each side of a cell, and its default is 6pt in the standard classes:

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

Put these in the preamble to affect the whole document, or inside a group to limit them to one table.

Fonts you can use in LaTeX

With pdfLaTeX, the usual way to change the font is to load a font package in the preamble. Standard packages include times (Times-style text), palatino (Palatino-style text), helvet (Helvetica-style sans serif) and courier (Courier-style monospace). For example:

\usepackage{palatino}

To make the sans serif font the default for the whole document, load helvet and set the family default:

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

With XeLaTeX or LuaLaTeX, use fontspec and choose any font installed on your system. This does not work with pdfLaTeX:

\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}

Tables follow the document font, so a change to the main font also applies to the table text.

Captions and table labels

The caption uses the document font. To make captions smaller, or to style them separately from the table, use the caption package:

\usepackage{caption}
\captionsetup{font=small}

This changes only the caption. To change the word Table in the label, see how to change the table caption name in LaTeX.

Quick reference

Goal Command or package Notes
Smaller table text {\small ...} around the tabular Braces keep the caption at normal size
Scale the whole table \resizebox (graphicx) Scales lines and spacing too
Bold one cell \textbf{...} Text commands limit the change to one cell
Bold a whole column >{\bfseries}l (array) Applies to the header too
Change the font family \sffamily, \ttfamily, \rmfamily Use \textsf{...} for one cell
Change the row height \renewcommand{\arraystretch}{...} Default is 1
Wrap text in a column p{4cm} Sets a fixed width

Keep exploring

Guides from other topics

All topics →