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}
Best Answer
First of all,
\centering
needs a\par
(or an empty line) before the closing braceUsually it's used inside some environment that provides the necessary
\par
, such asminipage
orfigure
. Tryto 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 oftrivlist
.Note that it's an error to use
because this will last “forever” (up to the end of the current group, anyway). The command exists just as a side effect of the existence of the
center
environment.