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
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% PLACE NEW FONT
\begin{document}
Default
\input{test.tex}
\end{document}
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 (neededgetnonfreefonts luximono
)\usepackage[scaled=1.05]{ulgothic}
for Letter Gothic (neededgetnonfreefonts 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
\begin{document}
Default
\input{test.tex}
% Switch to AnonymousPro
\input{test.tex}
% Switch to ...
\end{document}
Best Answer
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: