Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical Supply Distributor100,000+ medical supplies. 48-hour critical dispatch.Ships from 8 regional U.S. hubs. Net-30 terms for verified institutional accounts.Shop lac.us CodeCASRAIlac.us

Centering in LaTeX: center vs centering for Figures and Equations

How to center text, images and equations in LaTeX: the center environment versus the centering command, plus ragged2e and gather.

Written and maintained by CASRAI Editorial Board

Last updated

To center text in LaTeX, wrap it in \begin{center} ... \end{center}; to center something inside a figure or table float, put \centering at the start of the float instead. The two do the same job horizontally but differ in vertical spacing and scope, which is the part most answers skip. This guide is for researchers writing papers, theses and reports in LaTeX, and by the end you can pick the right command for a paragraph, a figure, a table or an equation.

Which centering command to use (decision table)

What you are centering Use Why (source)
A standalone paragraph or block of lines in the body text \begin{center} ... \end{center} Overleaf calls it the default LaTeX environment for centered text.
An image or table inside a figure or table float \centering The center environment is built on LaTeX’s list code and adds space around itself; \centering adds none (TeX FAQ; LaTeX2e reference).
Centered text that should hyphenate and break lines well \begin{Center} ... \end{Center} or \Centering from ragged2e Overleaf, Text alignment.
Several display equations, each centered, with no alignment between them gather or gather* (amsmath) Overleaf, Aligning equations with amsmath.
Equations lined up at a chosen point such as = align or align* with & Overleaf, Aligning equations with amsmath.

What it is used for in research

Centering shows up in three places in a typical manuscript: a centered block such as a dedication or epigraph, figures and tables that sit in the middle of the text column, and display equations. Each has a different correct command, and mixing them up is the usual cause of stray gaps in a float. Related layout controls are covered in Indentation in LaTeX, and figure construction in LaTeX Figure: Insert an Image, Caption It and Add Subfigures.

Install or access

center and \centering are part of core LaTeX, so no package is needed. The Center environment and \Centering command come from the ragged2e package (\usepackage{ragged2e}), and gather and align come from amsmath (\usepackage{amsmath}). Any LaTeX editor or online LaTeX service can compile these examples.

How to center text in LaTeX

How do I align a text to the center?

Use the center environment. The LaTeX2e reference describes it as creating a new paragraph of lines centered between the left and right margins.

  1. Type \begin{center} on its own line where the centered text should start.
  2. Write the text. Use a double backslash \\ to force a line break; each resulting line is centered separately. A \\ after the last line is optional and adds no vertical space.
  3. Close with \end{center}.
\begin{center}
First line of the block \\
Second line of the block
\end{center}

Text too long for one line is broken for you without hyphenation and without stretching or shrinking interword spaces. In a two-column document the text is centered within the column, not across the page.

Centering with the centering declaration

\centering is a declaration, not an environment. Use it as {\centering ... } in braces or inside another environment. It lasts until the enclosing braces or group end, and it adds no vertical space above or below. It does not start a paragraph: if the scope ends mid-paragraph, only the lines before the break are centered. To center separate lines as their own paragraph, end the scope with \par or a blank line.

{\centering
A centered paragraph.

}
Back to normal text alignment.

Centered text with better line breaking (ragged2e)

The standard commands avoid hyphenation in centered lines. The ragged2e package provides Center (note the capital) and \Centering; Overleaf’s example places \Centering before a paragraph and \justifying after it to return to justified text.

How do I align an image to the center?

Put \centering as the first command inside the float, before \includegraphics. The LaTeX2e reference gives exactly this pattern:

\begin{figure}
  \centering
  \includegraphics[width=0.6\textwidth]{ctan_lion.png}
  \caption{CTAN Lion}  \label{fig:CTANLion}
\end{figure}

The declaration ends at \end{figure}, so nothing after the float is affected. The same placement works inside a table float before the tabular. Why not center? The TeX FAQ explains that center is based on LaTeX’s list-handling code, and lists always separate themselves from surrounding material, which produces extra vertical space in a float. Its fix is to use generic layout commands such as \centering instead. For cross-referencing the figure afterwards, see LaTeX ref: Cross-Referencing Figures and Syntax.

How to center equations in Overleaf

Overleaf’s amsmath page says that to have equations centered with no alignment between them, use the gather environment. To line equations up at chosen points, use align and mark the alignment point with &. Adding * (gather*, align*) suppresses equation numbers. This works the same in any LaTeX editor, since it only needs amsmath.

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

Output and how to read it

A correct result is a block (or float contents) whose lines sit symmetrically between the margins, with normal spacing before and after. If a float shows a larger gap above or below its contents than neighbouring floats, suspect a center environment inside the float. If only part of a paragraph is centered, the scope of a \centering ended early.

Troubleshooting

  • Extra white space around a centered figure or table. Replace \begin{center}...\end{center} inside the float with \centering (TeX FAQ, Extra vertical space in floats).
  • Only the first lines are centered. \centering changes line formatting of the current paragraph; end its scope with \par or a blank line so the centered lines form a complete paragraph (LaTeX2e reference).
  • Centering is not applied across the whole page in two columns. Centering is relative to the column, not the page.
  • Odd line breaks in centered prose. Standard centering does not hyphenate; try the Center environment from ragged2e.

Alternatives and variants (table)

Command Kind Package Vertical space added
center Environment Core LaTeX Yes, above and below
\centering Declaration Core LaTeX None
Center / \Centering Environment / declaration ragged2e Not stated in the source read
gather, gather* Equation environment amsmath Not applicable (display math)

FAQ

How to center text in LaTeX?

Wrap it in \begin{center} ... \end{center}, or use \centering inside a group, figure or table.

What is the difference between center and centering?

center is an environment that starts a new paragraph and adds vertical space above and below; \centering is a declaration that adds none and is meant for floats and boxes.

How do I align an image to the center?

Start the figure environment’s body with \centering, then \includegraphics.

How to center equations in Overleaf?

Use gather (or gather*) from amsmath for centered equations with no alignment between them.

For working with LaTeX collaboratively, see LaTeX and Overleaf collaborative writing.

Sources

Follow CASRAI

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

Ask CASRAI · free to try

Ask about Centering in LaTeX: center vs centering for Figures and Equations

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 →