From 5a8c98d1c020d0d3d6dd0e44dbe41bf98adc7c32 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 31 Dec 2018 22:10:03 +0000 Subject: pst-lsystem (31dec18) git-svn-id: svn://tug.org/texlive/trunk@49556 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-lsystem/Changes | 1 + .../texmf-dist/doc/generic/pst-lsystem/README.md | 9 +- .../doc/generic/pst-lsystem/pst-lsystem-doc.bib | 97 +++++++++++++-------- .../doc/generic/pst-lsystem/pst-lsystem-doc.pdf | Bin 2937429 -> 2936125 bytes .../doc/generic/pst-lsystem/pst-lsystem-doc.tex | 69 ++++++++++----- .../tex/generic/pst-lsystem/pst-lsystem.tex | 19 ++-- 6 files changed, 128 insertions(+), 67 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/pst-lsystem/Changes b/Master/texmf-dist/doc/generic/pst-lsystem/Changes index a5b0400035f..52e9359b1fb 100644 --- a/Master/texmf-dist/doc/generic/pst-lsystem/Changes +++ b/Master/texmf-dist/doc/generic/pst-lsystem/Changes @@ -1,4 +1,5 @@ ..... pst-lsystem.tex +0.02 2018-12-31 some code cleanup 0.01 2018-09-23 first CTAN version diff --git a/Master/texmf-dist/doc/generic/pst-lsystem/README.md b/Master/texmf-dist/doc/generic/pst-lsystem/README.md index c24507252f6..14c6160d4bf 100644 --- a/Master/texmf-dist/doc/generic/pst-lsystem/README.md +++ b/Master/texmf-dist/doc/generic/pst-lsystem/README.md @@ -1,4 +1,9 @@ -# pst-lsystem: creating images defined by a L-system +# pst-lsystem: creating images defined by a L-system: +A L-system or Lindenmayer system is a parallel rewriting system and a type of +formal grammar. An L-system consists of an alphabet of symbols that can be used +to make strings, a collection of production rules that expand each symbol into +some larger string of symbols, an initial »axiom« string from which to begin construction, +and a mechanism for translating the generated strings into geometric structures. Save the files pst-lsystem.sty|pro|tex in a directory, which is part of your local TeX tree. The pro file should go into $TEXMF/dvips/pstricks/ @@ -17,4 +22,4 @@ pdflatex with package auto-pst-pdf or xelatex. %% in directory macros/latex/base/lppl.txt. -%% $Id: README.md 815 2018-09-25 06:16:11Z herbert $ +%% $Id: README.md 819 2018-09-26 06:40:48Z herbert $ diff --git a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.bib b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.bib index 60e1400c195..ba627e29bbd 100644 --- a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.bib +++ b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.bib @@ -27,30 +27,42 @@ @Book{companion, - author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Vo{\ss}}, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Voß}, title = {The {\LaTeX} {G}raphics {C}ompanion}, publisher = {{Addison-Wesley Publishing Company}}, edition = 2, year = {2007}, - address = {Reading, Mass.} + address = {Reading, Mass. (USA)} } @Book{PSTricks2, - author = {Herbert Vo\ss}, + author = {Herbert Voß}, title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, - edition = {4.}, - publisher = {DANTE -- Lehmanns}, - year = {2007}, - address = {Heidelberg/Hamburg} + edition = {7}, + publisher = {DANTE and Lehmanns Media}, + year = {2017}, + address = {Heidelberg and Berlin} } + +@Book{PSTricksE, + author = {Herbert Voß}, + title = {\texttt{PSTricks} -- {G}raphics and {P}ost{S}cript for \LaTeX}, + edition = {1}, + publisher = {UIT}, + date = {2011}, + location = {Cambridge -- UK} +} + + + @Book{LaTeXRef, - author = {Herbert Vo\ss}, + author = {Herbert Voß}, title = {\LaTeX\ Referenz}, - edition = {1.}, - publisher = {DANTE -- Lehmanns}, - year = {2007}, - address = {Heidelberg/Hamburg} + edition = {3}, + publisher = {DANTE and Lehmanns Media}, + year = {2012}, + address = {Heidelberg and Berlin} } @Book{PostScript, Author = {Kollock, Nikolai G.}, @@ -61,30 +73,47 @@ year = 1989, } -@Manual{pstricks, +@online{pstricks, Title = {PSTricks - {\PS} macros for generic {\TeX}}, Author = {{Timothy van} Zandt}, - Organization = {}, - Address = {\url{http://www.tug.org/application/PSTricks}}, - Note = {}, + url = {http://www.tug.org/application/PSTricks}, year = 1993 } -Michel Charpentier. Dragon Curve in PostScript. http://www.cs.unh. -edu/~charpov/Programming/L-systems/simple-dragon.ps. -[3] Michel Charpentier. L-systems in PostScript. http://www.cs.unh.edu/ -~charpov/Programming/L-systems/plant2.ps. -[4] Michel Charpentier. Ulam’s Spiral in PostScript. http://www.cs.unh.edu/ -~charpov/Programming/PostScript-primes/primes-distribution.ps. -[5] Jim Lund. DoodleTron (a L-system Iterator). http://elegans.uky.edu/ -jiml/lsystem/ls_index.html. -[6] Przemyslaw Prusinkiewicz and Aristid Lindenmayer. The Algorithmic Beauty -of Plants. Springer-Verlag, 1990. -[7] Pavel Tišnovský. L-systémy: přírodní objekty i umělé artefakty. http://www. -root.cz/clanky/l-systemy-prirodni-objekty-i-umele-artefakty. -[8] Eric W. Weisstein. Dragon Curve. From MathWorld–A Wolfram Web -Resource. http://mathworld.wolfram.com/PrimeSpiral.html. -[9] Eric W. Weisstein. Lindenmayer Systems. From MathWorld–A Wolfram Web -Resource. http://mathworld.wolfram.com/LindenmayerSystem.html. -[10] Eric W. Weisstein. Ulam’s Spiral. From MathWorld–A Wolfram Web -Resource. http://mathworld.wolfram.com/PrimeSpiral.html. +@online{charp, + author= {Michel Charpentier}, + title = {Dragon Curve in PostScript}, + url = {http://www.cs.unh.edu/~charpov/Programming/L-systems/simple-dragon.ps}, + urldate={2018-09-24}, +} + +@online{charp2, + author= {Michel Charpentier}, + title = {L-systems in PostScript}, + url = {http://www.cs.unh.edu/~charpov/Programming/L-systems/plant2.ps}, + urldate={2018-09-24}, +} + +@book{Linde, +author={Przemyslaw Prusinkiewicz and Aristid Lindenmayer}, +title={The Algorithmic Beauty of Plants}, +publisher= {Springer-Verlag}, +date={1990}, +} + +@article{charp3, + author= {Michel Charpentier}, + title={Programming L-Systems in PostScript}, + journal = {Zpravodaj Československého sdružení uživatelů \TeX u}, + organisation = {CSTUG: Czech and Slovak \TeX\ Users Group}, + date = {2012}, + doi={10.5300/2012-1/9}, +number = 1, +pages={9--19}, +url={http://bulletin.cstug.cz/pdf/bul_0013.pdf}, +urldate = {2018-09-25}, +} + + + + diff --git a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.pdf b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.pdf index f00c5cb0d68..ff9180091ad 100644 Binary files a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.pdf and b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.tex b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.tex index e28dd78cbbb..073ac3c6994 100644 --- a/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-lsystem/pst-lsystem-doc.tex @@ -1,21 +1,24 @@ -%% $Id: pst-lsystem-doc.tex 815 2018-09-25 06:16:11Z herbert $ +%% $Id: pst-lsystem-doc.tex 820 2018-09-26 09:52:39Z herbert $ \documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false, headings=small, headinclude=false,footinclude=false,oneside,abstract=on]{pst-doc} \usepackage{pst-lsystem} \let\pstFV\fileversion \usepackage{dtk-logos} +\usepackage{xltabular} \renewcommand\bgImage{% -%\psset{yunit=4cm,xunit=3} -\begin{pspicture}(-2,-1.5)(4,6) - \pslsystem[X=-FX++FY-, - Y=+FX--FY+, - Ftype=1, - Start=X, - Angle=45, - N=9, - linewidth=0.1pt, - BaseLength=2mm](0,0) -\end{pspicture}} +\begin{pspicture}(-2,-0.5)(3,6) +\pslsystem[ + Start=Y, + X={X[-FFF][+FFF]FX}, + Y={YFX[+Y][-Y]}, + Angle=25, + N=6, + Ftype=1, + BaseLength=2.5pt, + usecolor=2](0,0) +\psdot(0,0) +\end{pspicture} +} \addbibresource{\jobname.bib} @@ -35,7 +38,7 @@ \begin{document} \title{\texttt{pst-lsystem}} -\subtitle{Creating images, based on the Lindenmeyer-system; v.\pstFV} +\subtitle{Creating images, based on the Lindenmayer-system; v.\pstFV} \author{Herbert Voß} \docauthor{} \date{\today} @@ -53,7 +56,7 @@ of having older versions, go to \url{http://www.CTAN.org/} and load the newest v \vfill\noindent Thanks to \\ -Michel Charpontier, +Michel Charpentier, and last but not least \url{http://mathworld.wolfram.com}. @@ -92,15 +95,15 @@ defined by the three functions $F$, $X$, and $Y$. At least one function must be The following optional arguments for the macro are possible: -\begin{tabularx}{\linewidth}{@{} l l X @{}}\toprule +\begin{xltabular}{\linewidth}{@{} l l X @{}}\toprule \emph{name} & \emph{default} & \emph{menaing}\\\midrule \Lkeyword{F} & & Rule $F\rightarrow(F)$\\ \Lkeyword{X} & & Rule $X\rightarrow(F,X,Y)$\\ \Lkeyword{Y} & & Rule $Y\rightarrow(F,X,Y)$\\ \Lkeyword{Start} & & Startrule $S\rightarrow(F,X,Y)$\\ -\Lkeyword{Angle} & 0 & Angle for the drection change\\ +\Lkeyword{Angle} & 45 & Angle for the drection change\\ \Lkeyword{N} & 5 & Number of the recursive calls\\ -\Lkeyword{Ftype} & 4 & How the F-rule should handled\\ +\Lkeyword{Ftype} & 4 & How the F-rule should be handled\\ \Lkeyword{BaseLength} & 1mm & The length of a base line, created by the ruke F (Forward)\\ \Lkeyword{usecolor} & 0 & Which color should be used for the lines.\\ %\define@key[psset]{pst-lsystem}{order}[5]{\pst@getint{#1}\psk@lsystem@order} @@ -109,16 +112,32 @@ The following optional arguments for the macro are possible: %\define@key[psset]{pst-lsystem}{size}[4]{\pst@getint{#1}\psk@lsystem@size} %\define@key[psset]{pst-lsystem}{type}[0]{\pst@getint{#1}\psk@lsystem@type} \bottomrule -\end{tabularx} +\end{xltabular} +\bigskip If the rules contain square brackets then it must be enclosed by braces: \verb|X=F[-X]| is wrong and \verb|X={F[-X]}| is correct. \subsection{Different types for the F-rule} It depends to the given rule(s) what kind of the F-type must be used. -There are four possibilities: - +There are five possibilities: + +\begin{xltabular}{\linewidth}{@{} >{\ttfamily}l X @{}} +0 & $F\rightarrow \textrm{draw line element}$ \\ + & in PostScript: \verb|/F { D } def|\\ +1 & $F\rightarrow \textrm{If loop variable }=0 \textrm{ then draw line element}$\\ + & in PostScript: \verb|/F { 0 eq { D } if } def|\\ +2 & $F\rightarrow \textrm{If loop variable }=0 \textrm{ then draw line element and keep variable}$\\ + & in PostScript: \verb|/F { dup 0 eq { D } if } def|\\ +3 & $F\rightarrow \textrm{draw line element and delete current loop variable}$\\ + & in PostScript: \verb|/F { pop D } def|\\ +4 & $F\rightarrow \textrm{If loop variable }=0 $ then draw line element! If not $=0$ decrease loop variable, duplicate it + $n-1$ times (n is the number of functions in $F$) and put F-rule on stack\\ + & in PostScript: \verb|/F { dup 0 eq { D }{ 1 sub N 1 sub {dup} repeat F-rule } ifelse pop } def| +\end{xltabular} + +\iffalse \begin{verbatim} \ifcase\psk@lsystem@Ftype /F { D } def % type 0 @@ -132,6 +151,7 @@ There are four possibilities: /F { dup 0 eq { D }{ 1 sub \psk@lsystem@Fnumber {dup} repeat \psk@lsystem@F } ifelse pop } def \fi \end{verbatim} +\fi The function D does nothing else than drawing a line in the current direction. Its length is given by the optional parameter BaseLength. @@ -173,6 +193,7 @@ There are four predefined color modes, where mode=0 is no color. +\clearpage \subsection{Kochflake} If the rule for \Lkeyword{Start} has more than one function name, one has to repeat @@ -244,7 +265,10 @@ for the first one. That is done already internally: \end{pspicture} \end{LTXexample} +\clearpage + +\clearpage \subsection{Plant 4} @@ -281,6 +305,9 @@ for the first one. That is done already internally: \end{pspicture} \end{LTXexample} +\clearpage + +\clearpage \subsection{Plant 6} @@ -312,6 +339,8 @@ for the first one. That is done already internally: \end{pspicture} \end{LTXexample} +\clearpage + \subsection{Plant 8} diff --git a/Master/texmf-dist/tex/generic/pst-lsystem/pst-lsystem.tex b/Master/texmf-dist/tex/generic/pst-lsystem/pst-lsystem.tex index bc76fbed916..68e19e086c5 100644 --- a/Master/texmf-dist/tex/generic/pst-lsystem/pst-lsystem.tex +++ b/Master/texmf-dist/tex/generic/pst-lsystem/pst-lsystem.tex @@ -25,8 +25,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-lsystem} -\def\fileversion{0.01} -\def\filedate{2018/09/22} +\def\fileversion{0.02} +\def\filedate{2018/12/31} \message{`PST-lsystem' v\fileversion, \filedate\space (hv)} % \pstheader{pst-lsystem.pro} @@ -35,6 +35,8 @@ \def\pst@tempg{}% \pst@cntm=0 \ifx\relax#2\relax\else\pst@lsystem@@checkRule#2;\fi +% \let#1\pst@tempg +% \@namedef{\expandafter\@gobble\detokenize\expandafter{\string#1number}}{\the\pst@cntm}% \expandafter\let\csname#1\endcsname\pst@tempg \global\expandafter\edef\csname#1number\endcsname{\the\pst@cntm}% } @@ -54,22 +56,17 @@ \define@key[psset]{pst-lsystem}{X}[]{\pst@lsystem@checkRule{psk@lsystem@X}{#1}} \define@key[psset]{pst-lsystem}{Y}[]{\pst@lsystem@checkRule{psk@lsystem@Y}{#1}} \define@key[psset]{pst-lsystem}{Start}[]{\pst@lsystem@checkRule{psk@lsystem@Start}{#1}} -\define@key[psset]{pst-lsystem}{Angle}[0]{\def\psk@lsystem@Angle{#1 }} +\define@key[psset]{pst-lsystem}{Angle}[45]{\def\psk@lsystem@Angle{#1 }} \define@key[psset]{pst-lsystem}{N}[5]{\def\psk@lsystem@N{#1 }} \define@key[psset]{pst-lsystem}{Ftype}[4]{\def\psk@lsystem@Ftype{#1 }} \define@key[psset]{pst-lsystem}{N2}[4]{\def\psk@lsystem@Nii{#1 }} \define@key[psset]{pst-lsystem}{BaseLength}[1mm]{\pst@getlength{#1}\psk@lsystem@BaseLength} -\psset[pst-lsystem]{F={},X={},Y={},Start={},Angle=0,N=5,Ftype=4,BaseLength=1mm} +\psset[pst-lsystem]{F={},X={},Y={},Start={},Angle=45,N=5,Ftype=4,BaseLength=1mm} % -\define@key[psset]{pst-lsystem}{usecolor}[0]{\def\psk@lsystem@color{#1}} +\define@key[psset]{pst-lsystem}{usecolor}[0]{\def\psk@lsystem@color{#1}}% 0 is no color % \define@key[psset]{pst-lsystem}{order}[5]{\pst@getint{#1}\psk@lsystem@order} -%\define@key[psset]{pst-lsystem}{factor}[2]{\pst@checknum{#1}\psk@lsystem@factor} -% Size (the smaller, the bigger), no need to be changed, normally -%\define@key[psset]{pst-lsystem}{size}[4]{\pst@getint{#1}\psk@lsystem@size} -%\define@key[psset]{pst-lsystem}{type}[0]{\pst@getint{#1}\psk@lsystem@type} -\psset[pst-lsystem]{order=5,%factor=2,size=4,type=0, - usecolor=0} +\psset[pst-lsystem]{order=5,usecolor=0} % \def\pslsystem{\def\pst@par{}\pst@object{pslsystem}} \def\pslsystem@i{\@ifnextchar(\pslsystem@ii{\pslsystem@ii(0,0)}}% -- cgit v1.2.3