Scenario

\pspicture with showgrid will be regarded as a PERMANENT grid.

\psgrid in \pspicture WITHOUT showgrid will be regarded as a TEMPORARY grid.

If I want to remove all temporary grids, I just need to redefine \psgrid as follows in the preamble.

\let\psgrid\relax


However, if I do this, the \pspicture with showgrid will produce strange output.

Question

How to resolve this issue?

Minimal Code

\documentclass{article}
\usepackage{pstricks}

%If I uncomment out this,
%all temporary grids must disappear.
%\let\psgrid\relax

\begin{document}

%permanent grid
\pspicture[showgrid](2,2)
\psframe*(1,1)
\endpspicture

%temporary grid
\pspicture(2,2)
\psgrid
\psframe*(1,1)
\endpspicture

\end{document}

-
I already gave you an answer how to deal with two macros.you can't say \let\foo\relax when foo expects some optional parameter. –  Herbert Jan 10 '11 at 16:58
I've merged the two questions. Could you please accept the answer here? –  Juan A. Navarro Jan 10 '11 at 17:26

1 Answer

\documentclass{article}
\usepackage{pstricks}
\makeatletter
\def\psgrid@iv(#1)(#2)(#3){}
\makeatother
\begin{document}

\pspicture[showgrid](2,2)
\psframe*(1,1)
\endpspicture

\pspicture(2,2)
\psgrid
\psframe*(1,1)
\endpspicture

\end{document}

-
@xport: see changed code –  Herbert Jan 10 '11 at 16:18
@xport: then you have to copy all \psgrid commands (see pstricks.tex) to won macros and use this for a permanent grid. –  Herbert Jan 10 '11 at 16:48
Why cannot we use \psset{showgrid=true/false/top/bottom} at the preamble? –  kiss my armpit Nov 21 '13 at 15:29