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 want to use two different monospaced fonts in one and the same document.

However, when I write \texttt{The quick brown fox jumps over the lazy dog} using \usepackage{courier}, I can get figure 2 but cannot get figure 1.

In contrast, when I write \texttt{The quick brown fox jumps over the lazy dog} using \usepackage{newtxtext}, I can get figure 1 but cannot get figure 2.

So, how to generate the two figures in the same article?

Figure 1:

Figure 1

Figure 2:

Figure 2

share|improve this question
    
Just to clarify: You want to be able to use two different monospaced fonts in one and the same document? –  Mico May 11 at 5:27
    
@Mico Yes, thanks for the clear description. –  Lijie Xu May 11 at 5:44

1 Answer 1

up vote 3 down vote accepted

Here it is, although it's not really clear why you want this:

\documentclass{article}
\usepackage{newtxtext}

\DeclareRobustCommand\crfamily{\fontfamily{pcr}\selectfont}
\DeclareTextFontCommand{\textcr}{\crfamily}

\begin{document}

\texttt{The quick brown fox jumps over the lazy dog}

\textcr{The quick brown fox jumps over the lazy dog}

\end{document}

enter image description here

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.