34

For some small macros I'm writing I would need to change the font size relative to the font size of the text that surrounds to macro later on. I only know how to change the font size for the whole document (documentclass/fontspec), or for some text, but only relative to the default font size for the document (\Large, \small).

What I was thinking of was something like:

\newcommand*\mycommand{\smaller ipsum}
\Large lorem \mycommand
\small lorem \mycommand

If I use \Large, \small etc in the command itself, it will not care about the font size of the surrounding text but set the font size relative to the default font size. I would want it to be e.g. 1.2 times smaller than \Large or \small, depending on where it is used.

  • IMO, adding the macro tag or not was a close call here. – lockstep May 21 '12 at 15:52
  • After reading the tag description a second time (for another question) I though that it did not fit since the question was not on the "mechanics" of macros, but rather on a specific macro. But you are right...we surely could discuss this – Andreas Wallner May 21 '12 at 16:22
41

Have a look at the relsize package. Package description:

The basic command of the package is \relsize, whose argument is a number of \magsteps to change size; from this are defined commands \larger, \smaller, \textlarger, etc.

  • Thanks, I had stumbled upon this package on some webpage, but the description there was so bad that I thought it was something immitating \Large etc. – Andreas Wallner May 20 '12 at 20:50
  • 5
    The AMS classes (amsart and amsbook) have a similar built-in mechanism. – egreg May 21 '12 at 15:50

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.