center vs. centering

A frequently seen mistake is to use \begin{center} … \end{center} inside a figure or table environment. This center environment can cause additional vertical space. If you want to avoid that just use \centering instead like in this example:


The additional space of the center environment is caused by a trivlist environment. Its defined by latex.ltx:

\def\center{\trivlist \centering\item\relax}

As you can see \center calls \centering too. By directly using \centering you could omit that trivlist.

Inside normal text \begin{center} … \end{center} is useful of course to center and to generate vertical space between the centered text and the surrounding text.

Concerning \centering it’s advisable to limit its scope by grouping. Inside a figure or table environment it’s already limited, but inside normal text you should use curly braces or \begingroup\centering … \endgroup:

{\centering Text

As you can see I set an empty line before closing the centered group. If I do not end the paragraph by a paragraph break or the line by \\ then the following text outside the group will be centered too. \centering is also defined by latex.ltx:


It’s using \leftskip and \rightskip to flush left and right.

This topic was discussed in the LaTeX Community Forum, on and on

13. June 2008 by stefan
Categories: Figures and Tables | 8 comments

Comments (8)

  1. Pingback: » Blog Archive » Automatic Table Row Numbers in LaTeX

  2. > … then the following text outside the group will be centered too.

    Is this a bug? Why does it do this?

  3. @Yoo:

    No, it’s just because center is a switch: you switch on centered typesetting. Unless it’s turned off again (switched to left-aligned, say), LaTeX will continue centering. Everything’s fine there. The scope is a paragraph, as determined by the TeX engine.

  4. how to end centering?

  5. Pingback: ATTN: Studenten steun- en klaagthread - Deel 22 - Pagina 117 - 9lives - Games Forum

  6. Just give it a scope {centering …}

  7. Regards,

    First, I want congratulate to you for your excellent site.
    My question is not about “center vs. centering”, but about the plugin that do you use for write latex code in your page.
    I look forward you can answer my question.

    Kind regards.

  8. I am trying the given code to center image but its not working.

    \includegraphics[trim=0cm 0cm 0cm 0cm, clip=true,width=\linewidth]{twsd.jpg}
    \caption{Types of WSD}
    and showing a warning:

    `h’ float specifier changed to `ht’.
    output of the above code: here is the output image

    At starting i was using compiler latex and it was working correctly. But now am using xelatex, and the images alignment changed automatically. Please suggest me some way to center the images.

    graphics horizontal-alignment xetex

Leave a Reply to Madhavi Agarwal Cancel reply

Required fields are marked *