Skip to main content
v2026.11,986 entries · CC-BY 4.0

Align LaTeX Center: center, centering and gather

How to align LaTeX center: when to use center, centering, ragged2e Center, gather or align, with left/right counterparts.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

Who this is for: researchers writing papers, theses or reports in LaTeX who need to centre text or equations, or who are unsure whether they want center, \centering, gather or align. After reading you can pick the right command for each case and write it correctly.

Short answer: to centre text in standard LaTeX use the center environment or the \centering command. To centre equations with no alignment between them use gather. The align environment does something different: it lines equations up at an & marker rather than centring them as text.

What it is used for in research

Centring comes up for title blocks, captions, short displayed lines and displayed equations. In LaTeX the word “align” covers two separate jobs, and searchers often mix them up: horizontal alignment of text (left, centre, right) and vertical alignment of several equations at a chosen point. Overleaf’s documentation on text alignment covers the first, and its page on aligning equations with amsmath covers the second.

Install or access (official source only)

Both approaches below are documented by Overleaf and need nothing beyond a LaTeX installation.

  • Standard LaTeX: center and \centering are part of standard LaTeX and need no package.
  • ragged2e: adds Center and \Centering. Load it with \usepackage{ragged2e} in the preamble.
  • amsmath: provides align, align*, gather and gather*. Load it with \usepackage{amsmath}.

To run LaTeX you can use an online editor such as Overleaf, or install a distribution on your own computer. MiKTeX, for example, describes itself on its about page as an up-to-date implementation of TeX/LaTeX for Windows, macOS and Linux, with a package manager that fetches missing components when needed.

Step-by-step task

Align LaTeX center: choose the command for your case

What you want to centre Use Package
A block of text \begin{center} ... \end{center} none (standard LaTeX)
Everything that follows, as a switch \centering none (standard LaTeX)
Text with less ragged edges \begin{Center} ... \end{Center} or \Centering ragged2e
Equations centred, no alignment between them \begin{gather*} ... \end{gather*} amsmath
Equations lined up at a chosen point (usually before =) \begin{align*} ... \end{align*} with & amsmath

Center align in LaTeX: text with center and \centering

  1. For a block of text, wrap it in the environment:
    \begin{center}
    This text is centred.
    \end{center}
  2. To switch centring on with a command, put \centering before the text it should affect.
  3. If the default result looks uneven, add \usepackage{ragged2e} to the preamble and use \begin{Center} ... \end{Center} or \Centering instead.

Overleaf’s text alignment page lists the matching tools for each direction, shown in the next table.

Left, right, centre and justified counterparts

Alignment Environment Command ragged2e environment ragged2e command
Left flushleft \raggedright FlushLeft \RaggedRight
Right flushright \raggedleft FlushRight \RaggedLeft
Centre center \centering Center \Centering
Fully justified justify (ragged2e) \justifying (ragged2e) see ragged2e

This table also answers the searches “LaTeX align left” and “LaTeX left align after centering”: after a centred passage, switch to left alignment with flushleft or \raggedright. Overleaf shows the same idea with ragged2e commands in one document: \Centering text \vspace{5mm} \justifying text.

Align LaTeX center equation, formula or graph

For several equations that should each be centred with no relation to one another, use gather. Overleaf describes consecutive gather equations as centred with no alignment whatsoever:

\begin{gather*}
2x - 5y = 8 \\
3x^2 + 9y = 3a + c
\end{gather*}

If instead the equations should line up vertically, use align and mark the alignment point with &, usually before =, < or >:

\begin{align*}
2x - 5y &= 8 \\
3x + 9y &= -12
\end{align*}

The starred forms (align*, gather*) suppress equation numbers; without the asterisk the equations are numbered. Wider layouts use extra & pairs for additional columns in align.

Output and how to read it

  • With center or \centering, each line of the block sits in the middle of the text width.
  • With gather*, each equation is centred independently, so equals signs do not line up.
  • With align*, the equals signs (or whichever symbol follows your &) form a vertical column.

For figure placement, the same text-centring commands apply; see the CASRAI guide on including figures in LaTeX. For matrices and other displayed math layouts, see matrices in LaTeX, and for cross-references to equations see cross-referencing in LaTeX. A related paragraph-formatting guide is indentation in LaTeX.

Troubleshooting

My equations are not centred the way I expected

If you used align without any &, or expected it to behave like centred text, switch to gather: Overleaf documents align as the tool for vertical alignment at & points and gather as the tool for centred equations with no alignment.

Centred text looks too ragged

Overleaf notes that standard \raggedright can produce results that look “too ragged”, and that ragged2e allows hyphenation when a line is too short, giving a more uniformly ragged edge. The same package supplies Center and \Centering.

Center or \Centering is undefined

These come from ragged2e, not from standard LaTeX. Add \usepackage{ragged2e} to the preamble. Lowercase center and \centering need no package.

Equation numbers appear (or do not) when I do not want that

The asterisk toggles numbering: align and gather number each line; align* and gather* do not.

Free alternatives (table)

Tool What it is, per its own documentation
Overleaf Online LaTeX editor whose Learn pages document center, \centering, ragged2e, align and gather as used above.
MiKTeX Open-source TeX/LaTeX implementation for Windows, macOS and Linux with a Portable Edition and TeXworks as an editing front end (miktex.org/about, read 2026-11-07).

FAQ

How do I align LaTeX center text?

Wrap the text in \begin{center} ... \end{center} or place \centering before it. Both are standard LaTeX; ragged2e adds Center and \Centering if you want less ragged results.

How do I centre an equation in LaTeX?

Use gather (or gather* for no numbers) from amsmath.

What is the difference between align and center?

center centres text. align aligns several equations vertically at the & marker. They solve different problems.

How do I go back to left alignment after centring?

Use flushleft or \raggedright (or FlushLeft and \RaggedRight with ragged2e), as listed in the counterparts table above.

Sources (official docs)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Align LaTeX Center: center, centering and gather

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →