%dashline.sty % This file adds the commands \dashline, \dashvector, \dotline, \dotvector % to the range of picture items. % % The dot commands seem to be working quite well, although the arrow heads % seem a little misplaced sometimes (Why??). % The dash commands are not working so well, and are actually uncompleted. % Basically I lost interest when I realised how big the dashes had to be % to use the current line font. %problems: % hdashline always works from left to right, so dashes are not symmetrical. % Last dash is larger to make up the length. How about about spreading the gap? % (I actually have spread the gap in the dots routines, so just copy this.) % vdashline has not been implemented. \def\dotline(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@linelen #3\unitlength \ifnum\@xarg=\z@\@vdotline\else\@sdotline\fi} \def\@sdotline{\ifnum\@xarg<\z@ \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg \else \@negargfalse \@yyarg \@yarg \fi \ifnum\@yarg<\z@ \@tempcnta-\@yarg \else \@tempcnta\@yarg \fi \@tempdima2pt\ifnum\@xarg<\@tempcnta \divide\@tempdima\@tempcnta \multiply\@tempdima\@xarg \fi \@tempdimb\@linelen \advance\@tempdimb0.5\@tempdima \@tempcntb\@tempdimb \divide\@tempcntb\@tempdima %\@tempcntb now contains the number of dots. \@tempdima\@linelen \divide\@tempdima\@tempcntb \setbox\@dashbox\hbox to\@tempdima{\hss .\hss}% \divide\@tempdima\@xarg \multiply\@tempdima\@tempcnta \setbox\@dashbox\vbox to\@tempdima{\vss \box\@dashbox\vss}% \ht\@dashbox0.5\@tempdima \dp\@dashbox0.5\@tempdima %\showthe\wd\@dashbox \showthe\ht\@dashbox \showthe\dp\@dashbox \ifnum \@yarg >\z@ \let\@upordown\raise\else\let\@upordown\lower\fi \@clnwd \z@ \@clnht \z@ \if@negarg \def\@tempa{\hskip -2\wd\@dashbox}\else \let\@tempa\relax\fi \hskip -0.5\wd\@dashbox \@whiledim \@clnwd <\@linelen \do {\@upordown\@clnht\copy\@dashbox \@tempa \advance\@clnht 2\ht\@dashbox \advance\@clnwd \wd\@dashbox}% \if@negarg \hskip \wd\@dashbox\fi } \def\@vdotline{\@tempdima2pt\@tempdimb\@linelen \advance\@tempdimb0.5\@tempdima \@tempcntb\@tempdimb \divide\@tempcntb\@tempdima %\@tempcntb now contains the number of dots. \@tempdima\@linelen \divide\@tempdima\@tempcntb \setbox\@dashbox\vbox to\@tempdima{\vss \hbox to\z@{\hss .\hss}\vss}% \ht\@dashbox0.5\@tempdima \dp\@dashbox0.5\@tempdima %\showthe\wd\@dashbox \showthe\ht\@dashbox \showthe\dp\@dashbox \ifnum \@yarg >\z@ \let\@upordown\raise\else\let\@upordown\lower\fi \@clnht \z@ \@whiledim \@clnht <\@linelen \do {\@upordown\@clnht\copy\@dashbox \advance\@clnht 2\ht\@dashbox}% } \def\dotvector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@tempcnta \ifnum\@xarg<\z@ -\@xarg\else\@xarg\fi \ifnum\@tempcnta<5\relax \@linelen #3\unitlength \ifnum\@xarg =\z@ \@vdotvector \else \@sdotvector \fi \else\@badlinearg\fi} \def\@sdotvector{\@sdotline \@tempcnta\@yarg \ifnum\@tempcnta <\z@ \@tempcnta -\@tempcnta\fi \ifnum\@tempcnta <5\relax \setbox\@tempboxa\hbox to\z@{\@linefnt \if@negarg \@getlarrow(\@xarg,\@yyarg)\hss\else \hss\@getrarrow(\@xarg,\@yyarg)\fi}% \ifnum \@yarg >\z@ \advance\@clnht-\ht\@tempboxa\fi \@upordown\@clnht\box\@tempboxa \else\@badlinearg\fi} \def\@vdotvector{\ifnum \@yarg <\z@ \@downdotvector \else \@updotvector \fi} \def\@updotvector{\@vdotline\setbox\@tempboxa\hbox{\@linefnt\char'66}\raise \@linelen \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}} \def\@downdotvector{\@vdotline\lower \@linelen \hbox to \z@{\@linefnt\char'77\hss}} \def\dashline(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@linelen #3\unitlength \ifnum\@xarg =\z@ \@vdashline \else \ifnum\@yarg =\z@ \@hdashline \else \@sdashline\fi \fi} \def\@sdashline{\ifnum\@xarg<\z@ \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg \else \@negargfalse \@yyarg \@yarg \fi \ifnum \@yyarg >\z@ \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi \ifnum\@tempcnta>6 \@badlinearg\@tempcnta\z@ \fi \ifnum\@xarg>6 \@badlinearg\@xarg \@ne \fi \setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}% \ifnum \@yarg >\z@ \let\@upordown\raise \@clnht\z@ \else\let\@upordown\lower \@clnht \ht\@linechar\fi \@clnwd \wd\@linechar \if@negarg \hskip -\wd\@linechar \def\@tempa{\hskip -3\wd\@linechar}\else \def\@tempa{\hskip \wd\@linechar}\fi \@whiledim \@clnwd <\@linelen \do {\@upordown\@clnht\copy\@linechar \@tempa \advance\@clnht 2\ht\@linechar \advance\@clnwd 2\wd\@linechar}% \advance\@clnht -2\ht\@linechar \advance\@clnwd -2\wd\@linechar \@tempdima\@linelen\advance\@tempdima -\@clnwd \@tempdimb\@tempdima\advance\@tempdimb -2\wd\@linechar \if@negarg \hskip -\@tempdimb \else \hskip \@tempdimb \fi \multiply\@tempdima 500 \@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima \@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta \divide\@tempdima 500 \advance\@clnht \@tempdima \ifdim \@linelen <\wd\@linechar \hskip \wd\@linechar \else\@upordown\@clnht\copy\@linechar\fi} \def\@hdashline{\ifnum \@xarg <\z@ \hskip -\@linelen \fi \leavevmode\hbox to\z@{\baselineskip \z@ \lineskip \z@ \@dashdim \@linelen \@dashcnt \@dashdim \advance\@dashcnt 200 \@dashdim 10pt\divide\@dashcnt \@dashdim %\showthe\@dashcnt \ifodd\@dashcnt\@dashdim \z@ \advance\@dashcnt \@ne \divide\@dashcnt \tw@ \else \divide\@dashdim \tw@ \divide\@dashcnt \tw@ \advance\@dashcnt \m@ne \setbox\@dashbox \hbox{\vrule \@height \@halfwidth \@depth \@halfwidth \@width \@dashdim}\put(0,0){\copy\@dashbox}% \put(0,0){\hskip \@linelen\hskip-\@dashdim\copy\@dashbox\hskip -\@linelen}% \multiply\@dashdim \thr@@ \fi \setbox\@dashbox \hbox{\vrule \@height \@halfwidth \@depth \@halfwidth \@width 10pt\hskip 10pt}\@tempcnta\z@ \put(0,0){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt \do{\copy\@dashbox\advance\@tempcnta \@ne }}\@tempcnta\z@\hss }%end of hbox \ifnum \@xarg <\z@ \else\hskip \@linelen \fi} \def\dashvector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax \@tempcnta \ifnum\@xarg<\z@ -\@xarg\else\@xarg\fi \ifnum\@tempcnta<5\relax \@linelen #3\unitlength \ifnum\@xarg =\z@ \@vdashvector \else \ifnum\@yarg =\z@ \@hdashvector \else \@sdashvector\fi \fi \else\@badlinearg\fi} \def\@hdashvector{\@hdashline\hbox to\z@{\@linefnt \ifnum \@xarg <\z@ \@getlarrow(1,0)\hss\else \hss\@getrarrow(1,0)\fi}} \def\@vdashvector{\ifnum \@yarg <\z@ \@downdashvector \else \@updashvector \fi} \def\@sdashvector{\@sdashline \@tempcnta\@yarg \ifnum\@tempcnta <\z@ \@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} \def\@vdashline{%\ifnum \@yarg <\z@ \@downdashline \else \@updashline\fi} \@dashdim \@linelen \@dashcnt \@dashdim \advance\@dashcnt 200 \@dashdim 10pt\divide\@dashcnt \@dashdim \ifodd\@dashcnt \@dashdim \z@ \advance\@dashcnt \@ne \divide\@dashcnt \tw@ \else \divide\@dashdim \tw@ \divide\@dashcnt \tw@ \advance\@dashcnt \m@ne \setbox\@dashbox\hbox{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height \@dashdim}\put(0,0){\copy\@dashbox}% %\put(0,#3){\lower\@dashdim\copy\@dashbox}% \multiply\@dashdim \thr@@ \fi \setbox\@dashbox\hbox{\vrule \@width \@wholewidth \@height 10pt\unitlength}\@tempcnta\z@ \put(0,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta <\@dashcnt \do{\vskip 10pt\unitlength\copy\@dashbox\advance\@tempcnta \@ne }% \vskip\@dashdim}}\@tempcnta\z@ } \def\@updashline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height \@linelen \@depth \z@\hss}} \def\@downdashline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth \@height \z@ \@depth \@linelen \hss}} \def\@updashvector{\@updashline\setbox\@tempboxa\hbox{\@linefnt\char'66}\raise \@linelen \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}} \def\@downdashvector{\@downdashline\lower \@linelen \hbox to \z@{\@linefnt\char'77\hss}}