home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.text.tex
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sun4nl!ruuinf!piet
- From: piet@cs.ruu.nl (Piet van Oostrum)
- Subject: Re: Dashed lines in Picture Environment
- Sender: network-news@cs.ruu.nl
- Message-ID: <1992Nov18.112949.22783@cs.ruu.nl>
- In-Reply-To: sas6r@amsun26.apma.Virginia.EDU ()
- Date: Wed, 18 Nov 1992 11:29:49 GMT
- Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
- References: <1992Nov17.155819.25282@murdoch.acc.Virginia.EDU>
- Organization: Dept of Computer Science, Utrecht University, The Netherlands
- Lines: 117
-
- >>>>> sas6r@amsun26.apma.Virginia.EDU () (Steph) writes:
-
- Steph> I would like to have a dashed line in the picture environment. I know
- Steph> the command for a line is, for example,
-
- Steph> \put(10,90){\line(70,0){70}}
-
- Steph> Is there a similar command to create a dashed line? I would
- Steph> appreciate it if the response were mailed to me.
-
- epic.sty has this kind of thing. I also made a dashline style before I knew
- about epic. It is simpler, because it does only dashed lines and vectors,
- but it uses a different calling scheme:
-
- % ============================ dashlines.sty ============================
- % Use \dashline and \dashvector the same way as \line/\vector
- % You can change the ratio of black/white by redefining \dashfactor
- % Doesn't work very good with extremely small lines.
-
- \def\dashfactor{0.5}
- \def\dashline(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
- \@linelen#3\unitlength
- \ifnum\@xarg =0 \@dvline \else \@dshline \fi}
- \def\@dshline{\ifnum\@xarg< 0 \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg
- \else \@negargfalse \@yyarg \@yarg \fi
- \ifnum \@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi
- \ifnum\@tempcnta>6 \@badlinearg\@tempcnta0 \fi
- \setbox\@linechar\hbox{\ifnum\@yarg=0
- \vrule \@height \@halfwidth \@depth \@halfwidth \@width 1em
- \else \@linefnt\@getlinechar(\@xarg,\@yyarg)\fi}%
- \@clnwd\wd\@linechar
- \@tempdima\@clnwd\advance\@tempdima\dashfactor\@clnwd
- \@tempcnta \@linelen \divide\@tempcnta\@tempdima
- \ifnum\@tempcnta<1 \@tempcnta 1 \fi
- \@clnwd -\@clnwd \advance\@clnwd\@linelen \divide\@clnwd\@tempcnta
- \@tempdima \@clnwd
- \multiply\@tempdima100
- \@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima
- \@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta
- \divide\@tempdima100
- \@clnht \@tempdima
- \ifnum \@yarg >0 \let\@upordown\raise \ht\@linechar \@clnht \@clnht\z@
- \else\ifnum \@yarg<0 \let\@upordown\lower \advance\@clnht -\ht\@linechar
- \setbox\@linechar\hbox{\raise\@clnht\box\@linechar}\@clnht \ht\@linechar
- \else\def\@upordown##1{}\@clnht\z@
- \fi\fi
- \if@negarg \hskip -\wd\@linechar \def\@tempa{\hskip -2\wd\@linechar}\else
- \let\@tempa\relax \fi
- \wd\@linechar \@clnwd
- \@whiledim \@clnwd <\@linelen \do
- {\@upordown\@clnht\copy\@linechar
- \@tempa
- \advance\@clnht \ht\@linechar
- \advance\@clnwd \wd\@linechar}%
- \advance\@clnwd -\wd\@linechar
- \ifnum \@yarg<0 \advance\@clnht -\ht\@linechar\fi
- \setbox\@linechar\hbox{\unhbox\@linechar \setbox0\lastbox\unhbox0}%
- \ifnum \@yarg<0 \advance\@clnht\ht\@linechar\fi
- \@tempdima\@linelen\advance\@tempdima -\@clnwd
- \advance\@tempdima -\wd\@linechar
- \if@negarg \hskip -\@tempdima \else \hskip \@tempdima \fi
- \multiply\@tempdima \@m
- \@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima
- \@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta
- \divide\@tempdima \@m
- \advance\@clnht \@tempdima
- \ifdim \@linelen <\wd\@linechar
- \hskip \wd\@linechar
- \else\@upordown\@clnht\copy\@linechar\fi}
- \def\@dvline{\setbox\@linechar
- \hbox to\z@{\hskip -\@halfwidth
- \vrule \@width \@wholewidth \@height 1em\@depth \z@ \hss}%
- \@clnht \ht\@linechar
- \@tempdima \@clnht \advance\@tempdima\dashfactor\@clnht
- \@tempcnta \@linelen \divide\@tempcnta\@tempdima
- \ifnum\@tempcnta<1 \@tempcnta 1 \fi
- \@clnht -\@clnht \advance\@clnht\@linelen \divide\@clnht\@tempcnta
- \ifnum\@yarg>0 \let\@upordown\raise \ht\@linechar \@clnht \@clnht \z@
- \else \let\@upordown\lower \advance\@clnht -\ht\@linechar
- \setbox\@linechar\hbox{\raise\@clnht\box\@linechar}\@clnht \ht\@linechar
- \fi
- \@clnwd \ht\@linechar
- \@whiledim \@clnwd <\@linelen \do
- {\@upordown\@clnht\copy\@linechar
- \advance\@clnht\ht\@linechar
- \advance\@clnwd\ht\@linechar}%
- \setbox\@linechar\hbox{\unhbox\@linechar \setbox0\lastbox\unhbox0}%
- \@clnht\@linelen
- \ifnum \@yarg >0 \advance\@clnht -\ht\@linechar \fi
- \ifdim \@linelen <\ht\@linechar \else \@upordown\@clnht\copy\@linechar \fi}
- \def\dashvector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
- \@linelen#3\unitlength
- \ifnum\@xarg =0 \@dvvector
- \else \@dshvector
- \fi}
- \def\@dvvector{\@dvline
- \ifnum \@yarg >0 \setbox\@tempboxa\hbox{\@linefnt\char'66}\raise \@linelen
- \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}%
- \else \lower \@linelen \hbox to \z@{\@linefnt\char'77\hss}%
- \fi}
- \def\@dshvector{\@dshline
- \ifnum \@yarg=0 \hbox to \z@{\@linefnt
- \if@negarg \hskip -\wd\@linechar \@getlarrow(1,0)\hss
- \else \hss\@getrarrow(1,0)%
- \fi}%
- \else
- \@tempcnta\@yarg \ifnum\@tempcnta <0 \@tempcnta-\@tempcnta\fi
- \ifnum\@tempcnta <5
- \hskip -\wd\@linechar
- \@upordown\@clnht \hbox{\@linefnt \if@negarg
- \@getlarrow(\@xarg,\@yyarg) \else \@getrarrow(\@xarg,\@yyarg) \fi}%
- \else\@badlinearg\fi\fi}
- --
- Piet* van Oostrum, Dept of Computer Science, Utrecht University,
- Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
- Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet
- Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')
-