For complex length manipulation (see here), I would need to get the font size that was passed as an option to the document class:


I would like it to work on all the main classes including beamer and extarticle. Currently this fails on beamer. How to make it work? (and I don't want the exact size of the font like 10.95pt for 11pt, I want the option that was passed).


Since most classes define their own option handling system you need one different macro for each.

For example, for 12pt, article (and the standard LaTeX classes) store just 2 in \@ptsize. extarticle stores 12. beamer stores {size12.clo} in a \beamer@size macro, and memoir stores 12 in \@memptsize. Not exactly standardised.

Here's a macro that checks for these classes and uses the correct macro accordingly, then stores the font size (from the option, not the actual font size) in a length:

      \vincent@ifclassloaded {beamer}
          \vincent@ifclassloaded {memoir}
              \vincent@ifclassloaded {extarticle}
  \expandafter\ifx\csname ver@#1.cls\endcsname\relax
\def\get@@beamersize size#1.clo{#1 pt}
\def\get@memoirsize{\@memptsize pt}
\def\get@extartsize{\@ptsize pt}
\def\get@standardsize{1\@ptsize pt}

For other classes you'd need to add another conditional and the corresponding macro to get the 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.