"unit" and "linewidth" parameters

Denis Girou Denis.Girou at idris.fr
Fri Feb 4 22:31:03 CET 2000


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

  Etienne Riga <etienne.riga at skynet.be> recently ask me a question about
a strange effect he found in one of his codes. As it is a rather huge code,
I simplify it here to a smallest part demonstrating the problem.

------------------------------------------------------------------------------

\input pstricks

\newcmykcolor{LOGO}{1 .5 0 .5}

\def\LOGO{%
\pspicture(45.2,174.1)(90.5,207)
  \psset{fillstyle=solid,fillcolor=LOGO,linecolor=LOGO}
  \pscustom{%
    \pscurve(45.2,175)(45.9,191)(45.75,207)                    %
    \psline(45.75,207)(51.25,207.2)                            %
    \pscurve[liftpen=1](51.25,207.2)(50.75,194)(50.5,177.3)    %
    \pscurve[liftpen=1](50.5,177.3)(56,177.5)(62.5,178.35)     %
    \psline(62.5,178.35)(62.1,174.5)                           %%%%
    \pscurve[liftpen=1](62.1,174.5)(54,175)(46,174.5)
    \psbezier(46,174.5)(45.5,174.5)(45.2,174.75)(45.2,175)}
%
  \pscustom{%
    \pscurve(63.65,174.1)(64.1,191)(64,206.75)                 %
    \psline(64,206.75)(69.5,207)                               %
    \pscurve[liftpen=1](69.5,207)(68.75,190)(69,174.3)         %
    \psline(69,174.3)(63.65,174.1)}                            %
%
  \pscustom{%
    \pscurve(71.5,174.3)(71.9,190)(71.5,207)                   %%%%
    \pscurve[liftpen=1](71.5,207)(80,206.6)(89.5,206.9)        %
    \psline(89.5,206.9)(89,203.5)                              %
    \pscurve[liftpen=1](89,203.5)(83,204)(78,204.2)            %
    \psbezier(78,204.2)(77.5,204.2)(76.75,204)(76.75,203.2)    %%%%
    \psline(76.75,203.2)(76.5,192.8)                           %
    \pscurve[liftpen=1](76.5,192.8)(82,192.9)(88,193.3)        %
    \psline(88,193.3)(88,189.65)                               %
    \pscurve[liftpen=1](88,189.65)(86,190)(76.6,190.25)        %%%%
    \psline(76.6,190.25)(76.6,177)
    \pscurve[liftpen=1](76.6,177)(82,177.1)(90.5,178.1)
    \psline(90.5,178.1)(89.8,174.2)
    \pscurve[liftpen=1](89.8,174.2)(80,174.7)(71.5,174.3)}
\endpspicture}

\vskip 4cm
{\psset{unit=0.1}\LOGO}
\hfill
{\psset{unit=0.025}\LOGO}
\hfill
{\psset{unit=0.01}\LOGO}

\bye

------------------------------------------------------------------------------

  As we can see, the effect of the "unit" parameter is not the expected one
and the last logo specially doesn't look like expected.

  This is clearly surprising at least at first glance, and I remember that
I was also surprised the first time I saw such effect in the past. I do not
believe that it can be called a bug but I agree that it can be called
a strange feature or a strange design choice. This is true that people must be
aware of such effect, but I do not think that it could have too much damage as
it is easy to bypass.

  The reason is, as it can be notice in the documentation, several things use
the value of the current "linewidth" parameter to internally compute their own 
values, and "linewidth" is not relative to the "unit" parameter.

  Here is a clear example of such effect, about the "arrowsize" parameter
(documentation, page 30), amplificated by the choice of a coefficient of 15, 
and you can see that the simple workaround is just to redefine accordingly
the "linewidth" value.

------------------------------------------------------------------------------

\documentclass{article}

\usepackage{pstricks}

\newcommand{\Line}{%
\begin{pspicture}(4,1)
  \psline[arrowsize=0.1 15,arrowinset=0]{<->}(4,0)
\end{pspicture}}

