[Tex/LaTex] Should I use center or centering for figures and tables

floatshorizontal alignment

What is the correct way to center figures and tables (figure, table)?

\begin{center}
...
\end{center}

or

\begin{centering}
...
\end{centering}

Best Answer

The correct way is

\begin{figure}
\centering
... (Code for pictures, captions) ...
\end{figure}

\begin{center} ... \end{center} inside a figure environment will result in (generally unwanted) additional vertical space.

Note that while \centering produces proper spacing, manually adding this command to every figure environment (and to every table and custom-made float) is tedious and goes against the idea of separating the content of a document from the format. Even better ways are to add the following to your document preamble (thanks to egreg for the tip):

\makeatletter
\g@addto@macro\@floatboxreset\centering
\makeatother

or to load the floatrow package which allows to control the justification of float contents from the preamble (with objectset=centering as default).