This is a follow up question to Options in custom class. It seems that I still did not understand how global options work. Consider the following code:
\RequirePackage{filecontents}
\begin{filecontents}{sampleclass.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sampleclass}
%Providing key value syntax
\RequirePackage{xkeyval}
%Options
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOptionX{language}{\PassOptionsToPackage{#1}{babel}}
\ExecuteOptionsX{language=latin}
\ProcessOptions\relax
\ProcessOptionsX\relax
%Parent class
\LoadClass[
]{article}
%Language support
\RequirePackage{babel}
\end{filecontents}
\documentclass[language=english]{sampleclass}
\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}
It prints the text in English - as it's supposed to - but gives the warning
Unused global option(s): [language=english].
If I comment out the line
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
the warning disappears. What is the correct way to use a [language=english] option for my custom class to pass the option english to babel? After some playing around I did not come to find out which parts of the above code actually lead to the warning so I will leave this not-so-minimal working example.
\DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{article}}and\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}? – Mar 03 '18 at 11:31\DeclareOptionX*should be sufficent, if I remember correctly. – Mar 03 '18 at 11:37