Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using libertine fonts and I would like to change the texttt command to use the cmtt font. I tried :

\renewcommand{\texttt}[1]{\fontfamily{cmtt}\selectfont{#1}}

but it seems to switch the font for all the text coming after the texttt command. If I type before \texttt{center} after, I want only center to be in cmtt. How to do that ?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

If you load the libertine package, do

\usepackage[tt=false]{libertine}

With other font packages, if they don't provide a suitable option, just do

\renewcommand{\ttdefault}{cmtt}

after having loaded the font package.

Redefining \texttt in the way you tried is wrong.

share|improve this answer

Another good looking monospace font is Beramono:

\usepackage[T1]{fontenc}
\usepackage[tt=false]{libertine}
\usepackage[scaled=0.88]{beramono}
...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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