This article reviews several methods for changing font size—use the following links to jump to the article section(s) of interest:
LaTeX uses the document class, loaded via the \documentclass command, to set the default font size for various elements, such as footnotes and section headings, which form part of the document’s content. Document classes also support options for explicitly setting the font size of the main document text (and other components):
\documentclass[options]class>
For example, the article class supports 10pt, 11pt and 12pt for the main document text:
\documentclass[11pt]article>
The main text will be set to 11pt with correspondingly appropriate vales applied to other document elements.
The extsizes classes which compromise extarticle, extreport, extbook, extletter, and extproc support font sizes of 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt and 20pt.
The next example uses the extarticle class to set the document font size to 9pt.
\documentclass[9pt]extarticle> % Note the extarticle document class % Using the geometry package with a small % page size to create the article graphic \usepackage[paperheight=6in, paperwidth=5in, top=10mm, bottom=20mm, left=10mm, right=10mm]geometry> \usepackagelipsum> \begindocument> \sectionIntroduction> \lipsum[1] \subsectionMore details> \lipsum[1] \enddocument>
This example produces the following output:
LaTeX provides a set of 10 standard (predefined) commands to change the font size—note that document classes or LaTeX packages may redefine those commands to vary the actual point size. The following table lists those commands and their corresponding point size values for a document using 10pt for the main text font, the default setting of the article class:
\documentclassarticle>
For the corresponding point sizes generated by \documentclass[11pt] and \documentclass[12pt] refer to the font sizes chart in LaTeX2e: An unofficial reference.
The next table lists the additional commands \HUGE and \ssmall provided by the moresize package. The corresponding font sizes are those in effect when moresize is used with the extarticle document class:
\documentclassextarticle> \usepackagemoresize>
The next example demonstrates using these commands.
\documentclassextarticle> % Note the extarticle document class % Using the geometry package with a small % page size to create the article graphic \usepackage[paperheight=6in, paperwidth=5in, top=10mm, bottom=20mm, left=10mm, right=10mm]geometry> \usepackagemoresize> \begindocument> The size of this text is \verb=\normalsize= but now it is \tiny tiny until we make it \small small or \ssmall ``ssmall'' via the moresize package. Let's revert to \normalsize normal size then \ttfamily \scriptsize use monospaced \verb=\scriptsize= text in a group> then back to normal. Now, try \verb=\large= \large text then \sffamily \Large \verb=\Large= sans serif text> and finally \HUGE really big (\verb=\HUGE=) and \bfseries bold> text> \enddocument>
This example produces the following output:
The names of the size-changing commands listed above can be used as environments to contain text whose size you wish to change; for example:
\beginLarge> Text to be typeset in the \texttt\string\Large> font size goes here. \endLarge>%
The next example shows how these environments can be nested.
\documentclassextarticle> % Note the extarticle document class % Using the geometry package with a small % page size to create the article graphic \usepackage[paperheight=6in, paperwidth=5in, top=10mm, bottom=20mm, left=10mm, right=10mm]geometry> \usepackagemoresize> \begindocument> \noindent We'll start with normal-sized text then add \begintiny> some \ttfamily \string\tiny> text \beginLarge> mixed with \ttfamily\string\Large> and \beginHUGE>\ttfamily \string\HUGE<> text \endHUGE>% \endLarge>% \endtiny>% then back to normal-sized text. \enddocument>
This example produces the following output:
The font-size commands listed in the tables above are implemented using the LaTeX commands \fontsize and \selectfont which can also be used to directly select a font-size and the corresponding baseline-skip setting:
\fontsizefont-size>baseline-skip>\selectfont
The baseline-skip value determines the distance between baselines of text in a paragraph typeset using font-size ; it is also stored in a parameter command called \baselineskip —for more detail, see the Overleaf article How to change paragraph spacing in LaTeX.
The next example demonstrates \fontsize and \selectfont for a range of font-size and baseline-skip values:
Aesthetically pleasing combinations of font-size and baseline-skip spacing can depend on the design of the typeface being used.
\documentclassarticle> % Using the geometry package with a small % page size to create the article graphic \usepackage[paperheight=6in, paperwidth=5in, top=8mm, bottom=20mm, left=10mm, right=8mm]geometry> \usepackageblindtext> \begindocument> \fontsize6>8>\selectfont\blindtext \fontsize8>9>\selectfont\blindtext \fontsize12>13.5>\selectfont\blindtext \enddocument>
This example produces the following output:
In this section we briefly review the following LaTeX packages:
The relsize package provides commands to set font sizes relative to the current font size—i.e., the font size in use at the location where you want to make a size change; for example, when typesetting footnotes the current (font) size is smaller than within the main text.
For historical reasons, which we won’t explore (but see here), many TeX/LaTeX font-sizing/scaling operations involve the value \(\text\); for example, the table above shows \Large is \(\text\) and the next-larger size, \LARGE , is \(\text\) because \(\text \times 1.2 = \text\). We can also see that \[\texttt <(\LARGE) >\text \times 1.2 = \text\texttt< (\huge)>\]
The relsize package refers to “steps” when moving between font sizes listed in the table above; for example, the code shown below demonstrates moving from 10pt text to 17.28pt involves 3 “steps”, each using a multiplier of 1.2: \[\text \times 1.2 \times 1.2 \times 1.2 = \text\]
\renewcommand\RSlargest75pt> \renewcommand\RSsmallest5pt>
The relsize package documentation lists the following commands, which are designed for text only and not for use with mathematical content.
Command | Purpose |
---|---|
\relsizen> | Change font size by n steps. |
\larger[n] | Increase font size by (optional) n steps (default is 1 step). |
\smaller[n] | Reduce font size by (optional) n steps (default is 1 step). |
\relscalef> | Change font size by scale factor f . |
\textlarger[n] | Text size enlarged by (optional) n steps. |
\textsmaller[n] | Text size reduced by (optional) n steps. |
\textscale[f] | Text size scaled by factor f . |
The next example demonstrates various commands provided by the relsize package. Note the following:
\renewcommand\RSlargest75pt>
% article class is loaded with default 10pt text size \documentclassarticle> % Using the geometry package with a small % page size to create the article graphic \usepackage[paperheight=6in, paperwidth=5in, top=10mm, bottom=20mm, left=10mm, right=10mm]geometry> \usepackagerelsize> % Define our simple macro \bgroup \catcode`@=11 \gdef\getfontsize\f@size pt> \egroup % Set the maximum scaled font size to 75pt \renewcommand\RSlargest75pt> \begindocument> Hello, in this paragraph the normal font size is \getfontsize. Now scale the current font using 3 ``steps'': \verb=\relsize3>=\relsize3> which sets the current size to \getfontsize>. Outside the group the font size is once again \getfontsize. Another paragraph with some\larger[2] larger text> and \smaller[1] smaller text>---note the use of groups \. \>. Also using \textlarger[3]large text> and some \textscale2>scaled text>. \vskip12pt Using a larger number of steps: \vskip12pt \textlarger[11]11 steps (\getfontsize)> \vskip12pt \textlarger[20]20 steps (\getfontsize)>---size limit reached and a warning is given: \vskip12pt ``Package relsize Warning: Font size 383.35397pt is too large. Using 75pt instead. '' \enddocument>
The LaTeX code above accesses the current font size via an internal LaTeX variable called \f@size , whose value can be typeset using a macro, such as \getfontsize , which can be defined as follows:
\bgroup \catcode`@=11 \gdef\getfontsize\f@size pt> \egroup
The example above produces the following output: