Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

After reading this question Should I use center or centering for figures?, I want to know the answer of the following.

When should we use \begin{center} instead of \centering?

For example, should we use this one?

{%
\centering
<other contents>
}

or this one?

\begin{center}
<other contents>
\end{center}
share|improve this question

1 Answer

up vote 28 down vote accepted

First of all, \centering needs a \par (or an empty line) before the closing brace

{\centering
  contents\par
}

Usually it's used inside some environment that provides the necessary \par, such as minipage or figure. Try

abc{\centering def}ghi

to see the effect.

The main difference with center is that \centering doesn't leave vertical space before and after it: \begin{center} is defined in terms of trivlist.

\def\center{\trivlist \centering\item\relax}
\def\endcenter{\endtrivlist}
\def\centering{%
  \let\\\@centercr
  \rightskip\@flushglue\leftskip\@flushglue
  \parindent\z@\parfillskip\z@skip}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.