LaTeX error "File `boktabs.sty' not found": cause and fix
A command asked for a file, such as a package (.sty), a class (.cls) or a file named in \input, and LaTeX found it neither in the project folder nor in the TeX installation. LaTeX then asks for another file name; when nobody can answer, the run stops and writes no PDF.
Why it happens
- The package name has a typo, for example
\usepackage{boktabs}instead of\usepackage{booktabs}. - The package is not installed. A small TeX installation contains only part of the packages.
- The path in
\input{...}is wrong. LaTeX reads the path from the folder of the main document, also when the\inputline sits in a file inside a subfolder. \documentclass{...}names a class whose.clsfile is not in the project folder, for example the template of a university.
How to fix it
- Read the file name in the message. The extension tells you what is missing:
.styis a package,.clsa class,.texa file from\input. - Correct the spelling of the name.
- Install the package with the package manager of your TeX distribution, in TeX Live with
tlmgr install booktabs. - Put your own files next to the main document, or write the path from there:
\input{chapters/intro}. kpsewhich booktabs.styon the command line prints the path of an installed file and prints nothing when the file is missing.
A document that produces the message
\documentclass{article}
\usepackage{boktabs}
\begin{document}
A table follows.
\end{document}The corrected document
\documentclass{article}
\usepackage{booktabs}
\begin{document}
A table follows.
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.