# Reset \psset within a pspicture environment

How can I invalidate a style that was created using a \psset comand within a pspicture environment?

Take the following MWE, which compiles with XeLaTeX:

I would like to invalidate the current style after the middle black circle is drawn so that the red circle at the bottom has the same linewidth as the blue circle at the top.

% !TeX program = xelatex
\documentclass[pstricks]{standalone}

\begin{document}
\begin{pspicture}(2,4)
% Set new style
\psset{linecolor=blue}
% Draw top circle
\pscircle(1,3){1}
% Set new style
\psset{linewidth=4pt, linecolor=black}
% Draw middle circle
\pscircle(1,2){1}

% Invalidate current style here

% Set new style
\psset{linecolor=red} % linewidth is kept at 4pt!
% Draw bottom circle
\pscircle(1,1){1}
\end{pspicture}
\end{document}

• Very simple: \psset{linecolor=red, linewidth=0.8pt}. 0.8pt is the default value of the length \pslinewidth. – Bernard Jun 29 '16 at 12:41
• @Bernard Thanks a lot Bernard! Are the default values of pstricks documented somewhere? – codeaviator Jun 29 '16 at 13:50
• For pstricks-base, they're given with the definition of the parameters. For instance, linewidth default is in pst-user.pdf, §5, p. 8. For other packages, they generally have a list of parameters defined by the extension, with the default, at the end of the documentation. – Bernard Jun 29 '16 at 14:23

You can use a group

{% begin a group
% Set new local style
\psset{linewidth=4pt, linecolor=black}
% Draw middle circle
\pscircle(1,2){1}
}% end the group


Then the settings are local.

% !TeX program = xelatex
\documentclass[pstricks]{standalone}
\begin{document}
\begin{pspicture}(2,4)
% Set new style
\psset{linecolor=blue}
% Draw top circle
\pscircle(1,3){1}

{% begin a group
% Set new local style
\psset{linewidth=4pt, linecolor=black}
% Draw middle circle
\pscircle(1,2){1}
}% end the group

% Set new style
\psset{linecolor=red}
% Draw bottom circle
\pscircle(1,1){1}
\end{pspicture}
\end{document}


Or you use the optional argument of \pscircle:

% Draw middle circle with new style
\pscircle[linewidth=4pt, linecolor=black](1,2){1}

• That's great! I didn't know you could define groups with curly brackets. So simple. Using the optional arguments of \pscircle is a very elegant approach. Thanks a lot! – codeaviator Jun 29 '16 at 13:57

use always local settings without \psset which makes more or less only sense for global settings:

\documentclass[pstricks]{standalone}

\begin{document}
\begin{pspicture}(2,4)
\pscircle[linecolor=blue](1,3){1}
\pscircle[linewidth=4pt](1,2){1}
\pscircle[linecolor=red](1,1){1}
\end{pspicture}
\end{document}