| 1 |
\documentclass{article} |
| 2 |
\usepackage{amsmath} |
| 3 |
\providecommand\ttbasefont{QTAntiquePost.otf} |
| 4 |
\providecommand\ttmathfont{cmuntt.otf} |
| 5 |
|
| 6 |
\providecommand\ttoverprintnormal{0} |
| 7 |
\providecommand\ttoverprintbolda{1} |
| 8 |
\providecommand\ttoverprintboldb{0} |
| 9 |
\providecommand\ttoverprintboldc{0} |
| 10 |
\providecommand\ttgreynormala{0.5} |
| 11 |
\providecommand\ttrotatenormal{3} |
| 12 |
|
| 13 |
\usepackage{typewriter} |
| 14 |
|
| 15 |
\raggedright |
| 16 |
\begin{document} |
| 17 |
\title{The Typewriter Package for LaTeX} |
| 18 |
\author{David Carlisle\thanks{With Contributions from Udi Fogiel} |
| 19 |
\thanks{https://github.com/davidcarlisle/dpctex/}} |
| 20 |
\date{2025-02-10} |
| 21 |
|
| 22 |
\maketitle |
| 23 |
|
| 24 |
\section{Introduction} |
| 25 |
The typewriter package uses (by default) the OpenType Computer Modern Unicode |
| 26 |
Typewriter font, together with a LuaTeX virtual font setup that |
| 27 |
introduces random variability in grey level and angle of each |
| 28 |
character. It was originally an answer to a question on stackexchange, |
| 29 |
http://tex.stackexchange.com/questions/344214/use-latex-to-simulate-old-typewriter-written-texts |
| 30 |
|
| 31 |
|
| 32 |
\hrule |
| 33 |
|
| 34 |
Currently there are no options to the package, However there are several parameters that control the offsets |
| 35 |
and grey levels used to generate the variation. Any of the following |
| 36 |
commands may be defined before loading the package to change the defaults shown below. |
| 37 |
|
| 38 |
\begin{verbatim} |
| 39 |
\providecommand\ttgreybolda{0.6} |
| 40 |
\providecommand\ttgreyboldb{0.3} |
| 41 |
\providecommand\ttrotatebold{12} |
| 42 |
\providecommand\ttdownbold{20000} |
| 43 |
\providecommand\ttrightbold{35000} |
| 44 |
\providecommand\ttoverprintbolda{1} |
| 45 |
\providecommand\ttoverprintboldb{1} |
| 46 |
\providecommand\ttoverprintboldc{1} |
| 47 |
|
| 48 |
\providecommand\ttgreynormala{0.3} |
| 49 |
\providecommand\ttgreynormalb{0.5} |
| 50 |
\providecommand\ttrotatenormal{8} |
| 51 |
\providecommand\ttrightnormal{20000} |
| 52 |
\providecommand\ttdownnormal{20000} |
| 53 |
\providecommand\ttoverprintnormal{1} |
| 54 |
|
| 55 |
\providecommand\ttbasefont{cmuntt.otf} |
| 56 |
\providecommand\ttmathfont{\ttbasefont} |
| 57 |
\providecommand\ttfontsize{12pt} |
| 58 |
\end{verbatim} |
| 59 |
|
| 60 |
The grey levels should be between 0 and 1 and control the maximim |
| 61 |
amount of grey level. |
| 62 |
|
| 63 |
The rotate values can be any angle (measured in degrees), but setting |
| 64 |
values more than 20 makes the text more or less unreadable. |
| 65 |
|
| 66 |
The right and down offsets (which are in the font design units) control the |
| 67 |
maximum horizontal and vertical offsets of the overprinted characters |
| 68 |
|
| 69 |
The flags such ttoverprintnormal control whether multiple characters are printed |
| 70 |
By default bold font has four characters with different offsets, normal has two. |
| 71 |
Setting the flags to 0 stops this over-printing. |
| 72 |
|
| 73 |
By default the same font is used for text and math, but you may set |
| 74 |
ttbasefont to the filename for the base font, and |
| 75 |
ttmathfont to a different font, this may be useful if the main font |
| 76 |
does not have math characters. |
| 77 |
|
| 78 |
|
| 79 |
\hrule |
| 80 |
|
| 81 |
There is random variability in each letter as you can see by repeating |
| 82 |
a letter repeatededly: |
| 83 |
|
| 84 |
OOOOOOOOOOOOONNNNNNNNNNNNNNEEEEEEEEEE |
| 85 |
|
| 86 |
TTTTTTTTTTTTwwwwwwwwwwwwwwwwwwwwooooooooooooooooo |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
\subsection{Text} |
| 92 |
|
| 93 |
one two three |
| 94 |
|
| 95 |
\textbf{one two three} |
| 96 |
|
| 97 |
[some greek text $θ$] |
| 98 |
|
| 99 |
a rule: \rule{3cm}{1pt} |
| 100 |
|
| 101 |
\subsection{Math} |
| 102 |
|
| 103 |
$\alpha^2=0$ and bold {\boldmath $\alpha^2=0$} |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
more math $x^2-\cos θ$ |
| 108 |
|
| 109 |
|
| 110 |
display math: |
| 111 |
\[\left(\frac{x^2}{\sqrt{1+y}}\right)\] |
| 112 |
and |
| 113 |
\[\int_{x=0}^n f(x) dx = \sum_0^m q(y)\] |
| 114 |
|
| 115 |
and alignments: |
| 116 |
\begin{align} |
| 117 |
A &\rightarrow B\\ |
| 118 |
\mupGamma &\Rightarrow C |
| 119 |
\end{align} |
| 120 |
|
| 121 |
|
| 122 |
\subsection{Lists} |
| 123 |
|
| 124 |
\begin{enumerate} |
| 125 |
\item red yellow blue green |
| 126 |
\item black blue purple |
| 127 |
\end{enumerate} |
| 128 |
|
| 129 |
\begin{itemize} |
| 130 |
\item this |
| 131 |
\item that |
| 132 |
\item and the other |
| 133 |
\end{itemize} |
| 134 |
|
| 135 |
|
| 136 |
\subsection{Tables} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
\begin{center} |
| 141 |
|
| 142 |
\begin{tabular}{|l|l|l|} |
| 143 |
\cline{1-3} |
| 144 |
one & two & three\\ |
| 145 |
$\alpha$ & $\beta$ & $\gamma$\\ |
| 146 |
\cline{1-3} |
| 147 |
\end{tabular} |
| 148 |
|
| 149 |
\end{center} |
| 150 |
|
| 151 |
\subsection{Colophon} |
| 152 |
\raggedleft |
| 153 |
typeset by egreg design services |
| 154 |
|
| 155 |
\end{document} |