Fix “\RequirePackage or \LoadClass in Options Section” and “article.cls not found”
At a glance
- 1. Find the first error
Read the log from the top; later messages can be consequences of an earlier failure.
- 2. Check option code
Do not load a package or class inside a class or package option handler.
- 3. Check the class file
Confirm that article.cls is installed and that no local file is interfering with it.
- 4. Test a minimal document
Compile a plain article document to separate installation problems from custom-class problems.
These messages often appear together when a custom class or package is involved, but they do not mean the same thing. The first points to when a class or package is loaded; the second says LaTeX cannot find a class file named article.cls.
Start by checking the first error in the compiler log. A later message may be a consequence of an earlier failure, so fixing errors in the order they first appear is more reliable than addressing the last line shown by an editor.
What the options-section error means
A class or package can declare options and specify code to run when an option is selected. LaTeX processes those option handlers when it reaches \ProcessOptions. During that processing, loading another class with \LoadClass or a package with \RequirePackage is not allowed. Doing so triggers the error:
\RequirePackage or \LoadClass in Options Section.
A problematic class file might contain code like this:
\DeclareOption{draft}{\RequirePackage{somepackage}}
\ProcessOptions\relax
The package-loading command runs as part of the option handler. Instead, record the selected option, pass options along where appropriate, or defer loading until option processing has finished.
For example, when a class option should be passed to the parent article class, use this pattern:
\DeclareOption{draft}{\PassOptionsToClass{draft}{article}}
\ProcessOptions\relax
\LoadClass{article}
Here, \PassOptionsToClass forwards the option without loading the class immediately. \LoadClass runs only after \ProcessOptions is complete. If a package should be loaded only for certain options, have the option handler set a flag, then use that flag to decide whether to call \RequirePackage after \ProcessOptions.
\LoadClass is for use in a class file. \RequirePackage is normally used in a class or package file, though it can also be used in a document preamble; it does not select a document class. In an ordinary document, use \documentclass{article} to select the standard class.
What “article.cls not found” means
article.cls is the file that defines LaTeX’s standard article document class. LaTeX cannot compile a document using that class if it cannot find the file. Common explanations include:
- The TeX distribution or its base LaTeX files were not fully installed.
- The editor is invoking a different TeX installation from the one you updated.
- The compiler is running in a restricted online or automated environment without the base class files.
- The document or a custom class loads
articleincorrectly, or the project’s files interfere with the search path.
Check whether the failing document explicitly requests article with \documentclass{article}. If it uses a custom class, inspect that class for \LoadClass{article}. In either case, a normal LaTeX installation should provide article.cls. Repair or install the base LaTeX components for the distribution and environment you actually use. The precise package name and installation steps depend on whether you use TeX Live, MiKTeX, or another distribution.
Also check the project directory for a file named article.cls. A hand-made file with that name can shadow the standard class. Do not rename a standard class file or copy one from an unrelated TeX installation as a quick fix; resolve the installation or search-path problem instead.
A minimal test document
Save this as a new file and compile it with the same engine and environment that produced the errors:
\documentclass{article}
\begin{document}
A minimal test of the standard article class.
\end{document}
This example needs no additional packages. If it fails with article.cls not found, investigate the TeX installation, compiler configuration, or file search path before changing your original document. If it compiles, the standard class is available; look next at the original document’s class declaration and any custom .cls or .sty files it loads.
Diagnose both messages in order
If both messages appear, use this sequence:
- Find the first LaTeX error in the full log, not just the final error displayed by the editor.
- Inspect the named
.clsor.styfile and locate option handlers such as\DeclareOption. - Move class or package loading out of those handlers so it occurs after
\ProcessOptions. - Compile the minimal
articledocument above using the same engine and project folder. - If the minimal test fails, repair the class-file installation or search path. If it succeeds, reduce the original document to identify which custom file triggers the problem.
The two diagnoses are independent: moving a \RequirePackage call may fix the options-section error but cannot install a missing article.cls. Conversely, repairing the TeX installation does not fix a class file that tries to load another file while its options are being processed.
Common mistakes
- Loading inside the option handler: Do not put
\RequirePackageor\LoadClassdirectly in code executed by\DeclareOption. - Treating a class as a package: Use
\documentclass{article}to select a document class.\RequirePackage{article}does not select thearticleclass. - Installing the wrong component: The class is part of the LaTeX base installation, not an arbitrary package required by the document. Make sure you are repairing the distribution used by the compiler.
- Fixing only the last log line: A missing file or malformed custom class can cause additional errors afterward. Resolve the earliest relevant error, then compile again.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.