Text FormattingHow to use two different typewriter fonts?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gmiwenht
Posts: 3
Joined: Wed Oct 13, 2010 5:20 am

How to use two different typewriter fonts?

Post by gmiwenht »

Hi,

I am using the courier package in a very large document, for listing/verbatim/etc. I would like to keep using this package and I would like everything to remain exactly as it is at the moment.

I just want to make one small adjustment: I want my email at the start of the document to be displayed in the default CMU typewriter font (i.e. the way it would be displayed if I did not use the courier package and just used the \texttt command).

It seems like such a simple thing to do, but I cannot figure it out. I've been trying for hours.

I am using Latex => PS => PDF.

Thank you in advance,
Last edited by gmiwenht on Sat Oct 23, 2010 3:05 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to use two different typewriter fonts?

Post by frabjous »

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{courier}
\begin{document}

{\fontfamily{cmtt}\selectfont This is in Computer Modern Typewriter.}

\texttt{This is in courier.}

(Both are ugly. Ever considered beramono or inconsolata?)

\end{document}
tt.png
tt.png (7.3 KiB) Viewed 7508 times
gmiwenht
Posts: 3
Joined: Wed Oct 13, 2010 5:20 am

Re: How to use two different typewriter fonts?

Post by gmiwenht »

Thank you, worked perfectly.

And I've never even heard of the other fonts!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to use two different typewriter fonts?

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic (and not the last post) accordingly as clearly written in Section 3 of the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the board
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to use two different typewriter fonts?

Post by frabjous »

gmiwenht wrote:Thank you, worked perfectly.

And I've never even heard of the other fonts!
See the LaTeX Font Catalogue: Subsection: Typewriter Fonts.
gmiwenht
Posts: 3
Joined: Wed Oct 13, 2010 5:20 am

Re: How to use two different typewriter fonts?

Post by gmiwenht »

I will mark the topic as solved.
Sorry, I did not read the rules before I posted, as I should have.

Thank you again for the response, and for the font suggestions.
Post Reply