9

I'm trying to give my custom class file two options for font size, 11pt and 12pt. I want 12pt to be the default. I create the options like this:

\DeclareOption{11pt}{
    \PassOptionsToClass{11pt}{article}}

\DeclareOption{12pt}{
    \PassOptionsToClass{12pt}{article}}

\ExecuteOptions{12pt}
\ProcessOptions

\LoadClass[]{article}

This works fine, the default font size becomes 12pt. However the problem occurs when in the case that I want to go against this default and use 11pt font, using, of course, the 11pt option like so:

\documentclass[11pt]

This does nothing when it should change the font size to 11pt (actually 10.95pt, since that is what the article class uses as a substitute for 11pt, but this does not matter). How can I make the 11pt option override the default 12pt? I can't seem to figure it out, Is it simply a problem with my method?

Interestingly enough, if I make 11pt the default option, with \ExecuteOptions{11pt}, then I can use \documentclass[12pt] and get 12pt font, but just not the other way around.

1 Answer 1

8

Also \documentclass[12pt,11pt]{article} uses 12pt and the 11pt option has no effect. Here's a workaround

\ProvidesClass{akuritsu}
\DeclareOption{10pt}{\def\aku@ptsize{0}}
\DeclareOption{11pt}{\def\aku@ptsize{1}}
\DeclareOption{12pt}{\def\aku@ptsize{2}}

\ExecuteOptions{12pt}
\ProcessOptions
\PassOptionsToClass{1\aku@ptsize pt}{article}

\LoadClass{article}

In this way only one font size option is passed.

10
  • That looks good, so are you saying that my problem is that article is passed both 12pt and 11pt as options?
    – akuritsu
    Jul 11, 2013 at 15:33
  • @akuritsu Yes, that's the problem
    – egreg
    Jul 11, 2013 at 15:36
  • Thank you, although I didn't use your workaround, your answer (and comment) solved the problem.
    – akuritsu
    Jul 15, 2013 at 9:58
  • Doesn't this always pass 12pt to article, since 12pt is always executed and the last declared option?
    – John
    Mar 14 at 23:56
  • With \ProcessOptions* instead of \ProcessOptions the code would be correct, see here.
    – John
    Mar 15 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.