Reading topics about monospaced fonts, I found out that changing \tt font for the document requires replacing only one line in the preambule. For example, I only change the commented line


to \renewcommand

  • \renewcommand{\ttdefault}{cmtt} for Computer Modern Typewriter
  • \renewcommand{\ttdefault}{cmvtt} for Computer Modern Typewriter Proportional
  • \renewcommand{\ttdefault}{lcmtt} for Computer Modern Teletype L
  • \renewcommand*\ttdefault{lmvtt} for Latin Modern Typewriter Proportional
  • \renewcommand{\ttdefault}{pcr} for Courier
  • \renewcommand*\ttdefault{txtt} for TXTT

or \usepackage

  • \usepackage[ttdefault=true]{AnonymousPro} for Anonymous Pro
  • \usepackage{ascii} for Ascii
  • \usepackage[scaled=0.82]{beramono} for Bera Mono
  • \usepackage{courier} for Courier
  • \usepackage[scaled=1.04]{couriers} for Scaled Courier
  • \usepackage{DejaVuSansMono} for DejaVu Sans Mono
  • \usepackage[defaultmono]{droidmono} for Droid Sans Mono
  • \usepackage{inconsolata} for Inconsolata
  • \usepackage{kpfonts} for KP Monospaced
  • \usepackage{lmodern} for Latin Modern
  • \usepackage[zerostyle=d]{newtxtt} for New TXTT
  • \usepackage[ocr-a]{ocr} for OCR-A Optical Character Recognition Font A
  • \usepackage{ocr} for OCR-B Optical Character Recognition Font B
  • \usepackage{pxfonts} for PX Fonts
  • \usepackage{tgcursor} for TeX Gyre Cursor
  • \usepackage[scaled=1.05,proportional,lightcondensed]{zlmtt} for Latin Modern Typewriter Z
  • \usepackage{luximono} for LuxiMono (needed getnonfreefonts luximono)
  • \usepackage[scaled=1.05]{ulgothic} for Letter Gothic (needed getnonfreefonts lettergothic)

In the test.tex I simply use {\ttfamily ... } and I get selected font instead of default \tt.

What should I do to use the all listed above fonts in the same document?

The idea is something like this

% Switch to AnonymousPro
% Switch to ...

If you want to run a test document which includes the typewriter font alongside other styles (e.g. to test how well a particular typewriter font works with a serif used for body text) or you just don't like typing, this example provides a couple of commands for convenience:


\newcommand*\ttfontstotry{cmtt,cmvtt,lcmtt,lmvtt,pcr,txtt}% add additional families here, separated by commas
  \newcommand*\myttfontstest{% defines the actual test command
    \@for \xx:=\ttfontstotry \do {% loops through the families
      \par family: \xx\par

\begin{filecontents}{test.tex}% just for testing


    Oh, jinxed quartz of black sphinx, go hear my vow!



      Oh, jinxed quartz of black sphinx, go hear my vow!}



  \myttfontstest% try them out!


typewriter variants with default serif

  • Fonts ascii and cm pica work with \newfont. Do they have families? – mwloda Nov 25 '14 at 11:35
  • @user2793410 ascii is a font family but it is defined only in the package file, and it uses the 'raw' encoding U. The README for cmpica states that 'A modified version of the original companion LaTeX [2.09] style can be found floating around on the net if one looks hard.' I'd assume if a family is declared anywhere, it would be there (assuming that 'modified' means 'updated for LaTeX-2e'). – cfr Nov 25 '14 at 15:53
  • @Down-voter Any particular reason? Or just general animus? – cfr Apr 25 '15 at 23:36


You can just use the font family without making it the default. For the packages you need to check their documentation the name of the font family used, then use it in the same way.



{\fontfamily{cmtt}\selectfont abcdef 123}

{\fontfamily{cmvtt}\selectfont abcdef 123}

{\fontfamily{lcmtt}\selectfont abcdef 123}

{\fontfamily{lmvtt}\selectfont abcdef 123}

{\fontfamily{pcr}\selectfont abcdef 123}

{\fontfamily{txtt}\selectfont abcdef 123}

  • Does No file T1something.fd mean that something is not the name of the font family? – mwloda Nov 25 '14 at 8:32
  • @user2793410 it could mean that, or it could mean that is the name, but you do not have the font installed or (least likely) the font package does not use .fd files but includes the definitions directly in the package. – David Carlisle Nov 25 '14 at 9:20
  • @user2793410 Or it could mean that the font family is not available with the T1 encoding but only set up to support (an)other encoding(s). – cfr Nov 25 '14 at 15:45

David Carlisle's answer is about changing current font. The answer from cfr changes \ttdefault.
I cannot call my solution complete because I couldn't make it for all the fonts. Looking for font families names took me some time. So I put them in my own answer.

% Store the default font
% Fonts from packages
   % ! LaTeX Error: Option clash for package textcomp.
\usepackage[scaled=0.84]{luximono} % getnonfreefonts luximono
\usepackage[scaled=0.92]{ulgothic} %  getnonfreefonts lettergothic


% The last one
\ttdefault\\ % why do I get zlmvtt?

% Back to default

{\renewcommand{\ttdefault}{pcr} \input{testtt}}

{\renewcommand{\ttdefault}{cmtt} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{cmvtt} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{lcmtt} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{lmvtt} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{txtt} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{AnonymousPro} \noindent\input{testtt}}

{\renewcommand{\ttdefault}{fvm} \noindent\input{testtt}} % Beramono

% Courier == pcr

Scaled Courier\\
{\renewcommand{\ttdefault}{pcrs} \noindent\input{testtt}} % Scaled Courier

{\renewcommand{\ttdefault}{DejaVuSansMono-TLF} \noindent\input{testtt}}

Droid Mono\\
{\renewcommand{\ttdefault}{fdm} \noindent\input{testtt}} % Droid Mono

{\renewcommand{\ttdefault}{zi4} \noindent\input{testtt}} % inconsolata

KP tt\\
{\renewcommand{\ttdefault}{jkptt} \noindent\input{testtt}} % KP tt

Latin Modern\\
{\renewcommand{\ttdefault}{lmtt} \noindent\input{testtt}} % latin modern

{\renewcommand{\ttdefault}{ul9} \noindent\input{testtt}} % LuxiMono

New TXTT\\ 
{\renewcommand{\ttdefault}{newtxtt} \noindent\input{testtt}} % New TXTT

% Optical Character Recognition Font B ?

% PX Font tt == TX Fonts == txtt ?

New TX\\
{\renewcommand{\ttdefault}{ntxtt} \noindent\input{testtt}} % New TX

{\renewcommand{\ttdefault}{qcr} \noindent\input{testtt}} % gyre cursor looks like courier ?

Letter Gothic\\
{\renewcommand{\ttdefault}{ulg} \noindent\input{testtt}} % Letter Gothic

{\renewcommand{\ttdefault}{zlmtt} \noindent\input{testtt}} % Latin Modern Typewriter Z

{\asciifamily \noindent\input{test}} % No file T1ascii.fd


Fo the testtt.tex file (File test.tex for ascii is without {\ttfamily ... })

Normal {\bfseries Bold} 
{\slshape Slanted} {\bfseries\slshape Slanted\&Bold} 
{\itshape Italic} {\bfseries\itshape Italic\&Bold} 
Z2 lI1 S5 O0}

I get the following font comparison (attention, some fonts are scaled!).

Fonts comparison

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.