diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:37 +0000 |
commit | b4286ff7458edba75a5cb8c875079e3d1093686a (patch) | |
tree | c943d76f247c703c5e1ea91b4e839f1f2d9d80fb /Master/texmf-dist/tex/latex | |
parent | 3ae22149de526b60ca4f84b163189bb575f857f2 (diff) |
eepic
git-svn-id: svn://tug.org/texlive/trunk@849 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/eepic/eepic.sty | 477 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/eepic/eepicemu.sty | 94 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/eepic/epic.sty | 561 |
3 files changed, 1132 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/eepic/eepic.sty b/Master/texmf-dist/tex/latex/eepic/eepic.sty new file mode 100644 index 00000000000..29446873f06 --- /dev/null +++ b/Master/texmf-dist/tex/latex/eepic/eepic.sty @@ -0,0 +1,477 @@ +% eepic Version 1.1e < Dec 21, 1999 > +% Updated by Piet van Oostrum <piet@cs.uu.nl> +% eepic Version 1.1c < Nov 25, 1998 > +% Updated by Piet van Oostrum <piet@cs.uu.nl> +% eepic Version 1.1b < Febrary 7, 1988 > +% Written by Conrad Kwok +% +% Internet : kwok@iris.ucdavis.edu +% csnet : kwok@ucd.csnet +% csnet : kwok%iris.ucdavis.edu@csnet.relay +% UUCP : ...!ucbvax!ucdavis!iris!kwok +% +% The macros are in public domain. +% You may distribute or modify it in any ways you like. +% Please report any bugs, enhancements, comments, suggestions, etc. +% +% This style file modify some of the commands in epic[1] and LaTeX[2] such +% that \special commands will be generated in drawing lines if approriate. +% The \special commands generated is the subset of the \specials used +% by tpic[3]. +% +% [1] epic is written by Sunil Podar. Please read epic.sty for the +% copyright notice. +% [2] LaTeX is written by Leslie Lamport. Please read the book LaTeX +% [3] tpic is modified from pic by Tim Morgan +% +%% This file contains extensions of the following epic commands: +%% \dottedline \dashline \drawline +%% \jput +%% +%% It also contains extensions of the following LaTeX commands: +%% \circle \line \oval +%% +%% New commands include: +%% \Thicklines \arc \ellipse +%% \path \spline \allinethickness +%% +%% New commands for eepic 1.1 +%% \blacken \whiten \shade +%% \texture \filltype{type} type=black|white|shade +%% +%% For documentation, please see the accompanying manual +%% +%% Change Log; +%% o (October 2, 88) +%% Fixed the problem of \line (\@sline). When both x and y are +%% large, it produced 'bad character code' error. +%% +%% o (January 17, 89) +%% Add commands \blacken, \whiten, \shade, \texture +%% +%% o (January 17, 89) +%% Add \filltype{xxxxx} +%% xxxxx - black, white, shade +%% +\typeout{% +Extension to Epic and LaTeX. Version 1.1e - Released Dec 21, 1999} +% +\newcount\@gphlinewidth +\newcount\@eepictcnt +\newdimen\@tempdimc +\@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736 + +%% Redefine \thinlines, \thicklines +%% See also latex.tex +\def\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc + \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth + \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax} +\def\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw + \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth + \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736 + \advance\@gphlinewidth\@ne % Make the output looks better + \relax} +%% +%% To indicate whether the dot character is defined in the dotted join +%% environment or not (\@ifnodotdef) +\newif\if@nodotdef \global\@nodotdeftrue +%% +%% Redefine \dottedjoin +\def\dottedjoin{\global\@jointhemtrue \global\@joinkind=0\relax + \bgroup\@ifnextchar[{\global\@nodotdeffalse\@idottedjoin}% + {\global\@nodotdeftrue\@idottedjoin[\@empty]}} +%%---------------------------------------------------------------------- +%% Redefine \jput +\long\def\jput(#1,#2)#3{\@killglue\raise#2\unitlength\hbox to \z@{\hskip +#1\unitlength #3\hss}% +\if@jointhem \if@firstpoint \gdef\x@one{#1} \gdef\y@one{#2} \global\@firstpointfalse + \else\ifcase\@joinkind + \if@nodotdef + \@spdottedline{\dotgap@join\unitlength}% +(\x@one\unitlength ,\y@one\unitlength)(#1\unitlength,#2\unitlength) + \else + \@dottedline[\dotchar@join]{\dotgap@join\unitlength}% +(\x@one\unitlength,\y@one\unitlength)(#1\unitlength,#2\unitlength) + \fi + \or\@dashline[\dashlinestretch]{\dashlen@join\unitlength}[\dotgap@join]% +(\x@one,\y@one)(#1,#2) + \else\@drawline[\drawlinestretch](\x@one,\y@one)(#1,#2)\fi + \gdef\x@one{#1}\gdef\y@one{#2}% + \fi +\fi\ignorespaces} +%% +%% Redefine \dottedline to generate special whenever possible. +\def\dottedline{\@ifnextchar [{\@idottedline}{\@ispdottedline}} +%% Similar to \@idottedline but it generate \special +\def\@ispdottedline#1(#2,#3){\@ifnextchar (% +{\@iispdottedline{#1}(#2,#3)}{\relax}} +\def\@iispdottedline#1(#2,#3)(#4,#5){\@spdottedline{#1\unitlength}% +(#2\unitlength,#3\unitlength)(#4\unitlength,#5\unitlength)% +\@ispdottedline{#1}(#4,#5)} +% +\def\@spdottedline#1(#2,#3)(#4,#5){% + \@killglue % This line added by Piet van Oostrum, Dec 21, 1999. + \@tempcnta \@gphlinewidth\relax + \advance\@tempcnta by 2 % solely for better output + \special{pn \the\@tempcnta}% + \@tempdimc=#2\relax + \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempdimc=#3\relax + \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \@tempdimc=#4\relax + \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempdimc=#5\relax + \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \@tempdimc=#1\relax +%% +%% Generate the pen width in terms of inch with 3 decimal digit. + \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736 +%% \@tempcnta contain the pen width in terms of thousandth of a inch +%% Then it is converted back to inch. I know the way I use is dumb but +%% I cannot think of any better method + \@tempcntb \@tempcnta\relax \divide\@tempcntb 1000 + \multiply \@tempcntb 1000 \advance\@tempcnta -\@tempcntb + \divide\@tempcntb 1000 + \ifnum\@tempcnta < 10 + \special{dt \the\@tempcntb.00\the\@tempcnta}% + \else\ifnum\@tempcnta < 100 + \special{dt \the\@tempcntb.0\the\@tempcnta}% + \else + \special{dt \the\@tempcntb.\the\@tempcnta}% + \fi\fi + \ignorespaces +} +% +\def\@iiidashline[#1]#2[#3](#4,#5)(#6,#7){% +\@dashline[#1]{#2\unitlength}[#3](#4,#5)(#6,#7)% +\@iidashline[#1]{#2}[#3](#6,#7)} +% +%% Redefine \@dashline +\long\def\@dashline[#1]#2[#3](#4,#5)(#6,#7){{% +\x@diff=#6\unitlength \advance\x@diff by -#4\unitlength +\y@diff=#7\unitlength \advance\y@diff by -#5\unitlength +%% correction to get actual width since the dash-length as taken in arguement +%% is the center-to-center of the end-points. +\@tempdima=#2\relax \advance\@tempdima -\@wholewidth +\sqrtandstuff{\x@diff}{\y@diff}{\@tempdima}% +\ifnum\num@segments <3 \num@segments=3\fi% min number of dashes I can plot +% is 2, 1 at either end, thus min num@segments is 3 (including 'empty dash'). +\@tempdima=\x@diff \@tempdimb=\y@diff +\divide\@tempdimb by\num@segments +\divide\@tempdima by\num@segments +%% ugly if-then-else. If optional dotgap specified, then use it otherwise +%% make a solid dash. +{\ifx#3\@empty \relax + \ifdim\@tempdima < 0pt \x@diff=-\@tempdima\else\x@diff=\@tempdima\fi + \ifdim\@tempdimb < 0pt \y@diff=-\@tempdimb\else\y@diff=\@tempdimb\fi + \global\setbox\@dotbox\hbox{% + \@absspdrawline(0pt,0pt)(\@tempdima,\@tempdimb)}% + \else\global\setbox\@dotbox\hbox{% + \@spdottedline{#3\unitlength}(0pt,0pt)(\@tempdima,\@tempdimb)}% + \fi}% +\advance\x@diff by -\@tempdima % both have same sign +\advance\y@diff by -\@tempdimb +% +%%here we correct the number of dashes to be put by reducing them +%%appropriately. (num@segments*\@wholewidth) is in some way the slack we +%%have,and division by dash-length gives the reduction. reduction = +%%(2*num@segments*\@wholewidth)/dash-length +%% (num@segments includes empty ones) +\@tempdima=\num@segments\@wholewidth \@tempdima=2\@tempdima +\@tempcnta\@tempdima\relax \@tempdima=#2\relax \@tempdimb=0.5\@tempdima +\@tempcntb\@tempdimb\relax \advance\@tempcnta by \@tempcntb % round-off error +\divide\@tempcnta by\@tempdima \advance\num@segments by -\@tempcnta +% +\ifnum #1=0 \relax\else\ifnum #1 < -100 + \typeout{***dashline: reduction > -100 percent implies blankness!***} +\else\num@segmentsi=#1 \advance\num@segmentsi by 100 + \multiply\num@segments by\num@segmentsi \divide\num@segments by 100 +\fi\fi +% +\divide\num@segments by 2 % earlier num@segments included 'empty dashes' too. +\ifnum\num@segments >0 % if =0 then don't divide => \x@diff & \y@diff + \divide\x@diff by\num@segments% remain same. + \divide\y@diff by\num@segments + \advance\num@segments by\@ne %for the last segment for which I subtracted + %\@tempdima & \@tempdimb from \x@diff & \y@diff + \else\num@segments=2 % one at each end. +\fi +%%\typeout{num@segments finally = \the\num@segments} +%% equiv to \multiput(#4,#5)(\x@diff,\y@diff){\num@segments}{\copy\@dotbox} +%% with arguements in absolute dimensions. +\@xdim=#4\unitlength \@ydim=#5\unitlength +\@killglue +\loop \ifnum\num@segments > 0 +\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@dotbox\hss}% +\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff% +\repeat}% +\ignorespaces} +%% redefine \@drawline +% +\def\@drawline[#1](#2,#3)(#4,#5){{% +\@drawitfalse\@horvlinefalse +\ifnum#1 <0 \relax\else\@horvlinetrue\fi +\if@horvline + \@spdrawline(#2,#3)(#4,#5) +\else\@drawittrue\fi +%%------------------------------- +\if@drawit +\ifnum #1=0 \relax \else\ifnum #1 < -99 + \typeout{***drawline: reduction <= -100 percent implies blankness!***}% +\else\num@segmentsi=#1 \advance\num@segmentsi by 50 + \multiply\num@segmentsi 2 +\fi\fi +\@dashline[\num@segmentsi]{10pt}[\@empty](#2,#3)(#4,#5) +\fi}\ignorespaces}% for \if@drawit +% +\def\@spdrawline(#1,#2)(#3,#4){% + \@absspdrawline(#1\unitlength,#2\unitlength)(#3\unitlength,#4\unitlength) + \ignorespaces +} +\def\@absspdrawline(#1,#2)(#3,#4){% + \@killglue % This line added by Piet van Oostrum, Dec 21, 1999. + \special{pn \the\@gphlinewidth}% + \@tempdimc=#1\relax + \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempdimc=#2\relax + \@tempcntb -\@tempdimc\relax \advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \@tempdimc=#3\relax + \@tempcnta\@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempdimc=#4\relax + \@tempcntb -\@tempdimc\relax \advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \special{fp}% + \ignorespaces +} +%%---------------------------------------------------------------------- +\def\@paspecial#1#2{% + \special{pa #1 #2}% +} +%% +%% Functions below modify the LaTeX commands and some additional commands +%% are not supported by LaTeX nor epic such as ThickLines and arc. +%% +%% The macros are for use with LaTeX picture environment +%% By including the macro file, you can draw +%% 1) \line in any slope +%% 2) \circle with any radius +%% 3) \ellipse with any x-axis and y-axis length +%% 4) Circular \arc by giving starting and ending angle (in radius) +%% +%% Furthermore you may draw lines in any thickness. +%% +%% +%% Redefine \thinlines, \thicklines and define \Thickline +%% See also latex.tex +\def\Thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw + \@wholewidth\fontdimen8\tenlnw \@wholewidth 1.5\@wholewidth + \@halfwidth .5\@wholewidth + \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax} +%% +%% Generate the \special command for drawing arc +\def\@circlespecial#1#2#3#4{% + \special{pn \the\@gphlinewidth}% + \special{ar 0 0 #1 #2 #3 #4} +} +%% +%% Command for drawing an arc. Elliptical arc command can be generated +%% but all iptex program I saw so far does not support that. +\def\@arc#1#2#3#4{% +%% convert TeX dimension to length in terms thousandth of an inch + \@tempdima #1\unitlength + \@tempdimb #2\unitlength + \@tempcnta\@tempdima \advance\@tempcnta 4736 \divide\@tempcnta 9473 + \@tempcntb\@tempdimb \advance\@tempcntb 4736 \divide\@tempcntb 9473 + \setbox\@tempboxa\hbox{% + \@circlespecial{\the\@tempcnta}{\the\@tempcntb}{#3}{#4}}% + \wd\@tempboxa\z@ \box\@tempboxa} +%% +%% Command for drawing Circle and Ellipse in terms of \@arc +%% replace original \circle +\def\circle{% + \@ifstar{\copy\@filltype\@circle}{\@circle}} +\def\@circle#1{\@arc{#1}{#1}{0}{6.2832}} +\def\ellipse{% + \@ifstar{\copy\@filltype\@ellipse}{\@ellipse}} +\def\@ellipse#1#2{{\@arc{#1}{#2}{0}{6.2832}}} +\def\arc#1#2#3{\@arc{#1}{#1}{#2}{#3}} +%% +%% Generate \special commands for drawing line +\def\@linespecial#1#2{% + \special{pn \the\@gphlinewidth}% + \special{pa 0 0}% + \special{pa #1 #2}% + \special{fp}% +} +%% Replace original \line. Only change is to call \@ssline instead +%% of \@sline. For description, see latex.tex +\def\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax +\@linelen=#3\unitlength +\ifnum\@xarg =0 \@vline + \else \ifnum\@yarg =0 \@hline \else \@ssline\fi +\fi} +%% +\def\@ssline{% + \ifnum\@xarg< 0 + \@negargtrue \@xarg -\@xarg \@tempdima -\@linelen + \else + \@negargfalse \@tempdima\@linelen + \fi +%% truncation is used in arithmetic + \@tempcnta\@linelen \divide\@tempcnta 4736 + \@yyarg -\@yarg \multiply\@yyarg \@tempcnta \divide\@yyarg\@xarg + \if@negarg + \@tempcnta -\@tempcnta + \fi + \setbox\@linechar\hbox{\@linespecial{\the\@tempcnta}{\the\@yyarg}}% + \wd\@linechar\@tempdima + \@clnht\@linelen + \multiply\@clnht\@yarg + \divide\@clnht\@xarg + \ifnum\@yarg< 0 + \@clnht -\@clnht + \ht\@linechar\z@ \dp\@linechar\@clnht + \else + \ht\@linechar\@clnht \dp\@linechar\z@ + \fi + \box\@linechar +} +%% +%% Replace original \@sline +\def\@sline{% + \@ssline +%% Codes below (till end of the command) is only necessary +%% when used with \@svector + \if@negarg + \@yyarg -\@yarg + \else + \@yyarg \@yarg + \fi + \setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}% + \ifnum\@yarg> 0 + \let\@upordown\raise + \advance\@clnht -\ht\@linechar + \else + \let\@upordown\lower + \fi + \if@negarg \kern\wd\@linechar \fi +} +%% +\def\spline(#1,#2){% + \@killglue % This line added by Piet van Oostrum, Dec 21, 1999. + \special{pn \the\@gphlinewidth}% + \@spline(#1,#2)% +} +\def\@spline(#1,#2){% + \@tempdima #1\unitlength + \@tempdimb #2\unitlength + \@tempcnta \@tempdima \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempcntb -\@tempdimb \advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \@ifnextchar ({\@spline}{\special{sp}}% +} +\def\path(#1,#2){% + \@killglue % This line added by Piet van Oostrum, Dec 20, 1999. + \special{pn \the\@gphlinewidth}% + \@path(#1,#2)% +} +\def\@path(#1,#2){% + \@tempdima #1\unitlength + \@tempdimb #2\unitlength + \@tempcnta \@tempdima \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \@tempcntb -\@tempdimb \advance\@tempcntb -2368 \divide\@tempcntb 4736 + \@paspecial{\the\@tempcnta}{\the\@tempcntb}% + \@ifnextchar ({\@path}{\special{fp}}% +} + +%%%%%%%%%% Beginning of \oval %%%%%%%%%%%%%%% +\newdimen\maxovaldiam \maxovaldiam 40pt\relax + +\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen + \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue + \@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}\@ovxx + #1\unitlength \@ovyy #2\unitlength + \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi + \@ovro \ifdim \@tempdimb>\maxovaldiam \maxovaldiam\else\@tempdimb\fi\relax + \divide \@ovro \tw@ + \@ovdx\@ovxx \divide\@ovdx \tw@ + \@ovdy\@ovyy \divide\@ovdy \tw@ + \setbox\@tempboxa \hbox{% + \if@ovr \@ovverta\fi + \if@ovl \kern \@ovxx \@ovvertb\kern -\@ovxx \fi + \if@ovt \@ovhorz \kern -\@ovxx \fi + \if@ovb \raise \@ovyy \@ovhorz \fi}% Update by Piet van Oostrum (% added) + \ht\@tempboxa\z@ \dp\@tempboxa\z@ + \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}% + \endgroup} + +\def\@qcirc#1#2#3#4{% + \special{pn \the\@gphlinewidth}% + \@eepictcnt \@gphlinewidth \divide\@eepictcnt 2 + \@tempcnta #1 + \advance\@tempcnta 2368 \divide\@tempcnta 4736 + \advance\@tempcnta\@eepictcnt + \@tempcntb #2 \divide\@tempcntb 4736 \advance\@tempcntb 2 + \hbox{% + \@qcircspecial{\the\@tempcnta}{-\the\@eepictcnt}{\the\@tempcntb}{#3}{#4}}% +} +\def\@qcircspecial#1#2#3#4#5{\special{ar #1 #2 #3 #3 #4 #5}} + +\def\@ovverta{\vbox to \@ovyy{% + \if@ovb + \kern \@ovro + \@qcirc{\@ovro}{\@ovro}{3.1416}{4.7124}\nointerlineskip + \else + \kern \@ovdy + \fi + \leaders\vrule width \@wholewidth\vfil \nointerlineskip + \if@ovt + \@qcirc{\@ovro}{\@ovro}{1.5708}{3.1416}\nointerlineskip + \kern \@ovro + \else + \kern \@ovdy + \fi +}\kern -\@wholewidth} + +\def\@ovvertb{\vbox to \@ovyy{% + \if@ovb + \kern \@ovro + \@qcirc{-\@ovro}{\@ovro}{4.6124}{6.2832}\nointerlineskip + \else + \kern \@ovdy + \fi + \leaders\vrule width \@wholewidth\vfil \nointerlineskip + \if@ovt + \@qcirc{-\@ovro}{\@ovro}{0}{1.6708}\nointerlineskip + \kern \@ovro + \else + \kern \@ovdy + \fi +}\kern -\@wholewidth} + +\def\@ovhorz{\hbox to \@ovxx{% + \if@ovr \kern \@ovro\else \kern \@ovdx \fi + \leaders \hrule height \@wholewidth \hfil + \if@ovl \kern \@ovro\else \kern \@ovdx \fi + }} +%%%%%%%%% End of \oval %%%%%%%%%%%%%% + +\def\allinethickness#1{\let\@linefnt\tenlnw \let\@circlefnt\tencircw + \@wholewidth #1 \@halfwidth .5\@wholewidth + \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax} + +\def\blacken{\special{bk}} +\def\whiten{\special{wh}} +\def\shade{\special{sh}} +\def\texture#1{\special{tx #1}\ignorespaces} +%% +\newbox\@filltype +\setbox\@filltype\hbox{\special{bk}} +\def\filltype#1{\@nameuse{ft@#1}} +\def\ft@black{\setbox\@filltype\hbox{\special{bk}}} +\def\ft@white{\setbox\@filltype\hbox{\special{wh}}} +\def\ft@shade{\setbox\@filltype\hbox{\special{sh}}} +%% diff --git a/Master/texmf-dist/tex/latex/eepic/eepicemu.sty b/Master/texmf-dist/tex/latex/eepic/eepicemu.sty new file mode 100644 index 00000000000..13e45ba29cb --- /dev/null +++ b/Master/texmf-dist/tex/latex/eepic/eepicemu.sty @@ -0,0 +1,94 @@ +% eepicemu Version 1.1a < Febrary 1, 1988 > +% Written by Conrad Kwok +% +% Internet : kwok@iris.ucdavis.edu +% csnet : kwok@ucd.csnet +% csnet : kwok%iris.ucdavis.edu@csnet.relay +% UUCP : ...!ucbvax!ucdavis!iris!kwok +% +% The macros are in public domain. +% You may distribute or modify it in any ways you like. +% Please report any bugs, enhancements, comments, suggestions, etc. +% +% Change logs: +% o Febrary 1, 1989 +% Add \newdimen\maxovaldiam for compatility with eepic +% +% o Febrary 1, 1989 +% Enhanced to handle new commands in eepic 1.1 +% +\typeout{Emulation of EEPIC using EPIC. Version 1.1a - Released Febrary 1, 1988} +\let\path\drawline +\def\ellipse{% + \@ifstar{\@ellipse}{\@ellipse}} +\def\@ellipse#1#2{% + \ifnum #1=#2% + \circle{#1}% + \else + \oval(#1,#2) + \fi\relax} +\let\Thicklines\thicklines +\def\circle{% + \@ifstar + {\@emudot}% + {\@emucirc}% +} +\def\@emudot#1{% + \@tempdimb #1\unitlength + \ifdim \@tempdimb > 15pt + \oval(#1,#1)% + \else + \@dot{#1}% + \fi +} +\def\@emucirc#1{% + \@tempdimb #1\unitlength + \ifdim \@tempdimb > 40pt + \oval(#1,#1)% + \else + \@circle{#1}% + \fi +} +\def\arc#1#2#3{\typeout{arc function is not supported in emulation package}} +\newcount\@spxcnt +\newcount\@spycnt +\newcount\@ispxcnt +\newcount\@ispycnt +\newcount\@cmidxcnt +\newcount\@cmidycnt + +\def\spline(#1,#2){% + \@ifnextchar ({\@ispline(#1,#2)}% + {\ignorespaces}} +\def\@ispline(#1,#2)(#3,#4){% + \@ifnextchar ({\@iispline(#1,#2)(#3,#4)}% + {\@drawline[0](#1,#2)(#3,#4)\ignorespaces}} +\def\@iispline(#1,#2)(#3,#4)(#5,#6){% + \@ifnextchar ({% + \@spxcnt=#3 \advance\@spxcnt by #5 \divide\@spxcnt by 2\relax + \@spycnt=#4 \advance\@spycnt by #6 \divide\@spycnt by 2\relax + \@chaikin{#1}{#2}{#3}{#4}{\@spxcnt}{\@spycnt}% + \@ispxcnt=\@spxcnt\relax \@ispycnt=\@spycnt\relax + \@iispline(\@ispxcnt,\@ispycnt)(#5,#6)}% +% else + {\@chaikin{#1}{#2}{#3}{#4}{#5}{#6}}} +\def\@chaikin#1#2#3#4#5#6{% + \@cmidxcnt=#1 \advance\@cmidxcnt by #3 + \advance\@cmidxcnt by #3 \advance\@cmidxcnt by #5 + \divide\@cmidxcnt by 4 + \@cmidycnt=#2 \advance\@cmidycnt by #4 + \advance\@cmidycnt by #4 \advance\@cmidycnt by #6 + \divide\@cmidycnt by 4 + \@drawline[0](#1,#2)(\@cmidxcnt,\@cmidycnt)% + \@drawline[0](\@cmidxcnt,\@cmidycnt)(#5,#6)% +} +\def\allinethickness#1{\thicklines\linethickness{#1}} +% +\newdimen\maxovaldiam \maxovaldiam 40pt\relax +% +\def\filltype#1{} +\def\blacken{} +\def\whiten{} +\def\shade{} +\def\texture{} +\endinput diff --git a/Master/texmf-dist/tex/latex/eepic/epic.sty b/Master/texmf-dist/tex/latex/eepic/epic.sty new file mode 100644 index 00000000000..a18285adb22 --- /dev/null +++ b/Master/texmf-dist/tex/latex/eepic/epic.sty @@ -0,0 +1,561 @@ +\makeatletter +\typeout{% +Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986} +%---------------------------------------------------------------------- +% Copyright (C) podar@sbcs (Sunil Podar) July 14,1986. +% You may use this file in whatever way you wish. You are requested to +% leave this notice intact, and report any bugs, enhancements, comments, +% suggestions, etc. to: +% USmail: Sunil Podar,Dept. of Computer Science,SUNY at Stony Brook,NY 11794. +% CSNET: podar@sbcs.csnet +% ARPA: podar%suny-sb.csnet@csnet-relay.arpa +% UUCP: {allegra, hocsd, philabs, ogcvax}!sbcs!podar +%---------------------------------------------------------------------- +% This file contains implementation of: +% \multiputlist \matrixput \grid \picsquare +% \dottedline \dashline \drawline \jput +% \putfile +% Environments: dottedjoin, dashjoin and drawjoin +% +% For documentation, see the accompanying manual. +%---------------------------------------------------------------------- +% usage: \multiputlist(x,y)(delta-x,delta-y)[tbrl]{item1,item2,item3,.....} +% \lop and \lopoff taken from TeXbook. +%---------------------------------------------------------------------- +\def\lop#1\to#2{\expandafter\lopoff#1\lopoff#1#2} +\long\def\lopoff,#1,#2\lopoff#3#4{\def#4{#1}\def#3{,#2}} +\def\@@mlistempty{,} +\newif\iflistnonempty +\def\multiputlist(#1,#2)(#3,#4){\@ifnextchar +[{\@imultiputlist(#1,#2)(#3,#4)}{\@imultiputlist(#1,#2)(#3,#4)[]}} + +\long\def\@imultiputlist(#1,#2)(#3,#4)[#5]#6{{% +\@xdim=#1\unitlength \@ydim=#2\unitlength +\listnonemptytrue \def\@@mlist{,#6,} % need this for end condition +\loop +\lop\@@mlist\to\@@firstoflist +\@killglue\raise\@ydim\hbox to\z@{\hskip +\@xdim\@imakepicbox(0,0)[#5]{\@@firstoflist}\hss} +\advance\@xdim #3\unitlength\advance\@ydim #4\unitlength +\ifx\@@mlist\@@mlistempty \listnonemptyfalse\fi +\iflistnonempty +\repeat\relax +\ignorespaces}} +%---------------------------------------------------------------------- +% two-dimensional version of \multiput +% \matrixput(0,0)(20,0){5}(0,20){3}{\circle{2}} +%---------------------------------------------------------------------- +\newcount\@@multicnt +\def\matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{% +\ifnum#5>#8\@matrixput(#1,#2)(#3,#4){#5}(#6,#7){#8}{#9}% +\else\@matrixput(#1,#2)(#6,#7){#8}(#3,#4){#5}{#9}\fi} + +%% here #5 >= #8 +\long\def\@matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{{\@killglue% +\@multicnt=#5\relax\@@multicnt=#8\relax% +\@xdim=0pt% +\@ydim=0pt% +\setbox\@tempboxa\hbox{\@whilenum \@multicnt > 0\do {% +%%\typeout{\the\@multicnt, \the\@@multicnt}% +\raise\@ydim\hbox to \z@{\hskip\@xdim #9\hss}% +\advance\@multicnt \m@ne% +\advance\@xdim #3\unitlength\advance\@ydim #4\unitlength}}% +\@xdim=#1\unitlength% +\@ydim=#2\unitlength% +\@whilenum \@@multicnt > 0\do {% +\raise\@ydim\hbox to \z@{\hskip\@xdim \copy\@tempboxa\hss}% +\advance\@@multicnt \m@ne% +\advance\@xdim #6\unitlength\advance\@ydim #7\unitlength}% +\ignorespaces}} +%---------------------------------------------------------------------- +%\grid(wd,ht)(delta-wd,delta-ht)[initial-X-integer,initial-Y-integer] +% example: 1. \put(0,0){\grid(95,100)(9.5,10)} +% 2. \put(0,0){\grid(100,100)(10,5)[-10,0]} +% or \put(0,0){\tiny \grid(100,100)(5,5)[0,0]}%numbers in \tiny font +%---------------------------------------------------------------------- +\newcount\d@lta +\newdimen\@delta +\newdimen\@@delta +\newcount\@gridcnt +\def\grid(#1,#2)(#3,#4){\@ifnextchar [{\@igrid(#1,#2)(#3,#4)}% +{\@igrid(#1,#2)(#3,#4)[@,@]}} + +\long\def\@igrid(#1,#2)(#3,#4)[#5,#6]{% +\makebox(#1,#2){% +\@delta=#1pt\@@delta=#3pt\divide\@delta \@@delta\d@lta=\@delta% +\advance\d@lta \@ne\relax\message{grid=\the\d@lta\space x}% +%% copied the definition of \line(0,1){#2} for some efficiency!. +\multiput(0,0)(#3,0){\d@lta}{\hbox to\z@{\hskip -\@halfwidth \vrule + \@width \@wholewidth \@height #2\unitlength \@depth \z@\hss}}% +\ifx#5@\relax\else% +\global\@gridcnt=#5% +\multiput(0,0)(#3,0){\d@lta}{% +\makebox(0,-2)[t]{\number\@gridcnt\global\advance\@gridcnt by #3}}% +\global\@gridcnt=#5% +\multiput(0,#2)(#3,0){\d@lta}{\makebox(0,0)[b]{\number\@gridcnt\vspace{2mm}% +\global\advance\@gridcnt by #3}}% +\fi% +\@delta=#2pt\@@delta=#4pt\divide\@delta \@@delta\d@lta=\@delta% +\advance\d@lta \@ne\relax\message{\the\d@lta . }% +%% copied the definition of \line(1,0){#1} for some efficiency!. +\multiput(0,0)(0,#4){\d@lta}{\vrule \@height \@halfwidth \@depth \@halfwidth + \@width #1\unitlength}% +\ifx#6@\relax\else +\global\@gridcnt=#6% +\multiput(0,0)(0,#4){\d@lta}{% +\makebox(0,0)[r]{\number\@gridcnt\ \global\advance\@gridcnt by #4}}% +\global\@gridcnt=#6% +\multiput(#1,0)(0,#4){\d@lta}{% +\makebox(0,0)[l]{\ \number\@gridcnt\global\advance\@gridcnt by #4}}% +\fi}} +%---------------------------------------------------------------------- +% \picsquare is a centered square of dimensions governed by \thinlines, +% \thicklines or \linethickness declarations. +\def\picsquare{\hskip -0.5\@wholewidth% +\vrule height \@halfwidth depth \@halfwidth width \@wholewidth} +% +% just a square dot with reference point at bottom-left +\def\picsquare@bl{\vrule height \@wholewidth depth \z@ width \@wholewidth} +%---------------------------------------------------------------------- +% \begin{dottedjoin}{interdot-gap in units} +% ..... +% \end{dottedjoin} +% \begin{dashjoin}{dash-length in units}{interdotgap in each dash} +% ..... +% \end{dashjoin} +% \begin{drawjoin} +% ..... +% \end{drawjoin} +% \jput(x,y){character} +% \dottedline[opt. dotcharacter]{dotgap in units}(x1,y1)(x2,y2)...(xN,yN) +% \dashline[#]{dash-length}[opt. dotgap](x1,y1)(x2,y2)...(xN,yN) +% \drawline[#](x1,y1)(x2,y2)...(xN,yN) +%---------------------------------------------------------------------- +% definitions for *join environment. had to do all this mess because of +% optional arguments. +%---------------------------------------------------------------------- +\newif\if@jointhem \global\@jointhemfalse +\newif\if@firstpoint \global\@firstpointtrue +\newcount\@joinkind +%\newenvironment{dottedjoin}[1]%[opt char]{dotgap} +%{\global\@jointhemtrue \gdef\dotgap@join{#1}\global\@joinkind=0\relax}% +%{\global\@jointhemfalse \global\@firstpointtrue} +%---------------------------------------------------------------------- +\def\dottedjoin{\global\@jointhemtrue \global\@joinkind=0\relax + \bgroup\@ifnextchar[{\@idottedjoin}{\@idottedjoin[\picsquare@bl]}} +\def\@idottedjoin[#1]#2{\gdef\dotchar@join{#1}\gdef\dotgap@join{#2}} +\def\enddottedjoin{\global\@jointhemfalse \global\@firstpointtrue\egroup} +%---------------------------------------------------------------------- +\def\dashjoin{\global\@jointhemtrue \global\@joinkind=1\relax + \bgroup\@ifnextchar[{\@idashjoin}{\@idashjoin[\dashlinestretch]}} +\def\@idashjoin[#1]#2{\edef\dashlinestretch{#1}\gdef\dashlen@join{#2}% +\@ifnextchar[{\@iidashjoin}{\gdef\dotgap@join{}}} +\def\@iidashjoin[#1]{\gdef\dotgap@join{#1}} +\let\enddashjoin\enddottedjoin +%---------------------------------------------------------------------- +\def\drawjoin{\global\@jointhemtrue \global\@joinkind=2\relax + \bgroup\@ifnextchar[{\@idrawjoin}{}} +\def\@idrawjoin[#1]{\def\drawlinestretch{#1}} +\let\enddrawjoin\enddottedjoin +%---------------------------------------------------------------------- +%% this is equiv to \put(x,y){#1} when not in {dot*join} environment. +\long\def\jput(#1,#2)#3{{\@killglue\raise#2\unitlength\hbox to \z@{\hskip +#1\unitlength #3\hss}\ignorespaces} +\if@jointhem + \if@firstpoint \gdef\x@one{#1} \gdef\y@one{#2} \global\@firstpointfalse + \else\ifcase\@joinkind + \@dottedline[\dotchar@join]{\dotgap@join\unitlength}% +(\x@one\unitlength,\y@one\unitlength)(#1\unitlength,#2\unitlength) + \or\@dashline[\dashlinestretch]{\dashlen@join}[\dotgap@join]% +(\x@one,\y@one)(#1,#2) + \else\@drawline[\drawlinestretch](\x@one,\y@one)(#1,#2)\fi + \gdef\x@one{#1} \gdef\y@one{#2} + \fi +\fi} +%---------------------------------------------------------------------- +\newdimen\@dotgap +\newdimen\@ddotgap +\newcount\@x@diff +\newcount\@y@diff +\newdimen\x@diff +\newdimen\y@diff +\newbox\@dotbox +\newcount\num@segments +\newcount\num@segmentsi +\newif\ifsqrt@done +%% from sqrtandstuff func basically need \num@segments. +%% given a deltax, deltay and dotgap, it calculates \num@segments = number of +%% segments along the hypotenuse. used by \dottedline & \dashline. +%% It finishes quickly if any of deltax or deltay are zero or close to zero. +\def\sqrtandstuff#1#2#3{ +\ifdim #1 <0pt \@x@diff= -#1 \else\@x@diff=#1\fi +\ifdim #2 <0pt \@y@diff= -#2 \else\@y@diff=#2\fi +%% @diff's will be positive and diff's will retain their sign. +\@dotgap=#3 \divide\@dotgap \tw@ +\advance\@x@diff \@dotgap \advance\@y@diff \@dotgap% for round-off errors +\@dotgap=#3 +\divide\@x@diff \@dotgap \divide\@y@diff \@dotgap +\sqrt@donefalse +\ifnum\@x@diff < 2 + \ifnum\@y@diff < 2 \num@segments=\@x@diff \advance\num@segments \@y@diff + \sqrt@donetrue + \else\num@segments=\@y@diff \sqrt@donetrue\fi + \else\ifnum\@y@diff < 2 \num@segments=\@x@diff \sqrt@donetrue\fi +\fi +\ifsqrt@done \ifnum\num@segments=\z@ \num@segments=\@ne\fi\relax + \else \ifnum\@y@diff >\@x@diff + \@tempcnta=\@x@diff \@x@diff=\@y@diff \@y@diff=\@tempcnta + \fi %exchange @x@diff & @y@diff, so now @x@diff > @y@diff + \num@segments=\@y@diff + \multiply\num@segments \num@segments + \multiply\num@segments by 457 + \divide\num@segments \@x@diff + \advance\num@segments by 750 % for round-off, going to divide by 1000. + \divide\num@segments \@m + \advance\num@segments \@x@diff + %num@segments = @x@diff + (0.457*sqr(@y@diff)/@x@diff) +\fi} +%---------------------------------------------------------------------- +% \dottedline[opt. char]{interdot gap in units}(x1,y1)(x2,y2)....(xN,yN) +%---------------------------------------------------------------------- +%% Used the following construction earlier but that results in box memory +%% full much too soon although it works perfectly. +%% \setbox\@dotbox\vbox to\z@{\vss \hbox to\z@{\hss #1\hss}\vss}\relax} +%% The cenetering of characters is achieved by substracting half the ht, wd +%% of character from the (x,y) coordinates where they are to be put. We +%% chose to use a macro for the ``dot'' instead of \copy\box to save memory +%% at the expense of extra cpu, since memory becomes an issue very soon. +%% \picsquare is already centered, whereas other characters, except \circle, +%% will not be cenetered, hence to handle them all in a similar fashion, +%% used \picsquare@bl. +% +% kind of tail recursion. +\def\dottedline{\@ifnextchar [{\@idottedline}{\@idottedline[\picsquare@bl]}} +\def\@idottedline[#1]#2(#3,#4){\@ifnextchar (% +{\@iidottedline[#1]{#2}(#3,#4)}{\relax}} +\def\@iidottedline[#1]#2(#3,#4)(#5,#6){\@dottedline[#1]{#2\unitlength}% +(#3\unitlength,#4\unitlength)(#5\unitlength,#6\unitlength)% +\@idottedline[#1]{#2}(#5,#6)} +% +%% user not supposed to use this directly. arguments in absolute dimensions. +%% need to pass absolute dimens here because dashline calls dottedline and +%% can supply only absolute dimensions. +\long\def\@dottedline[#1]#2(#3,#4)(#5,#6){{% +\x@diff=#5\relax\advance\x@diff by -#3\relax +\y@diff=#6\relax\advance\y@diff by -#4\relax +\sqrtandstuff{\x@diff}{\y@diff}{#2} +\divide\x@diff \num@segments +\divide\y@diff \num@segments +\advance\num@segments \@ne % to put the last point at destination. +%%\typeout{num@segments= \the\num@segments} +\setbox\@dotbox\hbox{#1}% just to get the dimensions of the character. +\@xdim=#3 \@ydim=#4 +\ifdim\ht\@dotbox >\z@% otherwise its a circle. + \advance\@xdim -0.5\wd\@dotbox + \advance\@ydim -0.5\ht\@dotbox + \advance\@ydim .5\dp\@dotbox\fi +%%circle's have a ht=0, this is one way I could think of to catch circles. +%%following loop is equiv to +%%\multiput(\@xdim,\@ydim)(\x@diff,\y@diff){\num@segments}{#1} +%%with arguments in absolute dimensions. +\@killglue +\loop \ifnum\num@segments > 0 +\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim #1\hss}% +\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff% +\repeat +\ignorespaces}} +%---------------------------------------------------------------------- +% \dashline[#]{dash-length}[optional dotgap](x1,y1)(x2,y2)...(xN,yN) +% The minimum # of dashes put is 2, one at either end point; dash-length is +% reduced accordingly if necessary. Also have to some dirty work to account +% for stretch & shrink. +% \renewcommand{\dashlinestretch}{-50} %ONLY INTEGERS PERMITTED. +%---------------------------------------------------------------------- +\def\dashlinestretch{0} %well, could have used a counter. +\def\dashline{\@ifnextchar [{\@idashline}{\@idashline[\dashlinestretch]}} +\def\@idashline[#1]#2{\@ifnextchar [{\@iidashline[#1]{#2}}% +{\@iidashline[#1]{#2}[\@empty]}} %\@empty needed-- later checked with \ifx +\def\@iidashline[#1]#2[#3](#4,#5){\@ifnextchar (% +{\@iiidashline[#1]{#2}[#3](#4,#5)}{\relax}} +% +\def\@iiidashline[#1]#2[#3](#4,#5)(#6,#7){% +\@dashline[#1]{#2}[#3](#4,#5)(#6,#7)% +\@iidashline[#1]{#2}[#3](#6,#7)} +% +\long\def\@dashline[#1]#2[#3](#4,#5)(#6,#7){{% +\x@diff=#6\unitlength \advance\x@diff by -#4\unitlength +\y@diff=#7\unitlength \advance\y@diff by -#5\unitlength +%% correction to get actual width since the dash-length as taken in arguement +%% is the center-to-center of the end-points. +\@tempdima=#2\unitlength \advance\@tempdima -\@wholewidth +\sqrtandstuff{\x@diff}{\y@diff}{\@tempdima} +\ifnum\num@segments <3 \num@segments=3\fi% min number of dashes I can plot +% is 2, 1 at either end, thus min num@segments is 3 (including 'empty dash'). +\@tempdima=\x@diff \@tempdimb=\y@diff +\divide\@tempdimb by\num@segments +\divide\@tempdima by\num@segments +%% ugly if-then-else. If optional dotgap specified, then use it otherwise +%% make a solid looking dash. +{\ifx#3\@empty \relax + \ifdim\@tempdima < 0pt \x@diff=-\@tempdima\else\x@diff=\@tempdima\fi + \ifdim\@tempdimb < 0pt \y@diff=-\@tempdimb\else\y@diff=\@tempdimb\fi + \ifdim\x@diff < 0.3pt %it's a vertical dashline + \ifdim\@tempdimb > 0pt + \global\setbox\@dotbox\hbox{\hskip -\@halfwidth \vrule + \@width \@wholewidth \@height \@tempdimb} + \else\global\setbox\@dotbox\hbox{\hskip -\@halfwidth \vrule + \@width \@wholewidth \@height\z@ \@depth -\@tempdimb}\fi + \else\ifdim\y@diff < 0.3pt %it's a horizontal dashline + \ifdim\@tempdima >0pt + \global\setbox\@dotbox\hbox{\vrule \@height \@halfwidth + \@depth \@halfwidth \@width \@tempdima} + \else\global\setbox\@dotbox\hbox{\hskip \@tempdima + \vrule \@height \@halfwidth \@depth \@halfwidth + \@width -\@tempdima \hskip \@tempdima}\fi + \else\global\setbox\@dotbox\hbox{% +\@dottedline[\picsquare]{0.98\@wholewidth}(0pt,0pt)(\@tempdima,\@tempdimb)} +\fi\fi +\else\global\setbox\@dotbox\hbox{% +\@dottedline[\picsquare]{#3\unitlength}(0pt,0pt)(\@tempdima,\@tempdimb)} +\fi} +\advance\x@diff by -\@tempdima % both have same sign +\advance\y@diff by -\@tempdimb +% +%%here we correct the number of dashes to be put by reducing them +%%appropriately. (num@segments*\@wholewidth) is in some way the slack we +%%have,and division by dash-length gives the reduction. reduction = +%%(2*num@segments*\@wholewidth)/dash-length +%% (num@segments includes empty ones) +\@tempdima=\num@segments\@wholewidth \@tempdima=2\@tempdima +\@tempcnta=\@tempdima \@tempdima=#2\unitlength \@tempdimb=0.5\@tempdima +\@tempcntb=\@tempdimb \advance\@tempcnta by \@tempcntb % round-off error +\divide\@tempcnta by\@tempdima \advance\num@segments by -\@tempcnta +% +\ifnum #1=0 \relax\else\ifnum #1 < -100 + \typeout{***dashline: reduction > -100 percent implies blankness!***} +\else\num@segmentsi=#1 \advance\num@segmentsi by 100 + \multiply\num@segments by\num@segmentsi \divide\num@segments by 100 +\fi\fi +% +\divide\num@segments by 2 % earlier num@segments included 'empty dashes' too. +\ifnum\num@segments >0 % if =0 then don't divide => \x@diff & \y@diff + \divide\x@diff by\num@segments% remain same. + \divide\y@diff by\num@segments + \advance\num@segments by\@ne %for the last segment for which I subtracted + %\@tempdima & \@tempdimb from \x@diff & \y@diff + \else\num@segments=2 % one at each end. +\fi +%%\typeout{num@segments finally = \the\num@segments} +%% equiv to \multiput(#4,#5)(\x@diff,\y@diff){\num@segments}{\copy\@dotbox} +%% with arguements in absolute dimensions. +\@xdim=#4\unitlength \@ydim=#5\unitlength +\@killglue +\loop \ifnum\num@segments > 0 +\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@dotbox\hss}% +\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff% +\repeat +\ignorespaces}} +%---------------------------------------------------------------------- +%%1.00 .833333 .80 .75 .66666 .60 .50 .40 .33333 .25 .20 .16666 +%% .916666 .816666 .775 .708333 .633333 .55 .45 .366666 .291666 .225 .183333 +%% 0.0 +%%0.083333 +%% the first line has absolute slopes corresponding to various permissible +%% integer combinations representing slopes. The second line is the midpoint +%% of all those slopes (attempted to show them in the middle of two entries). +%% +%% \lineslope(x@diff dimen, y@diff dimen) +%% Given base (x@diff) and height (y@diff) in dimensions, determines the +%% closest available slope and returns the two required integers in \@xarg +%% and \@yarg. The given base and height can be ANYTHING, -ve or +ve, or +%% even 0pt. \lineslope knows about (0,1) and (1,0) slopes too and returns +%% correct values if the conditions regarding x@diff & y@diff are obeyed +%% (see NOTE). Used by \drawline. This is the simplest and only way I could +%% figure out to accomplish it!. +%% NOTE: both the dimensions (x@diff & y@diff) must be in SAME units and the +%% larger of the two dimensions must be atleast 1pt (i.e. 65536sp). To avoid +%% dividing by 0, I make the larger dimension = 1pt if it is < 1pt. +%% will need a similar one for vectors, or maybe this can be used. For +%% vectors the range is -4, 4 unlike lines where it is -6, 6. +\newif\if@flippedargs +\def\lineslope(#1,#2){% +\ifdim #1 <0pt \@xdim= -#1 \else\@xdim=#1\fi +\ifdim #2 <0pt \@ydim= -#2 \else\@ydim=#2\fi +%%\typeout{xdim,ydim= \the\@xdim, \the\@ydim} +\ifdim\@xdim >\@ydim \@tempdima=\@xdim \@xdim=\@ydim \@ydim=\@tempdima +\@flippedargstrue\else\@flippedargsfalse\fi% x < y +\ifdim\@ydim >1pt \@tempcnta=\@ydim + \divide\@tempcnta by 65536% now \@tempcnta=integral part of #1. + \divide\@xdim \@tempcnta\fi +\ifdim\@xdim <.083333pt \@xarg=1 \@yarg=0 + \else\ifdim\@xdim <.183333pt \@xarg=6 \@yarg=1 + \else\ifdim\@xdim <.225pt \@xarg=5 \@yarg=1 + \else\ifdim\@xdim <.291666pt \@xarg=4 \@yarg=1 + \else\ifdim\@xdim <.366666pt \@xarg=3 \@yarg=1 + \else\ifdim\@xdim <.45pt \@xarg=5 \@yarg=2 + \else\ifdim\@xdim <.55pt \@xarg=2 \@yarg=1 + \else\ifdim\@xdim <.633333pt \@xarg=5 \@yarg=3 + \else\ifdim\@xdim <.708333pt \@xarg=3 \@yarg=2 + \else\ifdim\@xdim <.775pt \@xarg=4 \@yarg=3 + \else\ifdim\@xdim <.816666pt \@xarg=5 \@yarg=4 + \else\ifdim\@xdim <.916666pt \@xarg=6 \@yarg=5 + \else \@xarg=1 \@yarg=1% +\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi +\if@flippedargs\relax\else\@tempcnta=\@xarg \@xarg=\@yarg + \@yarg=\@tempcnta\fi +\ifdim #1 <0pt \@xarg= -\@xarg\fi +\ifdim #2 <0pt \@yarg= -\@yarg\fi +%%\typeout{closest slope integers = \the\@xarg, \the\@yarg} +} +%---------------------------------------------------------------------- +% usage: \drawline[#](x1,y1)(x2,y2)....(xN,yN) +% % # is an optional integer between -100 & infinity. +% \renewcommand{\drawlinestretch}{-50} %ONLY INTEGERS PERMITTED. +%---------------------------------------------------------------------- +\newif\if@toosmall +\newif\if@drawit +\newif\if@horvline +\def\drawlinestretch{0} %well, could have used a counter. +% kind of tail recursion. +\def\drawline{\@ifnextchar [{\@idrawline}{\@idrawline[\drawlinestretch]}} +\def\@idrawline[#1](#2,#3){\@ifnextchar ({\@iidrawline[#1](#2,#3)}{\relax}} +\def\@iidrawline[#1](#2,#3)(#4,#5){\@drawline[#1](#2,#3)(#4,#5) +\@idrawline[#1](#4,#5)} +% +\def\@drawline[#1](#2,#3)(#4,#5){{% +\x@diff=#4\unitlength \advance\x@diff by -#2\unitlength +\y@diff=#5\unitlength \advance\y@diff by -#3\unitlength +%% override any linethickness declarations, and since horiz & vertical lines +%% come out thinner than the slanted ones, assign slightly larger values. +%% default values are: thinlines=0.4pt, thicklines=0.8pt +\ifx\@linefnt\tenln \linethickness{0.5pt} \else \linethickness{0.9pt}\fi +\lineslope(\x@diff,\y@diff)% returns the two integers in \@xarg & \@yarg. +%------ +\@toosmalltrue +{\ifdim\x@diff <\z@ \x@diff=-\x@diff\fi + \ifdim\y@diff <\z@ \y@diff=-\y@diff\fi + \ifdim\x@diff >10pt \global\@toosmallfalse\fi + \ifdim\y@diff >10pt \global\@toosmallfalse\fi} +%------ +%% For efficiency, if the line is horiz or vertical then we draw it in one +%% shot, only if the stretch is not -ve and the line is not too small. +\@drawitfalse\@horvlinefalse +\ifnum#1 <0 \relax\else\@horvlinetrue\fi +\if@toosmall\@horvlinetrue\fi% to get 'or' condition. We necessarily draw a +% solid line if the line is too small ignoring any -ve stretch. +\if@horvline + \ifdim\x@diff =0pt \put(#2,#3){\ifdim\y@diff >0pt \@linelen=\y@diff \@upline + \else\@linelen=-\y@diff \@downline\fi}% + \else\ifdim\y@diff =0pt + \ifdim\x@diff >0pt \put(#2,#3){\vrule \@height \@halfwidth \@depth + \@halfwidth \@width \x@diff} + \else \put(#4,#5){\vrule \@height \@halfwidth \@depth + \@halfwidth \@width -\x@diff}\fi + \else\@drawittrue\fi\fi % construct the line explicitly +\else\@drawittrue\fi +%------------------------------- +\if@drawit +\ifnum\@xarg< 0 \@negargtrue\else\@negargfalse\fi +\ifnum\@xarg =0 \setbox\@linechar% +\hbox{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height 10.2pt + \@depth \z@} +\else \ifnum\@yarg =0 \setbox\@linechar% +\hbox{\vrule \@height \@halfwidth \@depth \@halfwidth \@width 10.2pt} +\else \if@negarg \@xarg -\@xarg \@yyarg -\@yarg + \else \@yyarg \@yarg\fi +\ifnum\@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg\fi +\setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}% +\fi\fi +%------ +\if@toosmall% => it isn't a horiz or vert line and is toosmall. + \@dottedline[\picsquare]{.98\@wholewidth}% +(#2\unitlength,#3\unitlength)(#4\unitlength,#5\unitlength)% +\else +%% following is neat. The last segment takes \wd\@linechar & \ht\@linechar +%% so plot the line as though it were from (#2,#3) to +%% (#4-\wd\@linechar,#5-\ht\@linechar) (i.e. for positive slope; of course, +%% signs are reversed for other slopes). For horizontal & vertical dashes we +%% don't have to subtract the ht & wd resp. since they are already centered. +\ifnum\@xarg=0\relax\else\ifdim\x@diff >\z@ \advance\x@diff -\wd\@linechar + \else\advance\x@diff \wd\@linechar\fi\fi +\ifnum\@yarg=0\relax\else\ifdim\y@diff >\z@\advance\y@diff -\ht\@linechar + \else\advance\y@diff \ht\@linechar\fi\fi +\ifdim\x@diff <\z@ \@x@diff=-\x@diff \else\@x@diff=\x@diff\fi +\ifdim\y@diff <\z@ \@y@diff=-\y@diff \else\@y@diff=\y@diff\fi +%%\typeout{x@diff,y@diff=\the\x@diff , \the\y@diff} +\num@segments=0 \num@segmentsi=0 +\ifdim\wd\@linechar >1pt + \num@segmentsi=\@x@diff \divide\num@segmentsi \wd\@linechar\fi +\ifdim\ht\@linechar >1pt + \num@segments=\@y@diff \divide\num@segments \ht\@linechar\fi +\ifnum\num@segmentsi >\num@segments \num@segments=\num@segmentsi\fi +\advance\num@segments \@ne %to account for round-off error +% +\ifnum #1=0 \relax \else\ifnum #1 < -99 + \typeout{***drawline: reduction <= -100 percent implies blankness!***} +\else\num@segmentsi=#1 \advance\num@segmentsi by 100 + \multiply\num@segments \num@segmentsi + \divide\num@segments by 100 + \ifnum \num@segments=0 \num@segments=1 \fi +\fi\fi +%%\typeout{num@segments after = \the\num@segments} +% +\divide\x@diff \num@segments +\divide\y@diff \num@segments +\advance\num@segments \@ne %for the last segment for which I subtracted + %\wd & \ht of \@linechar from \@x@diff & \@y@diff. +%%\typeout{numseg,x@diff,y@diff= \the\num@segments, \the\x@diff, \the\y@diff} +% +\@xdim=#2\unitlength \@ydim=#3\unitlength +\if@negarg \advance\@xdim -\wd\@linechar\fi +\ifnum\@yarg <0 \advance\@ydim -\ht\@linechar\fi +%%following loop equiv to \multiput@abs(\@xdim,\@ydim)% +%%(\x@diff,\y@diff){\num@segments}{\copy\@linechar} +%%with arguements in absolute dimensions. +\@killglue +\loop \ifnum\num@segments > 0 +\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim \copy\@linechar\hss}% +\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff% +\repeat +\ignorespaces +\fi%the if of @toosmall +\fi}}% for \if@drawit +%---------------------------------------------------------------------- +%usage: \putfile{datafile}{OBJECT} +% The OBJECT is plotted at EACH of the coordinates read from the datafile. +% The idea of these macros is to generate (x,y) pairs using some program +% and then directly use those coordinates. Since TeX doesn't have real +% floating point calculations, it is much more efficient and accurate to do +% things this way. One can also use the unix facility 'spline' now to +% generate smooth curves with equidistant ``dots''. +% NOTE: the external file of coordinates must have x y pairs with a space +% between them. Also it is suggested that some extension such as '.put' +% be used for such datafiles to distinguish them in which case it must +% be explicitely specified in the 1st argument so that TeX doesn't look +% for a .tex extension. +% The % char remains valid as a comment char and such lines are ignored; +% however, there should be atleast one space after the second entry if a +% comment is on the same line as data since % eats up the newline. +%----------------------------------------------------------------------- +\long\def\splittwoargs#1 #2 {(#1,#2)} +% +\newif\if@stillmore +\newread\@datafile +\long\def\putfile#1#2{\openin\@datafile = #1 +\@stillmoretrue +\loop +\ifeof\@datafile\relax\else\read\@datafile to\@dataline\fi +%if file nonexistent, do nothing. +\ifeof\@datafile\@stillmorefalse +\else\ifx\@dataline\@empty \relax + \else +\expandafter\expandafter\expandafter\put\expandafter\splittwoargs% +\@dataline{#2} + \fi +\fi +\if@stillmore +\repeat +\closein\@datafile +} +%---------------------------------------------------------------------- +\makeatother |