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:
centerand\centeringare part of standard LaTeX and need no package. - ragged2e: adds
Centerand\Centering. Load it with\usepackage{ragged2e}in the preamble. - amsmath: provides
align,align*,gatherandgather*. 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
- For a block of text, wrap it in the environment:
\begin{center} This text is centred. \end{center} - To switch centring on with a command, put
\centeringbefore the text it should affect. - If the default result looks uneven, add
\usepackage{ragged2e}to the preamble and use\begin{Center} ... \end{Center}or\Centeringinstead.
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
centeror\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)
- Overleaf, Text alignment, read 2026-11-07.
- Overleaf, Aligning equations with amsmath, read 2026-11-07.
- MiKTeX, About MiKTeX, read 2026-11-07.







