{typewriter} is the term used for a "monospaced" font, that is, a font in which all characters have the same width.

learn more… | top users | synonyms (2)

50
votes
2answers
37k views

When should one use \verb and when \texttt

Sometimes people here use \verb!A SHORT COMMAND! and sometimes \textt{A SHORT COMMAND}. I'm unsure when to use which. Are there any guidelines or arguments for \verbatim vs. \texttt?
31
votes
3answers
2k views

What's a good typewriter template?

I'm searching for a template which makes a document look like it's written with a real typewriter. Ideally, this means it's not only in mono-spaced font, but the hyphenation is adjusted accordingly. ...
30
votes
1answer
3k views

How to automatically hyphenate within \texttt?

This question was phrased as a bug report for LaTeX and I thought it would be helpful to be presented here (including an answer). The person had a lot of "common words" in typewriter font sprinkled ...
27
votes
3answers
13k views

How to get long \texttt sections to break

I often format path names with \texttt which can be very long. Usually Tex will not break this text. The line will just create a hbox overflow. It looks like this: ................ ...C:\documents ...
22
votes
5answers
4k views

Why are URLs typeset with monospace fonts by default?

When typesetting URLs in LaTeX using the url package, they are set in a mono space font by default. While I just accepted that as a fact for a long time, I am now starting to wonder why? In Browsers, ...
21
votes
3answers
36k views

Underscores in words (text)

How can I produce the text Word_one_two in LaTeX? I tried: Samp\_Dist\_Corr But, it doesn't quite look right. Also, I want it in the typewriter font, so actually, I'm doing: ...
21
votes
4answers
10k views

Using \ttfamily with \bfseries (or how to enable bold in fixed-width font)

I'm using listings package, and I've added basicstyle=\ttfamily\footnotesize. However, when I do that, the keywords from the embedded source-code are not bold anymore. I figured that \ttfamily ...
19
votes
2answers
9k views

Good monospace font for code in LaTeX?

I'm currently working on my dissertation and am using Palatino for text with the Euler font for mathematics. As part of my work I'll be presenting quite a few code examples, and was wondering if ...
18
votes
1answer
361 views

Improving typewriter animation

How can I improve the code for this animation so that I can write more words? I wanted a smarter code. \documentclass{article} \usepackage{tikz} \usepackage[active,tightpage]{preview} ...
17
votes
3answers
11k views

Shrinking monospace style for listings package

I am working on a thesis and putting together a "pretty" listing. I'm looking at setting up a small font style for a code view. What I have here is: \usepackage{listings} \lstset{language=C, ...
17
votes
2answers
811 views

Entire document typed in monospace font

I want to put an entire document into monospace font for various reasons. This is nominally fairly easy; you can say \renewcommand{\familydefault}{\ttdefault}. However, there at least two problems ...
16
votes
2answers
15k views

How to make a real apostrophe or single-quote in LaTeX

I am trying to incorporate programming examples in a LaTeX document. The document renders nicely with pdflatex; however, the single quotes get transformed into U+2019, a right-single-quotation mark. ...
16
votes
3answers
2k views

How can I create a full-size circumflex in typewriter font?

I have some C source code and would like to show the circumflex or caret (^) in the way it is typically shown in source code -- as a full-size character. The source code will be appearing in ...
15
votes
2answers
909 views

Which typewriter font fits to Linux Libertine and supports bold letters?

I'm thinking about using the Linux Libertine font (\usepackage{libertine}) in my next TeX documents. For listings with syntax highlighting I will need a typewriter font that supports boldface. I ...
15
votes
2answers
589 views

How to center a typewriter (ttfamily) '+'

I would like to draw a circular TikZ node with + in its center, but font=\ttfamily moves it up. Why? How to solve it? \documentclass[border=3mm]{standalone} \usepackage{tikz} \begin{document} ...
14
votes
6answers
7k views

Alternative monospace fonts

My document uses the txfonts package, which provides Times Roman, Helvetica and what appears to be a facsimile of Courier. However, I dislike the monospace font and find it to be particularly ugly. I ...
14
votes
2answers
5k views

\texttt overfull hbox problem

