[pstricks] Macro problems...
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Sat Dec 5 08:29:10 CET 2009
Am 05.12.2009 07:33, schrieb Werner Grundlingh:
> \providecommand{\circulant}{%
> \makeatletter%
> \SpecialCoor \degrees[8]%
> \multido{\iN=0+1}{8}{%
> \cnode*[linecolor=black,fillcolor=black](2;\iN){2pt}{v\iN}% Draw
> the nodes/vertices
> }
> \multido{\iN=0+1}{8}{%
> \psforeach{\nA}{1,2}{%
> \pst at cntc=\iN
> \advance\pst at cntc by \nA
> \pst at mod{\pst at cntc}{8}\nextnode%
> \psline[linewidth=0.5pt,linestyle=solid,nodesep=-0.5pt](2;\iN)(2;\nextnode)
> }
> }%
> \makeatother%
> }
> Why is that? Better yet, how would I be able to make this work?
the makeatletter ... makeatother must be outside of a
macro definition and by the way: there is a package pst-poly:
\documentclass{article}
\usepackage{multido}
\usepackage{pst-poly,pstricks-add}
\makeatletter%
\newcommand\circulant{%
\SpecialCoor \degrees[8]%
\multido{\iN=0+1}{8}{%
\cnode*[linecolor=black,fillcolor=black](2;\iN){2pt}{v\iN}% Draw the
nodes/vertices
}
\multido{\iN=0+1}{8}{%
\psforeach{\nA}{1,2}{%
\pst at cntc=\iN
\advance\pst at cntc by \nA
\pst at mod{\pst at cntc}{8}\nextnode%
\psline[linewidth=0.5pt,linestyle=solid,nodesep=-0.5pt](2;\iN)(2;\nextnode)
}
}%
}
\makeatother%
\begin{document}
\begin{pspicture}(-3,-3)(3,3)
\circulant
\end{pspicture}
\newcommand\PstPolygonNode{\psdot(1;\INode)}
\PstPolygon[unit=2,PolyNbSides=8]%
\rput[lb](-4,0){\PstPolygon[unit=2,PolyNbSides=4]}%
\rput[lb](-4,0){\PstPolygon[unit=2,PolyNbSides=4,PolyRotation=45]}%
\end{document}
Herbert
More information about the PSTricks
mailing list