Spring til indhold

This error is related to a file which cannot be found by LaTeX. This error usually appears when either

  • The file path contains forbidden characters
  • You have forgotten to upload the file
  • The file path is spelled incorrectly.

For all information on how to correctly include images in your project, see our tutorial. Also note that whenever you are including images, you must include the graphicx package in your preamble by writing \usepackage{graphicx}. If you make any of the mistakes outlined above, you will get an error which looks like

main.tex, line 5

LaTeX Error: File `image3' not found.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.8 \includegraphics{image3} I could not locate the file with any of these extensions: .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps Try typing <return> to proceed. If that doesn't work, type X <return> to quit.

Common Causes of Error

Forbidden characters in the file path

LaTeX has issues with certain characters in file paths, which you should avoid. In some cases the usage of such characters results in a file not found error. Characters you should avoid include:

  • space ( )
  • percent symbol (%)
  • backslash (\)
  • characters which are made active, by default this is only the tilde, which expands to an unbreakable space (~)

Forgetting to upload file:

When you want to include a file in your project, you must upload it to the project so that LaTeX is able to find it. This is done by clicking the 'upload' button as shown below

Uploadimage.PNG

After this, the file should appear in the left hand menu.


File path incorrect:

When including a file, you must always write the file path from the root directory. This is true even if the main document which you are compiling is stored in a folder in the root directory instead of the root directory itself. An example of this is shown below

Imagefolder.PNG

Here, the image you want to use, image.PNG is stored inside folder2, which itself is stored inside folder. Therefore, to tell LaTeX where to find the image, you should write the path as folder/folder2/image. This is shown below

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}

\begin{figure}
    \centering
    \includegraphics{ {folder/folder2/image} }
    \caption{This is your image}
    \label{fig:my_label}
\end{figure}
\end{document}

Imageexample.PNG

Using \graphicspath{...} incorrectly:

If you decide to tell LaTeX where your images are stored in the preamble so that you don't have to keep writing out the file path, then you must remember to include a forward slash at the end of the file path, and to write the entire file path inside a set of braces, as shown below

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\graphicspath{ {folder/folder2/} } %This is where you have saved the images

\begin{document}

\begin{figure}
    \centering
    \includegraphics{image}
    \caption{This is your image}
    \label{fig:my_label}
\end{figure}
\end{document}

Imageexample.PNG

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX