How to set the default typewriter font?

It's the \ttdefault command which normally takes care of this.

\documentclass{article}
\begin{document}
\texttt{How to use a typewriter font}% CM default typewriter font
\par
\renewcommand\ttdefault{cmvtt} % selects CM typewriter proportional font
\texttt{How to use a typewriter font}
\par
\renewcommand{\ttdefault}{pcr} % selects Courier font
\texttt{How to use a typewriter font}      
\end{document}

enter image description here

But indeed it's usually best to let dedicated packages as beramamono do this, since there can be a lot of subtleties behind fonts (of which I'm often not aware myself :-)


\usepackage[scaled=0.8]{FiraMono}

Put the above line in the preamble of your document, i.e. immediately after \documentclass. That's it!

Concerning the related question of what font to choose, see my answer at
Alternative monospace fonts.

Reference:
https://tug.org/FontCatalogue/typewriterfonts.html

Tags:

Fonts