Text FormattingChanging size of typewriter typeface

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
nifty
Posts: 16
Joined: Sat Oct 09, 2010 4:24 pm

Changing size of typewriter typeface

Post by nifty »

I'm setting a book in 11pt type and using the Listings package. The author thinks the \tt font is too big. I changed the parameters of the listing to \small and this looks great. Is there a way resize the rest of the typewriter font used in the document to "small"?

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Changing size of typewriter typeface

Post by localghost »

nifty wrote:[…] The author thinks the \tt font is too big. […]
At least for Computer Modern (CM) he's mistaken. Are you using other fonts than CM? Show your document setup by a minimal example.


Thorsten
nifty
Posts: 16
Joined: Sat Oct 09, 2010 4:24 pm

Changing size of typewriter typeface

Post by nifty »

Here is a link to a sample page. We've set hundreds of textbooks with various "typewriter" faces including Courier, Letter Gothic, Monospace 821. We almost always have to drop a point size when using a monospace font to make it look the same size as the text. It would be nice if the type in #14 was the same size as #17. And, yes, to your question of whether we are using CM fonts.
http://www.necomp.us/pics/ttSample.pdf
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Changing size of typewriter typeface

Post by localghost »

The typewriter font on that sample page is not bigger than the serif font of the surrounding text. That's what your first post suggested. The font in the small script has been downscaled. You described that this is done by settings for the listings package. So far so good. But from my point of view there is still no counterexample for the claim that the typewriter font is too big.

Unfortunately you don't say anything about the in-line code in point #14 is written. Assumed that you have chosen basicstyle=\small\ttfamily as general option for your listings, you could use \lstinline|…| to get the desired result.
nifty
Posts: 16
Joined: Sat Oct 09, 2010 4:24 pm

Re: Changing size of typewriter typeface

Post by nifty »

It's too big in relation to example 17. I realize that in example 14, both the basal text and the \tt font are 11 point. Optically, it looks bigger even though they are both 11 point. I don't want the \tt at 11 point. I'd like it smaller throughtout the document as in the listing. I thought there may be something I could put in the preamble that would change ONLY the \tt font to \small
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Changing size of typewriter typeface

Post by localghost »

I have shown a possible solution in my last reply. Did you test it?
Post Reply