summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/wiggly.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/genmisc/wiggly.tex')
-rw-r--r--Master/texmf-dist/tex/generic/genmisc/wiggly.tex30
1 files changed, 30 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/genmisc/wiggly.tex b/Master/texmf-dist/tex/generic/genmisc/wiggly.tex
new file mode 100644
index 00000000000..7f04760f34a
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/genmisc/wiggly.tex
@@ -0,0 +1,30 @@
+% A macro \underwiggle for drawing variable length wiggly lines horizontally
+% under its argument in the same way as \underbar.
+% Written by Dr. John S. Garavelli on 4 December 1987 and adapted from a routine
+% by A. G. W. Cameron at Harvard University which appeared in TUGBOAT November
+% 1985, vol. 6, no. 3, p. 155.
+% WARNING: the computations performed by this macro can be very time consuming,
+% so use it sparingly.
+
+\newcount\vone \newcount\vtwo \newcount\vthree \newcount\vfour \newcount\vfive
+\newcount\vsix \newcount\vseven \newcount\veight \newcount\vnine \newcount\vten
+\newbox\wbox \newdimen\wbsize
+\def\underwiggle#1{\ifmmode\setbox\wbox=\hbox{$#1$}
+ \else\setbox\wbox=\hbox{#1}\fi
+\dp\wbox=0pt\wbsize=\wd\wbox\lower2pt\hbox to0pt
+{\hss$\vone=0\vtwo=0\vthree=7000\vfive=\vtwo
+\loop
+\vseven=\vone \divide\vseven by 2
+\vsix=\vfive \divide\vsix by 2 \multiply\vsix by -1
+\veight=16384 \advance\veight by \vsix
+\vnine=16384 \advance\vnine by -\vsix
+\vten=\vseven \advance\vten by 32768
+\hskip\vseven sp
+\vrule height\veight sp width 32768 sp depth\vnine sp
+\hskip-\vten sp
+\ifdim\vseven sp<\wbsize \advance\vone by 20000
+\advance\vtwo by \vthree
+\vfour=-\vtwo \divide\vfour by 10
+\advance\vthree by \vfour
+\advance\vfive by \vtwo
+\repeat$}\box\wbox}