home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
useful
/
dist
/
text
/
tex
/
pastex
/
macros
/
epic
/
epic.sty
< prev
next >
Wrap
Text File
|
1991-01-29
|
26KB
|
560 lines
\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 \dottedl