home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
useful
/
dist
/
text
/
tex
/
pastex
/
macros
/
eepic
/
eepic.sty
next >
Wrap
Text File
|
1991-01-29
|
17KB
|
470 lines
% 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.1b - Released Febrary 7, 1988}
%
\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){%
\@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\hb