From 54c2f79f29cc81b5e93d3b4e73f3062811276058 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Dec 2009 23:16:59 +0000 Subject: pst-poly 1.61 (20dec09) git-svn-id: svn://tug.org/texlive/trunk@16460 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/generic/pst-poly/pst-poly.tex | 389 ++++++++++----------- 1 file changed, 179 insertions(+), 210 deletions(-) (limited to 'Master/texmf-dist/tex/generic/pst-poly') diff --git a/Master/texmf-dist/tex/generic/pst-poly/pst-poly.tex b/Master/texmf-dist/tex/generic/pst-poly/pst-poly.tex index 43e4e714961..9720ab84087 100644 --- a/Master/texmf-dist/tex/generic/pst-poly/pst-poly.tex +++ b/Master/texmf-dist/tex/generic/pst-poly/pst-poly.tex @@ -1,32 +1,14 @@ +%% $Id: pst-poly.tex 187 2009-12-20 12:44:24Z herbert $ %% %% This is file `pst-poly.tex', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% pst-poly.dtx (with options: `pst-poly') %% %% IMPORTANT NOTICE: %% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from pst-poly.tex. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file pst-poly.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% -%% Package `pst-poly.dtx' -%% +%% (C) %% Denis Girou (CNRS/IDRIS - France) -%% Herbert Voss +%% Herbert Voss %% -%% Novermber 20, 2004 +%% december 20, 2009 %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -36,209 +18,193 @@ %% `pst-poly' is a PSTricks package to draw easily various kinds of regular %% or non regular polygons, with various customizations. %% -\def\fileversion{1.60} -\def\filedate{2004/11/20} -\message{`PST-Polygon' v\fileversion, \filedate\space (DG/hv)} +% \csname PSTPolygonLoaded\endcsname \let\PSTPolygonLoaded\endinput \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi \ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi -\ifx\MultidoLoaded\endinput\else\input multido.tex\fi -\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi +\ifx\MultidoLoaded\endinput\else \input multido.tex\fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +% +\def\fileversion{1.61} +\def\filedate{2009/12/20} +\message{`PST-Polygon' v\fileversion, \filedate\space (DG/hv)} +% \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax \pst@addfams{pst-poly} -\newif\ifPst@PstPicture -\define@key[psset]{pst-poly}{PstPicture}[true]{\@nameuse{Pst@PstPicture#1}} -\define@key[psset]{pst-poly}{PolyRotation}{\edef\PstPoly@Rotation{#1}} -\define@key[psset]{pst-poly}{PolyNbSides}{\pst@getint{#1}{\PstPoly@NbSides}} -\define@key[psset]{pst-poly}{PolyOffset}{\pst@getint{#1}{\PstPoly@Offset}} +\define@boolkey[psset]{pst-poly}[Pst@]{PstPicture}[true]{} +\define@key[psset]{pst-poly}{PolyRotation}[0]{\def\PstPoly@Rotation{#1}} +\define@key[psset]{pst-poly}{PolyNbSides}[5]{\pst@getint{#1}{\PstPoly@NbSides}% + \ifnum\PstPoly@NbSides<3 + \@pstrickserr{PolyNbSides must be greater than 2 + (and not `\PstPoly@NbSides')}{\@eha}% + \fi% + \ifnum\PstPoly@NbSides>200 + \@pstrickserr{PolyNbSides must be less than 201 + (and not `\PstPoly@NbSides')}{\@eha}% + \fi} +\define@key[psset]{pst-poly}{PolyOffset}[1]{\pst@getint{#1}{\PstPoly@Offset}% + \ifnum\PstPoly@Offset<1 + \@pstrickserr{PolyOffset must be greater than 0 + (and not `\PstPoly@Offset')}{\@eha}% + \fi} \newdimen\PstPoly@IntermediatePointDim -\define@key[psset]{pst-poly}{PolyIntermediatePoint}{\edef\PstPoly@IntermediatePoint{#1}} -\define@key[psset]{pst-poly}{PolyName}{\edef\PstPoly@Name{#1}} -\newif\ifPstPoly@Curves -\define@key[psset]{pst-poly}{PolyCurves}[true]{\@nameuse{PstPoly@Curves#1}} -\newif\ifPstPoly@Epicycloid -\define@key[psset]{pst-poly}{PolyEpicycloid}[true]{\@nameuse{PstPoly@Epicycloid#1}} +\define@key[psset]{pst-poly}{PolyIntermediatePoint}[]{\def\PstPoly@IntermediatePoint{#1}} +\define@key[psset]{pst-poly}{PolyName}[]{\def\PstPoly@Name{#1}} +\define@boolkey[psset]{pst-poly}[Pst@]{PolyCurves}[true]{} +\define@boolkey[psset]{pst-poly}[Pst@]{PolyEpicycloid}[true]{} \psset{% PstPicture=true,PolyRotation=0,PolyNbSides=5,PolyOffset=1, PolyIntermediatePoint=,PolyName=,PolyCurves=false,PolyEpicycloid=false} -\def\PstPolygon{\pst@ifstar{\@ifnextchar[{\PstPolygon@i}{\PstPolygon@i[]}}} -\def\PstPolygon@i[#1]{{% -\psset{#1}% -\if@star\solid@star\fi -\ifnum\PstPoly@NbSides<3 - \@pstrickserr{PolyNbSides must be greater than 2 - (and not `\PstPoly@NbSides')}{\@eha}% -\fi -\ifnum\PstPoly@NbSides>200 - \@pstrickserr{PolyNbSides must be less than 201 - (and not `\PstPoly@NbSides')}{\@eha}% -\fi -\ifnum\PstPoly@Offset<1 - \@pstrickserr{PolyOffset must be greater than 0 - (and not `\PstPoly@Offset')}{\@eha}% -\fi -\ifodd\PstPoly@Offset - \def\PstPoly@Decimal{.5}% -\else - \def\PstPoly@Decimal{}% -\fi +% \SpecialCoor -\ifPst@PstPicture\pspicture(-1,-1)(1,1)\fi -\rput{\PstPoly@Rotation}(0,0){% - \degrees[\PstPoly@NbSides] - \pssetlength{\PstPoly@IntermediatePointDim}{\PstPoly@IntermediatePoint} - \ifx\PstPoly@Name\@empty - \else - \pnode(0,0){\PstPoly@Name 0} - \ifnum\psxunit=\psyunit - \def\PstPoly@Node{\pnode(1;\i)}% - \else - \def\PstPoly@Node{% - \pnode(! \i\space 360 \PstPoly@NbSides\space div mul cos - \i\space 360 \PstPoly@NbSides\space div mul sin)}% - \fi - \multido{\i=0+1}{\PstPoly@NbSides}{% - \PstPoly@Node{\PstPoly@Name\the\multidocount}} - \fi - \pscustom{% - \ifPstPoly@Epicycloid - \pst@cnta=\PstPoly@NbSides - \divide\pst@cnta\tw@ - \multido{\i=0+1}{\PstPoly@NbSides}{% - \moveto(1;\i) - \lineto(1;\the\pst@cnta) - \advance\pst@cnta\PstPoly@Offset} +% +\def\PstPolygon{\pst@object{PstPolygon}} +\def\PstPolygon@i{{% + \use@par% + \if@star\solid@star\fi + \ifodd\PstPoly@Offset\def\PstPoly@Decimal{.5}\else\def\PstPoly@Decimal{}\fi + \ifPst@PstPicture\pspicture(-1,-1)(1,1)\fi + \rput{\PstPoly@Rotation}(0,0){% + \degrees[\PstPoly@NbSides] + \NormalCoor + \pssetlength{\PstPoly@IntermediatePointDim}{\PstPoly@IntermediatePoint} + \SpecialCoor + \ifx\PstPoly@Name\@empty \else + \pnode(0,0){\PstPoly@Name 0} \ifnum\psxunit=\psyunit - \moveto(1,0) + \def\PstPoly@Node{\pnode(1;\i)}% \else - \moveto(! 1 0) + \def\PstPoly@Node{% + \pnode(! \i\space 360 \PstPoly@NbSides\space div mul cos + \i\space 360 \PstPoly@NbSides\space div mul sin)}% \fi - \ifx\PstPoly@IntermediatePoint\@empty - \ifnum\psxunit=\psyunit - \def\PstPoly@Junction{\lineto(1;\i)}% - \else - \def\PstPoly@Junction{\lineto% - (! \i\space 360 \PstPoly@NbSides\space div mul cos - \i\space 360 \PstPoly@NbSides\space div mul sin)}% - \fi - \multido{\i=\PstPoly@Offset+\PstPoly@Offset}{\PstPoly@NbSides}{% - \PstPoly@Junction} + \multido{\i=0+1}{\PstPoly@NbSides}{% + \PstPoly@Node{\PstPoly@Name\the\multidocount}} + \fi + \pscustom{% + \ifPst@PolyEpicycloid + \pst@cnta=\PstPoly@NbSides + \divide\pst@cnta\tw@ + \multido{\i=0+1}{\PstPoly@NbSides}{% + \moveto(1;\i) + \lineto(1;\the\pst@cnta) + \advance\pst@cnta\PstPoly@Offset} \else - \ifPstPoly@Curves - \let\PstPoly@JunctionType\pscurve - \else - \let\PstPoly@JunctionType\psline - \fi - \ifnum\psxunit=\psyunit - \def\PstPoly@Junction{\PstPoly@JunctionType% - (\PstPoly@IntermediatePointDim;\the\pst@cnta\PstPoly@Decimal) - (1;\i)}% + \ifnum\psxunit=\psyunit \moveto(1,0)\else\moveto(! 1 0)\fi + \ifx\PstPoly@IntermediatePoint\@empty + \ifnum\psxunit=\psyunit + \def\PstPoly@Junction{\lineto(1;\i)}% + \else + \def\PstPoly@Junction{\lineto% + (! \i\space 360 \PstPoly@NbSides\space div mul cos + \i\space 360 \PstPoly@NbSides\space div mul sin)}% + \fi + \multido{\i=\PstPoly@Offset+\PstPoly@Offset}{\PstPoly@NbSides}{\PstPoly@Junction} \else - \def\PstPoly@Junction{\PstPoly@JunctionType% - (! \PstPoly@IntermediatePoint\space - \the\pst@cnta\PstPoly@Decimal\space 360 + \ifPst@PolyCurves\let\PstPoly@JunctionType\pscurve\else\let\PstPoly@JunctionType\psline\fi + \ifnum\psxunit=\psyunit + \def\PstPoly@Junction{\PstPoly@JunctionType% + (\PstPoly@IntermediatePointDim;\the\pst@cnta\PstPoly@Decimal)(1;\i)}% + \else + \def\PstPoly@Junction{\PstPoly@JunctionType% + (! \PstPoly@IntermediatePoint\space \the\pst@cnta\PstPoly@Decimal\space 360 \PstPoly@NbSides\space div mul cos mul - \PstPoly@IntermediatePoint\space - \the\pst@cnta\PstPoly@Decimal\space 360 + \PstPoly@IntermediatePoint\space \the\pst@cnta\PstPoly@Decimal\space 360 \PstPoly@NbSides\space div mul sin mul) - (! \i\space 360 \PstPoly@NbSides\space div mul cos - \i\space 360 \PstPoly@NbSides\space div mul sin)}% + (! \i\space 360 \PstPoly@NbSides\space div mul cos \i\space 360 \PstPoly@NbSides\space div mul sin)}% + \fi + \pst@cnta=\PstPoly@Offset + \divide\pst@cnta\tw@ + \multido{\i=\PstPoly@Offset+\PstPoly@Offset}{\PstPoly@NbSides}{% + \PstPoly@Junction + \advance\pst@cnta\PstPoly@Offset} \fi - \pst@cnta=\PstPoly@Offset - \divide\pst@cnta\tw@ - \multido{\i=\PstPoly@Offset+\PstPoly@Offset}{\PstPoly@NbSides}{% - \PstPoly@Junction - \advance\pst@cnta\PstPoly@Offset} - \fi - \fi} - \ifx\PstPolygonNode\@undefined - \else - \multido{\INode=\z@+\PstPoly@Offset}{\PstPoly@NbSides}{% - \PstPolygonNode} - \fi} -\ifPst@PstPicture - \endpspicture -\fi}} -\def\PstTriangle{% -\pst@ifstar{\@ifnextchar[{\PstTriangle@i}{\PstTriangle@i[]}}} -\def\PstTriangle@i[#1]{{% -\psset{PolyNbSides=3,PolyRotation=90}% For triangle (360/3*(3/4)) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstSquare{% -\pst@ifstar{\@ifnextchar[{\PstSquare@i}{\PstSquare@i[]}}} -\def\PstSquare@i[#1]{{% -\psset{PolyNbSides=4,PolyRotation=45}% For square (360/4/2) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstPentagon{% -\pst@ifstar{\@ifnextchar[{\PstPentagon@i}{\PstPentagon@i[]}}} -\def\PstPentagon@i[#1]{{% -\psset{PolyNbSides=5,PolyRotation=18}% For pentagon (360/5/4) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstHexagon{% -\pst@ifstar{\@ifnextchar[{\PstHexagon@i}{\PstHexagon@i[]}}} -\def\PstHexagon@i[#1]{{% -\psset{PolyNbSides=6}% -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstHeptagon{% -\pst@ifstar{\@ifnextchar[{\PstHeptagon@i}{\PstHeptagon@i[]}}} -\def\PstHeptagon@i[#1]{{% -\psset{PolyNbSides=7,PolyRotation=38.57}% For heptagon (360/7*(3/4)) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstOctogon{% -\pst@ifstar{\@ifnextchar[{\PstOctogon@i}{\PstOctogon@i[]}}} -\def\PstOctogon@i[#1]{{% -\psset{PolyNbSides=8,PolyRotation=22.5}% For octogon (360/8/2) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstNonagon{% -\pst@ifstar{\@ifnextchar[{\PstNonagon@i}{\PstNonagon@i[]}}} -\def\PstNonagon@i[#1]{{% -\psset{PolyNbSides=9,PolyRotation=10}% For nonagon (360/9/4) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstDecagon{% -\pst@ifstar{\@ifnextchar[{\PstDecagon@i}{\PstDecagon@i[]}}} -\def\PstDecagon@i[#1]{{% -\psset{PolyNbSides=10}% -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstDodecagon{% -\pst@ifstar{\@ifnextchar[{\PstDodecagon@i}{\PstDodecagon@i[]}}} -\def\PstDodecagon@i[#1]{{% -\psset{PolyNbSides=12,PolyRotation=15}% For dodecagon (360/12/2) -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstStarFiveLines{% -\pst@ifstar{\@ifnextchar[{\PstStarFiveLines@i}{\PstStarFiveLines@i[]}}} -\def\PstStarFiveLines@i[#1]{{% -\psset{PolyOffset=2,PolyRotation=18}% -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} -\def\PstStarFive{% -\pst@ifstar{\@ifnextchar[{\PstStarFive@i}{\PstStarFive@i[]}}} -\def\PstStarFive@i[#1]{{% -\psset{PolyIntermediatePoint=0.38,PolyRotation=18}% -\psset{#1}% -\if@star\solid@star\fi -\PstPolygon}} + \fi} + \ifx\PstPolygonNode\@undefined + \else\multido{\INode=\z@+\PstPoly@Offset}{\PstPoly@NbSides}{\PstPolygonNode}\fi} + \ifPst@PstPicture\endpspicture\fi% +}} +% +\def\PstTriangle{\pst@object{PstTriangle}} +\def\PstTriangle@i{{% + \addto@par{PolyNbSides=3,PolyRotation=90}% For triangle (360/3*(3/4)) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstSquare{\pst@object{PstSquare}} + \def\PstSquare@i{{% + \addto@par{PolyNbSides=4,PolyRotation=45}% For square (360/4/2) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstPentagon{\pst@object{PstPentagon}} + \def\PstPentagon@i{{% + \addto@par{PolyNbSides=5,PolyRotation=18}% For pentagon (360/5/4) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstHexagon{\pst@object{PstHexagon}} +\def\PstHexagon@i{{% + \addto@par{PolyNbSides=6}% + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstHeptagon{\pst@object{PstHeptagon}} +\def\PstHeptagon@i{{% + \addto@par{PolyNbSides=7,PolyRotation=38.57}% For heptagon (360/7*(3/4)) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstOctogon{\pst@object{PstOctogon}} +\def\PstOctogon@i{{% + \addto@par{PolyNbSides=8,PolyRotation=22.5}% For octogon (360/8/2) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstNonagon{\pst@object{PstNonagon}} +\def\PstNonagon@i{{% + \addto@par{PolyNbSides=9,PolyRotation=10}% For nonagon (360/9/4) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstDecagon{\pst@object{PstDecagon}} +\def\PstDecagon@i{{% + \addto@par{PolyNbSides=10}% + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstDodecagon{\pst@object{PstDodecagon}} +\def\PstDodecagon@i{{% + \addto@par{PolyNbSides=12,PolyRotation=15}% For dodecagon (360/12/2) + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstStarFiveLines{\pst@object{PstStarFiveLines}} +\def\PstStarFiveLines@i{{% + \addto@par{PolyOffset=2,PolyRotation=18}% + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% +\def\PstStarFive{\pst@object{PstStarFive}} +\def\PstStarFive@i{{% + \addto@par{PolyIntermediatePoint=0.38,PolyRotation=18}% + \use@par% + \if@star\solid@star\fi + \PstPolygon}} +% \newdimen\pst@dimm \newdimen\pst@dimn \newdimen\pst@dimo @@ -247,6 +213,7 @@ \def\pspolygonbox@i{\pst@makebox\pspolygonbox@ii} \def\pspolygonbox@ii{{% \begingroup% + \addbefore@par{boxsep=true}% \pst@useboxpar% \pst@dima=\pslinewidth% \ifpsdoubleline% @@ -263,21 +230,21 @@ \setbox\pst@hbox=\hbox{% \ifpsboxsep\kern\pst@dima\fi% left side \begin@ClosedObj% - \addto@pscode{% + \addto@pscode{ /framesep \pst@number\pst@dima def - /boxdepth \pst@number\pst@dimb framesep add def + /boxdepth \pst@number\pst@dimb framesep add def /boxheight0 \pst@number\pst@dimd def /boxheight boxheight0 framesep add def /boxwidth \pst@number\pst@dimc def /radius \pst@number\pst@dimm def /order \PstPoly@NbSides\space def /dAlpha 360 order div def - /alpha \PstPoly@Rotation\space def + /alpha \PstPoly@Rotation\space def \pst@cp - \tx@polygonB - \psline@iii + \tx@polygonB + \psline@iii %% \tx@Line - \tx@Polygon + \tx@Polygon }% \def\pst@linetype{1}% \showpointsfalse% @@ -296,6 +263,7 @@ \box\pst@hbox% \endgroup% }\ignorespaces} +% \pst@def{polygonB}<{% /x1 framesep neg def /x2 boxwidth framesep add def @@ -310,6 +278,7 @@ radius alpha sin mul } repeat }> +% \catcode`\@=\PstAtCode\relax \endinput %% -- cgit v1.2.3