[pstricks] unexpected interference of \renewcommand with \psclip

Toche, Patrick ptoche at cityu.edu.hk
Thu Nov 3 21:02:34 CET 2011


Dear all,

I have some experience with PSTricks, but it is the first time I use \psclip. 

Half-way down my \pspicture I redefine shortcuts with \renewcommand{\myNumber}{1}. I've never had problems with this in the past. But here, everytime I have a \renewcommand, my \psline and other objects are unexpectedly shifted away from their assigned position.

Is there a workaround?

Thanks,

Patrick.

Below is a minimal example. The picture "should" produce one blue and one red box in perfect alignment. But the \renewcommands in between interfere. The more of them, the bigger the interference, as measured by the distance by which the objects are shifted away from their assigned position.


\documentclass[dvips]{article}

\pagestyle{empty}

\usepackage{pstricks-add}

\begin{document}

\psset{xunit=300pt,yunit=300pt}

% Label Positions Initialized
\newcommand{\xa}{}
\newcommand{\ya}{}
\newcommand{\xb}{}
\newcommand{\yb}{}
\newcommand{\xc}{}
\newcommand{\yc}{}

\begin{pspicture}(0,0)(\textwidth,\textheight)

\psaxes(0,0)(1,1)

\pscustom[%
  linestyle=none
  , fillstyle = solid
  , fillcolor = blue
  ]%
{%
  \psline(0,0.5)(0,1)(1,1)(1,0.5)(0,0.5)
}%

\renewcommand{\xa}{1}
\renewcommand{\ya}{2}
\renewcommand{\xb}{3}
\renewcommand{\yb}{4}
\renewcommand{\xc}{5}
\renewcommand{\yc}{6}

\psclip{%
  \pscustom[linestyle=none]
    {%
      \psline(0,0)(0,0.5)(1,0.5)(1,0)(0,0)
    }%
  }%
  \psframe*[linecolor=red](0,0)(1,1)
\endpsclip


\end{pspicture}

\end{document}


More information about the PSTricks mailing list