Locally switching to a different font
A typographically good document with a consistent appearance commonly uses just a few fonts, each with a purpose. Common font choices are as follows:
- Serif body text
- Sans-serif for headings
- Monospaced for source code
Each font family is defined in the preamble, usually implicitly done by packages. There are LaTeX commands to switch between families, shapes, and weights, but what if you also wanted to use a completely different font, such as a second serif font? This recipe will help to achieve that.
How to do it...
We will take a look at two ways to switch to a completely different font:
- Defining a command
- Defining an environment
In each case, we need to know the shortcut code for the font. The code is based on Karl Berry’s naming scheme; you can read about it by running texdoc fontname at the command line or online at https://texdoc.org/pkg/fontname. You don’t need to study this guide...