How do I adjust the font size?
Introduction
This article reviews several methods for changing font size—use the following links to jump to the article section(s) of interest:
- Using document classes to set font sizes
- Using LaTeX font size commands
- Using LaTeX font size environments
- Using the
\fontsize
and\selectfont
commands - Using packages to change font size
- Using tex.stackexchange to find helpful examples
Setting document font sizes
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
The extsizes classes which compromise extarticle, extreport, extbook, extletter, and extproc support font sizes of 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt and 20pt.
Example: using the extarticle
class
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}
\usepackage{lipsum}
\begin{document}
\section{Introduction}
\lipsum[1]
\subsection{More details}
\lipsum[1]
\end{document}
This example produces the following output:
LaTeX font size commands
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:
\documentclass{article}
For the corresponding point sizes generated by \documentclass[11pt]{article}
and \documentclass[12pt]{article}
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:
\documentclass{extarticle}
\usepackage{moresize}
Example: using font size commands
The next example demonstrates using these commands.
\documentclass{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}
\usepackage{moresize}
\begin{document}
{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}
\end{document}
This example produces the following output:
LaTeX font size environments
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:
\begin{Large}
Text to be typeset in the \texttt{\string\Large}
font size goes here...
\end{Large}%
The next example shows how these environments can be nested.
Example: using font size environments
\documentclass{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}
\usepackage{moresize}
\begin{document}
\noindent We'll start with normal-sized text then add
\begin{tiny}
some {\ttfamily \string\tiny} text
\begin{Large}
mixed with {\ttfamily\string\Large} and
\begin{HUGE}\ttfamily \string\HUGE{} text
\end{HUGE}%
\end{Large}%
\end{tiny}%
then back to normal-sized text.
\end{document}
This example produces the following output:
The \fontsize
and \selectfont
commands
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:
\fontsize{font-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.
Example: using \fontsize
and \selectfont
The next example demonstrates \fontsize
and \selectfont
for a range of font-size
and baseline-skip
values:
\fontsize{6}{8}\selectfont
: use 6pt text with baselines spaced at 8pt\fontsize{8}{9}\selectfont
: use 8pt text with baselines spaced at 9pt\fontsize{12}{13.5}\selectfont
: use 12pt text with baselines spaced at 13.5pt
Aesthetically pleasing combinations of font-size
and baseline-skip
spacing can depend on the design of the typeface being used.
\documentclass{article}
% 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}
\usepackage{blindtext}
\begin{document}
\fontsize{6}{8}\selectfont\blindtext
\fontsize{8}{9}\selectfont\blindtext
\fontsize{12}{13.5}\selectfont\blindtext
\end{document}
This example produces the following output:
Other packages for changing font size: relsize
and scalefnt
In this section we briefly review the following LaTeX packages:
- the
relsize
package which provides commands to set font size relative to the current size; - the
scalefnt
package that lets you “rescale fonts to arbitrary sizes”.
The relsize
package
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{1.2}\); for example, the table above shows \Large
is \(\text{14.4pt}\) and the next-larger size, \LARGE
, is \(\text{17.28pt}\) because \(\text{14.4pt} \times 1.2 = \text{17.28pt}\). We can also see that \[\texttt{(\LARGE) } \text{17.28pt} \times 1.2 = \text{20.74pt}\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{10pt} \times 1.2 \times 1.2 \times 1.2 = \text{17.28pt}\]
- The command
\relsize{n}
will try to scale the current font usingn
“steps”; however, if the requested (scaled) size is too small or too large:- a warning message is issued, and
- the scaled size is restricted to limits set by the commands
\RSsmallest
(usually\tiny
) and\RSlargest
(usually\Huge
)
- Use
\renewcommand
to set new values for\RSlargest
and\RSsmallest
:\renewcommand\RSlargest{75pt} \renewcommand\RSsmallest{5pt}
Other relsize
package commands
The relsize
package documentation lists the following commands, which are designed for text only and not for use with mathematical content.
Command | Purpose |
---|---|
\relsize{n} |
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).
|
\relscale{f} |
Change font size by scale factor f .
|
\textlarger[n]{text} |
Text size enlarged by (optional) n steps.
|
\textsmaller[n]{text} |
Text size reduced by (optional) n steps.
|
\textscale[f]{text} |
Text size scaled by factor f .
|
- Note: The
relsize
commands\mathsmaller
and\mathlarger
are designed for use with mathematical content—refer to the package documentation for further details.
Example: using the relsize
package
The next example demonstrates various commands provided by the relsize
package. Note the following:
- the use of groups {...} to localize the effect of font size changes;
- fixing the maximum scaled font size to 75pt by writing
\renewcommand\RSlargest{75pt}
% article class is loaded with default 10pt text size
\documentclass{article}
% 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}
\usepackage{relsize}
% Define our simple macro
\bgroup
\catcode`@=11
\gdef\getfontsize{\f@size pt}
\egroup
% Set the maximum scaled font size to 75pt
\renewcommand\RSlargest{75pt}
\begin{document}
Hello, in this paragraph the normal font size is \getfontsize.
Now scale the current font using 3 ``steps'': {\verb=\relsize{3}=\relsize{3}
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 \textscale{2}{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...''
\end{document}
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:
The scalefnt
package
The scalefnt
package defines the \scalefont
command
\scalefont{factor}
where factor
will scale the size of the current font and the current value of \baselineskip
—which is used to calculate the spacing between lines of text in a typeset paragraph.
Example: using the scalefnt
package
The next example demonstrates the \scalefont
command and also uses our \getfontsize
macro.
% article class is loaded with default 10pt text size
\documentclass{article}
% 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}
\usepackage{scalefnt}
% Define our simple macro \getfontsize
\bgroup
\catcode`@=11
\gdef\getfontsize{\f@size pt}
\egroup
\begin{document}
For this paragraph, the current font size is \getfontsize{} and the value of \verb=\baselineskip= is \the\baselineskip.
If we use \verb=\scalefont{1.5}= \scalefont{1.5} the font size is now \getfontsize{} and \verb=\baselineskip= is \the\baselineskip.
\end{document}
This example produces the following output:
Examples from tex.stackexchange
A search on tex.stackexchange for questions tagged fontsize
produces a long list of results which contain explanations, code and solutions related to changing font sizes. Some questions are quite specialist whereas others are more general; here is a small selection that may be of interest:
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class