Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How do I create a new sizing command command, \semiHuge, that is defined as being the size that lies between \huge and \Huge?

share|improve this question

1 Answer 1

up vote 27 down vote accepted

The standard LaTeX document classes -- article, report, and book-- provide the following definitions of the directives \huge and \Huge:

  • If the main font size is either 10pt or 11pt,

    \newcommand\huge{\@setfontsize\huge\@xxpt{25}}
    \newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}}
    
  • and if the main font size is 12pt, one finds

    \newcommand\huge{\@setfontsize\huge\@xxvpt{30}}
    \let\Huge=\huge
    

    i.e., there's no difference between \huge and \Huge in this case.

Next, in the file latex.ltx (which contains the "LaTeX kernel"), one finds the following definitions of \@xxpt and \@xxvpt:

 \def\@xxpt{20.74}
 \def\@xxvpt{24.88}

The geometric mean of 20.74 and 24.88 is 22.72, and the geometric mean of 25 and 30 -- the baseline distances in effect for \huge and \Huge -- is 27.38. (See below for an explanation of why I choose the geometric mean.)

Thus, if you use either 10pt or 11pt as the size of the main text font, and if you use a font that's freely scalable, you could include the following instructions in your document's preamble to set up the directive \semiHuge:

\makeatletter 
\newcommand\semiHuge{\@setfontsize\semiHuge{22.72}{27.38}}}
\makeatother

This method of defining \@setfontsize is (marginally) safer than the more direct definition, viz., \newcommand\semiHuge{\fontsize{22.72}{27.38}\selectfont}, because \@setfontsize takes care not to mess with math font sizes.

Putting all this into an MWE, e.g.,

\RequirePackage{fix-cm} %% make CM font freely scalable
\documentclass{article}
\makeatletter 
\newcommand\semiHuge{\@setfontsize\semiHuge{22.72}{27.38}}
\makeatother 
\begin{document}
\huge The quick huge fox jumps \ldots

\semiHuge The quick semiHuge fox jumps \ldots

\Huge The quick Huge fox jumps \ldots
\end{document}

one gets:

enter image description here


Lastly, you may ask why I take the geometric mean of the \huge and \Huge font sizes to arrive at the font size for \semiHuge. For a main text font size ("\normalsize") of 10pt, LaTeX sets the ratio of adjoining font sizes -- \normalsize, \large, \Large, \LARGE, \huge, and \Huge -- is exactly 1.2. In addition, in LaTeX the exact font size for 11pt is not 11.00 but 10.95, i.e., the geometric mean of 10 and 12. LaTeX's evident preference for keeping relative font sizes in tidy geometric progressions is what swayed me to go with the geometric mean of the sizes for \huge and \Huge to obtain the size for \semiHuge.

Left as an exercise for the reader: Design macros named \semiLarge, \semiLARGE, and \semihuge. :-)

share|improve this answer
6  
Unless you load fix-cm or type1cm or use scalable fonts, a font size of 22.72 is not available, LaTeX will warn you that it is switching to size 20.74 so your semiHuge and huge only differ in baselineskip, not in font size. LaTeX Font Warning: Font shape OT1/cmr/m/n' in size <22.72> not available (Font) size <20.74> substituted on input line 8.` –  David Carlisle Mar 16 '12 at 9:23
1  
@DavidCarlisle -- let me add the \RequirePackage{fix-cm} instruction. –  Mico Mar 16 '12 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.