# What makes showgrid=true or showgrid=top displace my clip to the right?

The following code is trivial but important to show the problem. When I activate the showgrid with true or top option, my graphics object gets shifted to right as shown in the following animation.

\documentclass[pstricks,border=12pt]{standalone}

\def\Atom{\psframe(1,2)(2,3)}

\begin{document}

% NO problem WITHOUT showgrid or with showgrid=bottom
\begin{pspicture}[showgrid=bottom](2,4)
\begin{psclip}{\Atom}
\psframe*(2,4)
\end{psclip}
\end{pspicture}

% get shifted to the right with showgrid=true or showgrid=top
\begin{pspicture}[showgrid=true](2,4)
\begin{psclip}{\Atom}
\psframe*(2,4)
\end{psclip}
\end{pspicture}

\end{document}


Warning:

• showgrid=true is equal to showgrid=top rather than showgrid=bottom.
• The statement on page 4 of pst-news12.pdf might wrongly be typed.

What makes this displacement?

-
What does showgrid=top leads to? It will include \psgrid at the end of the pspicture-environment. This may be the problem, as everything gets shifted by drawing the grid at the very end... –  DL6ER Apr 4 '13 at 12:27

use this version: http://texnik.dante.de/tex/generic/pstricks/pstricks.tex It has a bugfix for that.

-
The documentation was also incorrectly typed. showgrid=true should be identical to showgrid=top rather than showgrid=bottom. See page 4 of pst-news12.pdf. –  Oh my ghost Apr 4 '13 at 12:33
There is one more bug: chat.stackexchange.com/transcript/message/8793447#8793447 –  Oh my ghost Apr 4 '13 at 13:22
Yes. But in general, showgrid activated in pspicture is for navigational purposes when constructing the diagram. For me, showgrid=bottom or showgrid=top should take unit defined outside the pspicture. And \psgrid should be used for other purposes. It is just an opinion. :-) –  Oh my ghost Apr 4 '13 at 13:51

Notice my comment above:

What does showgrid=top leads to? It will include \psgrid at the end of the pspicture-environment. This may be the problem, as everything gets shifted by drawing the grid at the very end...

This solution will produce a correct version (draw grid first to set everything right and draw another one at the end to get it on top):

\begin{pspicture}[showgrid=bottom](2,4)
\begin{psclip}{\Atom}
\psframe*(2,4)
\end{psclip}
\psgrid[style=gridstyle]
\end{pspicture}


There is a white space at the end of

      \ifx#1t


in the following code snippet.

% -----------  hv 20120219 -------------------
\newpsstyle{gridstyle}{subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=8pt}
%\define@boolkey[psset]{pstricks}[]{showgrid}[true]{}
\newif\ifshowgrid
\define@key[psset]{pstricks}{showgrid}[b]{\pst@@showgrid#1\@nil}
\def\pst@@showgrid#1#2\@nil{%
\ifx#1b\showgridtrue\def\showgridp@s{0}\else%            bottom
\ifx#1f\showgridfalse\else
\ifx#1t
\ifx#2r\showgridtrue\def\showgridp@s{0}\else%      true->bottom
\showgridtrue\def\showgridp@s{1}\fi%        top
\fi\fi\fi%
}

-
+1: Oh my ghost, you noticed the white space. :-) –  Oh my ghost Apr 4 '13 at 12:40