I'm trying to achieve a specific behavior between global and local options within my own class. The example below does not work as intended. Other attempts also failed.
\begin{filecontents*}[overwrite]{foo.cls}
\ProvidesClass{foo}[2022/07/30 v1.0.0 class foo (RN)]
\PassOptionsToPackage{english,ngerman}{babel}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*\relax
\LoadClass{article}
\RequirePackage{babel}
\endinput
\end{filecontents*}
\documentclass[12pt,english]{foo}% (1)
%\documentclass[12pt,ngerman]{foo}% (2)
%\documentclass[12pt]{foo}% (3)
%\documentclass[12pt,french]{foo}% (4)
\begin{document}
\typeout{************ The language is: \languagename}
\end{document}
I want to achieve the following:
- (1) Main language: english, secondary language: ngerman
- (2) Main language: ngerman, secondary language: english
- (3) Main language: ngerman, secondary language: english
- (4) Main language: french, secondary language: english, (possibly further secondary language: ngerman)
Thanks for your help.