46

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.

2
  • IMO, adding the macro tag or not was a close call here.
    – lockstep
    Commented May 21, 2012 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 Commented May 21, 2012 at 16:22

1 Answer 1

56

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.

2
  • 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. Commented May 20, 2012 at 20:50
  • 5
    The AMS classes (amsart and amsbook) have a similar built-in mechanism.
    – egreg
    Commented May 21, 2012 at 15:50

You must log in to answer this question.

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