# [pstricks] Bug in pscustom or ...

Denis Girou Denis.Girou at idris.fr
Fri Feb 16 20:45:59 CET 2001

>>>>> "Etienne.Riga" == Etienne Riga <etienne.riga at skynet.be> writes:

Etienne.Riga> In the figure whose code follows, it seems to to me that the width of
Etienne.Riga> the line which was traced in red for better locating should be 0.8pt.

I believe that this is the expected behavior. When we heavily magnify
the resulting area, we see that the red line doesn't disappear but that
half of it width is overlapped by the \pscustom command and the new
fillstyle. But this is what we can expect because a \psline draw it line
in the middle of the path defined and the next fillstyle used an area with
the same border definition, so override half of the preceding line.

This is what we can clearly see if we emphasize the case, using a large
value for the width:

\documentclass[a4paper]{article}

\usepackage{pstricks}

\pagestyle{empty}

\begin{document}

\psset{subgriddiv=0,linewidth=1}

\begin{pspicture}(5,4)\psgrid
\psline(0,1)(5,1)
\pscustom[fillstyle=solid,fillcolor=red,linecolor=green]{%
\psline(0,1)(3,1)
\psline(3,3)(0,3)}
\end{pspicture}

\vspace{1cm}

\begin{pspicture}(5,4)\psgrid
\psline(0,1)(5,1)
\pscustom[fillstyle=solid,fillcolor=red,linestyle=none]{%
\psline(0,1)(3,1)
\psline(3,3)(0,3)}
\end{pspicture}
\hfill
\begin{pspicture}(5,4)\psgrid
\psline(0,1)(5,1)
\pscustom[fillstyle=solid,fillcolor=red,linewidth=0]{%
\psline(0,1)(3,1)
\psline(3,3)(0,3)}
\end{pspicture}

\end{document}

What you seems to want is to be able to draw the first line with something
like the effect of the "dimen=inner" parameter (documentation page 26),
but this one is defined only for some closed objects.

So, I think that in your case the solution is to code it in another way,
which is also simplest, and in this case your problem doesn't appear...:

Etienne.Riga>  \psline[linecolor=red](0,28)(1,144.5)(2,101)(3,42)(4,13.5)(5,16)(6,3)(7,5)
Etienne.Riga>   (8,4)(9,1.5)(10,.75)(11,1.5)(12,0)(13,2)
Etienne.Riga> \pscustom[fillstyle=crosshatch*,fillcolor=black,hatchcolor=white,
Etienne.Riga>   hatchwidth=.8pt,hatchsep=1.2pt,hatchangle=0,linestyle=none]{
Etienne.Riga>  \psline(0,28)(1,147)(2,110)(3,54)(4,17)(5,25)(6,4.5)(7,7.75)
Etienne.Riga>   (8,6)(9,5)(10,2)(11,3)(12,4.75)(13,3)
Etienne.Riga>  \psline(13,3)(13,2)(12,0)(11,1.5)(10,.75)(9,1.5)(8,4)
Etienne.Riga>   (7,5)(6,3)(5,16)(4,13.5)(3,42)(2,101)(1,144.5)(0,28)(0,28)}
Etienne.Riga>  \psline(0,28)(1,147)(2,110)(3,54)(4,17)(5,25)(6,4.5)(7,7.75)
Etienne.Riga>   (8,6)(9,5)(10,2)(11,3)(12,4.75)(13,3)

\pscustom[fillstyle=crosshatch*,fillcolor=black,hatchcolor=white,
hatchwidth=.8pt,hatchsep=1.2pt,hatchangle=0,linecolor=red]{%
\psline(0,28)(1,147)(2,110)(3,54)(4,17)(5,25)(6,4.5)(7,7.75)
(8,6)(9,5)(10,2)(11,3)(12,4.75)(13,3)
\psline(13,3)(13,2)(12,0)(11,1.5)(10,.75)(9,1.5)(8,4)
(7,5)(6,3)(5,16)(4,13.5)(3,42)(2,101)(1,144.5)(0,28)}
\psline(0,28)(1,147)(2,110)(3,54)(4,17)(5,25)(6,4.5)(7,7.75)
(8,6)(9,5)(10,2)(11,3)(12,4.75)(13,3)

P.S. Take care to never end a line by an opening brace, which will
introduce a spurious blank (see documentation page 3, last paragraph). So:

Etienne.Riga> \pscustom[fillstyle=solid,fillcolor=lightgray,linestyle=none]{
Etienne.Riga> \pscustom[fillstyle=vlines,hatchwidth=.4pt,hatchsep=3pt,linestyle=none]{
Etienne.Riga> \pscustom[fillstyle=hlines,hatchwidth=.4pt,hatchsep=1.5pt,linestyle=none]{
Etienne.Riga>   hatchwidth=.8pt,hatchsep=1.2pt,hatchangle=0,linestyle=none]{

\pscustom[fillstyle=vlines,hatchwidth=.4pt,hatchsep=3pt,linestyle=none]{%
etc.

D.G.