2

I am a beginner in LaTeX. I used the LaTeX example to insert a figure in my thesis. Here is the code:

\begin{figure}[ht]
\centering
\includegraphics[width=\textwidth]{figs/#####.jpg}
\vspace{0in}
\caption{#####}
\end{figure}

I think the code should only generate one caption below the figure.

However, I got two captions with my figure. The form is like:

#####.jpg

(The figure itself looks fine)

Fig1.1 #####

Anyone had this problem in the past? How could I get rid of the top #####.jpg?

  • 6
    Hi, welcome to TeX.SX. Do you by any chance have any spaces in the filename of the image? (See e.g. http://tex.stackexchange.com/questions/84378/xelatex-includegraphics-with-a-png-file-shows-filename-in-output-how-do-i-hi) – Torbjørn T. Oct 26 '13 at 08:00
  • Have you tried using \usepackage{grffile}? – Mario S. E. Oct 26 '13 at 08:52
  • 2
    Can you compile your question into a minimal working example? The "#1" as parameter to the "\caption" command suggests that you are showing the definition of a macro, but the rest of the question does not indicate this. – DCTLib Oct 26 '13 at 11:26
  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Fran Oct 26 '13 at 12:04
  • @MarioS.E. I tried just now, but it gave me an error message: File "griffile.sty" not found. \ usepackage – user38844 Oct 28 '13 at 01:20
  • @TorbjørnT. Thanks! I tried that and it worked! Is there any way to omit the spaces in the filename of the figure? I used newcommand for inserting figure, and thinking to use #1 for both figure filename and caption name, so I only need to type it once instead of twice. – user38844 Oct 28 '13 at 01:33
  • You tried what? Note that the package Mario mentioned is called grffile, not griffile. – Torbjørn T. Oct 28 '13 at 06:40

0 Answers0