# Overriding the default font size for custom classes

I'm in the middle of writing a document class (let's call it base.cls) which serves as base class for several other classes I'm writing. The base class itself is based on the article class. By default, the font size is set to 12pt, i.e. I'm calling \LoadClass[12pt]{article} in base.cls. Now, one of the classes derived from base.cls (let's call it derived.cls) should use 11pt rather than 12pt. I therefore added a default option handler to base.cls to pass all options on to article when \LoadClass[11pt]{base} is called in derived.cls.

This is where things break down. It seems that once the 12pt option gets processed, 11pt is ignored and the font size remains 12pt. I tried swapping the font sizes, i.e. set 11pt as default in base.cls, and specify 12pt when loading base.cls in derived.cls. In this case, the result is as expected: the font size is 12pt; if I don't specify 12pt when loading base.cls, the font size is 11pt. Here's a minimal working example.

base.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{base}[2015/09/11 v0.1]

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ProcessOptions\relax

\endinput


derived.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{derived}[2015/09/11 v0.1]

\endinput


example.tex:

\documentclass{derived}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}


Any ideas?

• welcome to the forum. although perhaps it's not imperative, or not always done that way, i think it's good to have the possible size options fully defined in the base class; they can always be disabled in a derived class. take a look at how font sizes are defined in amsart.cls to see what i mean. – barbara beeton Sep 11 '15 at 17:30

Here is a solution base.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{base}[2015/09/11 v0.1]

\providecommand\mtfntsize{12pt}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ProcessOptions\relax

\endinput


derived.cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{derived}[2015/09/11 v0.1]

\def\mtfntsize{11pt}

\endinput


example.tex:

\documentclass{derived}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}

• That'd work, but I'd prefer derived.cls not to make any assumptions about the internals of base.cls. I've therefore decided to leave the font size unspecified in base.cls, and let each derived class set its desired size manually. – tloeffler Sep 12 '15 at 13:20