[pstricks] New macro addtopsstyle
Christoph Bersch
christoph at bersch.net
Fri Sep 7 16:51:32 CEST 2007
Hi,
for me it would be comfortable to have a macro which adds some
additional settings to an existing psstyle. Something like
\newpsstyle{Fiber}{linecolor=green}
\addtopsstyle{Fiber}{linewidth=0.1}
-> style Fiber contains both informations
The following code seems to work, but it uses the LaTeX macro
\g at addto@macro. As I plan to include this into a PSTricks package, the
question is, if I should rewrite it in plain TeX (don't know how), or if
use of a LaTeX macro is ok.
\documentclass{article}
\usepackage{pstricks}
\makeatletter
\def\addtopsstyle#1#2{%
\@ifundefined{pscs@#1}%
{\newpsstyle{#1}{#2}}%
{%
\expandafter\g at addto@macro\csname pscs@#1\endcsname{%
\def\pset at tempa{#2}%
\ifx\pst at tempa\@empty\else\psset{#2}\fi%
}
}%
}
\makeatother
\newpsstyle{Fiber}{linewidth=0.1}
\begin{document}
\begin{pspicture}(5,5)
\psline[style=Fiber](0,0)(5,1)
\addtopsstyle{Fiber}{linecolor=green}
\psline[style=Fiber](0,1)(5,2)
\addtopsstyle{Fiber}{linestyle=dotted}
\psline[style=Fiber](0,2)(5,3)
\end{pspicture}
\end{document}
Christoph
More information about the PSTricks
mailing list