22

I find captions appearing above figures in the PDF output of a latex thesis file using the code below:

\includegraphics{chapter2/fig5.pdf} 
\begin{figure}  
\label{Fig. 5} 
\caption{Time responses using optimal drive sweep rates obtained from a numerical      
parameter search for the: (a) pendulum $(\omega=1, \alpha=-0.01)$, (b) softening
Duffing oscillator $(\epsilon=1/6, \omega=1, \alpha=-0.001)$ and (c) softening  
Duffing-Van der Pol oscillator $(\epsilon=1/6, \omega=1, \mu=0.005, \alpha=-0.01
$) using the  downward swept drive $(F \cos(\omega t-0.5(\alpha t^2)), F=0.5) $ }
\end{figure}

I presume the problem has to do with the lengthy caption. I read a similar question on this site but unfortunately the answer did not work. I also tried adding [!h] after the includegraphics command to no avail.

Any suggestions would be greatly appreciated.

1
  • 1
    Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting.
    – lockstep
    Mar 12, 2011 at 21:57

1 Answer 1

25

Put the \includegraphics command immediately after \begin{figure}. Also, put \label after \caption for correct cross-references. Positioning arguments like [!ht] should, if it all, be used this way: \begin{figure}[!ht].

EDIT: To clarify: In your document, the caption is inside a (floating) figure environment, while the graphic presumably is part of the normal text flow. Therefore, it is likely that the caption will be placed above (or even separate from) the graphic.

3
  • Hi lockstep, Thank you for the solution and explanation. It works great! Best wishes,
    – Carey
    Mar 12, 2011 at 22:25
  • +1, but \label after \caption wasn't necessary for me. I got errors. Jan 31, 2013 at 11:39
  • This doesn't work. \begin{figure}[!ht]\includegraphics[width=0.5\textwidth]{Pics/lbp_num_points_radii} \caption{Slika 2.1: LBP atributi.} % \centering \label{fig:lbpfeaturecalculationprocess} \end{figure} Doesn't change a thing, i have tried putting the includegraphics in a newline still nothing
    – daniels_pa
    Sep 18, 2018 at 7:09

You must log in to answer this question.

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