修訂 | 03f00373d3bffd34329246497ccfecb873789fdf (tree) |
---|---|
時間 | 2017-03-09 22:17:01 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
A script to mimic an old typewriter.
@@ -0,0 +1,130 @@ | ||
1 | +\documentclass[10pt]{article}% This is a document class providing more font size options | |
2 | +\usepackage{graphicx} | |
3 | +\usepackage{ifthen} | |
4 | +\usepackage[textwidth=7.5in,textheight=9.5in]{geometry} | |
5 | +\usepackage{xcolor} % | |
6 | + | |
7 | + | |
8 | +\pagestyle{empty} | |
9 | + | |
10 | + | |
11 | +% thanks to Bruno Le Floch: http://tex.stackexchange.com/q/9331/4012 | |
12 | +% and in his comments to http://tex.stackexchange.com/a/29458/4012 | |
13 | +\usepackage[first=-1,last=1]{lcg}% you can play around with these values | |
14 | +\makeatletter | |
15 | +\newcommand{\globalrand}{\rand\global\cr@nd\cr@nd} | |
16 | +\makeatother | |
17 | + | |
18 | +\newcommand{\randomvshift}[1]{\globalrand\raisebox{\value{rand}pt}{#1}} | |
19 | + | |
20 | +%%% thanks to Martin Scharrer: http://tex.stackexchange.com/q/11598/4012 | |
21 | +\makeatletter | |
22 | +\def\typewriter#1{% | |
23 | + \@typewriter#1 \@empty | |
24 | +} | |
25 | +\def\@typewriter#1 #2{% | |
26 | + \randomvshift{#1}\space | |
27 | + \ifx #2\@empty\else | |
28 | + \expandafter\@typewriter | |
29 | + \fi | |
30 | + #2% | |
31 | +} | |
32 | +\makeatother | |
33 | + | |
34 | +% \fontdimen3\font=0em % interword stretch | |
35 | +% \fontdimen4\font=0em % interword shrink | |
36 | +% \fontdimen7\font=0em % extra space | |
37 | + | |
38 | + | |
39 | +\usepackage{ragged2e} | |
40 | +\setlength{\RaggedRightParindent}{\parindent} | |
41 | + | |
42 | +% \newcommand\BlurText[1]{% | |
43 | +% \vbox{#1\par\duplines}} | |
44 | + | |
45 | + | |
46 | + | |
47 | +\renewcommand{\baselinestretch}{1} | |
48 | + | |
49 | + | |
50 | +\newbox\flinebox | |
51 | +\newbox\slinebox | |
52 | +\newbox\mlinebox | |
53 | +\def\duplines{\setlength\parindent{0pt} | |
54 | + \setbox\flinebox\lastbox | |
55 | + \ifvoid\flinebox\relax | |
56 | + \else | |
57 | + \setbox\slinebox\hbox{\copy\flinebox} | |
58 | + \setbox\mlinebox\hbox{\copy\flinebox} | |
59 | + \unskip\unpenalty | |
60 | + {\duplines} | |
61 | + | |
62 | +{\color{black!30} \box\flinebox\vspace*{-2.85ex}} | |
63 | +{\color{black!50} \makebox[\textwidth]{\hspace*{-0.25pt}\box\mlinebox}\vspace*{-2.75ex}} | |
64 | +{\color{black!90} \makebox[\textwidth]{\hspace*{0.25pt}\box\slinebox}}\fi | |
65 | + | |
66 | +} | |
67 | + | |
68 | +\newcommand\BlurText[1]{% | |
69 | + \vbox{#1\par\duplines}} | |
70 | + | |
71 | + | |
72 | +% \usepackage{tikz} | |
73 | +% \newcommand*{\random}[2]{% | |
74 | +% \pgfmathparse{random(2)}% | |
75 | +% \ifodd\pgfmathresult\relax#1\else#2\fi% | |
76 | +% } | |
77 | + | |
78 | + | |
79 | + | |
80 | + | |
81 | +% \usepackage{pgf} | |
82 | +% \newcommand*{\random}[4]{% | |
83 | +% \pgfmathparse{random(4)}% | |
84 | +% \ifcase\pgfmathresult\relax | |
85 | +% \or#1\or#2\or#3\or#4% | |
86 | +% \fi% | |
87 | +% } | |
88 | + | |
89 | +\begin{document}\tt | |
90 | + | |
91 | +% \raggedright | |
92 | + \RaggedRight | |
93 | + | |
94 | +\typewriter{Math 101 Fall 1963} | |
95 | + | |
96 | + | |
97 | +\begin{enumerate} | |
98 | +\item \typewriter | |
99 | + {$\frac{\texttt{d}}{\texttt{dx}}\texttt{(x)}^2$} | |
100 | + | |
101 | +\item \typewriter | |
102 | + {State the Fundamental Theorem of Calculus.} | |
103 | + | |
104 | +\end{enumerate} | |
105 | + | |
106 | + | |
107 | + \typewriter | |
108 | +{And now let us see the effect of adding quite some text. If everything | |
109 | +goes fine, this should look like human typed text. | |
110 | +And now let us see the effect of adding quite some text. If everything | |
111 | +goes fine, this should look like human typed text. | |
112 | +And now let us see the effect of adding quite some text. If everything | |
113 | +goes fine, this should look like human typed text. | |
114 | +And now let us see the effect of adding quite some text. If everything | |
115 | +goes fine, this should look like human typed text. | |
116 | +And now let us see the effect of adding quite some text. If everything | |
117 | +goes fine, this should look like human typed text. | |
118 | +% \BlurText{From now on, the text is also blurred. This should enhance | |
119 | +% the feel that everything is being typed down by hand (i.e. by | |
120 | +% typewriter). And now let us see the effect of adding quite some text. If everything | |
121 | +% goes fine, this should look like human typed text.} | |
122 | +} | |
123 | +\footnote{\typewriter{and here | |
124 | +we are!}} | |
125 | +% \random{1}{2}{3}{4} | |
126 | +% \random{1}{2}{3}{4} | |
127 | + | |
128 | + | |
129 | + | |
130 | +\end{document} | |
\ No newline at end of file |