I'm writing a wrapper document class that starts with article and adds a bunch of customizations (required for a particular journal style). One of the requirements is to lock down certain options:


should behave the same as

% plus some more stuff


\documentclass[12pt]{thisjournal} % or 'onecolumn', or 'a4paper, etc

should produce an error message, but other options should be passed through, e.g.

\documentclass[draft]{thisjournal} % should turn on overfull rules

I've gotten as far as

\DeclareOption{12pt}{\ClassError{testclass}{Ten point text is required.}}

but I am unenthusiastic about having to write \DeclareOption boilerplate for every possible font and paper size option other than 10pt and letterpaper. (Is it even possible to enumerate that set?) Surely there is a better way?

  • 1
    Which set is smaller: those to pass through or those not to? Is one (or both) well defined? – Joseph Wright Jul 26 '12 at 6:26
  • The locked-down options are the ones I showed: 10pt, letterpaper, and twocolumn. I have no idea how many other options article.cls has, and people probably do still want to use the generic "options on the \documentclass line get passed to all packages even if not recognized as class options" mechanism. – zwol Jul 26 '12 at 15:32

Expanding on Gonzalo's answer, you can iterate through the options you want to kill. (As th base classes do not use key-value methods, it's not like you only have to kill the 'key' part, regrettably.)

| improve this answer | |
  • For other reasons I suspect I am going to have to start from scratch, after all; but this seems like the best answer to the question as posed. – zwol Jul 29 '12 at 22:08

You can use \OptionNotUsed; for example,

| improve this answer | |
  • That makes the boilerplate less repetitive, but there's still a couple dozen \DeclareOption lines to write; it's that that I'm hoping to avoid somehow. – zwol Jul 26 '12 at 1:56

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.