I'd like to select a new font for the monospaced text such as those parts within a \texttt{} and code snippets in the minted context. (As far as I can tell, minted just uses the document's default typewriter font, so I don't think I need to touch its settings.) I just want to change to another monospaced font that looks all right and has a normal tilde character. How do I do that?


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

\texttt{How to use a typewriter font}% CM default typewriter font
\renewcommand\ttdefault{cmvtt} % selects CM typewriter proportional font
\texttt{How to use a typewriter font}
\renewcommand{\ttdefault}{pcr} % selects Courier font
\texttt{How to use a typewriter font}      

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 :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.