\pagestyle{empty}

\begin{document}

\Line\hfill{\psset{unit=0.5}\Line}\hfill
{\psset{unit=0.2}\Line}\hfill{\psset{unit=0.1}\Line}

\Line\hfill
{\psset{unit=0.5,linewidth=0.5\pslinewidth}\Line}\hfill
{\psset{unit=0.2,linewidth=0.2\pslinewidth}\Line}\hfill
{\psset{unit=0.1,linewidth=0.1\pslinewidth}\Line}

\end{document}

------------------------------------------------------------------------------

  So, it can be done too in the first case of the logo. Nevertheless, another
simple workaround for this case (but of course inappropriate for the case of
arrows) is to use "linestyle=none" for all the picture. But it must be taken
into account from the beginning of the programming task to compute accordingly
the coordinates, and can't give the same result that the very precise one
expected when used afterward, as here.

------------------------------------------------------------------------------

\input pstricks

\newcmykcolor{LOGO}{1 .5 0 .5}

\def\LOGO{%
\pspicture(45.2,174.1)(90.5,207)
  \psset{fillstyle=solid,fillcolor=LOGO,linecolor=LOGO}
  \pscustom{%
    \pscurve(45.2,175)(45.9,191)(45.75,207)                    %
    \psline(45.75,207)(51.25,207.2)                            %
    \pscurve[liftpen=1](51.25,207.2)(50.75,194)(50.5,177.3)    %
    \pscurve[liftpen=1](50.5,177.3)(56,177.5)(62.5,178.35)     %
    \psline(62.5,178.35)(62.1,174.5)                           %%%%
    \pscurve[liftpen=1](62.1,174.5)(54,175)(46,174.5)
    \psbezier(46,174.5)(45.5,174.5)(45.2,174.75)(45.2,175)}
%
  \pscustom{%
    \pscurve(63.65,174.1)(64.1,191)(64,206.75)                 %
    \psline(64,206.75)(69.5,207)                               %
    \pscurve[liftpen=1](69.5,207)(68.75,190)(69,174.3)         %
    \psline(69,174.3)(63.65,174.1)}                            %
%
  \pscustom{%
    \pscurve(71.5,174.3)(71.9,190)(71.5,207)                   %%%%
    \pscurve[liftpen=1](71.5,207)(80,206.6)(89.5,206.9)        %
    \psline(89.5,206.9)(89,203.5)                              %
    \pscurve[liftpen=1](89,203.5)(83,204)(78,204.2)            %
    \psbezier(78,204.2)(77.5,204.2)(76.75,204)(76.75,203.2)    %%%%
    \psline(76.75,203.2)(76.5,192.8)                           %
    \pscurve[liftpen=1](76.5,192.8)(82,192.9)(88,193.3)        %
    \psline(88,193.3)(88,189.65)                               %
    \pscurve[liftpen=1](88,189.65)(86,190)(76.6,190.25)        %%%%
    \psline(76.6,190.25)(76.6,177)
    \pscurve[liftpen=1](76.6,177)(82,177.1)(90.5,178.1)
    \psline(90.5,178.1)(89.8,174.2)
    \pscurve[liftpen=1](89.8,174.2)(80,174.7)(71.5,174.3)}
\endpspicture}

\vskip 4cm
{\psset{unit=0.1}\LOGO}
\hfill
{\psset{unit=0.025}\LOGO}
\hfill
{\psset{unit=0.01}\LOGO}
\hfill
{\psset{unit=0.01,linewidth=0.01\pslinewidth}\LOGO}
\hfill
{\psset{unit=0.01,linestyle=none}\LOGO}

\vskip 2cm
\psset{linestyle=none}
{\psset{unit=0.1}\LOGO}
\hfill
{\psset{unit=0.025}\LOGO}
\hfill
{\psset{unit=0.01}\LOGO}

\bye

------------------------------------------------------------------------------

D.G.

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



More information about the PSTricks mailing list