Font sizes, families, and styles

LaTeX normally chooses the appropriate font and font size based on the logical structure of the document (e.g. sections). In some cases, you may want to set fonts and sizes by hand.

The following example shows how to use the smallest available font size in LaTeX ( \tiny ) and the small caps ( \textsc <. >) font style:

This is a simple example, \tiny this will show different font sizes> and also \textscdifferent font styles>.

FontStyles.png

The following image shows the output produced by the example above:

Font sizes

Font sizes are identified by special names, the actual size is not absolute but relative to the font size declared in the \documentclass statement (see Creating a document in LaTeX).

In the following example, <\huge huge font size>declares that the text inside the braces must be formatted in a huge font size. For a complete list of available font sizes see the reference guide.

In this example the \huge huge font size> is set and the \footnotesize Foot note size also>. There's a fairly large set of font sizes.

FontSizesOLV2.png

The following image shows the output produced by the example above:

Font families

By default, in standard LaTeX classes the default style for text is usually a Roman (upright) serif font. To use other styles (families) such as sans serif, typewriter (monospace) etc. you need to use some specific LaTeX commands, as shown in the example below:

In this example, a command and a switch are used. \textttA command is used to change the style of a sentence>. \sffamily A switch changes the style from this point to the end of the document unless another switch is used.

The following image shows the output produced by the example above:

UsingFontStyles2.png

You can set up the use of sans font as a default in a LaTeX document by using the command:

\renewcommand\familydefault>\sfdefault> 

Similarly, for using roman font as a default:

\renewcommand\familydefault>\rmdefault> 

Font styles

The most common font styles in LaTeX are bold, italics and underlined, but there are a few more.

In the following example the \textsl command sets the text in a slanted style which makes the text look a bit like italics, but not quite. See the reference guide for a complete list of font styles.

Part of this text is written \textslin a different font style> to highlight it.

The following image shows the output produced by the example above:

UsingSlantedText.png

If you want to go back to "normal" font style (default for the LaTeX class you are using), this can be done by using the \textnormal <. >command or the \normalfont switch command.

Putting it all together

The following example combines together the various LaTeX code fragments used in this article.

\documentclassarticle> \begindocument> %Example of different font sizes and types This is a simple example, \tiny this will show different font sizes> and also \textscdifferent font styles>. \vspace1cm> %Example of different font sizes and types In this example the \huge huge font size> is set and the \footnotesize Foot note size also>. There's a fairly large set of font sizes. \vspace1cm> %Example of different font sizes and types In this example, a command and a switch are used. \textttA command is used to change the style of a sentence>. \sffamily A switch changes the style from this point to the end of the document unless another switch is used. \rmfamily \vspace1cm> %Example of different font sizes and types Part of this text is written \textslin different font style> to highlight it. \enddocument> 

Reference guide

Command Output
\tiny F-tiny.png
\scriptsize F-scriptsize.png
\footnotesize F-footnotesize.png
\small F-small.png
\normalsize F-normalsize.png
\large F-large.png
\Large F-large2.png
\LARGE F-large3.png
\huge F-huge.png
\Huge F-huge2.png

Default font families

typeface = family command switch command output
serif (roman) \textrm \rmfamily F-textrm.png
sans serif \textsf \sffamily F-textsf.png
typewriter (monospace) \texttt \ttfamily F-texttt.png

Font styles

style command switch command output
medium \textmd \mdseries F-textmd.png
bold \textbf \bfseries F-textbf.png
upright \textup \upshape F-textrm.png
italic \textit \itshape F-textit2.png
slanted \textsl \slshape F-textsl.png
small caps \textsc \scshape F-textsc.png

Further reading

For more information see:

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX