# scrlttr2: lco file read only if babel is not used ; DeclareOption*; actually: handling of options and babel

I have my own letterclass using scrlttr2:

%mwe.cls
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}[2010/11/19 mwe.cls]

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrlttr2}}
\ProcessOptions\relax

%\RequirePackage{graphicx}
\RequirePackage[english]{babel}



that I want to customize with .lco-files, like:

%mweelco.lco


Now I want to use it in a letter:

\documentclass[mwelco]%
{mwe}%(1)
\begin{document}
\begin{letter}{--Im Hause--}
\opening{test}
Content
\end{letter}
\end{document}


I want to give (1) the mwelco-option as an option to the documentclass and would rather not want to (2) use later in the file a \LoadLetterOptions.

However, only (2) works but (1) does not.

More strangely, if I comment babel out, then (1) and (2) work. Also, if I comment babel out and require graphicx (for argument's sake) also (1) and (2) work.

So there is some interaction between DeclareOption* and babel, that gets into my way. (Last September, with older texlive, it worked. Just checked, with out-of-the-box teelive-2019 babel works with (1) and (2).) I am using up-todate-texlive-2020.

edit (let me explain doesn't work¨ better): I expected the behavior, that saying in the tex-file: \documentclass[mwelco]{mwe} would lead mwe.cls to (A) load scrlttr2, (B) make scrlttr2 load the mwelco.lco file. But this does not happen.

Two ways that make this work are: (C) comment out the required babel or (D) to \LoadLetterOptions{mwelco} in the letter.tex. Clearly, (C) is unacceptable and (D) is clumsy and spreads an option to the letter class to a location much later.

So it seems that requiring babel even after \DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrlttr2}} \ProcessOptions\relax in the package seems to have side effect on the option mwelco being passed to scrlttr2 or not. This is what I can not understand. I would appreciate help in avoiding this problem.

• Please, what does “doesn't work“ mean exactly? – Javier Bezos Feb 24 at 16:09

Load package babel after class scrlttr2 in your wrapper class:

\begin{filecontents*}[overwrite]{testclass.cls}
\ProvidesClass{testclass}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrlttr2}}
\ProcessOptions\relax
\RequirePackage{graphicx}
\RequirePackage[english]{babel}% <- moved
\end{filecontents*}

\begin{filecontents*}{mwelco.lco}

• Option processing in babel have been changed several times. And there were changes in the latex kernel. – esdd Feb 26 at 17:43