3

I'm having issues with Overleaf, the online LaTeX. I'm trying to include a figure like shown. It keeps saying the file can't be found. However, the p=figure is actually being shown on the pdf but with the title on it twice. There's an error somewhere. It does it normally with my other figures but just this one off the internet. I can't find a url for the picture so can't use alternative methods. Please can someone help me solve this. Thanks in advance.

\documentclass[12pt]{report}

\usepackage{graphics}
\usepackage{graphicx}
\begin{document}

\begin{figure}
    \centering
    \includegraphics{stars convection.png}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}
\end{document}
3
  • 4
    Try a file name without spaces: stars-convection.png.
    – moewe
    Commented Mar 27, 2019 at 20:00
  • 4
    You loaded both graphics and graphicx: only one of them is needed.
    – CarLaTeX
    Commented Mar 27, 2019 at 20:12
  • 3
    Check also that your file name and extensions have the right case, e.g. if you uploaded stars-convection.PNG but you wrote \includegraphics{stars-convection.png, then the compiler would not find it.
    – imnothere
    Commented Mar 28, 2019 at 2:22

1 Answer 1

3

Put the name within "..." with no file extension.

I tried this (of course, renaming and using a .png of mine, since I don't have yours) and it worked:

\documentclass[12pt]{report}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics{"stars convection"}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}
\end{document}

Here the result on Overleaf.

Also \includegraphics{"stars convection".png} works:

\documentclass[12pt]{report}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics{"stars convection".png}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}
\end{document}

Here the result on Overleaf.

And remember to load only graphicx, without graphics.

You must log in to answer this question.

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