courierとnewtxtを一緒に使用する

courierとnewtxtを一緒に使用する

同じ文書内で 2 つの異なる等幅フォントを使用したいと考えています。

しかし、\texttt{The quick brown fox jumps over the lazy dog}を使用して記述すると\usepackage{courier}、図 2 は取得できますが、図 1 は取得できません。

対照的に、\texttt{The quick brown fox jumps over the lazy dog}を使用して 記述すると\usepackage{newtxtext}、図 1 は取得できますが、図 2 は取得できません。

では、同じ記事に 2 つの図を生成するにはどうすればよいでしょうか?

図1:

図1

図2:

図2

答え1

これがそれですが、なぜこれが必要なのかはよく分かりません。

\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}

ここに画像の説明を入力してください

関連情報