来自 pstricks 手册的一个例子,为什么“linecolor”无法工作

来自 pstricks 手册的一个例子,为什么“linecolor”无法工作
\documentclass{article}
\usepackage{pstricks,pst-poly,pst-text,pst-key,graphicx,color}

\makeatletter

\SpecialCoor

\def\PstCoggedWheel#1#2{%
% #1 = number of teeth (it must be a divisor of 360!)
% #2 = height of the teeth, between 0 and 1 unit
\pst@cntc=360
\divide\pst@cntc by #1
\pst@cntd=\pst@cntc
\divide\pst@cntd\tw@
 \pst@dimd=\psunit
 \pssetlength{\pst@dimc}{#2}%
 \advance\pst@dimd-\pst@dimc
 \pscustom{%
 \moveto(\pst@dimd;0)
 \multido{\iAngleA=\z@+\pst@cntc,
 \iAngleB=\pst@cntd+\pst@cntc,
 \iAngleC=\pst@cntc+\pst@cntc}{#1}{%
 \lineto(1;\iAngleA)
 \lineto(1;\iAngleB)
 \lineto(\pst@dimd;\iAngleB)
 \lineto(\pst@dimd;\iAngleC)}}}




\makeatother

\begin{document}

\rput(-2,4){\PstCoggedWheel{9}{0.3}}
 \rput(-2,1){\PstCoggedWheel{9}{7mm}}
\rput(-2,-3){\psset{unit=2,linecolor=red}\PstCoggedWheel{40}{0.1}}

\end{document} 

答案1

删除加载pst-key,一切都会正常运行。我甚至直接用pdflatex加载的编译了它auto-pst-pdf pstricks(不要忘记添加--enable-write18编译器(MiKTeX)或-shell-escape(TeX Live、MacTeX)的开关):

enter image description here

答案2

pst-key是旧包,请使用pst-xkey。但是,仅使用\usepackage{pstricks,multido}并且\SpecialCoor不再需要,它是默认的。

\documentclass{article}
\usepackage{pstricks,multido}

\makeatletter
\def\PstCoggedWheel#1#2{%
  [...] 

相关内容