4

I have a figure with a caption and it doesn't seem to center properly. It seems to left justify the figure:

\begin{figure}
{\centering\includegraphics[width=.9\textwidth]{figures/afigure}}

\protect\caption{Some Title\label{fig:some_label}}

\vspace{.3cm}

\footnotesize

A really nice description of the plot that you see above. It talks about all the interesting aspects of this plot. 

\normalsize

\end{figure}
1
  • it doesn't do any harm but \protect looks very odd there (it never does anything useful if it is not in the argument of some other command that needs it (a "moving argument") Aug 15, 2016 at 7:47

1 Answer 1

4

You have two choices:

  • Remove the pair of curly braces that enclose the \centering and \includegraphics statements.

  • If you want to keep the pair of curly braces, insert \par just ahead of the closing curly brace, }.

4
  • could you elaborate on what's going on? i thought to keep the centering limited to the includegraphics i need to enclose it in {}?
    – Alex
    Aug 14, 2016 at 22:29
  • @alex - See my edit: I've added a second option: to insert a \par statement just before the closing curly brace.
    – Mico
    Aug 14, 2016 at 22:30
  • could you explain why that is happening though?
    – Alex
    Aug 14, 2016 at 22:33
  • @Alex - What's "happening" is that \centering is applied at the end of what TeX considers to be "currently active paragraph". In your code, though, there's no paragraph break inside the group that contains the \includegraphics statement; hence, the \centering instruction ends up having no effect. To get the desired centering, either insert an explicit \par instruction inside the TeX group, or just omit the curly braces.
    – Mico
    Aug 14, 2016 at 22:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .