Strange behavior?

Denis Girou Denis.Girou at idris.fr
Fri Nov 7 22:03:07 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.
-----------------------------------------------------------------------------

    Ulrich.Dirr> One of many examples is:
    Ulrich.Dirr> ..............................

    Ulrich.Dirr> In the first edition I used \pspolygon without hatchangle and the result
    Ulrich.Dirr> was hlines at 0 degree and vlines at 135 degree (assuming 0 degree as
    Ulrich.Dirr> the origin with counterclockwise direction). With PST97 the hlines
    Ulrich.Dirr> appeared at 90 degree and vlines at 45 degree; so I had to add a
    Ulrich.Dirr> hatchangle of 90 degree to compensate for this behavior.
    Ulrich.Dirr> I'm using the Y&Y DVIPSONE driver with appropriate header files to work
    Ulrich.Dirr> with PSTricks (maybe the problem is here!). These are PSTRICKS.CON 799
    Ulrich.Dirr> 26.07.97 20:20 and PSTRICKS.PRO 12.339 08.09.97 18:36.

  I confirm that I don't reproduce this problem (with dvips driver). First
check the differences between your two PSTRICKS.PRO files and PSTRICKS.CON
ones.

    >> Nevertheless with the linewidth, dotted, dotsep, dashed and dash parameters
    >> you have already many possibilities to distinguish between lines. Not enough
    >> for your applications?

    Ulrich.Dirr> It's enough for me but not for my publisher!

  Here is my attempt tonight:

\documentclass{article}

\usepackage{pstricks}

\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.

D.G.

-----------------------------------------------------------------------------
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