1

I am simply trying to insert some figures in my tex document. I know this is very basic, I also have been following a latex guide, searching for question on stackexchange and asked around. I wrote these two simple pieces of code. The first one for putting two figures one close to the other. The second one for simply plotting a figure.

\documentclass[12pt,a4paper,oneside]{article}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{graphics}
\begin{document}

\begin{figure}[htbp]            
\centering
\subfigure[{A}]
{\includegraphics{C:/Users/Me/Dropbox/Me again/Figure A.png}}\qquad\qquad
\subfigure[{B}]
{\includegraphics{C:/Users/Me/Dropbox/Me again/Figure B.png}}
\caption{Try}
\end{figure}


\begin{figure}[htbp]                
\centering
\includegraphics{C:/Users/Me/Dropbox/Me again/Figure A.png}
\caption{Try again}
\end{figure}


\end{document}

I get error messages like "Figure A not found", and/or "cannot determine size of Figure A". Moreover, if I compile a .tex fil with only the figures (without the rest of the paper, as in the example above), it gives me similar results, but sometimes it plots the image in a completely wrong position and way.

Two points:

1) is this due to the .png format ?

2) is this due to the fact that the figures are NOT in the same folder of the .tex file? If this is the case, is there a way to avoid to copy everything in the folder of the .tex file?

If can helps, I am using MikTex, Texnic center and Texworks

  • 2
    Almost certainly your problem is the spaces in the paths. Try loading package grffile, but ideally don't use spaces in names/paths at all (with TeX, at least). – Joseph Wright Mar 7 '14 at 13:53
  • Using grffile now it actually prints the pdf file, but instead of figures I just get the link of the picture. If I add "", such as "/link/to/the/picture A.png", the name of the link disappears, but no picture is plotted yet. And I get the error "cannot determine the size of graphics". – Bob Mar 7 '14 at 13:59
  • Are you using pdfLaTeX or just LaTeX: the latter can't handle .png files. Using TeXworks you automatically use pdfLaTeX, so that shouldn't have an issue. – Joseph Wright Mar 7 '14 at 14:00
  • Hm. I fear I cannot provide an answer to your question. I have texworks installed but I use to work using Miktex interface. Hope this answer makes some sense. Should I use the " " before the path of the figure ? I also tried with 1 eps figure. Still does not work. Blank background in place of the figure – Bob Mar 7 '14 at 14:08
  • MiKTeX is a TeX system, not an editor. Which editor do you use? – Joseph Wright Mar 7 '14 at 14:21

Browse other questions tagged or ask your own question.