I am struggling to understand how option processing works in classes. As a MWE
foo.tex:
\documentclass[draft,figures]{foo}
\begin{document}
\includegraphics{example-image}
\end{document}
foo.cls:
\ProvidesClass{foo}
\RequirePackage{foo}
\LoadClassWithOptions{article}
\RequirePackage{graphicx}
foo.sty
\ProvidesPackage{foo}
\RequirePackage{etoolbox}
\newbool{foo@figures}
\DeclareOption{figures}{\booltrue{foo@figures}}
\ProcessOptions\relax
\ifbool{foo@figures}{\PassOptionsToPackage{final}{graphicx}}{}
When I process foo.tex with pdflatex the log shows
LaTeX Warning: Unused global option(s): [figures].
but I also see the graphic, which means that I am passing the final option to the graphicx package. Why does LaTeX think the figures option is unused?
Moving \LoadClassWithOptions to before the package is loaded gets rid of the warning. In my real use case, the class that is being loaded, loads the graphicx package and therefore I need to load the package before loading the class.
\LoadClassWithOptionsoverrules thefoo.styoptions. Try\LoadClassWithOptionsfirst – Nov 13 '15 at 22:55