[pstricks] A subtle problem with pstverb?

Boris Alexeev kaif at uga.edu
Fri Jan 9 03:32:58 CET 2009


I've been encountering problems drawing some pictures with PSTricks.
I've tried to condense it down to a minimal example, and here's what I
get:

The following outputs two dots, instead of one:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(-1,-1)(1,1)
\psdots(0,0)
{}
\pstverb{}
\psdots(0,0)
\end{pspicture}
\end{document}

However, if I add a single comment character %, this outputs only one
dot (well, two dots in the same place), as expected:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(-1,-1)(1,1)
\psdots(0,0)
{}%
\pstverb{}
\psdots(0,0)
\end{pspicture}
\end{document}

Now, you may say that it's suspicious to have an empty pair of braces
in the middle of my pspicture.  However, my original picture did not
have this.  I was also using the standard package "ifthen".  Once
again, the following code outputs two dots, even though it only
outputs one dot if I put a comment at the end of the ifthenelse line:

\documentclass{article}
\usepackage{pstricks}
\usepackage{ifthen}
\begin{document}
\begin{pspicture}(-1,-1)(1,1)
\psdots(0,0)
\ifthenelse{\equal{z}{z}}{}{}
\pstverb{}
\psdots(0,0)
\end{pspicture}
\end{document}

None of these problems seem to be present if I take out the pstverb{},
leading me to guess that \pstverb is the core of the problem; of
course, my hypothesis could easily be wrong.  (The problem does remain
if I change \pstverb to \pstVerb.)  The actual difference in terms of
the outputted Postscript is either something like "27 w", which
translates the current point, or simply a different pair of
coordinates like "931 676 a" instead of "903 676 a" --- depending on
whether one has \psdots or \psline or whatnot.

Any ideas what's going on and how to fix it?  (I'm currently handling
such problems by putting various %s at the ends of lines, but it's
annoying and I can never tell if they're necessary or not.)

Thanks for your attention!
Boris


More details:  The problem remains if I change the ifthenelse line to
   \ifthenelse{\equal{z}{z}}{}{\psdots(1,1)}
or
   \ifthenelse{\not\equal{z}{z}}{\psdots(1,1)}{}

The problem also happens if I define a new command
   \newcommand\nop[1][z]{}
and then change the problem line to
   \nop[]
Note that this no longer requires package "ifthen".

Based on reading the outputted Postscript, it appears the problem is
present even if my entire pspicture is
   \begin{pspicture}(-1,-1)(1,1)
   {}
   \pstverb{}
   \end{pspicture}
Of course, this is an empty picture and so there is no visible
difference.  What I mean is that the Postscript differs depending on
whether I write {} or {}%.


More information about the PSTricks mailing list