LaTeX error "Unknown option `number' for package `natbib'": cause and fix
A package got an option in the square brackets of \usepackage that it does not declare. The package still loads, without that option.
Why it happens
- The option name has a typo.
natbibknowsnumbers, notnumber;setspaceknowsonehalfspacing, notonehalfspace. - The option belongs to another package, for example
colorlinksgiven tourlinstead ofhyperref. - The message names a package you did not load yourself.
graphicxpasses its options on tographics, so a wrong option forgraphicxis reported forgraphics.
How to fix it
- Look up the exact option name in the documentation of the package, for example with
texdoc natbib. - Move the option to the package it belongs to, or delete it.
- Two related messages have the same cause. An unknown option of the document class only produces the warning "Unused global option(s)". Packages with
key=valueoptions, such asgeometry, report "Package keyval Error: ... undefined".
A document that produces the message
\documentclass{article}
\usepackage[square,number]{natbib}
\begin{document}
Text.
\end{document}The corrected document
\documentclass{article}
\usepackage[square,numbers]{natbib}
\begin{document}
Text.
\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.