GeneralPSTRICKS: How to enable grid by default?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
yoyoimut
Posts: 120
Joined: Mon Oct 19, 2009 6:58 am

PSTRICKS: How to enable grid by default?

Post by yoyoimut »

pspicture environment set showgrid to false by default.

How to set showgrid to true by default?

I attempted to use the following code, but it did not work.

Code: Select all

\psset{showgrid=true}
My objective is to show grid during development and remove it at the final stage. Any pspicture environments that intentionally/explicitly set showgrid to true will still render the grid even after by default showgrid set to false.

The following code might be useful for you to save time.

Code: Select all

\documentclass{article}
\usepackage{pstricks}

%for grid style
\newpsstyle{gridstyle}{%
gridcolor=magenta!30,
subgridcolor=yellow!30,
gridlabels=5pt,
gridlabelcolor=red,
gridwidth=0.4pt,
subgridwidth=0.2pt}


\begin{document}

%permanent grid
\begin{pspicture}[showgrid](-2,-2)(2,2)
\pscircle*[fillcolor=red]{1}
\end{pspicture}
\vspace{1cm}


%temporary grid 
\begin{pspicture}(-2,-2)(2,2)
\pscircle*[fillcolor=red]{1}
\end{pspicture}
\vspace{1cm}

\end{document}

Thank you.

yoyo

Note: scenario in this topic (showing grid at development stage and removing it at final stage by setting showgrid to true by default) will make us save energy by not typing \psGrid again and again (see here http://www.latex-community.org/forum/vi ... =5&t=10377 for the \psGrid trick).
Last edited by yoyoimut on Thu Oct 07, 2010 9:56 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTRICKS: How to enable grid by default?

Post by CrazyHorse »

yoyoimut wrote:pspicture environment set showgrid to false by default.

How to set showgrid to true by default?

I attempted to use the following code, but it did not work.

Code: Select all

\psset{showgrid=true}
Note: scenario in this topic (showing grid at development stage and removing it at final stage by setting showgrid to true by default) will make us save energy by not typing \psGrid again and again (see here http://www.latex-community.org/forum/vi ... =5&t=10377 for the \psGrid trick).
that didn't work, it is a feature, that showgrid must be set as optional
argument of pspicture. This is needed, because you can have nested pspicture
environments.

Herbert
yoyoimut
Posts: 120
Joined: Mon Oct 19, 2009 6:58 am

Re: PSTRICKS: How to enable grid by default?

Post by yoyoimut »

OK. I will return to the first idea, using \psGrid.

Thank you.


yoyo
Post Reply