41

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. Also, some randomness would be nice (e.g. some characters more bold than others), so that it looks more natural.

3

3 Answers 3

38

Best package for the job is manuscript

\documentclass{article}
\usepackage{manuscript,lipsum}
\begin{document}
\lipsum[1-3]
\end{document}

output

9
  • 3
    Thanks, this looks good. However, any idea on how to randomize the boldness of the characters?
    – Bob
    Commented Jan 27, 2013 at 15:10
  • 1
    @Bob Photocopy final pages then scan and import images or assume was typed with IBM golfball. Jokes aside only way I can think is to get the source of the fonts and hack it.
    – yannisl
    Commented Jan 27, 2013 at 15:55
  • 2
    What is the difference between using manuscript package and using \renewcommand\familydefault{\ttdefault}? Commented Jan 28, 2013 at 3:50
  • 2
    For example \emph{} will underline your text as with a typewriter:)
    – yannisl
    Commented Jan 28, 2013 at 4:16
  • 1
    +1 for the explanation. It is the correct answer. I think you should use blindtext instead of lipsum to illustrate more general aspects. Commented Jan 28, 2013 at 4:55
23

MWE

An alternative is the memoir class with the option ms. By default, the emphasis is simply ignored in this way, but adding the ulem package the text with emphasis is underlined. You can also add the xcolor package to introduce some red text. At least at the end of typerwritter era was usual the two-color ink ribbons, and therefore was usual highlight some parts of the text with red ink.

As using manuscript package, the titles need some tuning to look exactly as a typewriter document (you cannot obtain small capitals or large fonts in a real old typewriter) but with memoir is enough to change \large and \Large by \normalsize in the preamble.

Hyphenation can be obtained with hyphenat package with the option htt or with everysel package. In both cases you can play with microtype options after these packages to obtain better (or worse) margins and spacing. A moderate use of stretch and shrink options can produce also some randomness in font dimensions but must nearly imperceptible for good results.

Another tricky option is not Blur the text so it's not readable, but add only an hardly noticed blur (or some more for a carbon copy simulation). The effect is showed in the second paragraph of the example, but I'm not sure if this can be appreciated in the image (using different colors for each layer help to see the effect).

\documentclass[ms,a4paper]{memoir}
\chapterstyle{dash} % try also reparticle
\usepackage{ulem}   % underline
\usepackage{xcolor} %
\usepackage{lipsum} %dummy text
% All font size must be normal size 
\renewcommand{\large}{\normalsize}
\renewcommand{\Large}{\normalsize}
\newcommand{\red}[1]{\textcolor{red!50!black}{#1}}
\newcommand{\RED}[1]{\textcolor{red!50!black}{\MakeUppercase{#1}}}
% font hyphenation 
\usepackage{everysel}
\EverySelectfont{%
\fontdimen2\font=0.6em % interword space
\fontdimen3\font=0.2em % interword stretch
\fontdimen4\font=0.1em % interword shrink
\fontdimen7\font=0.9em % extra space
\hyphenchar\font=`\-% to allow hyphenation
}


%\usepackage[spacing=true,factor=1200, stretch=10, shrink=15]{microtype}

\renewcommand{\baselinestretch}{1}


\newbox\flinebox 
\newbox\slinebox
\newbox\mlinebox
\def\duplines{\setlength\parindent{0pt}
  \setbox\flinebox\lastbox
  \ifvoid\flinebox\relax
  \else
  \setbox\slinebox\hbox{\copy\flinebox}
  \setbox\mlinebox\hbox{\copy\flinebox}
  \unskip\unpenalty
  {\duplines}

{\color{black!30} \box\flinebox\vspace*{-2.85ex}}
{\color{black!50} \makebox[\textwidth]{\hspace*{-0.25pt}\box\mlinebox}\vspace*{-2.75ex}}
{\color{black!90}  \makebox[\textwidth]{\hspace*{0.25pt}\box\slinebox}}\fi

}

\newcommand\BlurText[1]{%
  \vbox{#1\par\duplines}}


\begin{document}
\chapter{\RED{Lore ipsum}}
\section{\red{Lore ipsum}}
LORE IPSUM text with \emph{some emphasis} and \red{color}.
\lipsum[1]
\BlurText{\lipsum[2]}
\end{document}

Edit As the comments note, this is still a noticeable computer-generated text because the interword spacing and the smooth right margin.

To avoid a perfect margin, as suggested, one can use
\raggedright but this prevent hyphenation (that is almost unavoidable using a typewriter). However, changing the lines 15 to 18 to:

\fontdimen3\font=0em % interword stretch
\fontdimen4\font=0em % interword shrink
\fontdimen7\font=0em % extra space

And the result will be not simply a flush left text, but one with an uneven right margin and hyphenation, apparently made by humans:

enter image description here

2
  • 5
    You should definitely activate ragged margins on the right. It would be nearly impossible to create justified block text using a typewriter: it would require you to plan ahead the exact number of characters until the end of of the line and add random spaces between words to make it fit. Not very likely.
    – fgysin
    Commented Feb 5, 2013 at 16:07
  • 1
    But \raggedright prevent hyphenation, that was usual using typewriters. Because this, the result is a right margin even worse than in texts made really with a typewriter. Instead, setting to 0em the lines 15 to 18 allow hyphenation without right justification and without extra spaces, giving a nicer right margin, but enough irregular to simulate carriage returns made by humans.
    – Fran
    Commented Apr 23, 2014 at 18:03
11

Using Xelatex and a typewriter font might get the effect you're looking for. This is with the font, "My Underwood", Harting is another choice but there are dozens out there.

image

1
  • 1
    Try \footnote{} will not look like it was with a typerwriter:)
    – yannisl
    Commented Jan 28, 2013 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .