diff options
Diffstat (limited to 'graphics/pstricks/contrib/pst-poly')
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/Changes | 13 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/README | 9 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.bib | 109 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.pdf | bin | 0 -> 181079 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.tex | 621 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/latex/pst-poly.sty | 8 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-poly/tex/pst-poly.tex | 287 |
7 files changed, 1047 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-poly/Changes b/graphics/pstricks/contrib/pst-poly/Changes new file mode 100644 index 0000000000..bf12aa0712 --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/Changes @@ -0,0 +1,13 @@ +1.63 2014/08/28 - bugfix for trailing spaces in \PstPolygon +1.62 2010/05/28 - use the dimens from the base packgage pstricks +1.61 2009/12/20 - use \NormalCoor for IntemediatePoint setting + - allow \SpecialCoor for a length + - updated documentation +1.60 2004/11/20 new macro \pspolygonbox, using pst-xkey (hv) +1.50 2001/02/08 Standard packaging (.ins + .dtx files). +1.40 1998/07/09 Define `PolyRotation' parameter as a real number + and not as an angle, to allow to use the macro + degrees' before to draw a polygon. +1.30 1998/02/06 Rename `PsPicture' parameter to `PstPicture' for + consistancy. +1.20 1997/06/27 First public release. diff --git a/graphics/pstricks/contrib/pst-poly/README b/graphics/pstricks/contrib/pst-poly/README new file mode 100644 index 0000000000..d4eccbee64 --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/README @@ -0,0 +1,9 @@ +Save the files pst-poly.sty|tex in a directory, +which is part of your local TeX tree. +Then do not forget to run texhash to update this tree. + +For more information see the documentation of your LaTeX distribution +on installing packages into your local TeX system or read the +TeX Frequently Asked Questions: +(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages). + diff --git a/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.bib b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.bib new file mode 100644 index 0000000000..f7d1f9a8d5 --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.bib @@ -0,0 +1,109 @@ +yy%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Dennis Roegel and Herbert Vo\ss}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = {second}, + year = {2007}, + address = {Boston, Mass.} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy Van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {{Timothy Van} Zandt}, + Organization = {}, + Address = {\url{CTAN:/macros/generic/multido.tex}}, + Note = {}, + year = 1997 +} + +@Book{PSTricks2, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {6.}, + publisher = {DANTE -- Lehmanns}, + year = {2010}, + address = {Heidelberg/Hamburg} +} + +@Book{PSTricksE, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}raphics and {P}ost{S}cript for \LaTeX}, + edition = {1.}, + publisher = {UIT}, + year = {2011}, + address = {Cambridge -- UK} +} + +@Book{LTXquick, + author = {Herbert Vo\ss{}}, + title = {{\LaTeX} quick reference}, + edition = {1.}, + publisher = {UIT}, + year = {2012}, + address = {Cambridge -- UK} +} + +@Book{presentations, + author = {Herbert Vo\ss}, + title = {Presentations with \LaTeX}, + edition = {1.}, + publisher = {DANTE -- Lehmanns Media}, + year = {2012}, + address = {Heidelberg/Berlin} +} + + +@Book{tbt, + author = {Victor Eijkhout}, + title = {\TeX\ by Topic -- {A} \TeX{}nician Reference}, + edition = {1}, + publisher = {DANTE -- lehmanns media}, + year = {2014}, + address = {Heidelberg/Berlin} +} + diff --git a/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.pdf b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.pdf Binary files differnew file mode 100644 index 0000000000..1419f8cb5b --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.pdf diff --git a/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.tex b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.tex new file mode 100644 index 0000000000..7c27442c6d --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/doc/pst-poly-doc.tex @@ -0,0 +1,621 @@ +\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings + headexclude,footexclude,oneside]{pst-doc} +\usepackage[utf8]{inputenc} +\usepackage{pst-poly} +\let\pstDocFV\fileversion + +\def\bgImage{\PstPolygon[unit=3,linecolor=red,PolyOffset=2,linewidth=0.001, + PolyNbSides=72,PolyEpicycloid]} + +\lstset{explpreset={pos=t,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}} +\begin{document} + +\title{\texttt{pst-poly}} +\subtitle{A PSTricks package for drawing polygons; v.\pstDocFV} +\author{Denis Girou\\Herbert Vo\ss} +%\docauthor{Herbert Vo\ss} +\date{\today} +\maketitle + +\tableofcontents + +\clearpage + +\begin{abstract} +\noindent +\LPack{pst-poly} allows to draw easily various kinds of regular or non regular +polygons, using the unique macro \Lcs{PstPolygon}, with various customization +parameters. +It is also a good example of the great power and flexibility of PSTricks, +as in fact it is a very short program (it body is only 100 lines long) but +nevertheless really powerful. + And last, it is also a good pedagogical example of how to design and +program high level graphic objects above PSTricks own ones. +\end{abstract} + +\clearpage + +\section{Introduction} +% +\LPack{pst-poly} offers a unique macro (plus some aliases to define +some often used polygons) with few parameters to interact on it. But we can +also use all the relevant PSTricks parameters to change the size, the +characteristics of lines, to add filling, etc. +The polygons are always drawn counter clockwise. +% +The syntax is simply: +\begin{BDef} +\LcsStar{PstPolygon}\OptArgs\\ +\Lcs{PstTriangle}\OptArgs\\ +\Lcs{PstSquare}\OptArgs\\ +\Lcs{PstPentagon}\OptArgs\\ +\Lcs{PstHexagon}\OptArgs\\ +\Lcs{PstHeptagon}\OptArgs\\ +\Lcs{PstOctogon}\OptArgs\\ +\Lcs{PstNonagon}\OptArgs\\ +\Lcs{PstDecagon}\OptArgs\\ +\Lcs{PstDodecagon}\OptArgs\\% +\Lcs{PstStarFiveLines}\OptArgs\\ +\Lcs{PstStarFive}\OptArgs\\ +\Lcs{pspolygonbox}\OptArgs\Largb{Text}\\ +\end{BDef} + +As for PSTricks closed objects, the \texttt{*} version uses a solid style +to fill the polygon, use the line color for fill color and set the linewidth +to 0. + +By default the polygons are set with a radius of 1 unit for the outer circle. + +\bigskip +\begin{LTXexample}[pos=l,width=0.3\linewidth] +\begin{pspicture}[showgrid=true](-1,-1)(1,1) + \PstPolygon[PstPicture=false] + \pscircle[linestyle=dashed]{1} +\end{pspicture} +\end{LTXexample} + +There is no special optional argument for this radius, the polygon can +be scaled by using the key \Lkeyword{unit}. With \Lkeyword{unit}=1.5, the outer +radius will be of 1.5cm when the current unit is set to 1cm. + + +\section{Optional arguments} +% +There are eight specific optional arguments defined to change the way the +polygons are defined: + +\begin{compactdesc} + \item [\Lkeyword{PstPicture}] (boolean): to define or not a \Lenv{pspicture} + environment for the polygon. We have to define this parameter to + \false\ if we want to mix the polygon with other PSTricks objects + --- see examples later + (\emph{Default:~\true} --- which is not the case for basic PSTricks + objects). With \Lkeyset{PstPicture=false} the image doesn't reserve + any space, it overwrites the text. The resulting box has a width and a height of 0pt. + +\bigskip +\begin{LTXexample}[pos=t] + foo\PstPolygon bar\hfill foo\PstPolygon[PstPicture=false] bar +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyRotation}] (real): rotation angle applied to the polygon + (\emph{Default:~0} --- no rotation). + +\bigskip +\begin{LTXexample}[pos=t] + \PstPolygon\hfill + \PstPolygon[PolyRotation=18]\hfill + \PstPolygon[PolyRotation=36]\hfill + \PstPolygon[PolyRotation=45] +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyNbSides}] (integer): number of sides of the polygon + (\emph{Default:~5}). + +\bigskip +\begin{LTXexample}[pos=t] + \PstPolygon\hfill + \PstPolygon[PolyNbSides=3]\hfill + \PstPolygon[PolyNbSides=4]\hfill + \PstPolygon[PolyNbSides=5]\hfill + \PstPolygon[PolyNbSides=8]\hfill + \PstPolygon[PolyNbSides=50] +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyOffset}] (integer): number of nodes to bypass to obtain each + time the next one (\emph{Default:~1} --- no node bypassed). + +\bigskip +\begin{LTXexample}[pos=t] + \PstPolygon + \PstPolygon[PolyOffset=2] + \PstPolygon[PolyOffset=3] + \PstPolygon[PolyNbSides=7,PolyOffset=2] + \PstPolygon[PolyNbSides=9,PolyOffset=4] + \PstPolygon[PolyNbSides=17,PolyOffset=6] +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyIntermediatePoint}] (real): position of the intermediate point + used to join each time the next node (\emph{Default:~empty} --- not used). + +\bigskip +\begin{LTXexample}[pos=t] + \PstPolygon + \PstPolygon[PolyIntermediatePoint=0.38] + \PstPolygon[PolyIntermediatePoint=0.2] + \PstPolygon[PolyIntermediatePoint=1.2] + \PstPolygon[PolyNbSides=7,PolyOffset=2, + PolyIntermediatePoint=0.38] + \PstPolygon[PolyNbSides=21,PolyOffset=2, + PolyIntermediatePoint=-1.25] +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyCurves}] (boolean): boolean value to choose between straight + line and curve to join each time the next node (\emph{Default:~\false} --- straight lines). + +\bigskip +\begin{LTXexample}[pos=t] + \psset{PolyCurves=true} + \PstPolygon[PolyNbSides=7,PolyIntermediatePoint=0.38]\hfill + \PstPolygon[PolyNbSides=11,PolyIntermediatePoint=0.6]\hfill + \PstPolygon[PolyNbSides=7,PolyIntermediatePoint=0.2, + PolyOffset=2]\hfill + \PstPolygon[PolyNbSides=9,PolyIntermediatePoint=0.1]\hfill + \PstPolygon[PolyNbSides=15,PolyIntermediatePoint=1.2] +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyEpicycloid}] (boolean): boolean value to choose between + polygon and epicycloid (\emph{Default:~\false} --- polygon). + +\bigskip +\begin{LTXexample}[pos=t] + \psset{linewidth=0.001,PolyNbSides=72,PolyEpicycloid=true} +% Epicycloid of factor 1 is cardioid and of factor 2 nephroid + \multido{\i=2+1}{4}{\PstPolygon[PolyOffset=\i]\hfill} + \PstPolygon[PolyOffset=72]\hfill% Epicycloid of factor 71 + \PstPolygon[PolyOffset=73] % Epicycloid of factor 72 +\end{LTXexample} + +\bigskip + \item [\Lkeyword{PolyName}] (string): name of the polygon, useful to have different + names for the nodes of different polygons (\emph{Default:~empty} --- no name). + + The center of the polygon has name \texttt{PolyName0} and the nodes +(vertices) have names \texttt{PolyName1} to \texttt{PolyNameN}. + With this parameter, we can connect as we want nodes of different polygons: + +\bigskip +\begin{LTXexample}[pos=l,width=0.3\linewidth,pos=l] + \psset{PstPicture=false} + \begin{pspicture}(-1,-1)(1,1) + \PstPolygon[unit=0.8,PolyName=A,PolyNbSides=6] + \PstPolygon[unit=1.2,PolyName=B,PolyNbSides=12] + \end{pspicture} + \multido{\i=1+2}{6}{% + \ncline{A\the\multidocount}{B\i}} +\end{LTXexample} + +It is also a way (limited in fact...) to define three dimensional objects in perspective: + +\bigskip +\begin{LTXexample}[pos=l,width=0.3\linewidth,pos=l] +\psset{unit=0.8} +\begin{pspicture}(3,2.5) +% \PstSquare is described later + \rput[lb](0,0){\PstSquare[PolyName=A]} + \rput[lb](2.5,2){\PstSquare[unit=0.5,PolyName=B]} + \multido{\i=1+1}{4}{\ncline{A\i}{B\i}} + \end{pspicture} +\end{LTXexample} + +\end{compactdesc} + +\bigskip + Of course, we can mix specific parameters of \LPack{pst-poly} with +relevant PSTricks ones and combine it with other generic macros +(for repetitions, projection in the 3d space, etc.) + + +\begin{LTXexample}[pos=t] + \PstPolygon[unit=1.5] + \PstPolygon[linewidth=1mm] + \PstPolygon[fillstyle=crosshatch,PolyNbSides=6] + \PstPolygon[linecolor=red,fillstyle=solid,fillcolor=yellow, + PolyRotation=18,PolyOffset=2] + \PstPolygon*[linecolor=cyan,PolyNbSides=7,PolyOffset=2] +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+2}{6}{% + \PstPolygon[PolyNbSides=\i,PolyCurves=true, + PolyIntermediatePoint=0.1,PolyOffset=3]} +\end{LTXexample} + + +\section{Pre-defined polygons} +% + Some often used polygons and other related geometric objects are +pre-defined, for immediate usage : + +\begin{LTXexample}[pos=t] + \PstTriangle + \PstSquare + \PstPentagon[unit=0.5,linestyle=dotted] + \PstHexagon[fillstyle=hlines,hatchangle=90] + \PstHeptagon[fillstyle=vlines] + \PstOctogon*[unit=0.8,linecolor=red] + \PstNonagon[unit=0.5] + \PstDecagon + \PstDodecagon[linecolor=green] \par + \PstStarFiveLines + \PstStarFive +\end{LTXexample} + + +\section{Non regular polygons} + +Until now, we have described only the so-called \emph{regular} polygons, +which are from far the most useful ones (all of them have equal edges and +angles). Nevertheless, it is not so difficult to extend these polygon to +\emph{non regular} ones, using a different value for horizontal and vertical +units (nevertheless, the code is more tricky, as we must do all the +trigonometry explicitely...) +% +\begin{LTXexample}[pos=t] + \PstPentagon[xunit=0.5]\hfill + \PstHexagon[yunit=0.5]\hfill + \PstStarFive[xunit=0.5,yunit=1.5]\hfill + \PstPolygon[xunit=0.8,yunit=1.5,PolyNbSides=9,PolyOffset=2, + PolyIntermediatePoint=0.1,PolyCurves=true] +\end{LTXexample} +% +\section{Nodes (vertices)} +% +And another powerful possibility is to define a command +\Lcs{PstPolygonNode} which will be excuted at each node (\emph{Default:~empty} --- nothing executed). +The counter name for nodes is \Lctr{INode}, starting from 0. The \Lcs{multidocount} counter, from the +\Lcs{multido} command, start itself from 1. + +\begin{LTXexample}[width=0.3\linewidth,pos=l] + \providecommand{\PstPolygonNode}{% + \psdots[dotsize=0.2,linecolor=cyan](1;\INode)} + \PstPentagon +\end{LTXexample} +% +\begin{LTXexample}[width=0.3\linewidth,pos=l] + \newcounter{Letter} + \providecommand{\PstPolygonNode}{% + \setcounter{Letter}{\the\multidocount}% + \rput*{*0}(1;\INode){\small\Alph{Letter}}} + \PstHeptagon[PolyOffset=3] +\end{LTXexample} +% +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \psdots[dotstyle=o,dotsize=0.2](1;\INode) + \psline[linecolor=red]{->}(0.9;\INode)} + \PstPolygon[PolyNbSides=8] +\end{LTXexample} +% +\vspace{3mm} + It is also a way to nest polygons: +\vspace{3mm} +% +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \newbox{\Star} + \savebox{\Star}{% + \PstStarFive*[unit=0.15,linecolor=red]} + \providecommand{\PstPolygonNode}{% + \rput{*0}(1;\INode){\usebox{\Star}}} + \shortstack{\PstNonagon\\[5mm] + \PstDodecagon[linestyle=none]} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \psset{unit=2,PstPicture=false} + \begin{pspicture}(-1.6,-1.6)(1.6,1.6) +% Just to name the nodes, to be able to join some of them. +% by solid curves. We can't draw the polygons now, +% as the node numbers must erase the solid curves... + \PstHexagon[unit=0.8,linestyle=none,PolyName=H]\PstDodecagon[unit=1.2,linestyle=none,PolyName=D] + {\SpecialCoor + \psset{linewidth=0.4pt,border=2pt,nodesep=0.45} + \psccurve(H1)(H4)(D8)([angle=-30]D9)(D11)\psccurve(D3)(H3)(H6)(D12)([angle=90]D1) + \psccurve(D4)(H2)(H5)(D7)([angle=90]D6)} + \psset{linestyle=dotted,framesep=1pt} + \PstTriangle[unit=0.23] + \providecommand{\PstPolygonNode}{\rput*{*0}(1;\INode){\small\the\multidocount}} + \PstHexagon[unit=0.8] \PstDodecagon[unit=1.2] \PstDodecagon[unit=1.6] + \end{pspicture} +\end{LTXexample} +% +\section{Polygonbox} + +The valid options with the predefined values are \Lkeyword{PolyNbSides}=3 and \Lkeyword{PolyRotation}=0 + +\begin{compactitem} +\item There maybe some problems with linearcs and rounding errors. +\item To rotate the text inside the box, one can use the \Lcs{rotatebox} macro from + the \LPack{rotating} package (see examples). +\end{compactitem} + +\begin{LTXexample}[pos=t] + \multido{\nA=3+1}{8}{% + \pspolygonbox[PolyNbSides=\nA,framesep=3mm]{Text}~} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\nA=3+1}{8}{\pspolygonbox[PolyNbSides=\nA,% + framesep=2mm,doubleline=true]{Text}~} +\end{LTXexample} + + +\begin{LTXexample}[pos=t] + \psset{PolyNbSides=4} + \multido{\nA=0+60}{8}{\pspolygonbox[PolyRotation=\nA,% + framesep=2mm,doubleline=true,% + linecolor=red,doublecolor=blue]{\magenta Text}~} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\nA=0+60,\nB=45+60}{8}{\pspolygonbox% + [PolyRotation=\nA,framesep=2mm,doubleline=true,% + linecolor=red,doublecolor=blue,linearc=0.4]% + {\rotatebox{\nB}{\blue Text}}~}\\[1cm] +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\nA=3+1}{8}{% + \pspolygonbox[PolyNbSides=\nA,rot=60,framesep=2pt,% + doubleline=true,linearc=0.2]{Text}~} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\nA=3+1}{8}{% + \pspolygonbox[PolyNbSides=\nA,framesep=10pt,% + fillstyle=solid,fillcolor=cyan,linearc=0.2]{Text}~} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\nA=-5+5}{8}{\pspolygonbox[framesep=\nA pt,% + PolyRotation=90]{\Huge\red T}~} +\end{LTXexample} + +\vspace{1cm} +\begin{LTXexample}[pos=t] + \multido{\nA=-5+5}{7}{\pspolygonbox[framesep=\nA pt,% + PolyRotation=90,boxsep=false]{\Huge\red T}~}\par + \rule{0pt}{1cm} +\end{LTXexample} + +\section{Some more examples} + +\begin{LTXexample}[pos=t] + \multido{\i=3+1}{6}{% + \PstPolygon[PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=3+2}{6}{% + \PstPolygon[PolyOffset=2,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=3+1}{10}{% + \PstPolygon[PolyOffset=3,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+1}{10}{% + \PstPolygon[PolyOffset=4,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+2}{10}{% + \PstPolygon[PolyOffset=5,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+2}{10}{% + \PstPolygon[PolyOffset=7,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+2}{10}{% + \PstPolygon[PolyOffset=8,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=1+1}{10}{% + \PstPolygon[PolyOffset=\i,PolyNbSides=5]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=1+1}{10}{% + \PstPolygon[PolyOffset=\i,PolyNbSides=7]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+1}{10}{% + \PstPolygon[PolyCurves,PolyIntermediatePoint=0.1,PolyNbSides=\i] + \hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+1}{10}{% + \PstPolygon[PolyCurves,PolyIntermediatePoint=0.2, + PolyOffset=2,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\i=5+2}{10}{% + \PstPolygon[PolyCurves,PolyIntermediatePoint=0.1, + PolyOffset=3,PolyNbSides=\i]\hspace{5mm}} +\end{LTXexample} + +% Second serie + +\begin{LTXexample}[pos=t] + \multido{\n=-1.4+0.5}{10}{% + \PstPolygon[PolyNbSides=3,PolyOffset=2,PolyIntermediatePoint=\n] + \hspace{5mm}}\par + \vspace{0pt}{2cm} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\n=-1.4+0.5}{6}{% + \PstPolygon[PolyNbSides=5,PolyOffset=2,PolyIntermediatePoint=\n] + \hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\n=-1.4+0.5}{6}{% + \PstPolygon[PolyNbSides=13,PolyOffset=2,PolyIntermediatePoint=\n] + \hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \multido{\n=-1.4+0.5}{6}{% + \PstPolygon[PolyNbSides=21,PolyOffset=2,PolyIntermediatePoint=\n] + \hspace{5mm}} +\end{LTXexample} + +% Third serie + +\begin{LTXexample}[pos=t] + \psset{unit=1.4,linewidth=0.001,PolyNbSides=72,PolyEpicycloid} + \multido{\i=2+1}{4}{% + % Epicycloid of factor 1 is cardioid and of factor 2 nephroid + \PstPolygon[PolyOffset=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + % Epicycloid of factor 10 + \PstPolygon[unit=2,linewidth=0.003, + PolyEpicycloid,PolyNbSides=72,PolyOffset=11] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + % Epicycloid of factor 22 + \PstPolygon[unit=2,linewidth=0.003, + PolyEpicycloid,PolyNbSides=72,PolyOffset=23] +\end{LTXexample} + +\begin{LTXexample}[pos=t] + \psset{unit=1.9,linewidth=0.001,PolyNbSides=72,PolyEpicycloid} + \multido{\i=71+1}{3}{% + \PstPolygon[PolyOffset=\i]\hspace{5mm}} +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + % Epicycloid of factor 100 + \PstPolygon[unit=2,linewidth=0.003, + PolyEpicycloid,PolyNbSides=72,PolyOffset=101] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + % Epicycloid of factor 153 + \PstPolygon[unit=2,linewidth=0.003, + PolyEpicycloid,PolyNbSides=72,PolyOffset=154] +\end{LTXexample} + +% Fourth serie + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \psdots[dotsize=0.2,linecolor=cyan](1;\INode)} + \PstPentagon[unit=2] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \rput{*0}(1.2;\INode){\small\the\multidocount}} + \PstPolygon[unit=2,PolyNbSides=7,PolyOffset=2] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \rput*{*0}(1;\INode){\small\the\multidocount}} + \PstHeptagon[unit=2,PolyOffset=2] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] +% \newcounter{Letter} + \providecommand{\PstPolygonNode}{% + \setcounter{Letter}{\the\multidocount}% + \rput*{*0}(1;\INode){\small\Alph{Letter}}} + \PstHeptagon[unit=2,PolyOffset=3] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \SpecialCoor + \degrees[3] + \rput{0.5}(0.5;\INode){% + \pspolygon*(0.5;0.5)(0.5;1.5)(0.5;2.5)}} + \PstTriangle +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \psdots[dotstyle=o,dotsize=0.2](1;\INode) + \psline[linecolor=red]{->}(0.9;\INode)} + \PstPolygon[unit=2,PolyNbSides=8] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \providecommand{\PstPolygonNode}{% + \psline[linewidth=0.1mm,doubleline=true, + linecolor=green]{<->}(0;0)(1;\INode)} + \PstHexagon[unit=2] +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=0.3\linewidth] + \newbox{\Star} + \savebox{\Star}{% + \PstStarFive*[unit=0.15,linecolor=red]} + \providecommand{\PstPolygonNode}{% + \rput{*0}(1;\INode){\usebox{\Star}}} + \shortstack{% + \PstNonagon\\[5mm] + \PstDodecagon[linestyle=none]} +\end{LTXexample} + +\begin{LTXexample}[pos=l,width=5cm] +%\newcounter{Letter}% if not defined +\setcounter{Letter}{\the\multidocount}% +\begin{pspicture}(-2.5,-2.5)(2.5,2.5) +\PstPolygon[PolyName=A,fillstyle=solid,fillcolor=lightgray,linewidth=2pt,PolyNbSides=5,unit=0.5,PstPicture=false] +\PstPolygon[PolyName=B,PolyNbSides=5,linewidth=2pt,PstPicture=false,unit=2.5] +\multido{\iA=1+1,\iB=2+1}{5}{% + \setcounter{Letter}{\the\multidocount}% + \ncline{A\iA}{B\iA}\ncput*{\bf\alph{Letter}}% + \ifnum\iB>5 \def\iB{1}\fi% + \pcline[linestyle=none](B\iA)(B\iB)\ncput*{\bf\iA}} +\end{pspicture} +\end{LTXexample} + +\clearpage +\section{List of all optional arguments for \texttt{pst-poly}} + +\xkvview{family=pst-poly,columns={key,type,default}} + + +\nocite{*} +\bgroup +\RaggedRight +\bibliographystyle{plain} +\bibliography{pst-poly-doc} +\egroup + +\printindex + +\end{document} + + diff --git a/graphics/pstricks/contrib/pst-poly/latex/pst-poly.sty b/graphics/pstricks/contrib/pst-poly/latex/pst-poly.sty new file mode 100644 index 0000000000..f6176fac98 --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/latex/pst-poly.sty @@ -0,0 +1,8 @@ +%% $Id: pst-poly.sty 187 2009-12-20 12:44:24Z herbert $ +\RequirePackage{pstricks} +\ProvidesPackage{pst-poly}[2009/12/20 package wrapper for pst-poly.tex (dg,hv)] +\input{pst-poly.tex} +\ProvidesFile{pst-poly.tex} + [\filedate\space v\fileversion\space `PST-poly' (dg,hv)] +\endinput + diff --git a/graphics/pstricks/contrib/pst-poly/tex/pst-poly.tex b/graphics/pstricks/contrib/pst-poly/tex/pst-poly.tex new file mode 100644 index 0000000000..ab5afcca65 --- /dev/null +++ b/graphics/pstricks/contrib/pst-poly/tex/pst-poly.tex @@ -0,0 +1,287 @@ +%% $Id: pst-poly.tex 332 2010-05-28 18:45:07Z herbert $ +%% +%% This is file `pst-poly.tex', +%% +%% IMPORTANT NOTICE: +%% +%% (C) +%% Denis Girou (CNRS/IDRIS - France) <Denis.Girou@idris.fr> +%% Herbert Voss <hvoss@tug.org> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-poly' is a PSTricks package to draw easily various kinds of regular +%% or non regular polygons, with various customizations. +%% +% +\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 +% +\def\fileversion{1.63} +\def\filedate{2014/08/28} +\message{`PST-Polygon' v\fileversion, \filedate\space (DG/hv)} +% +\edef\PstAtCode{\the\catcode`\@} +\catcode`\@=11\relax +\pst@addfams{pst-poly} +\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}[]{\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} +% +\SpecialCoor +% +\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 + \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{ + \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 + \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 + \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@NbSides\space div mul sin mul) + (! \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 + \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}} +% +% Aspecial version for pst-poly +\def\pst@polypyth#1#2#3{\ifdim#1>#2\pst@@polypyth#1#2#3\else\pst@@polypyth#2#1#3\fi} +\def\pst@@polypyth#1#2#3{% + \ifdim4#1>9#2 #3=#1\advance#3 .2122#2% + \else#3=.8384#1\advance#3 .5758#2\fi} +% +\def\pspolygonbox{\pst@object{pspolygonbox}}% voss 2004-11-20 +\def\pspolygonbox@i{\pst@makebox\pspolygonbox@ii} +\def\pspolygonbox@ii{% + \begingroup% + \addbefore@par{boxsep=true}% + \pst@useboxpar% + \pst@dima=\pslinewidth% + \ifpsdoubleline% + \advance\pst@dima by \psdoublesep\pslinewidth% + \advance\pst@dima by \pslinewidth% + \fi% + \advance\pst@dima by \psframesep% + \pst@dimc=\wd\pst@hbox% + \pst@dimp=\pst@dimc + \advance\pst@dimp by 2\pst@dima + \pst@dimb=\dp\pst@hbox + \pst@dimo=\pst@dimb% + \pst@dimd=\ht\pst@hbox + \advance\pst@dimo by \pst@dimd% totalheight + \pst@polypyth\pst@dimp\pst@dimo\pst@dimm + \global\divide\pst@dimm by 2% Radius + \setbox\pst@hbox=\hbox{% + \ifpsboxsep\kern\pst@dima\fi% left side + \begin@ClosedObj% + \addto@pscode{ + /framesep \pst@number\pst@dima 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 + \pst@cp + \tx@polygonB + \psline@iii + \tx@Polygon + }% + \def\pst@linetype{1}% + \showpointsfalse% + \end@ClosedObj% + \box\pst@hbox% + \ifpsboxsep\kern\pst@dima\fi%% right side + }% + \ifpsboxsep% + \pst@dimn=-.5\pst@dimo\advance\pst@dimn by \pst@dimb% + \advance\pst@dimn by 0.809\pst@dimm% + \dp\pst@hbox=\pst@dimn% + \pst@dimn=\pst@dimm\advance\pst@dimn by 0.5\pst@dimo% + \advance\pst@dimn by -\pst@dimb% + \ht\pst@hbox=\pst@dimn\fi% + \leavevmode% + \box\pst@hbox% + \endgroup% + \ignorespaces} +% +\pst@def{polygonB}<{% + /x1 framesep neg def + /x2 boxwidth framesep add def + /y1 boxdepth framesep add neg def + /y2 boxheight framesep add def + x2 x1 add 2 div y2 y1 add 2 div translate + [ + alpha cos radius mul + alpha sin radius mul + order { /alpha alpha dAlpha add def + radius alpha cos mul + radius alpha sin mul + } repeat +}> +% +\catcode`\@=\PstAtCode\relax +\endinput +%% +%% End of file `pst-poly.tex'. |