Sign up ×
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.

Possible Duplicate:
Should I use center or centering for figures and tables?

There are (at least) two ways of centering a single figure / graphic horizontally in a figure float:

1) using \begin{centering} in the float

2) using a \hfill left and right of the figure

What is the better / more robust / more LaTeX way of doing this?

share|improve this question

marked as duplicate by lockstep, Garbage Collector, Harish Kumar, percusse, clemens Sep 12 '12 at 21:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The question you refer to does not include the \hfill option, so I do not think it is a duplicate – Rainer Sep 12 '12 at 15:10
\begin{centering} is wrong. It's \centering. The reason why it still compiles is that \begin{foo} calls \foo and \end{foo} calls \endfoo if it exists. You might have confused it with \begin{center}, but it should not be used in floats because it is intended for normal texts and therefore adds vertical space. – Martin Scharrer Sep 12 '12 at 15:10
Nope - I used it on purpose, because this is what I saw somehwere. – Rainer Sep 12 '12 at 15:17
@Rainer: Well, its still wrong ;-) Please add @username (without any spaces, i.e. @MartinScharrer in my case) to your comments if you answer other comments, so that this user gets notified. The author of the Q or A where the comments are placed under is always notified. – Martin Scharrer Sep 12 '12 at 15:27

2 Answers 2

up vote 4 down vote accepted

The recommended way is

\caption{A nice figure.}

The center environment adds additional unnecessary space around the float.

share|improve this answer
So something like '\renewenvironment{figure}[1][]{ \@float{figure} \centering} {\end@float}' would be the best if it concerns all floats? – Rainer Sep 12 '12 at 15:04
@IanThompson: no, that makes only sense when you have a \caption. without a caption a center environment is the better choice. – Herbert Sep 12 '12 at 15:04
@Herbert --- Good point. I never even considered a float without a caption. – Ian Thompson Sep 12 '12 at 15:05
@IanThompson I agree with Herbert: if a figure can't float, then it doesn't need a caption, because it's part of the text it's in. If it needs a caption, then it may be let to float. However this is more likely for tables than figures. – egreg Sep 12 '12 at 15:11
looks a lot like @lockstep's answer – cmhughes Sep 12 '12 at 15:19

As explained in Should I use center or centering for figures and tables? \centering is recommended. It's AFAIK the standard way to do it. The center environment should not be used because it adds vertical space and is not intended for images. \hfill is a low-level TeX macro, not a LaTeX macro. It can be used by experienced users to get special behavior but should only be used if required.

Note that you can also center (or right align) images easily using my adjustbox package. It allows you to add a center key to \includegraphics or even turn an image directly into a figure:


\usepackage{mwe}% For example images only



    \caption{Caption (already centered).}

    \caption{Caption (already centered).}


\adjustimage{width=.8\textwidth,center,caption=[Short Caption]{Long Caption},label=fig:example3,figure}{image}


share|improve this answer
In addition, the thread also mentions floatrow package - many ways. Thanks for clarifying the \hfill option. – Rainer Sep 12 '12 at 15:19

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