[pstricks] unexpected interference of \renewcommand with \psclip

Werner Grundlingh wgrundlingh at gmail.com
Thu Nov 3 21:24:45 CET 2011


This is not limited to using \renewcommand. Instead, you need to end
off each \renewcommand with a '%' to avoid TeX from inserting a
so-called "spurious space". You already do this with your other
pstricks-related environments:

\pscustom[...]%

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

\psclip{%
...

Werner

On Thu, Nov 3, 2011 at 13:02, Toche, Patrick <ptoche at cityu.edu.hk> wrote:
> 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}
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
>



More information about the PSTricks mailing list