home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / text / tex / 13257 < prev    next >
Encoding:
Text File  |  1992-11-17  |  5.3 KB  |  131 lines

  1. Newsgroups: comp.text.tex
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sun4nl!ruuinf!piet
  3. From: piet@cs.ruu.nl (Piet van Oostrum)
  4. Subject: Re: Dashed lines in Picture Environment
  5. Sender: network-news@cs.ruu.nl
  6. Message-ID: <1992Nov18.112949.22783@cs.ruu.nl>
  7. In-Reply-To: sas6r@amsun26.apma.Virginia.EDU ()
  8. Date: Wed, 18 Nov 1992 11:29:49 GMT
  9. Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
  10. References: <1992Nov17.155819.25282@murdoch.acc.Virginia.EDU>
  11. Organization: Dept of Computer Science, Utrecht University, The Netherlands
  12. Lines: 117
  13.  
  14. >>>>> sas6r@amsun26.apma.Virginia.EDU () (Steph) writes:
  15.  
  16. Steph> I would like to have a dashed line in the picture environment.  I know
  17. Steph> the command for a line is, for example,
  18.  
  19. Steph>          \put(10,90){\line(70,0){70}}
  20.  
  21. Steph> Is there a similar command to create a dashed line?  I would
  22. Steph> appreciate it if the response were mailed to me.
  23.  
  24. epic.sty has this kind of thing. I also made a dashline style before I knew
  25. about epic. It is simpler, because it does only dashed lines and vectors,
  26. but it uses a different calling scheme:
  27.  
  28. % ============================ dashlines.sty ============================
  29. % Use \dashline and \dashvector the same way as \line/\vector
  30. % You can change the ratio of black/white by redefining \dashfactor
  31. % Doesn't work very good with extremely small lines.
  32.  
  33. \def\dashfactor{0.5}
  34. \def\dashline(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
  35. \@linelen#3\unitlength
  36. \ifnum\@xarg =0 \@dvline \else \@dshline \fi}
  37. \def\@dshline{\ifnum\@xarg< 0 \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg
  38. \else \@negargfalse \@yyarg \@yarg \fi
  39. \ifnum \@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi
  40. \ifnum\@tempcnta>6 \@badlinearg\@tempcnta0 \fi
  41. \setbox\@linechar\hbox{\ifnum\@yarg=0 
  42. \vrule \@height \@halfwidth \@depth \@halfwidth \@width 1em
  43. \else \@linefnt\@getlinechar(\@xarg,\@yyarg)\fi}%
  44. \@clnwd\wd\@linechar
  45. \@tempdima\@clnwd\advance\@tempdima\dashfactor\@clnwd
  46. \@tempcnta \@linelen \divide\@tempcnta\@tempdima
  47. \ifnum\@tempcnta<1 \@tempcnta 1 \fi
  48. \@clnwd -\@clnwd \advance\@clnwd\@linelen \divide\@clnwd\@tempcnta
  49. \@tempdima \@clnwd
  50. \multiply\@tempdima100 
  51. \@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima
  52. \@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta
  53. \divide\@tempdima100
  54. \@clnht \@tempdima
  55. \ifnum \@yarg >0 \let\@upordown\raise \ht\@linechar \@clnht \@clnht\z@
  56. \else\ifnum \@yarg<0 \let\@upordown\lower \advance\@clnht -\ht\@linechar
  57. \setbox\@linechar\hbox{\raise\@clnht\box\@linechar}\@clnht \ht\@linechar
  58. \else\def\@upordown##1{}\@clnht\z@
  59. \fi\fi
  60. \if@negarg \hskip -\wd\@linechar \def\@tempa{\hskip -2\wd\@linechar}\else
  61. \let\@tempa\relax \fi
  62. \wd\@linechar \@clnwd
  63. \@whiledim \@clnwd <\@linelen \do
  64. {\@upordown\@clnht\copy\@linechar
  65. \@tempa
  66. \advance\@clnht \ht\@linechar
  67. \advance\@clnwd \wd\@linechar}%
  68. \advance\@clnwd -\wd\@linechar
  69. \ifnum \@yarg<0 \advance\@clnht -\ht\@linechar\fi
  70. \setbox\@linechar\hbox{\unhbox\@linechar \setbox0\lastbox\unhbox0}%
  71. \ifnum \@yarg<0 \advance\@clnht\ht\@linechar\fi
  72. \@tempdima\@linelen\advance\@tempdima -\@clnwd
  73. \advance\@tempdima -\wd\@linechar
  74. \if@negarg \hskip -\@tempdima \else \hskip \@tempdima \fi
  75. \multiply\@tempdima \@m
  76. \@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima
  77. \@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta
  78. \divide\@tempdima \@m
  79. \advance\@clnht \@tempdima
  80. \ifdim \@linelen <\wd\@linechar
  81. \hskip \wd\@linechar
  82. \else\@upordown\@clnht\copy\@linechar\fi}
  83. \def\@dvline{\setbox\@linechar
  84. \hbox to\z@{\hskip -\@halfwidth
  85. \vrule \@width \@wholewidth \@height 1em\@depth \z@ \hss}%
  86. \@clnht \ht\@linechar
  87. \@tempdima \@clnht \advance\@tempdima\dashfactor\@clnht
  88. \@tempcnta \@linelen \divide\@tempcnta\@tempdima
  89. \ifnum\@tempcnta<1 \@tempcnta 1 \fi
  90. \@clnht -\@clnht \advance\@clnht\@linelen \divide\@clnht\@tempcnta
  91. \ifnum\@yarg>0 \let\@upordown\raise \ht\@linechar \@clnht \@clnht \z@
  92. \else \let\@upordown\lower \advance\@clnht -\ht\@linechar
  93. \setbox\@linechar\hbox{\raise\@clnht\box\@linechar}\@clnht \ht\@linechar
  94. \fi
  95. \@clnwd \ht\@linechar
  96. \@whiledim \@clnwd <\@linelen \do
  97. {\@upordown\@clnht\copy\@linechar
  98. \advance\@clnht\ht\@linechar
  99. \advance\@clnwd\ht\@linechar}%
  100. \setbox\@linechar\hbox{\unhbox\@linechar \setbox0\lastbox\unhbox0}%
  101. \@clnht\@linelen
  102. \ifnum \@yarg >0 \advance\@clnht -\ht\@linechar \fi
  103. \ifdim \@linelen <\ht\@linechar \else \@upordown\@clnht\copy\@linechar \fi}
  104. \def\dashvector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
  105. \@linelen#3\unitlength
  106. \ifnum\@xarg =0 \@dvvector 
  107. \else \@dshvector
  108. \fi}
  109. \def\@dvvector{\@dvline
  110. \ifnum \@yarg >0 \setbox\@tempboxa\hbox{\@linefnt\char'66}\raise \@linelen
  111.     \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}%
  112. \else \lower \@linelen \hbox to \z@{\@linefnt\char'77\hss}%
  113. \fi}
  114. \def\@dshvector{\@dshline
  115. \ifnum \@yarg=0 \hbox to \z@{\@linefnt 
  116. \if@negarg \hskip -\wd\@linechar \@getlarrow(1,0)\hss
  117. \else \hss\@getrarrow(1,0)%
  118. \fi}%
  119. \else
  120. \@tempcnta\@yarg \ifnum\@tempcnta <0 \@tempcnta-\@tempcnta\fi
  121. \ifnum\@tempcnta <5
  122. \hskip -\wd\@linechar
  123. \@upordown\@clnht \hbox{\@linefnt \if@negarg 
  124. \@getlarrow(\@xarg,\@yyarg) \else \@getrarrow(\@xarg,\@yyarg) \fi}%
  125. \else\@badlinearg\fi\fi}
  126. -- 
  127. Piet* van Oostrum, Dept of Computer Science, Utrecht University,
  128. Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
  129. Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
  130. Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')
  131.