%% $Id: pst-turtle-doc.tex 1093 2019-10-02 11:28:36Z herbert $ \documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false, headings=small, headinclude=false,footinclude=false,oneside]{pst-doc} \usepackage{pst-turtle} \let\pstTurtleFV\fileversion \renewcommand\bgImage{} %\usepackage[style=dtk]{biblatex} \addbibresource{pst-turtle-doc.bib} \begin{document} \title{\texttt{pst-turtle}} \subtitle{Turtle graphics; v.\pstTurtleFV} \author{Herbert Vo\ss} \docauthor{} \date{\today} \maketitle \tableofcontents \clearpage \begin{abstract} \noindent \LPack{pst-turtle} loads by default the following packages: \LPack{pstricks}, and \LPack{pst-xkey}. All should be already part of your local \TeX\ installation. If not, or in case of having older versions, go to \url{http://www.CTAN.org/} and load the newest version. \vfill\noindent Thanks to \\ \end{abstract} \section{Usage} \begin{BDef} \Lcs{psTurtle}\OptArgs\Largr{$x_0,y_0$}\Largb{Turtle code} \end{BDef} The turle commands must be in PostScript notation, where you can use the short or long version of the commands: \begin{verbatim} /bk { back } bind def /fd { forward } bind def /lt { left } bind def /pd { pendown } bind def /pu { penup } bind def /rt { right } bind def \end{verbatim} The default unit is cm. \bigskip \begin{LTXexample}[width=4cm,pos=l] \begin{pspicture}[showgrid](3,3) \psTurtle[linewidth=2pt,arrows=->](0,0){ 3 forward } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=4cm,pos=l] \begin{pspicture}[showgrid](3,3) \psTurtle[linewidth=2pt,arrows=->](0,0){ 3 fd 90 left 3 fd } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=4cm,pos=l] \begin{pspicture}[showgrid](3,3) \psTurtle[linewidth=2pt,arrows=->](0,0){ 3 fd 90 left 3 fd 90 left 3 fd 135 left 18 sqrt fd} \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](0.8,0){ 5 { 2.5 fd 72 left } repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](2,1){ 5 { 72 left 1 fd 72 right 1 fd 72 left} repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](2,0){ /Angle { 360 7 div } bind def 7 { Angle left 1 fd Angle right 1 fd Angle left} repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](2,2){ /Angle { 360 7 div } bind def 7 { Angle left 1 fd Angle 3 mul right 1 fd Angle left} repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](2,1){ /Angle 40 def 75 { 0.25 fd Angle left /Angle Angle 0.5 sub def } repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](4,4) \psTurtle[linewidth=2pt](0,3.5){ 5 { 3 fd 144 right } repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=6cm,pos=l] \begin{pspicture}[showgrid](5,5) \psTurtle[linewidth=0.2pt](1,1.75){ 75 { 3.5 fd 123 left } repeat } \end{pspicture} \end{LTXexample} \bigskip \begin{LTXexample}[width=11cm,pos=l] \begin{pspicture}[showgrid](10,10) \psTurtle[linewidth=0.5pt](5,5){ /L 1 def 150 { L fd 120 left L fd 120 left L fd /L L 0.03 add def 1.25 rotate } repeat } \end{pspicture} \end{LTXexample} \iffalse \def\a{3 } \begin{pspicture}[showgrid](12,6) \psset{linecolor=red,linewidth=1.5pt,unit=1cm} \psTurtle(0,0){ 90 left \a 1.5 mul fd 159 rt \a fd 120 lt \a fd 120 lt \a fd pu \a bk pd -125 rt \a fd 90 lt \a fd 90 lt \a fd 90 lt \a fd pu 90 lt \a fd 90 lt \a fd pd -37 lt \a fd 4 { 72 lt \a fd } repeat pu 2 { 72 lt \a fd } repeat pd -152 lt \a fd } %\psdot[dotscale=3](! Turtle8) \end{pspicture} \fi %\clearpage %\section{List of all optional arguments for \texttt{pst-turtle}} %\xkvview{family=pst-turtle,columns={key,type,default}} \bgroup \RaggedRight \nocite{*} %\bibliographystyle{plain} \printbibliography{pst-turtle-doc} \egroup \printindex \end{document}