How do I adjust the font size? (2023)

Contents

  • 1 Introduction
  • 2 Setting document font sizes
    • 2.1 The extsizes classes
      • 2.1.1 Example: using the extarticle class
  • 3 LaTeX font size commands
    • 3.1 Example: using font size commands
  • 4 LaTeX font size environments
    • 4.1 Example: using font size environments
  • 5 The \fontsize and \selectfont commands
    • 5.1 Example: using \fontsize and \selectfont
  • 6 Other packages for changing font size: relsize and scalefnt
    • 6.1 The relsize package
      • 6.1.1 Other relsize package commands
      • 6.1.2 Example: using the relsize package
    • 6.2 The scalefnt package
      • 6.2.1 Example: using the scalefnt package
  • 7 Examples from tex.stackexchange

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}

Open this example in Overleaf

This example produces the following output:

(Video) How Change The Font Size in Windows 10

How do I adjust the font size? (1)

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}

How do I adjust the font size? (2)

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}

How do I adjust the font size? (3)

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 tinyuntil 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}

Open this example in Overleaf

This example produces the following output:

(Video) How To Change Font Size On ANY iPhone!

How do I adjust the font size? (4)

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}

Open this example in Overleaf

This example produces the following output:

How do I adjust the font size? (5)

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.

(Video) How to Change Drop Down Width and Font Size in Excel

\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}

Open this example in Overleaf

This example produces the following output:

How do I adjust the font size? (6)

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 using n “steps”; however, if the requested (scaled) size istoo 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.

CommandPurpose
\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}.\vskip12ptUsing 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}
(Video) Android Lollipop How to Change Text Font Size

Open this example in Overleaf


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:

How do I adjust the font size? (7)

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}

Open this example in Overleaf

This example produces the following output:

How do I adjust the font size? (8)

(Video) How to Change Font Size on Windows 10

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:

Videos

1. How To Change Font Size On ANY Android! (2021)
(LoFi Alpaca)
2. How Change the Font Size in Windows 11 [Tutorial]
(MDTechVideos)
3. How To Change Font Size, Style, and Color on Shopify
(Brennan Valeski)
4. How to adjust text size on iPhone or iPad | Apple Support
(Apple Support)
5. How to change the font size and font style quickly in Microsoft Outlook
(Brad Dale)
6. Changing Default Font and Font Size in Word
(Charlotte Christian College Theological Seminary)

References

Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated: 11/10/2023

Views: 6031

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.