I asked a question earlier about \verb and overfull hbox : In-line \verb -- overfull hbox problem And regarding the solution there, changed many of my \verbs to \texttt{}s. I have come up with a new ...
13
votes
2answers
268 views

Typewriter in TikZ node

A small example: \documentclass{standalone} \usepackage{tikz} \begin{document} \tikz{\node[text width=1cm]{\tt totot\\t t t};} \tikz{\node{\parbox{1cm}{\tt totot\\t t t}};} \end{document} As you ...
12
votes
1answer
306 views

Escaped characters in typewriter font

I know a number of ways to fix this (e.g. \usepackage[T1]{fontenc}), but I want to understand what's happening in the following example. \documentclass{article} \begin{document} \noindent \$ \% ...
11
votes
1answer
2k views

Difference between {\tt \{} and \verb+{+

Why is {\tt \{} typeset as an ordinary { and not the same as for instance \verb+{+? To illustrate: {\tt With tt:~ \{} \verb+With verb: {+ yields
11
votes
3answers
750 views

unicode \begin{verbatim} with cmtt?

A lot of leading-edge programming languages (like Coq and Agda) allow nearly unrestricted use of unicode symbols in program text, so you can have math characters like $\otimes$ (Unicode U+2A02) as ...
10
votes
3answers
713 views

How can I ensure all teletype/monospaced text is in a certain color?

I'm trying to include some monospaced text, and I'd like it to be in a different color than the normal text. There will be several (read: hundreds) of instances of monospaced text, and I want it all ...
10
votes
5answers
2k views

Minion Pro and Monospace Font

This is more a typography question than a TeX one, but can anyone recommend me a good monospaced font that blends well with Minion Pro?
10
votes
4answers
358 views

A more wedge-like symbol instead of a caret in typewriter-font text?

I'm trying to typeset some computer code which involves a caret (for powers); for example \verb!x^3+x^2-1! The trouble here is that the caret produced is rather flat. I could use a wedge instead: ...
9
votes
1answer
495 views

Can I change all math output to use monospaced text?

Is there any way of modifying the preamble, so instead of typing $\mathtt{x}$ ... \begin{eqnarray} \mathtt{y} & \mathtt{=} & \mathtt{z^\pi} \end{eqnarray} I can omit the \mathtt{...} ...
9
votes
3answers
2k views

A monospace or typewriter font with matching math support

This might sound odd but I really like the old typewriter books from the pre-TeX era (the type of books that inspired Knuth to make TeX!). I don't know the exact reason, maybe its because I am very ...
9
votes
1answer
646 views

Middle English Yogh character

I was wondering if anyone knows of a package which supports the Middle English character yogh - that's Ȝ (U+021C) ȝ (U+021D). In TIPA, there is the character ezh - that's Ʒ (U+01B7) ʒ (U+0292). Ezh is ...
9
votes
1answer
238 views

Hyphenate \ttfamily without hyphen dash

Is it possible to hyphenate text without inserting a hyphen. \documentclass{article} %\usepackage{courier} %\usepackage{bera} %\usepackage{arev} \begin{document} ...
9
votes
1answer
321 views

How to deal with it/sl/bold in lmtt?

I just stumbled upon the fact that the font lmtt (latin modern typewriter) seems to exist in italic slanted bold bold slanted but not bold italic At least the file t1lmtt.fd contains the ...
8
votes
2answers
1k views

Scaling fonts document-wide

I'm looking to use lcmtt mentioned here as my default typewriter font, but the scaling is way out of proportion with the rest of the text. I've used the following commands to enable the font: ...
8
votes
2answers
4k views

Bold Typewriter Type fonts

I found out that there are cmbtt10 and cmttb10 fonts available. Unfortunately they are not used until I activate them with the \font macro, so just searching for those fonts is not possible. The ...
8
votes
1answer
499 views

Libertine monospaced font seems to big

I'd like to write a document with the Libertine font (using the libertine package). I have a couple of code snippets in the text, and to me it seems like the Libertine Mono font that is used by the ...
8
votes
2answers
2k views

Typesetting single quotes

How can the single quote character be typeset as the ascii character ' in a LaTeX document? For instance, consider the document: \documentclass{standalone} \usepackage[T1]{fontenc} ...
8
votes
2answers
269 views

Problem with >> inside of \tt

I have an inline code example with a nested Java generic declaration, using the typewriter typeface. However, the closing >> is rendering as a black box. A cursory Google search suggested ...
7
votes
3answers
891 views

Writing a backslash in the \texttt environment

How do you go about writing a backslash in the /texttt environment? The $\backslash$ trick makes the font inconsistent. The reason I am asking is that I am writing some introductory computer science ...
7
votes
3answers
145 views

Handling typesetting of plural class names

I'm sorry if this is the wrong stackexchange to ask in, but it seems to be the place where people care about typography :) I'm writing lecture notes on Android development, and I like to put class ...
7
votes
3answers
505 views

verbatim and CJK

I'm not familiar with chinese characters and fonts. But I have to type some characters into a document. XeLaTeX may be an option, but I'm looking for a solution with pdflatex. Here is my MWE, which I ...
7
votes
1answer
632 views

verbatim environment does not produce monospace

I use quite a lot packages in my document and I cannot find which one's fault is that verbatim does not produce monospaces. Anyway, if I knew this, I have no idea how to solve problems when packages ...
7
votes
1answer
190 views

How can I force pairs of brackets [][] to be closer to each other in \texttt?

\documentclass{article} \begin{document} Normal margin here. Normal margin here. Normal margin here. Normal margin here. Normal margin here. Normal margin here. Normal margin here. Abcdefgh ...
7
votes
2answers
240 views

How to horizontally align all characters like a typewriter

I want to make a document that looks like an old top secret file written on a typewriter. The problem is that when I want to use a center environment, the alignment of the characters is off. Is there ...
7
votes
1answer
338 views

Typewriter text in sections with ACM “sig-alternate” document class

I would like to put a \texttt{} block in a section, e.g. \section{Algorithm \texttt{FSG}} But the problem of this approach is that the text inside the\texttt{} block does not inherit the size and ...
7
votes
1answer
1k views

Change font size of \texttt globally?

I'm using TeX Gyre Pagella as the main font of a document which is typeset using a font size of 10pt. For the technical terms, I want to replace the default Computer Modern Typewriter with Bera Mono ...
7
votes
1answer
149 views

characters “>>” in LaTeX

I'm writing about programming language Haskell and I need to describe operators named >>= and >>. I wrap all references to names from the programming language in \texttt{ ... }, for ...
7
votes
1answer
2k views

not able to write bold characters using textbf

I'm working on latex and R (swaeave) and I am using utf8 encoding but when I use \textbf{dataset}, the text is not bold. Below is part of my code. But I am not sure what is reason behind it. ...
7
votes
1answer
2k views

Suggestions for typewriter font to match Concrete and Euler

I'm having fun using a combination of Concrete and Euler in some of my documents. I wonder if anyone has a suggestion about a matching typewriter font? I've been trying Inconsolata (scaled to .97) ...
7
votes
1answer
1k views

Double quotes with monospaced font and LuaLaTeX

I am trying to set the following minimal document: \documentclass[a4paper,11pt]{article} \usepackage{fontspec} \setmonofont{Inconsolata} \begin{document} \begin{verbatim} <!DOCTYPE HTML PUBLIC ...
6
votes
2answers
324 views

C++ operators ^=, <<=, >>= misinterpreted

I write a list of C/C++ operators of the following form : \texttt{operator+=}, \texttt{operator-=}, \texttt{operator*=}... The problem is that \texttt{operator\^=}, \texttt{operator>>=}, ...
6
votes
2answers
275 views

Bold monospace font extra-large

I would like to print very large (e.g., font size 43) monospaced bold text. The methods I know don't seem to go together: \documentclass[10pt, a4paper]{article} \usepackage{anyfontsize} ...
6
votes
4answers
421 views

How do I change the standard “math font”?

What I can tell, the font you get, it looks like the standard, "bookish" font, only tilted. How can I get a monospace font with a straight spine, e.g., the font you get with texttt? I'm happy with ...
6
votes
1answer
331 views

Garamond and URL links

I am experimenting the use of the Garamond Premier Pro font for a dissertation and I still would like to keep the URL information in the bibliography when available. Obviously, there's a font problem ...