LaTeX Error: File `<name>' not found

LaTeX cannot find a file you asked for: an \input or image name that is misspelled or missing, or a package or class that is not installed.

Help centre › LaTeX errors › Files and fonts · Error: the build stops or the output is wrong

What the log says

! LaTeX Error: File `sections/introduction.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

l.4 \input{sections/introduction}

Also printed as: LaTeX Error: File `<name>.sty' not found; LaTeX Error: File `<name>.cls' not found

What it means

LaTeX looked for a file by the name you gave and did not find it anywhere it searches: next to the main file, in the folder you named, and in the installed TeX distribution. The file can be one of yours (a chapter loaded with \input or \include, a figure for \includegraphics) or a package (.sty) or document class (.cls) loaded with \usepackage or \documentclass. What to do depends on which, and the extension in the message tells you.

Causes and fixes

Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.

1. The name in \input, \include or \includegraphics does not match the file

Compare the name in the message with the file tree, letter by letter: a typo, a missing folder (sections/intro versus intro), or a different extension. Paths are relative to the main file, not to the file that contains the command, and on Linux servers Figure1.png and figure1.png are different files even if your own computer treats them as the same.

Fails
\begin{filecontents*}[overwrite]{intro.tex}
We study the effect of temperature on yield.
\end{filecontents*}
\documentclass{article}
\begin{document}
\input{introduction}
\end{document}
Fixed
\begin{filecontents*}[overwrite]{intro.tex}
We study the effect of temperature on yield.
\end{filecontents*}
\documentclass{article}
\begin{document}
\input{intro}
\end{document}

2. A figure was never uploaded, or sits in another folder

An image missing from the project gives the same message with the image's name. Upload it, or write the path including its folder (\includegraphics{figures/figure1}), or tell graphicx where to look with \graphicspath{{figures/}} in the preamble.

Fails
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.5\linewidth]{figure1}
\end{document}
Fixed
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.5\linewidth]{example-image}
\end{document}

3. A package name is misspelled

When the missing file ends in .sty, look at the \usepackage line first: graphix for graphicx, amsmaths for amsmath, hyperrref for hyperref. Correct the name and compile again.

Fails
\documentclass{article}
\usepackage{graphix}
\begin{document}
Results are shown below.
\end{document}
Fixed
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Results are shown below.
\end{document}

4. The package or document class is not installed

A correctly spelled .sty or .cls that is not part of the TeX installation has to come from somewhere else. Journal classes and their .bst styles usually ship in the journal's template ZIP: upload the .cls or .sty next to your main file. If the package is not essential, delete the \usepackage line and compile again.

5. You compiled a chapter file instead of the main file

A file meant to be \input into a larger document often refers to other files by paths that only make sense from the main file's folder. Compile the main file (the one with \documentclass), not the chapter.

Finding the line when the line number does not help

In Manulyx

The editor shows the error beside the line that asked for the file. When the project has a file with a nearly identical name, a Fix button corrects the name in the source; a .sty or .cls that is not installed is reported as a package that is not installed, and you can ask for it to be added.

Write in Manulyx for free · Journal templates

More in files and fonts

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors