home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / useful / dist / text / tex / pastex / macros / eepic / eepic.sty-dist < prev    next >
Text File  |  1993-01-12  |  17KB  |  472 lines

  1. % eepic Version 1.1b < Febrary 7, 1988 >
  2. %    Written by Conrad Kwok
  3. %
  4. % Internet : kwok@iris.ucdavis.edu
  5. % csnet    : kwok@ucd.csnet
  6. % csnet    : kwok%iris.ucdavis.edu@csnet.relay
  7. % UUCP       : ...!ucbvax!ucdavis!iris!kwok
  8. %
  9. % The macros are in public domain.
  10. % You may distribute or modify it in any ways you like.
  11. % Please report any bugs, enhancements, comments, suggestions, etc.
  12. %
  13. % This style file modify some of the commands in epic[1] and LaTeX[2] such
  14. % that \special commands will be generated in drawing lines if approriate.
  15. % The \special commands generated is the subset of the \specials used
  16. % by tpic[3].
  17. %
  18. % [1] epic is written by Sunil Podar. Please read epic.sty for the
  19. %     copyright notice.
  20. % [2] LaTeX is written by Leslie Lamport. Please read the book LaTeX
  21. % [3] tpic is modified from pic by Tim Morgan
  22. %
  23. %% This file contains extensions of the following epic commands:
  24. %%    \dottedline    \dashline    \drawline
  25. %%    \jput
  26. %%
  27. %% It also contains extensions of the following LaTeX commands:
  28. %%    \circle        \line        \oval
  29. %%
  30. %% New commands include:
  31. %%    \Thicklines    \arc        \ellipse
  32. %%    \path        \spline        \allinethickness
  33. %%
  34. %% New commands for eepic 1.1
  35. %%    \blacken    \whiten        \shade
  36. %%    \texture    \filltype{type} type=black|white|shade
  37. %%
  38. %% For documentation, please see the accompanying manual
  39. %%
  40. %% Change Log;
  41. %% o    (October 2, 88)
  42. %%     Fixed the problem of \line (\@sline). When both x and y are
  43. %%     large, it produced 'bad character code' error.
  44. %%
  45. %% o    (January 17, 89)
  46. %%    Add commands \blacken, \whiten, \shade, \texture
  47. %%
  48. %% o    (January 17, 89)
  49. %%    Add \filltype{xxxxx}
  50. %%    xxxxx - black, white, shade
  51. %%
  52. \makeatletter
  53. \typeout{%
  54. Extension to Epic and LaTeX. Version 1.1b - Released Febrary 7, 1988}
  55. %
  56. \newcount\@gphlinewidth
  57. \newcount\@eepictcnt
  58. \newdimen\@tempdimc
  59. \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736
  60.  
  61. %% Redefine \thinlines, \thicklines
  62. %% See also latex.tex
  63. \def\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
  64.     \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth
  65.     \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736\relax}
  66. \def\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
  67.     \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth
  68.     \@gphlinewidth\@wholewidth \divide\@gphlinewidth 4736
  69.     \advance\@gphlinewidth\@ne   % Make the output looks better
  70.     \relax}
  71. %%
  72. %% To indicate whether the dot character is defined in the dotted join
  73. %%     environment or not (\@ifnodotdef)
  74. \newif\if@nodotdef \global\@nodotdeftrue
  75. %%
  76. %% Redefine \dottedjoin
  77. \def\dottedjoin{\global\@jointhemtrue \global\@joinkind=0\relax
  78.   \bgroup\@ifnextchar[{\global\@nodotdeffalse\@idottedjoin}%
  79.                       {\global\@nodotdeftrue\@idottedjoin[\@empty]}}
  80. %%----------------------------------------------------------------------
  81. %% Redefine \jput
  82. \long\def\jput(#1,#2)#3{\@killglue\raise#2\unitlength\hbox to \z@{\hskip
  83. #1\unitlength #3\hss}%
  84. \if@jointhem \if@firstpoint \gdef\x@one{#1} \gdef\y@one{#2} \global\@firstpointfalse
  85.  \else\ifcase\@joinkind
  86.     \if@nodotdef
  87.         \@spdottedline{\dotgap@join\unitlength}%
  88. (\x@one\unitlength ,\y@one\unitlength)(#1\unitlength,#2\unitlength)
  89.     \else
  90.     \@dottedline[\dotchar@join]{\dotgap@join\unitlength}%
  91. (\x@one\unitlength,\y@one\unitlength)(#1\unitlength,#2\unitlength)
  92.     \fi
  93.     \or\@dashline[\dashlinestretch]{\dashlen@join\unitlength}[\dotgap@join]%
  94. (\x@one,\y@one)(#1,#2)
  95.     \else\@drawline[\drawlinestretch](\x@one,\y@one)(#1,#2)\fi
  96.     \gdef\x@one{#1}\gdef\y@one{#2}%
  97.  \fi
  98. \fi\ignorespaces}
  99. %%
  100. %% Redefine \dottedline to generate special whenever possible.
  101. \def\dottedline{\@ifnextchar [{\@idottedline}{\@ispdottedline}}
  102. %% Similar to \@idottedline but it generate \special
  103. \def\@ispdottedline#1(#2,#3){\@ifnextchar (%
  104. {\@iispdottedline{#1}(#2,#3)}{\relax}}
  105. \def\@iispdottedline#1(#2,#3)(#4,#5){\@spdottedline{#1\unitlength}%
  106. (#2\unitlength,#3\unitlength)(#4\unitlength,#5\unitlength)%
  107. \@ispdottedline{#1}(#4,#5)}
  108. %
  109. \def\@spdottedline#1(#2,#3)(#4,#5){%
  110.     \@tempcnta \@gphlinewidth\relax
  111.     \advance\@tempcnta by 2     % solely for better output
  112.     \special{pn \the\@tempcnta}%
  113.     \@tempdimc=#2\relax
  114.     \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
  115.     \@tempdimc=#3\relax
  116.     \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736
  117.     \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
  118.     \@tempdimc=#4\relax
  119.     \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
  120.     \@tempdimc=#5\relax
  121.     \@tempcntb -\@tempdimc\relax\advance\@tempcntb -2368 \divide\@tempcntb 4736
  122.     \@paspecial{\the\@tempcnta}{\the\@tempcntb}%
  123.     \@tempdimc=#1\relax
  124. %%
  125. %% Generate the pen width in terms of inch with 3 decimal digit.
  126.     \@tempcnta \@tempdimc\relax \advance\@tempcnta 2368 \divide\@tempcnta 4736
  127. %% \@tempcnta contain the pen width in terms of thousandth of a inch
  128. %% Then it is converted back to inch. I know the way I use is dumb but
  129. %% I cannot think of any better method
  130.     \@tempcntb \@tempcnta\relax \divide\@tempcntb 1000
  131.     \multiply \@tempcntb 1000 \advance\@tempcnta -\@tempcntb
  132.     \divide\@tempcntb 1000
  133.     \ifnum\@tempcnta < 10
  134.         \special{dt \the\@tempcntb.00\the\@tempcnta}%
  135.     \else\ifnum\@tempcnta < 100
  136.         \special{dt \the\@tempcntb.0\the\@tempcnta}%
  137.     \else
  138.         \special{dt \the\@tempcntb.\the\@tempcnta}%
  139.     \fi\fi
  140.     \ignorespaces
  141. }
  142. %
  143. \def\@iiidashline[#1]#2[#3](#4,#5)(#6,#7){%
  144. \@dashline[#1]{#2\unitlength}[#3](#4,#5)(#6,#7)%
  145. \@iidashline[#1]{#2}[#3](#6,#7)}
  146. %
  147. %% Redefine \@dashline
  148. \long\def\@dashline[#1]#2[#3](#4,#5)(#6,#7){{%
  149. \x@diff=#6\unitlength \advance\x@diff by -#4\unitlength
  150. \y@diff=#7\unitlength \advance\y@diff by -#5\unitlength
  151. %% correction to get actual width since the dash-length as taken in arguement
  152. %% is the center-to-center of the end-points.
  153. \@tempdima=#2\relax \advance\@tempdima -\@wholewidth
  154. \sqrtandstuff{\x@diff}{\y@diff}{\@tempdima}%
  155. \ifnum\num@segments <3 \num@segments=3\fi% min number of dashes I can plot
  156. % is 2, 1 at either end, thus min num@segments is 3 (including 'empty dash').
  157. \@tempdima=\x@diff \@tempdimb=\y@diff
  158. \divide\@tempdimb by\num@segments
  159. \divide\@tempdima by\num@segments
  160. %% ugly if-then-else. If optional dotgap specified, then use it otherwise
  161. %% make a solid dash.
  162. {\ifx#3\@empty \relax
  163.     \ifdim\@tempdima < 0pt \x@diff=-\@tempdima\else\x@diff=\@tempdima\fi
  164.     \ifdim\@tempdimb < 0pt \y@diff=-\@tempdimb\else\y@diff=\@tempdimb\fi
  165.     \global\setbox\@dotbox\hbox{%
  166.                 \@absspdrawline(0pt,0pt)(\@tempdima,\@tempdimb)}%
  167.     \else\global\setbox\@dotbox\hbox{%
  168.         \@spdottedline{#3\unitlength}(0pt,0pt)(\@tempdima,\@tempdimb)}%
  169.     \fi}%
  170. \advance\x@diff by -\@tempdima % both have same sign
  171. \advance\y@diff by -\@tempdimb
  172. %
  173. %%here we correct the number of dashes to be put by reducing them
  174. %%appropriately. (num@segments*\@wholewidth) is in some way the slack we
  175. %%have,and division by dash-length gives the reduction. reduction =
  176. %%(2*num@segments*\@wholewidth)/dash-length
  177. %% (num@segments includes empty ones)
  178. \@tempdima=\num@segments\@wholewidth \@tempdima=2\@tempdima
  179. \@tempcnta\@tempdima\relax \@tempdima=#2\relax \@tempdimb=0.5\@tempdima
  180. \@tempcntb\@tempdimb\relax \advance\@tempcnta by \@tempcntb % round-off error
  181. \divide\@tempcnta by\@tempdima \advance\num@segments by -\@tempcnta
  182. %
  183. \ifnum #1=0 \relax\else\ifnum #1 < -100
  184.   \typeout{***dashline: reduction > -100 percent implies blankness!***}
  185. \else\num@segmentsi=#1 \advance\num@segmentsi by 100
  186.      \multiply\num@segments by\num@segmentsi \divide\num@segments by 100
  187. \fi\fi
  188. %
  189. \divide\num@segments by 2 % earlier num@segments included 'empty dashes' too.
  190. \ifnum\num@segments >0 % if =0 then don't divide => \x@diff & \y@diff
  191.  \divide\x@diff by\num@segments%   remain same.
  192.  \divide\y@diff by\num@segments
  193.  \advance\num@segments by\@ne %for the last segment for which I subtracted
  194.                   %\@tempdima & \@tempdimb from \x@diff & \y@diff
  195.  \else\num@segments=2 % one at each end.
  196. \fi
  197. %%\typeout{num@segments finally = \the\num@segments}
  198. %% equiv to \multiput(#4,#5)(\x@diff,\y@diff){\num@segments}{\copy\@dotbox}
  199. %% with arguements in absolute dimensions.
  200. \@xdim=#4\unitlength \@ydim=#5\unitlength
  201. \@killglue
  202. \loop \ifnum\num@segments > 0
  203. \unskip\