%% $Id: pstricks-add-doc.tex 520 2011-06-11 06:58:16Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings headexclude,footexclude,oneside]{pst-doc} \listfiles \makeatletter \RequirePackage{ltxcmds}[2010/01/28] \@ifpackagelater{ltxcmds}{2010/03/09}{}{% \def\ltx@pkgextension{sty}% } \makeatother \input{pstricks-add-doc.dat} \usepackage[utf8]{inputenc} \usepackage{pstricks-add} \let\pstricksaddFV\fileversion \usepackage{pst-eucl,pst-fun,pst-func,multirow} \usepackage{pifont} \let\belowcaptionskip\abovecaptionskip % \def\textat{\char064}% \newdimen\fullWidth \makeatletter \renewcommand*\l@section{\@dottedtocline{1}{2em}{2.3em}} \renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}} \renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}} \renewcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}} \makeatother \lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}, escapechar=§} \def\bgImage{\psset{unit=1.5} \begin{pspicture}(-3,-3)(3,3) \psChart[userColor={red!30,green!30,blue!40,gray,cyan!50, magenta!60,cyan},chartSep=30pt,shadow=true,shadowsize=5pt]{34.5,17.2,20.7,15.5,5.2,6.9}{6}{2} \psset{nodesepA=5pt,nodesepB=-10pt} \ncline{psChartO1}{psChart1}\nput{0}{psChartO1}{1000 (34.5\%)} \ncline{psChartO2}{psChart2}\nput{150}{psChartO2}{500 (17.2\%)} \ncline{psChartO3}{psChart3}\nput{-90}{psChartO3}{600 (20.7\%)} \ncline{psChartO4}{psChart4}\nput{0}{psChartO4}{450 (15.5\%)} \ncline{psChartO5}{psChart5}\nput{0}{psChartO5}{150 (5.2\%)} \ncline{psChartO6}{psChart6}\nput{0}{psChartO6}{200 (6.9\%)} \bfseries% \rput(psChartI1){Taxes}\rput(psChartI2){Rent}\rput(psChartI3){Bills} \rput(psChartI4){Car}\rput(psChartI5){Gas}\rput(psChartI6){Food} \end{pspicture}} \begin{document} \title{\texttt{pstricks-add}\\additionals Macros for \texttt{pstricks}\\ \small v.\pstricksaddFV} %\docauthor{Herbert Vo\ss} \author{Dominique Rodriguez\\Michael Sharpe\\Herbert Vo\ss} \date{\today} \maketitle \fullWidth=\linewidth \advance\fullWidth by \marginparsep \advance\fullWidth by \marginparwidth \begin{abstract} This version of \verb+pstricks-add+ needs \verb+pstricks.tex+ version >1.04 from June 2004, otherwise the additional macros may not work as expected. The ellipsis material and the option \verb+asolid+ (renamed to \verb+eofill+) are \index{fillstyle!eofill@\texttt{eofill}} now part of the new \verb+pstricks.tex+ package, available on CTAN. \LPack{pstricks-add} will for ever be an experimental and dynamical package, try it at your own risk. \begin{itemize} \item It is important to load \LPack{pstricks-add} as the \textbf{last} PSTricks related package, otherwise a lot of the macros won't work in the expected way. \item \LPack{pstricks-add} uses the extended version of the keyval package. So be sure that you have installed \LPack{pst-xkey} which is part of the \LPack{xkeyval}-package, and that all packages that use the old keyval interface are loaded \textbf{before} the \LPack{xkeyval}.\cite{xkeyval} \item the option \Lkeyword{tickstyle} from \LPack{pst-plot} is no longer supported; use \Lkeyword{ticksize} instead. \item the option \Lkeyword{xyLabel} is no longer supported; use the option \Lkeyword{labelFontSize} instead. \item if \LPack{pstricks-add} is loaded together with the package \LPack{pst-func} then \Lkeyword{InsideArrow} of the \Lcs{psbezier} macro doesn't work! \end{itemize} \vfill \noindent Thanks to: Hendri Adriaens; Stefano Baroni; Martin Chicoine; Gerry Coombes; Ulrich Dirr; Christophe Fourey; Hubert G\"a\ss lein; J\"urgen Gilg; Denis Girou; Pablo Gonzáles; Peter Hutnick; Christophe Jorssen; Uwe Kern; Manuel Luque; Jens-Uwe Morawski; Tobias N\"ahring; Rolf Niepraschk; Alan Ristow; Christine R\"omer; Arnaud Schmittbuhl; John Smith; Timothy Van Zandt \end{abstract} \clearpage \tableofcontents \clearpage \section{\nxLcs{psGetSlope} and \nxLcs{psGetDistance}} %-------------------------------------------------------------------------------------- \begin{BDef} \Lcs{psGetSlope}\coord1\coord2\Lcs{\Larga{macro}}\\ \Lcs{psGetDistance}\coord1\coord2\Lcs{\Larga{macro}} \end{BDef} \begin{LTXexample}[width=4cm] \psGetSlope(-2,1)(3,1)\SlopeVal \SlopeVal \quad \psGetDistance(-2,1)(3,1)\DVal \DVal\\ \psGetSlope(-2,1)(-3,-1)\SlopeVal \SlopeVal\quad \psGetDistance(-2,1)(-3,-1)\DVal \DVal\\ \psGetSlope(-2,0)(3,-1)\SlopeVal \SlopeVal\quad \psGetDistance(-2,0)(3,-1)\DVal \DVal\\ \psGetSlope(-2111,-12)(3,1)\SlopeVal \SlopeVal\quad %\psGetDistance(-2111,-12)(3,1)\DVal ==> Overflow! \end{LTXexample} \clearpage %-------------------------------------------------------------------------------------- \section{"`Handmade"' lines :-)} %-------------------------------------------------------------------------------------- \begin{BDef} \Lcs{pslineByHand}\OptArgs\coord1\coord2\coord3 \ldots \end{BDef} \begin{LTXexample}[width=0.4\linewidth] \begin{pspicture}(4,6) \psset{unit=2cm} \pslineByHand[linecolor=red](0,0)(0,2)(2,2)(2,0)(0,0)(2,2)(1,3)(0,2)(2,0) \end{pspicture} \end{LTXexample} \iffalse \pslineByHand( 1.20, 1.50)( 1.20, 1.51)( 1.20, 1.53)( 1.20, 1.54)( 1.19, 1.55)( 1.19, 1.56) ( 1.19, 1.57)( 1.18, 1.59)( 1.18, 1.60)( 1.17, 1.61)( 1.16, 1.62)( 1.15, 1.63)( 1.15, 1.64) ( 1.14, 1.65)( 1.13, 1.65)( 1.12, 1.66)( 1.11, 1.67)( 1.10, 1.68)( 1.09, 1.68)( 1.07, 1.69) ( 1.06, 1.69)( 1.05, 1.69)( 1.04, 1.70)( 1.03, 1.70)( 1.01, 1.70)( 1.00, 1.70)( 0.99, 1.70) ( 0.97, 1.70)( 0.96, 1.70)( 0.95, 1.69)( 0.94, 1.69)( 0.93, 1.69)( 0.91, 1.68)( 0.90, 1.68) ( 0.89, 1.67)( 0.88, 1.66)( 0.87, 1.65)( 0.86, 1.65)( 0.85, 1.64)( 0.85, 1.63)( 0.84, 1.62) ( 0.83, 1.61)( 0.82, 1.60)( 0.82, 1.59)( 0.81, 1.57)( 0.81, 1.56)( 0.81, 1.55)( 0.80, 1.54) ( 0.80, 1.53)( 0.80, 1.51)( 0.80, 1.50)( 0.80, 1.49)( 0.80, 1.47)( 0.80, 1.46)( 0.81, 1.45) ( 0.81, 1.44)( 0.81, 1.43)( 0.82, 1.41)( 0.82, 1.40)( 0.83, 1.39)( 0.84, 1.38)( 0.85, 1.37) ( 0.85, 1.36)( 0.86, 1.35)( 0.87, 1.35)( 0.88, 1.34)( 0.89, 1.33)( 0.90, 1.32)( 0.91, 1.32) ( 0.93, 1.31)( 0.94, 1.31)( 0.95, 1.31)( 0.96, 1.30)( 0.97, 1.30)( 0.99, 1.30)( 1.00, 1.30) ( 1.01, 1.30)( 1.03, 1.30)( 1.04, 1.30)( 1.05, 1.31)( 1.06, 1.31)( 1.07, 1.31)( 1.09, 1.32) ( 1.10, 1.32)( 1.11, 1.33)( 1.12, 1.34)( 1.13, 1.35)( 1.14, 1.35)( 1.15, 1.36)( 1.15, 1.37) ( 1.16, 1.38)( 1.17, 1.39)( 1.18, 1.40)( 1.18, 1.41)( 1.19, 1.43)( 1.19, 1.44)( 1.19, 1.45) ( 1.20, 1.46)( 1.20, 1.47)( 1.20, 1.49)( 1.20, 1.50) \fi \begin{LTXexample}[pos=t] \begin{pspicture}(\linewidth,3) \multido{\rA=0.00+0.25}{12}{\pslineByHand[linecolor=blue](0,\rA)(\linewidth,\rA)} \end{pspicture} \end{LTXexample} The amplitude and the width can be changed by the optional arguments \Lkeyword{varsteptol} and \Lkeyword{VarStepEpsilon}. Both are preset to \verb+VarStepEpsilon=2,varsteptol=0.8+. \begin{LTXexample}[pos=t] \begin{pspicture}(\linewidth,3) \multido{\rA=0.00+0.25}{12}{% \pslineByHand[linecolor=blue,VarStepEpsilon=4,varsteptol=2](0,\rA)(\linewidth,\rA)} \end{pspicture} \end{LTXexample} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{rmultiput}: a multiple \nxLcs{rput}} %-------------------------------------------------------------------------------------- \verb+PSTricks+ already has a \Lcs{multirput}, which puts a box n times with a difference of $dx$ and $dy$ relative to each other. It is not possible to put it with a different distance from one point to the next. This is possible with \Lcs{rmultiput}: \begin{BDef} \LcsStar{rmultiput}\OptArgs\Largb{any material}\coord1\coord2\ldots\Largr{\coord{n}} \end{BDef} \begin{LTXexample}[width=6.2cm] \psset{unit=0.75} \begin{pspicture}(-4,-4)(4,4) \rmultiput[rot=45]{\red\psscalebox{3}{\ding{250}}}% (-2,-4)(-2,-3)(-3,-3)(-2,-1)(0,0)(1,2)(1.5,3)(3,3) \rmultiput[rot=90,ref=lC]{\blue\psscalebox{2}{\ding{253}}}% (-2,2.5)(-2,2.5)(-3,2.5)(-2,1)(1,-2)(1.5,-3)(3,-3) \psgrid[subgriddiv=0,gridcolor=lightgray] \end{pspicture} \end{LTXexample} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psVector}: Drawing relative vector lines} %-------------------------------------------------------------------------------------- The new macros \Lcs{psStartPoint} and \Lcs{psVector} allow to draw a series of vectors which start point refers to the endpoint of the last drawn vector. The coordinates of the endpoint are \emph{always} interpreted relative to the last the vector. The first vector refers to the coordinates set by \Lcs{psStartPoint}. With the boolean argument one can draw the horizontal angle of the vector. The style of the angle arc is saved in \Lkeyval{psMarkAngleStyle} and the style for the horizontal line in \Lkeyval{psMarkAngleLineStyle} and preset to \begin{lstlisting} \newpsstyle{psMarkAngleStyle}{arrows=->,arrowsize=4pt} \newpsstyle{psMarkAngleLineStyle}{linestyle=dotted} \end{lstlisting} \begin{pspicture}[showgrid](10,10) \psStartPoint(1,1) \psVector(3;30)\psVector(4;60)\psVector[linecolor=red](3;10) \psVector[linestyle=dashed](4;110) \psStartPoint(1,1)\psset{markAngle} \psVector[linestyle=dashed](4;110)\psVector[linecolor=red](3;10) \psVector(4;60)\psVector(3;30) \end{pspicture} \begin{lstlisting} \begin{pspicture}[showgrid](10,10) \psStartPoint(1,1) \psVector(3;30)\psVector(4;60)\psVector[linecolor=red](3;10) \psVector[linestyle=dashed](4;110) \psStartPoint(1,1)\psset{markAngle} \psVector[linestyle=dashed](4;110)\psVector[linecolor=red](3;10) \psVector(4;60)\psVector(3;30) \end{pspicture} \end{lstlisting} All end points of the vectors are saved in node names with the preset name \verb=Vector#=, where \# is the consecutive number of the nodes. \verb=Vector0= ist the starting point of the first \Lcs{psVector}. With the macro \Lcs{psStartPoint} one can set the starting point and with optional argument the name of the nodes. \verb=Vector3= is the default node name of the endpoint of the third vector or the name of the starting point of the forth vector. \begin{BDef} \Lcs{psStartPoint}\OptArg{node basename}\Largr{$x$,$y$} \end{BDef} \begin{pspicture}[showgrid,linewidth=1pt](10,10.4) \psStartPoint[A](1,1)% nodes have the base name A \psVector(3;30)\psVector(4;60)\psVector[linecolor=red](3;10) \psVector[linestyle=dashed](4;110) \psline{->}(A0)(A4) \psStartPoint[B](1,1)\psset{markAngle}% nodes have the base name B \psVector[linestyle=dashed](4;110) \psVector[linecolor=red](3;10) \psVector(4;60)\psVector(3;30) \psline[arrows=-D>,arrowscale=2,linewidth=1.5pt,linecolor=red](B2)(A2) \psline[arrows=-D>,arrowscale=2,linewidth=1.5pt,linecolor=blue](A3)(B3) \multido{\iA=0+1}{5}{\uput[0](A\iA){A\iA}\uput[180](B\iA){B\iA}} \end{pspicture} \begin{lstlisting} \begin{pspicture}[showgrid,linewidth=1pt](10,10.4) \psStartPoint[A](1,1)% nodes have the base name A \psVector(3;30)\psVector(4;60)\psVector[linecolor=red](3;10) \psVector[linestyle=dashed](4;110) \psline{->}(A0)(A4) \psStartPoint[B](1,1)\psset{markAngle}% nodes have the base name B \psVector[linestyle=dashed](4;110) \psVector[linecolor=red](3;10) \psVector(4;60)\psVector(3;30) \psline[arrows=-D>,arrowscale=2,linewidth=1.5pt,linecolor=red](B2)(A2) \psline[arrows=-D>,arrowscale=2,linewidth=1.5pt,linecolor=blue](A3)(B3) \multido{\iA=0+1}{5}{\uput[0](A\iA){A\iA}\uput[180](B\iA){B\iA} \end{pspicture} \end{lstlisting} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psCircleTangents}: Calculating tangent lines of circles} %-------------------------------------------------------------------------------------- The macro calculates the points on a circle where tangent lines from another point or another circle are drawn. \begin{BDef} \Lcs{psCircleTangents}\Largr{$x1,y1$}\Largr{$x2,y2$}\Largb{Radius}\\ \Lcs{psCircleTangents}\Largr{$x1,y1$}\Largb{Radius}\Largr{$x2,y2$}\Largb{Radius} \end{BDef} In the first case the coordinates of a point and the center and the radius of a circle must be given. The names of the calculates node names are \verb=CircleT1= and \verb=CircleT2=. \bigskip \begin{pspicture}[showgrid](0,3)(10,10) \psdot(2,4)\pscircle(7,7){2} \psCircleTangents(2,4)(7,7){2} \pcline[nodesep=-1cm,linecolor=blue](2,4)(CircleT1) \pcline[nodesep=-1cm,linecolor=blue](2,4)(CircleT2) \psdots(CircleT1)(CircleT2) \uput[-80](CircleT1){T1}\uput[115](CircleT2){T2} \end{pspicture} \begin{lstlisting} \begin{pspicture}[showgrid](0,3)(10,10) \psdot(2,4)\pscircle(7,7){2} \psCircleTangents(2,4)(7,7){2} \pcline[nodesep=-1cm,linecolor=blue](2,4)(CircleT1) \pcline[nodesep=-1cm,linecolor=blue](2,4)(CircleT2) \psdots(CircleT1)(CircleT2) \uput[-80](CircleT1){T1}\uput[115](CircleT2){T2} \end{pspicture} \end{lstlisting} \bigskip When using the other variant of the macro two circles must be given. The macro then defines ten nodes, named \verb=CircleTC1= and \verb=CircleTC2= for the two intersection points, \verb=CircleTO1=, \verb=CircleTO2=, \verb=CircleTO3=, and \verb=CircleTO4= for the four nodes of the outer tangent lines and \verb=CircleTI1=, \verb=CircleTI2=, \verb=CircleTI3=, and \verb=CircleTI4= for the four nodes of the inner tangent lines. \bigskip \begin{pspicture}[showgrid](-2,-2)(10,10) \pscircle(1,1){1}\pscircle(7,7){3} \psCircleTangents(1,1){1}(7,7){3} \pcline[nodesep=-1cm,linecolor=blue](CircleTO1)(CircleTO2) \pcline[nodesep=-1cm,linecolor=blue](CircleTO3)(CircleTO4) \pcline[nodesep=-1cm,linecolor=red](CircleTI1)(CircleTI2) \pcline[nodesep=-1cm,linecolor=red](CircleTI3)(CircleTI4) \psdots(CircleTC1)(CircleTC2)% (CircleTO1)(CircleTO2)(CircleTO3)(CircleTO4)% (CircleTI1)(CircleTI2)(CircleTI3)(CircleTI4)% \uput[0](CircleTC1){TC1}\uput[0](CircleTC2){TC2} \uput[-80](CircleTI1){TI1}\uput[115](CircleTI2){TI2} \uput[150](CircleTI3){TI3}\uput[-45](CircleTI4){TI4} \uput[-80](CircleTO1){TO1}\uput[150](CircleTO2){TO2} \uput[150](CircleTO3){TO3}\uput[-45](CircleTO4){TO4} \end{pspicture} \bigskip \begin{lstlisting} \begin{pspicture}[showgrid](-2,-2)(10,10) \pscircle(1,1){1}\pscircle(7,7){3} \psCircleTangents(1,1){1}(7,7){3} \pcline[nodesep=-1cm,linecolor=blue](CircleTO1)(CircleTO2) \pcline[nodesep=-1cm,linecolor=blue](CircleTO3)(CircleTO4) \pcline[nodesep=-1cm,linecolor=red](CircleTI1)(CircleTI2) \pcline[nodesep=-1cm,linecolor=red](CircleTI3)(CircleTI4) \psdots(CircleTC1)\psdots(CircleTC2)% (CircleTO1)(CircleTO2)(CircleTO3)(CircleTO4)% (CircleTI1)(CircleTI2)(CircleTI3)(CircleTI4)% \uput[0](CircleTC1){TC1}\uput[0](CircleTC2){TC2} \uput[-80](CircleTI1){TI1}\uput[115](CircleTI2){TI2} \uput[150](CircleTI3){TI3}\uput[-45](CircleTI4){TI4} \uput[-80](CircleTO1){TO1}\uput[150](CircleTO2){TO2} \uput[150](CircleTO3){TO3}\uput[-45](CircleTO4){TO4} \end{pspicture} \end{lstlisting} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psEllipseTangents}: Calculating tangent lines of an ellipse} %-------------------------------------------------------------------------------------- The macro calculates the two points on an ellipse where tangent lines from an outside point are drawn. \begin{BDef} \Lcs{psEllipseTangents}\Largr{$x_0,y_0$}\Largr{$a,b$}\Largr{$x_p,y_p$}\\ \end{BDef} The first two pairs of coordinates are the same as the ones for the default ellipse. The names of the calculates node names are \verb=EllipseT1= and \verb=EllipseT2=. \bigskip \begin{pspicture}[showgrid](0,3)(10,10) \psdot(2,4)\psellipse(7,7)(3,1.5) \psEllipseTangents(7,7)(3,1.5)(2,4) \pcline[nodesep=-1cm,linecolor=blue](2,4)(EllipseT1) \pcline[nodesep=-1cm,linecolor=blue](2,4)(EllipseT2) \psdots(EllipseT1)(EllipseT2) \uput[-80](EllipseT1){T1}\uput[115](EllipseT2){T2} \end{pspicture} \begin{lstlisting} \begin{pspicture}[showgrid](0,3)(10,10) \psdot(2,4)\psellipse(7,7)(3,1.5) \psEllipseTangents(7,7)(3,1.5)(2,4) \pcline[nodesep=-1cm,linecolor=blue](2,4)(EllipseT1) \pcline[nodesep=-1cm,linecolor=blue](2,4)(EllipseT2) \psdots(EllipseT1)(EllipseT2) \uput[-80](EllipseT1){T1}\uput[115](EllipseT2){T2} \end{pspicture} \end{lstlisting} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psrotate}: Rotating objects} %-------------------------------------------------------------------------------------- \Lcs{rput} also has an optional argument for rotating objects, but it always depends on the \Lcs{rput} coordinates. With \Lcs{psrotate} the rotating center can be placed anywhere. The rotation is done with \verb+\pscustom+, all optional arguments are only valid if they are part of the \verb+\pscustom+ macro. \begin{BDef} \Lcs{psrotate}\OptArgs\Largr{$x,y$}\Largb{rot angle}\Largb{object} \end{BDef} \begin{LTXexample}[width=0.4\linewidth] \psset{unit=0.75} \begin{pspicture}(-0.5,-3.5)(8.5,4.5) \psaxes{->}(0,0)(-0.5,-3)(8.5,4.5) \psdots[linecolor=red,dotscale=1.5](2,1) \psarc[linecolor=red,linewidth=0.4pt,showpoints=true] {->}(2,1){3}{0}{60} \pspolygon[linecolor=green,linewidth=1pt](2,1)(5,1.1)(6,-1)(2,-2) \psrotate(2,1){60}{% \pspolygon[linecolor=blue,linewidth=1pt](2,1)(5,1.1)(6,-1)(2,-2)} \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=6cm] \begin{pspicture}(-1,-1)(3,6) \def\canne{% Idea by Manuel Luque \psgrid[subgriddiv=0](-1,0)(1,5) \pscustom[linewidth=2mm]{\psline(0,4)\psarcn(0.3,4){0.3}{180}{360}}% \pscircle*(0.6,4){0.1}\pstriangle*(0,0)(0.2,-0.3)} \def\Object{} \canne \psrotate(0.3,4){45}{\psset{linecolor=red!50}\canne} \psrotate(0.3,4){90}{\psset{linecolor=blue!50}\canne} \psrotate(0.3,4){360}{\psset{linecolor=cyan!50}\canne} \psdot[linecolor=red](0.3,4) \end{pspicture} \end{LTXexample} \begin{LTXexample}[pos=t] \begin{pspicture}(0,-6)(15,5) \def\majorette{\psline[linewidth=0.5mm](0,2)% Idea by Manuel Luque \pscircle[fillstyle=solid]{0.1} \pscircle[fillstyle=solid](0,2){0.1}} \psaxes[linewidth=0.5pt]{->}(0,0)(0,-5)(15,5) \pstVerb{/V0 10 def /Alpha 45 def}% vitesse initiale, angle de lancement \multido{\nT=0.0+0.05,\iA=0+40}{41}{% \pstVerb{/nT \nT\space def}% \rput(!V0 Alpha cos mul nT mul -9.81 2 div nT dup mul mul V0 Alpha sin mul nT mul add){% \psrotate(0,1){\iA}{\majorette\psdot[linecolor=red](0,1)\psdot[linecolor=green](0,2)}}} \parametricplot[linecolor=red]{0}{2}{% trajectoire du milieu V0 Alpha cos mul t mul -9.81 2 div t dup mul mul V0 Alpha sin mul t mul add 1 add} \parametricplot[linecolor=green,plotpoints=360]{0}{2}{% d'une extremite V0 Alpha cos mul t mul 800 t mul sin sub % x(t) -9.81 2 div t dup mul mul V0 Alpha sin mul t mul add 1 add 800 t mul cos add }%y(t) \end{pspicture} \end{LTXexample} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psComment}: comments to a graphic} %-------------------------------------------------------------------------------------- \begin{BDef} \LcsStar{psComment}\OptArgs\OptArg*{\Largb{arrows}}\coord0\coord1\Largb{Text}\OptArg{line macro}\OptArg{put macro} \end{BDef} By default the macro uses the \Lcs{ncline} macro to draw a line from the first to the second point, it can be changed with the first additional optional argument. The label is put by default with \Lcs{rput}, which can be changed with the last optional argument. If this is used, then the line macro has also be defined, eg \verb+\psComment(A)(B){text}[\ncarc][\ncput}+ At least, leave the argument empty. \begin{LTXexample}[pos=t,wide] \SpecialCoor\newpsstyle{weiss}{fillstyle=solid,fillcolor=white} \footnotesize\psset{unit=0.5cm,dimen=middle} \begin{pspicture}(-12,-4)(6,10) \psframe*[linecolor=black!20](-5,-3)(5,7) \psframe*[linecolor=black!40](-5,3)(5,6) \pscircle(-8.19,5.51){0.2} \psframe[fillcolor=white,fillstyle=solid](-5.8,3.6)(4.3,5.8) \psframe(-8.98,3.14)(-5.8,6.32) \multido{\rA=-4.1+1.3}{5}{\rput(\rA,-2.4){\psframe[style=weiss](1.1,6) \psline(0,0)(1.1,0.5)(0,1)(1.1,1.6)(0,2.2)(1.1,2.7)(0,3.2)(1.1,3.2)}} \pspolygon*(-4.1,3.7)(-4.1,3)(-3,3)(-3.01,3.7)(-3.54,4.19) \pspolygon*(1.09,3.7)(1.1,3)(2.2,3)(2.18,3.7)(1.65,4.24) \pspolygon*(-2.78,3.7)(-2.8,3)(-1.7,3)(-1.71,3.7)(-2.27,4.04) \pspolygon*(-1.51,3.7)(-1.5,3)(-0.4,3)(-0.41,3.7)(-1.02,4.17) \pspolygon*(-0.21,3.7)(-0.2,3)(0.9,3)(0.89,3.7)(0.3,4.04) \psline(-5,3.83)(-4.15,3.86)(-3.5,4.3)(-2.85,3.81)(-2.22,4.21)(-1.6,3.86)(-0.99,4.33) (-0.28,3.83)(0.35,4.19)(0.97,3.83)(1.65,4.39)(2.2,4.01)(3.57,4.89)(2.41,5.8) \psline(-5,5.8)(-5.78,5.8) \psline(-5.78,5.47)(2.85,5.47) \psline(-5.8,3.52)(-5,3.5) \psline(3.57,4.89)(-5.8,4.89) \psComment*[ref=r]{->}(-8.14,1.19)(-4.31,3.27){Mantelstift} \psComment*[ref=r]{->}(-8.17,-0.56)(-4.37,1.59){Kernstift}[\ncarc] \psComment*[ref=r]{->}(-7.91,-2.24)(-4.44,-0.23){Feder}[\ncarc] \psComment[npos=-0.1]{->}(-3.48,8.72)(-1.33,5.46){Nur f\"ur Profil} \end{pspicture} \end{LTXexample} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psChart}: a pie chart} %-------------------------------------------------------------------------------------- \begin{BDef} \Lcs{psChart}\OptArgs\Largb{comma separated value list}\Largb{comma separated value list}\Largb{radius} \end{BDef} The special optional arguments for the \Lcs{psChart} macro are as follows: \noindent \begin{tabularx}{\linewidth}{@{}>{\ttfamily}lX>{\ttfamily}l@{}} \textrm{\emph{name}} & \textrm{\emph{description}} & \textrm{\emph{default}}\\\hline \Lkeyword{chartSep} & distance from the pie chart center to an outraged pie piece & 10pt\\ \Lkeyword{chartColor} & gray or colored pie (values are: \texttt{gray} or \texttt{color})& gray\\ \Lkeyword{userColor} & a comma separated list of user defined colors for the pie & \{\}\\ \Lkeyword{chartNodeI}& the position of the inner node, relative to the radius & 0.75\\ \Lkeyword{chartNodeO}& the position of the outer node, relative to the radius & 1.5 \end{tabularx} \bigskip The first mandatory argument is the list of the values and may not be empty. The second one is a list of outraged pieces, numbered consecutively from 1 to up the total number of values. The list of user defined colors must be enclosed in braces! The macro \Lcs{psChart} defines for every value three nodes at the half angle and in distances from 0.75, 1, and 1.25 times of the radius from the origin. The nodes are named as \verb+psChartI?+, \verb+psChart?+, and \verb+psChartO?+, where ? is the number of the pie. The letter I leads to the inner node and the letter O to the outer node. The distance can be changed with the optional arguments \Lkeyword{chartNodeI} and \Lkeyword{chartNodeO} in the usual way with \verb+\psset{chartNodeI=...,chartNodeO=...}+. The other one is the node on the circle line. The origin is by default \texttt{(0,0)}. Moving the pie to another position can be done as usual with the \Lcs{rput}-macro. The used colors are named internally as \Lkeyword{chartFillColor?} and can be used by the user for coloring lines or text. \begin{LTXexample}[width=6cm] \begin{pspicture}(-3,-3)(3,3) \psChart{ 23, 29, 3, 26, 28, 14 }{}{2} \multido{\iA=1+1}{6}{% \psdot(psChart\iA)\psdot(psChartI\iA)\psdot(psChartO\iA)% \psline[linestyle=dashed,linecolor=white](psChart\iA) \psline[linestyle=dashed](psChart\iA)(psChartO\iA)} \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=6cm] \begin{pspicture}(-3,-3)(3,3) \psChart[chartColor=color]{45,90}{1}{2} \ncline[linecolor=-chartFillColor1, nodesepB=-20pt]{psChartO1}{psChart1} \rput[l](psChartO1){% \textcolor{chartFillColor1}{pie no 1}} \ncline[linecolor=-chartFillColor2, nodesepB=-20pt]{psChartO2}{psChart2} \rput[lt](psChartO2){% \textcolor{chartFillColor2}{pie no 2}} \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=7.5cm] \psframebox[fillcolor=black!20, fillstyle=solid]{% \begin{pspicture}(-3.5,-3.5)(4.25,3.5) \psChart[chartColor=color]% {23, 29, 3, 26, 28, 14, 17, 4, 9}{}{2} \multido{\iA=1+1}{9}{% \ncline[linecolor=-chartFillColor\iA, nodesepB=-10pt]{psChartO\iA}{psChart\iA} \rput[l](psChartO\iA){% \textcolor{chartFillColor\iA}{pie no \iA}}} \end{pspicture}} \end{LTXexample} \begin{LTXexample}[width=6cm] \begin{pspicture}(-3,-3)(3,3) \psChart[userColor={red!30,green!30, blue!40,gray,magenta!60,cyan}]% { 23, 29, 3, 26, 28, 14 }{1,4}{2} \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=6cm] \begin{pspicture}(-3,-2.5)(3,2.5) \psChart{ 23, 29, 3, 26, 28, 14 }{}{2} \multido{\iA=1+1}{6}{\rput*(psChartI\iA){\iA}} \end{pspicture} \end{LTXexample} %\begin{LTXexample}[pos=t] \psset{unit=1.5} \begin{pspicture}(-3,-3)(3,3) \psChart[userColor={red!30,green!30,blue!40,gray,cyan!50, magenta!60,cyan},chartSep=30pt,shadow=true,shadowsize=5pt]{34.5,17.2,20.7,15.5,5.2,6.9}{6}{2} \psset{nodesepA=5pt,nodesepB=-10pt} \ncline{psChartO1}{psChart1}\nput{0}{psChartO1}{1000 (34.5\%)} \ncline{psChartO2}{psChart2}\nput{150}{psChartO2}{500 (17.2\%)} \ncline{psChartO3}{psChart3}\nput{-90}{psChartO3}{600 (20.7\%)} \ncline{psChartO4}{psChart4}\nput{0}{psChartO4}{450 (15.5\%)} \ncline{psChartO5}{psChart5}\nput{0}{psChartO5}{150 (5.2\%)} \ncline{psChartO6}{psChart6}\nput{0}{psChartO6}{200 (6.9\%)} \bfseries% \rput(psChartI1){Taxes}\rput(psChartI2){Rent}\rput(psChartI3){Bills} \rput(psChartI4){Car}\rput(psChartI5){Gas}\rput(psChartI6){Food} \end{pspicture} %\end{LTXexample} \psset{unit=1cm} \begin{lstlisting} \psset{unit=1.5} \begin{pspicture}(-3,-3)(3,3) \psChart[userColor={red!30,green!30,blue!40,gray,cyan!50, magenta!60,cyan},chartSep=30pt,shadow=true,shadowsize=5pt]{34.5,17.2,20.7,15.5,5.2,6.9}{6}{2} \psset{nodesepA=5pt,nodesepB=-10pt} \ncline{psChartO1}{psChart1}\nput{0}{psChartO1}{1000 (34.5\%)} \ncline{psChartO2}{psChart2}\nput{150}{psChartO2}{500 (17.2\%)} \ncline{psChartO3}{psChart3}\nput{-90}{psChartO3}{600 (20.7\%)} \ncline{psChartO4}{psChart4}\nput{0}{psChartO4}{450 (15.5\%)} \ncline{psChartO5}{psChart5}\nput{0}{psChartO5}{150 (5.2\%)} \ncline{psChartO6}{psChart6}\nput{0}{psChartO6}{200 (6.9\%)} \bfseries% \rput(psChartI1){Taxes}\rput(psChartI2){Rent}\rput(psChartI3){Bills} \rput(psChartI4){Car}\rput(psChartI5){Gas}\rput(psChartI6){Food} \end{pspicture} \end{lstlisting} \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psHomothetie}: central dilatation} %-------------------------------------------------------------------------------------- \begin{BDef} \Lcs{psHomothetie}\OptArgs\Largr{center}\Largb{factor}\Largb{object} \end{BDef} \begin{LTXexample}[width=9cm] \begin{pspicture}[showgrid=true](-5,-4)(4,8) \psBill% needs package pst-fun \psHomothetie[linecolor=blue](4,-3){2}{\psBill} \psdots[dotsize=3pt,linecolor=red](4,-3) \psplot[linestyle=dashed,linecolor=red]{-5}{4}% [ /m -3 -0.85 sub 4 0.6 sub div def ] { m x mul m 4 mul sub 3 sub }% \psHomothetie[linecolor=green](4,-3){-0.2}{\psBill} \end{pspicture} \end{LTXexample} %\pstVerb{ /m -3 -0.85 sub 4 0.6 sub div def } \clearpage %-------------------------------------------------------------------------------------- \section{\nxLcs{psbrace}} %-------------------------------------------------------------------------------------- \begin{BDef} \LcsStar{psbrace}\OptArgs\Largr{A}\Largr{B}\Largb{text} \end{BDef} Additional to all other available options from \LPack{pstricks} or the other related packages, there are two new option, named \Lkeyword{braceWidth} and \Lkeyword{bracePos}. All important ones are shown in the following graphics and table. \begin{center} \begin{pspicture}[showgrid=true](10,5) \psbrace[braceWidth=1cm,braceWidthInner=1cm, braceWidthOuter=1cm,bracePos=0.6,fillcolor=white, nodesepA=10mm,nodesepB=10mm](0,5)(10,5){\fbox{Label}} \pcline{<->}(3,3)(3,4)\ncput*{\footnotesize\ttfamily braceWidth} \pcline{<->}(3,4)(3,5)\ncput*{\footnotesize\ttfamily braceWidthInner} \pcline{<->}(3,2)(3,3)\ncput*{\footnotesize\ttfamily braceWidthOuter} \pcline{<->}(6,1)(6,2)\ncput{\footnotesize\ttfamily nodesepB} \pcline{<->}(6,1)(7,1)\ncput*{\footnotesize\ttfamily A} \pcline{<->}(0,0.5)(6,0.5)\ncput*{\footnotesize\ttfamily bracePos} \psdot[dotscale=2](0,5)\uput[0](0,5){\textbf{A}} \psdot[dotscale=2](10,5)\uput[180](10,5){\textbf{B}} \end{pspicture} \end{center} A positive value for \Lkeyword{nodesepA} and \Lkeyword{nodesepB} shifts the label to the upper right and a negative value to the lower left. This does not depends on the value for the rotating of the label! \begin{center} \begin{tabular}{@{}l|l@{}} name & meaning\\\hline \Lkeyword{braceWidth} & default is \Lcs{pslinewidth}\\ \Lkeyword{braceWidthInner} & default is \verb+10\pslinewidth+\\ \Lkeyword{braceWidthOuter} & default is \verb+10\pslinewidth+\\ \Lkeyword{bracePos} & relative position (default is $0.5$)\\ \Lkeyword{nodesepA} & x-separation (default is $0pt$)\\ \Lkeyword{nodesepB} & y-separation (default is $0pt$)\\ \Lkeyword{rot} & additional rotating for the text (default is $0$)\\ \Lkeyword{ref} & reference point for the text (default is c)\\ \Lkeyword{fillcolor} & default is black \end{tabular} \end{center} By default the text is written perpendicular to the brace line and can be changed with the \LPack{pstricks} option \Lkeyword{rot}=\ldots\ The text parameter can take any object and may also be empty. The reference point can be any value of the combination of \Lkeyval{l} (left) or \Lkeyval{r} (right) and \Lkeyval{b} (bottom) or \Lkeyval{B} (Baseline) or \Lkeyval{C} (center) or \Lkeyval{t} (top), where the default is \Lkeyval{c}, the center of the object. \begin{LTXexample}[width=4.5cm] \begin{pspicture}(4,4) \psgrid[subgriddiv=0,griddots=10] \pnode(0,0){A} \pnode(4,4){B} \psbrace[linecolor=red,ref=lC](A)(B){Text I} \psbrace*[linecolor=blue,ref=lC](3,4)(0,1){Text II} \psbrace[fillcolor=white](3,0)(3,4){III} \end{pspicture} \end{LTXexample} \bigskip The option \Lcs{specialCoor} is enabled, so that all types of coordinates are possible, (nodename), ($x,y$), ($nodeA|nodeB$), \ldots The star version fills the inner of the \Index{brace} with the current linecolor. With the fillcolor \verb+white+ or any other background color the brace can be "`unfilled"'. \begin{LTXexample} \begin{pspicture}(8,2.5) \psbrace(0,0)(0,2){\fbox{Text}}% \psbrace[nodesepA=10pt](2,0)(2,2){\fbox{Text}} \psbrace[ref=lC](4,0)(4,2){\fbox{Text}} \psbrace[ref=lt,rot=90,nodesepB=-15pt](6,0)(6,2){\fbox{Text}} \psbrace[ref=lt,rot=90,nodesepA=-5pt,nodesepB=15pt](8,2)(8,0){\fbox{Text}} \end{pspicture} \end{LTXexample} \begin{LTXexample} \def\someMath{$\int\limits_1^{\infty}\frac{1}{x^2}\,dx=1$} \begin{pspicture}(8,2.5) \psbrace[ref=lC](0,0)(0,2){\someMath}% \psbrace[rot=90](2,0)(2,2){\someMath} \psbrace[ref=lC](4,0)(4,2){\someMath} \psbrace[ref=lt,rot=90,nodesepB=-30pt](6,0)(6,2){\someMath} \psbrace[ref=lt,rot=90,nodesepB=30pt](8,2)(8,0){\someMath} \end{pspicture} \end{LTXexample} %$ \begin{LTXexample} \begin{pspicture}(\linewidth,5) \psbrace(0,0.5)(\linewidth,0.5){\fbox{Text}}% \psbrace[bracePos=0.25,nodesepB=10pt,rot=90](0,2)(\linewidth,2){\fbox{Text}} \psbrace[ref=lC,nodesepA=-3.5cm,nodesepB=15pt,rot=90](0,4)(\linewidth,4){% \fbox{some very, very long wonderful Text}} \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=8cm] \psset{unit=0.8} \begin{pspicture}(10,11) \psgrid[subgriddiv=0,griddots=10] \pnode(0,0){A} \pnode(4,6){B} \psbrace[ref=lC](A)(B){One} \psbrace[rot=180,nodesepA=-5pt,ref=rb](B)(A){Two} \psbrace[linecolor=blue,bracePos=0.25,ref=lB](8,1)(1,7){Three} \psbrace[braceWidth=-1mm,rot=180,ref=rB](8,1)(1,7){Four} \psbrace*[linearc=0.5,fillstyle=none,linewidth=1pt,braceWidth=1.5pt, bracePos=0.25,ref=lC](8,1)(8,9){A} \psbrace(4,9)(6,9){} \psbrace(6,9)(6,7){} \psbrace(6,7)(4,7){} \psbrace(4,7)(4,9){} \psset{linecolor=red} \psbrace*[ref=lb](7,10)(3,10){I} \psbrace*[ref=lb,bracePos=0.75](3,10)(3,6){II} \psbrace*[ref=lb](3,6)(7,6){III} \psbrace*[ref=lb](7,6)(7,10){IV} \end{pspicture} \end{LTXexample} %$ \begin{LTXexample}[width=5cm] \[ \begin{pmatrix} \Rnode[vref=2ex]{A}{~1} \\ & \ddots \\ && \Rnode[href=2]{B}{1} \\ &&& \Rnode[vref=2ex]{C}{0} \\ &&&& \ddots \\ &&&&& \Rnode[href=2]{D}{0}~ \\ \end{pmatrix} \] \psbrace[rot=-90,nodesepB=-0.5,nodesepA=-0.2](B)(A){\small n times} \psbrace[rot=-90,nodesepB=-0.5,nodesepA=-0.2](D)(C){\small n times} \end{LTXexample} \clearpage It is also possible to put a vertical brace around a default paragraph. This works by setting two invisible nodes at the beginning and the end of the paragraph. Indentation is possible with a minipage. \small Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \noindent\rnode{A}{} \vspace*{-1ex} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex}\noindent\rnode{B}{}\psbrace*[linecolor=red](A)(B){} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \medskip\hfill\begin{minipage}{0.95\linewidth} \noindent\rnode{A}{} \vspace*{-1ex} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex} \noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} \end{minipage} \normalsize \begin{lstlisting} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \noindent\rnode{A}{} \vspace*{-1ex} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex}\noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \medskip\hfill\begin{minipage}{0.95\linewidth} \noindent\rnode{A}{} \vspace*{-1ex} Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. Some nonsense text, which is nothing more than nonsense. \vspace*{-2ex}\noindent\rnode{B}{}\psbrace[linecolor=red](A)(B){} \end{minipage} \end{lstlisting} \clearpage %-------------------------------------------------------------------------------------- \section{Random dots} %-------------------------------------------------------------------------------------- The syntax of the new macro \Lcs{psRandom} is: \begin{BDef} \Lcs{psRandom}\OptArgs\Largb{}\\ \Lcs{psRandom}\OptArgs\OptArg*{\Largr{$x_{Min},y_{Min}$}}\OptArg*{\Largr{$x_{Max},y_{Max}$}}\Largb{clip path} %$ %\psRandom[