Learn how to change the font size in a LaTeX document.
Changing the font size locally
When working on a LaTeX document, the easiest way to change the font size is by using these predefined commands:
\Huge \huge \LARGE \Large \large \normalsize \small \footnotesize \scriptsize \tiny
These commands change the font size locally. They can be used in two different ways: We can declare their scope inside a text within curly braces, such as {\huge these words are larger}
. We can also create an environment by writing our text inside \begin{huge}
and \end{huge}
commands.
Sometimes, we might want to consider the line spacing when changing the font size. Ending our commands with a paragraph includes the adjusting of the \baselineskip
, which specifies the minimum space between two successive lines in a paragraph. We can add a paragraph using \par
command or adding a new line character at the end of the text. Following example shows the line space adjusting:
\begin{huge} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam maximus mauris quis viverra imperdiet.\par \end{huge}
Changing the font size globally
These commands are relative to the global font size of the document. When we choose a document class we are also setting a font size for the whole document. If it’s not declared, the default font size for most of the standard document classes is 10pt. This size becomes the setting for \normalsize
option, and all the other size commands are adjusted accordingly. In standard classes (article
, book
, letter
and report
), there are three size options: 10pt, 11pt and 12pt. It can be changed by setting it as an argument to the document class: \documentclass[11pt]{article}
. Following table shows the font size for all commands and for each size options for the standard document classes.
size | 10pt | 11pt | 12pt |
---|---|---|---|
\tiny | 5 | 6 | 6 |
\scriptsize | 7 | 8 | 8 |
\footnotesize | 8 | 9 | 10 |
\small | 9 | 10 | 10.95 |
\normalsize | 10 | 10.95 | 12 |
\large | 12 | 12 | 14.4 |
\Large | 14.4 | 14.4 | 17.28 |
\LARGE | 17.28 | 17.28 | 20.74 |
\huge | 20.74 | 20.74 | 24.88 |
\Huge | 24.88 | 24.88 | 24.88 |
Other document classes might have different font size options. For instance, memoir class has 12 font sizes (9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt, 25pt, 30pt, 36pt, 48pt and 60pt). It also has two more size commands: \miniscule
for a smaller size than \tiny
and \HUGE
for a larger size than \Huge
.
Packages for changing font size
If the font size you are looking for are not in these options, there are packages that can extend the sizing options. Extsizes package adds more size options to standard document class packages. It supports 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt and 20pt options for article
, book
, letter
, report
and proc
document classes. It can be used by adding ext
to the document class name. (For example, \documentclass[14pt]{extbook}
)
If you need more sizing commands, moresize package adds two more sizing options: \HUGE
for a larger font size than \Huge
and \ssmall
to fill the gap between \scriptsize
and \tiny
. The first option has the size of 29.86pt and the latter option has the size of 6pt when used with the default 10pt option. This package must be used with a non-standard, scalable font, such as Latin Modern.
The default LaTeX font Computer Modern has individual files for a fixed set of font sizes, and it is not scalable to other sizes. It restricts the usage of fonts larger than \Huge
and smaller than \tiny
commands allow. To avoid any issues, you can use a vectorized version of the Computer Modern font, called Latin Modern, as the default font family. It enables these external packages to scale the fonts up or down to the arbitrary size we need. To enable Latin Modern, you can add \usepackage{lmodern}
\usepackage[T1]{fontenc}
to the beginning of the document.
If you want to declare the font size manually, anyfontsize package provides an option to scale the closest size available to the needed font size. Like the moresize package, this command only works with a non-standard, scalable font. If you need a size smaller than \tiny
, larger than \Huge
, or an exact size such as 19.5pt, you can use the syntax below:
\fontsize{size}{baselineskip}\selectfont
In this command, size
represents the font size you need, and baselineskip
is for the line spacing size between two successive lines. As a rule of thumb, baselineskip is usually 1.2x the font size. To activate the baselineskip
, the text in the scope of the command needs to end with a \par
, just like the usual font size commands. Following example shows the command in action.
{\fontsize{30pt}{36pt}\selectfont 30pt} {\Huge Huge} {\fontsize{15pt}{18pt}\selectfont 15pt} {\tiny tiny} {\fontsize{3pt}{3.6pt}\selectfont 3pt}
If you need to use a certain font size again and again, you can also define a new font size command. Following piece of code creates a new font size command called myfontsize.
\newcommand\myfontsize{\fontsize{15pt}{18pt}\selectfont} Normal size {\myfontsize My font size}
Summary
- Change the font size of a piece of text using these commands, from the largest to the smallest: \Huge, \huge, \LARGE, \Large, \large, \normalsize, \small, \footnotesize, \scriptsize, and \tiny.
- Set the font size of the whole document by adding an option to the \documentclass command. (10pt, 11pt, and 12pt are available on most classes.)
- Extsizes package makes more sizes from 8pt to 20pt available for the whole document.
- Moresize package adds two more size commands: \HUGE and \ssmall.
- With anyfontsize package, we can set the font size specifically by using \fontsize{size}{baselineskip}\selectfont command.