0

I am new in LaTeX and I am trying to insert a .pdf figure to my LaTeX code. (I use pdflatex and my distributor is Texmaker) I have the following code

\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{amsmath,amsfonts,latexsym}
\usepackage{graphicx}
\usepackage[text={15cm,24cm},top=3cm]{geometry}

%some text here

\begin{figure}
\centering
\caption{Contour Plot for Potential Energy}
\includegraphics[width=1\textwidth]{FinalContour}
\end{figure}

%some more text

I get the figure I want in my pdf file but it is in a wrong position. It appears in a new page, the caption appears at the top of the new page but the figure appears in the middle of the page. I want it to appear exactly after the text written above the the graph. Any ideas how to fix that would be much appreciated. Thank you.

Andriana
  • 153
  • Welcome to TeX.SX! You're using a floating environment named figure, i.e. LaTeX is enabled to shift the image to a position where it thinks it is best. If this is not what you want, you should use some of the parameters to figure or drop the figure environment (remove \begin{figure}...\end{figure}) and use \captionof{figure}{Contour Plot...}, in this case, use \usepackage{caption} in the preamble. Please post working examples, not fragments of code –  Apr 06 '15 at 18:27
  • Thank you for your response. I made the change you suggested and now the graph appears at the point I want it to appear but there is still a huge gap between the text I have written above and the graph. There is also a big gap between the graph and the caption (this gap is approximately the same as the width of the figure). Any more ideas that could help?? – Andriana Apr 07 '15 at 18:21

0 Answers0