2

Another year, another style guide for slides ...

I have to change some of the font sizes, I use in my beamer document. For font sizes beamer tends loads the standard size11.clo. I need to change the therein defined font sizes. This seems fairly straight forward, given that all these size macros, e.g. \large, \huge, etc., are nothing but wrappers around other macros.

For instance I should be able to simply change the font size in \large by doing this:

\renewcommand\large{\@setfontsize\large{12pt}{34}}

I noticed that (especially) size11.clo uses the macros \@xpt, \@xipt, \@xiipt, etc., a lot. AFAIK these are nothing but macros, defined as 10 pt, 11 pt and 12 pt respectively. I also think I remember reading that the purpose behind these roman number macros is speeding up the compile process, because \@xpt is only one token in the bowels of TeX, whereas 10 pt is five tokens that need interpretation first. The fact, that the size macros use the roman number macros excessively, tells me that the size macros are called very often and are therefore optimized for speed.

The question is, when redefining the font size macros, should I first create adequate roman number macros, in order to keep the compile process happy?

5
  • 1
    The real question is: Do you wish to use 2 hours of your own time, to save 23 milliseconds of compiler time?
    – user139954
    Jan 17, 2018 at 15:58
  • If that is the only question I have to ask myself, then the answer is crystal clear: I don't need anywhere close to 2h to write these macros :-)
    – Bananguin
    Jan 17, 2018 at 16:18
  • 1
    a correction to your statements \@xpt is not defined as 10pt it is just 10 and \@xipt is 10.95 \@xiipt is 12. there is basically no reason to define such macros if defining size commands now. Not only speed this probably saved a few tens of bytes, but you probably have more than a few tens of bytes to spare on your machine now. Jan 17, 2018 at 19:36
  • 12pt font on 34pt baseline? that's very spacy? Jan 17, 2018 at 19:38
  • @DavidCarlisle probably, i haven't tried it. it is four numeric keys right next to each other. The real values are values with a high likelyhood of starting a discussion on (good) type setting. However, I am not at liberty to create sensible styles. I am merely stoically reverse engineering the company templates.
    – Bananguin
    Jan 19, 2018 at 10:57

1 Answer 1

3

There is no reason to define (or use) these macros at all.

Unlike using \z@ or \@ne which are unexpandable tokens giving (slightly) quicker access to 0 and 1, these are simple macros: \@xpt just expands to 10 (not 10pt, despite the pt in the name) so TeX has the cost of expanding the macro to the two digit tokens and then still has to scan the tokens looking for a <number>, as if you had used 10 explicitly.

The reasons for the macros are mostly related to the amount of memory available to machines in the early 1980's.

\def\large{\@setfontsize\normalsize\@xpt\@xiipt}

is 4 tokens of replacement text in the definition.

\def\large{\@setfontsize\normalsize{10pt}{12pt}}

is 14, so saving about 10 bytes or so of memory when TeX saves the definition.

This century, it's probably not worth making the code slightly slower and harder to read, to save 10 bytes of memory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .