Questions tagged [typewriter]

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

Filter by
Sorted by
Tagged with
81
votes
5answers
74k 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 ...
2
votes
2answers
74 views

How can I save and restore fontdimen parameters?

I am using the fontdimen code in this answer to make spaces stretch in inline code samples (credit to Stefan Kottwitz): \documentclass{minimal} \usepackage{lipsum} \newcommand*\justify{% \...
1
vote
1answer
47 views

how can I change an arbitrary portion of my document to monospaced/typewriter font in xetex?

I want to put arbitrary portions of my text into a font that looks like it came out of a 1960s manual typewriter. In particular, each character must occupy a column, identical in width to all other ...
2
votes
1answer
38 views

Text runs off right margin with \texttt{}

I asked this question earlier and it was linked to other questions and considered closed. I've checked the answers to the linked questions and they don't answer my question so I'm trying again. The ...
18
votes
3answers
35k views

How to change the font of a LaTeX table to typewriter font?

I want to create a table in LaTeX, and this table needs to be in typewriter font. I have found Typesetting Tables with LaTeX, but I don't understand how to use it. How could I do this?
1
vote
1answer
27 views

How to edit .bst file to use texttt typewriter font?

I'm using the scrreprt document class and BibTeX, Version 0.99d with apsrev4-2 for by bibliography. I'd like to modify my local .bst file such that the eprint field is printed with the \texttt ...
7
votes
1answer
154 views

Selectively disable a ligature in pdflatex + newtxtext

I had a wonderfully working setup with LuaLaTeX, but my publisher demands I use PDFLaTeX and newtxtext. This, however, replaces ">>" in monospaced text with "»" which looks ...
0
votes
0answers
43 views

May I label with a monospaced typeface?

Say I have an enumerate environment like \documentclass{article} \usepackage{amsmath, amssymb, amsthm, enumitem, graphicx, hyperref, latexsym, babel, blindtext, thmtools} \usepackage{enumitem} \...
192
votes
7answers
329k 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?
0
votes
1answer
80 views

Use the bold typewriter font from lmodern for keywords in listings but keep Computer Modern fonts in the rest of document in LaTeX

I am writing a document in LaTeX using the standard Computer Modern fonts. The text is mainly in Russian but it includes some listings. I prefer to typeset listings using the standard typewriter font (...
1
vote
2answers
46 views

libertinus-otf does not print straight quotes in verbatim environment

Consider the following LuaLaTeX document: % arara: lualatex \documentclass{article} \usepackage{libertinus-otf} \setmonofont{CascadiaCod3-Light.otf} % from cascadia-code package on CTAN \begin{...
3
votes
2answers
129 views

typewriter font in times new roman

Given, \documentclass{article} \usepackage{times} \begin{document} This is textual typewriter {\tt Angry Hyena kills Lion to save her baby} This is mathematical typewriter ${\tt Angry~...
9
votes
3answers
267 views

\texttt and breaking in justified paragraphs

When a monospace segment is used within an otherwise variable-width justified paragraph, very often the monospaced part is wrapped "one word too late", resulting in many lines being overfull ...
127
votes
1answer
16k views

Use LaTeX to simulate old typewriter written texts

This question led to a new package: typewriter I'm giving my students an old exam and barely remembered to change the date at the top. A colleague and I joked about how long we could reuse the same ...
2
votes
1answer
47 views

Allow arbitrary linebreaks in \texttt formatted text

My document is a mixture of regular text and code, where I format the code with \texttt{}. To make this a little easier, I added a new command: \newcommand {\ttt} {\texttt} so now I just write, \ttt{...
2
votes
0answers
32 views

Typesetting mathematical unicode characters in typewriter font

This is a followup to this answer: https://tex.stackexchange.com/a/593973/27523 it suggests using the \DeclareUnicodeCharacter command to use Unicode source characters. Now the problem is that I use ...
0
votes
1answer
25 views

Newcommand without extra spacing [duplicate]

Defining a new command as \newcommand{\boo}{\texttt{boo}} and then using it in the text as \boo removes the space after boo and the next word. This is fine if the next word happens to be a period, ., ...
0
votes
1answer
104 views

Missing $ inserted when use \texttt [duplicate]

I have this simple code: \documentclass[10pt]{article} % amsmath package, useful for mathematical formulas \usepackage{amsmath} % amssymb package, useful for mathematical symbols \usepackage{amssymb} ...
2
votes
1answer
61 views

How do I detokenize '\texttt{%>%}'

I have a command: \newcommand{\help}[2]{ \href{https://www.rdocumentation.org/packages/#1/functions/#2}{\texttt{?\detokenize{#2}}} } and another \newcommand{\code}[1]{\texttt{\detokenize{#1}}} ...
4
votes
1answer
98 views

Define \textunderscore to mimic look of standard underscore

I noticed that the look of the underscore _ differs greatly from the look of \textunderscore How can I redefine \textunderscore to look like the standard underscore of the set font? I want to avoid ...
4
votes
1answer
138 views

Text in monospaced font being compressed

When there're too many characters in a line, the white spaces are being compressed so as to fit in those texts. Normally this is fine. But now since I'm using a monospaced font and I wish to keep the ...
1
vote
1answer
43 views

Modify hyphenation behavior for texts in monospaced font

I'm using a monospaced font and with some effort I got it hyphenated. However the hyphenation behavior is quite strange and the right side of the document is ugly. Is there a way to force it always ...
21
votes
4answers
11k views

Line break in texttt

I would like latex to break long text inside \texttt{} that does not contain any whitespaces. Currently the text just runs off the page. The latex document is generated from a reStructureText ...
1
vote
1answer
39 views

Combining Wrapping \texttt{} with Sections and TOC - Improper alphabetic constant

Was working on getting line wrapping working for code, and came across a solution which was working for me - until I tried to add a table of contents to my code. The issue seems to be with using the ...
1
vote
2answers
74 views

Underline text with === (SETEX style)

I'm trying to recreate the typewriter look. How to make \underline{sometext} work like SETEX-style section marker? The intended use is with monospaced/typewriter fonts for lines with plenty of space ...
2
votes
0answers
93 views

typewritten to Latex

I have a math book from the '60s in PDF. It's typewritten and I found it harder to read than a Latex edition, but couldn't find any modern edition. Is there an app or site or some way to transform it ...
28
votes
7answers
21k 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 ...
0
votes
1answer
95 views

Awful text wrap with \ttfamily

This might be a silly question but I cannot find a way to solve it. Below is a MWE: \documentclass{article} \usepackage[margin=1in]{geometry} \usepackage{blindtext} \begin{document} \ttfamily What ...
4
votes
1answer
135 views

How to avoid ligatures of double less equal sign in latex

I have lots of C++ code snippets in my article. Just see the following tex content and you'll get what I mean. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{xspace} \NewDocumentCommand{...
0
votes
1answer
46 views

Tex dash ligatures in TT family with Lualatex

I'm just playing around, trying to get Latex output like what I used see from a typewriter. (I know about typewriter.sty.) I'm using \ttfamily and Lualatex. Is there any way to get the Tex ligatures --...
1
vote
1answer
39 views

Reducing type text font when \texttt is inside a \newcommand

I am trying to reduce the font size of \texttt{} only, but the problem is that when I do it, the whole text (except for the tt!!) is reduced. My current packages are the below: \usepackage{stfloats} \...
0
votes
1answer
63 views

Text formatting, indent

How can I remove the indent after 'itemize'? I want 'algorithm 1...' to be written from the same place as header and first sentence. Is there a better way than \qquad to format lines after 'Inputs:' ...
4
votes
1answer
176 views

How to convert a quantitative article from the 1970s that was written on a typewriter to LaTeX math code?

Mathpix can convert formulas in journal articles into Mathjax/LaTeX code by scanning or taking a picture of them. Is there a similar way to scan a journal article from the 1970s that was written on an ...
6
votes
2answers
499 views

How to automatically use typewriter font in arrays?

I'm trying to write a script on formal logic. The source code looks something like this: some text... \[ \begin{array}[]{c | c} p & (\lnot p) \\ \hline 1 & 0 \\ 0 & 1 \\ \end{...
0
votes
2answers
153 views

How can I use \texttt{some text} for the names of greek letters?

I want to write coefficients names as alpha_0, beta_1 and phi_1 using \texttt{...} to make it look like a function arguments. I tried \texttt{alpha_0} but I got an error ! Missing $ inserted.<...
0
votes
1answer
74 views

How to prevent \texttt from making the text bold

I tried to escape the underscore character but the resultant "_" did not look perfect. Then I came across another answer suggesting to use \texttt. However, I see that \texttt is also ...
1
vote
0answers
34 views

Push \texttt in tcolorbox to a new line if it doesn't fit

So I use a colorbox with \texttt for inline code fragments, and as you can see from the picture below, the code fragments run off the page. What I would like is for the colorbox to appear on the next ...
1
vote
1answer
45 views

The most fancy way to write 2D array

I have something like What's the best way to do it? I tried this method but it doesn't work. \begin{array}{r}[[0.86455156], \\ [-0.82104237], \\ [4.12186079]]\end{array} Getting,
1
vote
2answers
34 views

problem with symbol ^, kerkis-font and texttt

I want to write something like this SomeCode^MoreCode, so I wrote the code below. \documentclass{article} \usepackage[english,greek]{babel} \usepackage[utf8]{inputenc} \usepackage{kerkis} \begin{...
3
votes
1answer
58 views

Monospaced numbers in invoice2

I am trying to make an invoice where the entries are all using ttfamily, in the invoice2 package, but can't seem to get the numbers (as opposed to the table text) in monospace. This is frustrating as ...
2
votes
1answer
105 views

Missing { / } inserted when using \texttt

I recently had to reinstall my tex environment (texlive under windows), and afterwards I got lots of "Missing { [or }] inserted" errors. I managed to track the cause down to the use of \...
5
votes
1answer
5k views

Adding a highlight to \texttt blocks

I'm trying the add a grey highlight to the \texttt command to essentially achieve the same effect as the code blocks on here. This is something I attempted to do when I first started writing my ...
17
votes
3answers
1k views

Is there an easy way to enter texttt mode, like $ for math mode?

When I want to refer to a math variable, say some index i, I simply surround it with dollars (i.e., $i$) as opposed to writing \begin{math}i\end{math}. Is there some similar option for texttt mode, e....
11
votes
5answers
2k views

Changing all single quotes to be straight when within texttt

I have a document with many ' characters inside of texttt. Is there a way to make them all appear straight when in texttt? I know that I can search/replace all ' with \textquotesingle: Adding ...
2
votes
0answers
55 views

How to detect teletype/typewriter mode

How do I detect whether or not I'm in teletype mode in LaTeX? I'm looking for something like \ifmmode or \mathpalette or \mathchoice. Perhaps this is an xy problem, so let me give my original context:...
5
votes
2answers
463 views

Typewriter font for Korean language

A little while ago I asked some questions about the Greek language in LaTeX and got some excellent responses. In the same context I'm looking now to the Korean Language but I'm having problems setting ...
2
votes
3answers
137 views

Missing characters in Greek output due to `\ttfamily`

Unfortunately the next question in the series ASCII text set in Greek script when using \usepackage[greek]{babel} / Missing characters in output due to `\renewcommand{\familydefault}{\sfdefault}` When ...
0
votes
0answers
88 views

How to emulate "typewriter" style?

[Not sure how to word this question exactly, please let me know if it is a duplicate.] Many older scientific papers are set completely in "typewriter" style. Here is an equation that was set using ...
1
vote
2answers
224 views

Fira Mono is oblique not upright by default

I'm trying to use Fira Mono as my monospaced font, but when I compile my MWE (below) in XeLaTeX or LuaLaTeX the font ends up in its oblique variant. What should I be doing differently? \documentclass{...
0
votes
1answer
2k views

How to change the \texttt font

This question is the most similar to my own, but it was closed before anyone could answer it. Looking here there are quite a few "Typewrite" fonts built into LaTeX. I was wondering what the default ...

1
2 3 4 5
7