diff options
-rw-r--r-- | Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf | bin | 65084 -> 101048 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex | 30 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty | 92 |
3 files changed, 96 insertions, 26 deletions
diff --git a/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf b/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf Binary files differindex 8209cedcdf4..a5a8e30d47b 100644 --- a/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf +++ b/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf diff --git a/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex b/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex index 36080fe1d24..5ecb6df1605 100644 --- a/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex +++ b/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex @@ -5,7 +5,7 @@ \begin{document} \title{The Typewriter Package for LaTeX} \author{David Carlisle \thanks{https://github.com/davidcarlisle/dpctex/}} -\date{2018-02-07} +\date{2018-02-10} \maketitle @@ -19,17 +19,37 @@ http://tex.stackexchange.com/questions/344214/use-latex-to-simulate-old-typewrit \hrule -Currently there are no options to the package, it just does what it does, -Possibly later versions might document how to modify the amount of random distortion that is applied. +Currently there are no options to the package, However there are several parameters that control the offsets +and grey levels used to generate the variation. Any of the following +commands may be defined before loading the package to change the defaults shown below. +\begin{verbatim} +\providecommand\ttgreyone{0.6} +\providecommand\ttgreytwo{0.3} +\providecommand\ttrotatebold{12} +\providecommand\ttdownbold{20000} +\providecommand\ttrightbold{35000} +\providecommand\ttdownshifttwo{20000} + +\providecommand\ttrotatenormal{8} +\providecommand\ttrightnormal{20000} +\providecommand\ttdownnormal{20000} +\end{verbatim} + +The grey levels should be between 0 and 1 and control the maximim +amount grey level. + +The rotate values can be any angle (measured degrees), but setting values more than 20 makes the text more or less unreadable. + +The right and down offsets (which are in the font design units) control the +maximum horizontal and vertical offsets of the overprinted characters There is random variability in each letter as you can see by repeating a letter repeatededly: OOOOOOOOOOOOONNNNNNNNNNNNNNEEEEEEEEEE -TTTTTTTTTTTTooooooooooooooooowwwwwwwwwwwwwwwwwwww - +TTTTTTTTTTTTwwwwwwwwwwwwwwwwwwwwooooooooooooooooo diff --git a/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty b/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty index db72be56f39..722fb3f6330 100644 --- a/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty +++ b/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty @@ -4,14 +4,22 @@ % See http://tex.stackexchange.com/questions/344214/use-latex-to-simulate-old-typewriter-written-texts -\ProvidesPackage{typewriter}[2018-02-07 v1.0 typewriter package] +\ProvidesPackage{typewriter}[2018-02-10 v1.1 typewriter package] \ifx\directlua\@undefined \endinput\PackageError{typewriter}{LuaLaTeX required for this package}\@ehc\fi +\providecommand\ttgreyone{0.6} +\providecommand\ttgreytwo{0.3} +\providecommand\ttrotatebold{12} +\providecommand\ttdownbold{20000} +\providecommand\ttrightbold{35000} +\providecommand\ttdownshifttwo{20000} - +\providecommand\ttrotatenormal{8} +\providecommand\ttrightnormal{20000} +\providecommand\ttdownnormal{20000} % luaotfload exlicitly loaded for latex formats before 2017/01/01 \usepackage{luaotfload} @@ -38,34 +46,34 @@ function(name,size,i) f.type = 'virtual' f.fonts = {{ name = 'file:cmuntt', size = size}} for j,v in pairs(f.characters) do - local gr = 0.1*math.random() - local gr2 = 0.3*math.random() + local gr = \ttgreyone*math.random() + local gr2 = \ttgreytwo*math.random() if name == 'cmtt10bx' then v.commands = { {'lua',' - r1 = 0.01*math.random(-10,10) + r1 = math.rad(0.1*\ttrotatebold*math.random(-10,10)) pdf.print (string.format(" q \%f \%f \%f \%f 0 0 cm ", math.cos(r1), - math.sin(r1), math.sin(r1), math.cos(r1) ))'}, {'special','pdf: ' .. string.format("\%f",gr2) .. ' g'}, {'push'}, -{'right', math.random(-35000,35000)}, -{'down', math.random(-20000,20000)}, +{'right', math.random(-\ttrightbold,\ttrightbold)}, +{'down', math.random(-\ttdownbold,\ttdownbold)}, {'char',j}, {'pop'}, {'push'}, -{'right', math.random(-35000,35000)}, -{'down', math.random(-20000,20000)}, +{'right', math.random(-\ttrightbold,\ttrightbold)}, +{'down', math.random(-\ttdownbold,\ttdownbold)}, {'char',j}, {'pop'}, {'push'}, -{'right', math.random(-35000,35000)}, -{'down', math.random(-20000,20000)}, +{'right', math.random(-\ttrightbold,\ttrightbold)}, +{'down', math.random(-\ttdownbold,\ttdownbold)}, {'char',j}, {'pop'}, {'lua','pdf.print(" Q ")'}, -{'down', math.random(-20000,20000)}, +{'down', math.random(-\ttdownbold,\ttdownbold)}, {'special','pdf: ' .. string.format("\%f",gr) .. ' g'}, {'char',j}, {'special','pdf: 0 g'} @@ -74,19 +82,19 @@ math.cos(r1), - math.sin(r1), math.sin(r1), math.cos(r1) else v.commands = { {'lua',' - r1 = 0.01*math.random(-10,10) + r1 = math.rad(0.1*\ttrotatenormal*math.random(-10,10)) pdf.print (string.format(" q \%f \%f \%f \%f 0 0 cm ", -math.cos(r1), - math.sin(r1), math.sin(r1), math.cos(r1) +math.cos(r1), math.sin(r1), - math.sin(r1), math.cos(r1) ))'}, {'special','pdf: ' .. gr2 .. ' g'}, {'push'}, -{'right', math.random(-20000,20000)}, -{'down', math.random(-20000,20000)}, +{'right', math.random(-\ttrightnormal,\ttrightnormal)}, +{'down', math.random(-\ttdownshifttwo,\ttdownshifttwo)}, {'char',j}, {'pop'}, {'lua','pdf.print(" Q ")'}, -{'down', math.random(-20000,20000)}, +{'down', math.random(-\ttdownnormal,\ttdownnormal)}, {'special','pdf: ' .. gr .. ' g'}, {'char',j}, {'special','pdf: 0 g'} @@ -535,7 +543,8 @@ end, \xUnicodeMathSymbol{"021CF}{\nRightarrow }{\mathrel}{not implies}% \xUnicodeMathSymbol{"021D0}{\Leftarrow }{\mathrel}{is implied by}% \xUnicodeMathSymbol{"021D1}{\Uparrow }{\mathrel}{up double arrow}% -\xUnicodeMathSymbol{"021D2}{\Rightarrow }{\mathrel}{implies}% +%\xUnicodeMathSymbol{"021D2}{\Rightarrow }{\mathrel}{implies}% +\xxUnicodeMathSymbol{"02192}{\Rightarrow}{=>} \xUnicodeMathSymbol{"021D3}{\Downarrow }{\mathrel}{down double arrow}% \xUnicodeMathSymbol{"021D4}{\Leftrightarrow }{\mathrel}{left and right double arrow}% \xUnicodeMathSymbol{"021D5}{\Updownarrow }{\mathrel}{up and down double arrow}% @@ -615,7 +624,7 @@ end, \xUnicodeMathSymbol{"02228}{\vee }{\mathbin}{/vee /lor b: logical or}% \xUnicodeMathSymbol{"02229}{\cap }{\mathbin}{intersection}% \xUnicodeMathSymbol{"0222A}{\cup }{\mathbin}{union or logical sum}% -\xUnicodeMathSymbol{"0222B}{\int }{\mathop}{integral operator}% +%\xUnicodeMathSymbol{"0222B}{\int }{\mathop}{integral operator}% \xUnicodeMathSymbol{"0222C}{\iint }{\mathop}{double integral operator}% \xUnicodeMathSymbol{"0222D}{\iiint }{\mathop}{triple integral operator}% \xUnicodeMathSymbol{"0222E}{\oint }{\mathop}{contour integral operator}% @@ -2726,23 +2735,64 @@ end, \let\oldhrule\hrule \def\hrule{\directlua{ -local h,w,d,hh,ww,dd +local h,w,d,hh,ww,dd,lw +h=token.scan_keyword("height") +if(h) then +hh=token.scan_dimen() +end +d=token.scan_keyword("depth") +if(d) then +dd=token.scan_dimen() +end +w=token.scan_keyword("width") +if(w) then +ww=token.scan_dimen() +end +if(not(h)) then +h=token.scan_keyword("height") +if(h) then +hh=token.scan_dimen() +end +end +if(not(d)) then +d=token.scan_keyword("depth") +if(d) then +dd=token.scan_dimen() +end +end +if(not(w)) then +w=token.scan_keyword("width") +if(w) then +ww=token.scan_dimen() +end +end +if(not(h)) then h=token.scan_keyword("height") if(h) then hh=token.scan_dimen() end +end +if(not(d)) then d=token.scan_keyword("depth") if(d) then dd=token.scan_dimen() end +end +if(not(w)) then w=token.scan_keyword("width") if(w) then ww=token.scan_dimen() end +end %print('\string\n=====') %print('h' .. tostring(h) .. (hh or '*')) %print('d' .. tostring(d) .. (dd or '*')) %print('w' .. tostring(w) .. (ww or '*')) %print('=====\string\n') -tex.sprint('\string\\par\string\\noindent\string\\leaders\string\\hbox{\string\\string_}\string\\hfill\string\\space')% +if(ww) then +lw="\string\\hskip " .. ww .. "sp\string\\hbox{}" +else +lw="\string\\hfill\string\\space" +end +tex.sprint('\string\\par\string\\noindent\string\\leaders\string\\hbox{\string\\string_}' .. lw)% }}
\ No newline at end of file |