In my custom LaTeX class, I've created some different options, such as different font sizes, 11pt, 12pt and 13pt, and paper sizes, such as a4paper and letterpaper. However, only one option from each group should be given, like the following.

\documentclass[12pt, letterpaper]{class} % or
\documentclass[13pt, a4paper]{class} % but never
\documentclass[12pt, 13pt]{class}

The last one shouldn't be used since it specifies the font size twice, which would create an undesirable effect. What I would want instead is that if two or more commands which clash are provided, such as in \documentclass[12pt, 13pt]{class}, my class delivers an error message using \ClassError. How would this be done?

Just in case I would need to use conditional 'if' statements, please try to give code using the style of statement used for the etoolbox package, it's what I use and find easiest.


Building on my previous answer, here is a way:



\PassOptionsToClass{1\aku@ptsize pt}{article}


     {Multiple font size options}
     {You have specified two or more options among `10pt', `11pt' or `12pt'}

You have to use a different default option, as otherwise the error message would be issued for a single font size option.

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.