summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/typewriter
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-02-14 21:34:24 +0000
committerKarl Berry <karl@freefriends.org>2018-02-14 21:34:24 +0000
commitc77870cf8b027ff1df80243e507baa9abb4999e8 (patch)
treeaaf3a66849eb82eae033fdd034cc0f8863b9a818 /Master/texmf-dist/tex/lualatex/typewriter
parent8b6cfd638559d98ab42f15ecae4afb6d754404d5 (diff)
typewriter (14feb18)
git-svn-id: svn://tug.org/texlive/trunk@46641 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/typewriter')
-rw-r--r--Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty92
1 files changed, 71 insertions, 21 deletions
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