Modified dashed linestyle

Ulrich Dirr udirr at das-team.com
Mon Nov 10 11:53:36 CET 1997


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

> \makeatletter
> % `dashed' linestyle modified to accept dashes defined
> % by two different segments - <Denis.Girou at idris.fr> - Nov. 7, 1997
> \def\pst at empty{\z@}
> \def\psset at dash#1{%
> \pst at expandafter\psset@@dash{#1} {\pst at empty} {\pst at empty}
>                                  {\pst at missing} {\pst at missing} {}\@nil
> \edef\psk at dash{\pst at number\pst at dimg \pst at number\pst at dimh
>                \pst at number\pst at dimc \pst at number\pst at dimd}}
> \def\psset@@dash#1 #2 #3 #4 #5\@nil{%
> \pssetlength\pst at dimg{#1}%
> \pssetlength\pst at dimh{#2}%
> \pssetlength\pst at dimc{#3}%
> \pssetlength\pst at dimd{#4}}
> 
> \pst at def{DashLine}<%
> dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def PathLength } ifelse
> /b ED /x1 ED /y1 ED /x ED /y ED
> /z y x add y1 add x1 add def
> /Coef b a .5 sub 2 mul y mul sub z Div round
> z mul a .5 sub 2 mul y mul add b exch Div def
> /y y Coef mul def /x x Coef mul def /y1 y1 Coef mul def /x1 x1 Coef mul def
> x1 0 gt y1 0 gt x 0 gt y 0 gt and { [ y x y1 x1 ] 1 a sub y mul}
> { [ 1 0] 0 } ifelse setdash stroke>
> \makeatother
> 
> \newcommand{\MyLine}[1][linestyle=solid]{%
> \begin{pspicture}(0,-0.5)(10,0.5)
>   \psline[#1](10,0)
> \end{pspicture}}
> 
> \pagestyle{empty}
> 
> \begin{document}
> 
> \psset{dashadjust=false}
> 
> \MyLine[linestyle=dashed,dash=1 1]
> 
> \MyLine[linestyle=dashed,linewidth=1mm,dash=2 0.5]
> 
> \MyLine[linestyle=dashed,dash=1 0.2 0.05 0.2]
> 
> \MyLine[linestyle=dashed,dash=0.05 0.2 1 0.2]
> 
> \MyLine[linestyle=dashed,linewidth=1mm,dash=2 1 1 2]
> 
> \psset{dashadjust=true}
> 
> \MyLine[linestyle=dashed,dash=1 1]
> 
> \MyLine[linestyle=dashed,linewidth=1mm,dash=2 0.5]
> 
> \MyLine[linestyle=dashed,dash=1 0.2 0.05 0.2]
> 
> \MyLine[linestyle=dashed,dash=0.05 0.2 1 0.2]
> 
> \MyLine[linestyle=dashed,linewidth=1mm,dash=2 1 1 2]
> 
> \end{document}
> 
>   P.S. * Take care that I see that there is a problem related to this example,
> at least in my installation, with gv (3.5.8) and ghostview (1.5) which display
> incorrectly this file. But it's correct with gs (5.03) and on my printer.

Hi,

i've just tested it on my system but it generates on both gsview5.03 and
on my printer the following error:

Loaded Ghostscript DLL D:\PS\GhostScript\gs5.03\gsdll32.dll
Aladdin Ghostscript 5.03 (1997-8-8)
Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA.  All rights
reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Displaying DSC file J:/usr/uli/olv/lb9/test.ps
Displaying page 1
%GSVIEW_PDF_MARK: /DOCINFO [/Title (TEST) /CreationDate
(D:19971110110722) /Creator (DVIPSONE \(32\) 2.0.7 1997 Jun 18 07:49:24)
/Subject (TeX output 1997.11.10:1106) /Author (Ulrich Dirr \(Dirr &
Hallstein\) 410 1997 Sep 30 11:17:55)]
%GSVIEW_PDF_MARK: /PAGES [/CropBox [0 0 595 841]]
Unrecoverable error: typecheck in restore
Operand stack:
    false  false  false  --nostringval--  0  1930214  0  0  1.4989e+07 
4.06314e+06  0  1930214  0  0  1.4989e+07  4.06314e+06  0  1930214  0 
0  1.4989e+07  4.06314e+06  0  1930214  0  0  3.95182e+07  0.0  0  0  0 
0  4.14843e+07  0.0  0  0  0  0

--- Begin offending input ---
 Div round z mul a .5 sub 2 mul
y mul add b exch Div def /y y Coef mul def /x x Coef mul def /y1
y1 Coef mul def /x1 x1 Coef mul def x1 0 gt y1 0 gt x 0 gt y 0 gt
and { [ y x y1 x1 ] 1 a sub y mul} { [ 1 0] 0 } ifelse setdash stroke
 grestore end
 restore

--- End offending input ---
file offset = 39515
gsdll_execute_cont returns -20

My printer stopped after six dashed lines with the above typecheck
error.
May be this is again Y&Y specific?! I hope I can look at the header
files today and find something relevant.

Ulrich

*****************************
* Ulrich Dirr               *
* Graphik & Typographie     *
* Arnimstraße 9             *
* D-81369 München           *
*****************************
* fon (+49)-89-7433060      *
* fax (+49)-89-7433061      *
* e-mail udirr at das-team.com *
*****************************


-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://tug.cs.umb.edu/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at tug.cs.umb.edu
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list