Text FormattingTeletype text in the entire document

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Wolfenstein
Posts: 4
Joined: Tue Jun 14, 2011 12:47 am

Teletype text in the entire document

Post by Wolfenstein »

By simply adding

Code: Select all

\ttfamily
I get all text in the document to be in teletype because my proof reader thinks it is easier on his eyes to make marks in text if it is monospaced but I get one problem. It breaks to new lines after the line reaches outside the text width so sometimes there is text in the margin and in the worst case scenario the last letters in the word reaches outside the paper.

http://img269.imageshack.us/img269/2751/longword.png

What I would like it for latex to line break before the word reaches in to the margin instead of after so words like Antidisestablishmentarianism would be on the next line instead of reaching outside of the paper.

I guess I could change the margin to be wider than what the longest word in the document is in teletype on the paper but that is an ugly solution.

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

Teletype text in the entire document

Post by frabjous »

To typeset the entire document in tt, I recommend doing this:

Code: Select all

\renewcommand*{\familydefault}{\ttdefault}
in the preamble, rather than using \ttfamily.

For the problem of going past the margins, try adding:

Code: Select all

\sloppy
right after \begin{document}. Not sure if that will help enough, but should be a start.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Teletype text in the entire document

Post by Stefan Kottwitz »

Perhaps this is also interesting for you, if justification would be desired: Full justification with typewriter font.

Stefan
LaTeX.org admin
Post Reply