diff options
author | Karl Berry <karl@freefriends.org> | 2009-01-30 00:07:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-01-30 00:07:44 +0000 |
commit | 233e8430afec69ca29c28c798cc0912785ea29d1 (patch) | |
tree | 77b0bea1f6629464d7b3b9b776f8e4af86f0504e /Master/texmf-dist | |
parent | 8eb0c96ca66f661f5ab3b61a641c3ef7ec79fea1 (diff) |
new pstricks package pst-bezier (29jan09)
git-svn-id: svn://tug.org/texlive/trunk@12014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-bezier/Changes | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-bezier/README | 42 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.bib | 110 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.pdf | bin | 0 -> 102996 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.tex | 365 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-bezier/pst-bezier.pro | 109 | ||||
-rw-r--r-- | Master/texmf-dist/source/generic/pst-bezier/Makefile | 68 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-bezier/pst-bezier.tex | 335 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-bezier/pst-bezier.sty | 13 |
9 files changed, 1052 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-bezier/Changes b/Master/texmf-dist/doc/generic/pst-bezier/Changes new file mode 100644 index 00000000000..66485d07ff9 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-bezier/Changes @@ -0,0 +1,10 @@ +-- pst-bezier.tex --- +0.01 2009-01-29 first CTAN version + + +-- pst-bezier.sty --- +0.01 2009-01-29 first CTAN version + + +-- pst-bezier.pro --- +0.01 2009-01-29 first CTAN version diff --git a/Master/texmf-dist/doc/generic/pst-bezier/README b/Master/texmf-dist/doc/generic/pst-bezier/README new file mode 100644 index 00000000000..c8f371e9078 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-bezier/README @@ -0,0 +1,42 @@ +Save the files pst-bezier.sty|tex in a directory, which is part of your +local TeX tree. pst-bezier.pro should be saved in ../texmf/dvips/pstricks/ +Then do not forget to run texhash to update this tree. +pst-bezier needs pst-plot and pst-tricks, which should be part of your +local TeX installation, otherwise get it from a CTAN server, f.ex. +http://www.CTAN.org + + +Save the files + +pst-bezier.sty +pst-bezier.tex +pst-bezier.pro + +in any place, where latex or any other TeX program will find it. +Do not forget to update your database, when installing this +package the first time. + +pst-bezier uses the extended version of the keyval package. So +be sure that you +- have installed xkeyval with the special pst-xkey + (CTAN: tex-archive/macros/latex/contrib/xkeyval/) +- do not load another package after pst-bezier, which loads + the old keyval.sty or pst-key.tex + + +If you like to get the documentation file in another format run + +latex pst-bezier-doc.tex +bibtex pst-bezier.doc +latex pst-bezier-doc.tex +dvips pst-bezier-doc.dvi + +to get a PostScript file. But pay attention, that the pst-bezier +files are saved in the above mentioned way, before you run +latex on the documentation file. + +The intermediate DVI file works only with viewers which can +interprete the embedded PostScript code. + +For another PDF output read the Introduction from +the documentation. diff --git a/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.bib b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.bib new file mode 100644 index 00000000000..d4c75592e2a --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.bib @@ -0,0 +1,110 @@ +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {PostScript richtig eingesetzt: vom Konzept zum + praktischen Einsatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for Generic TeX}, + Author = {Timothy Van Zandt}, + Organization = {}, + Address = {\url{http://www.tug.org/application/PSTricks}}, + Note = {}, + year = 1993, +} + + +@Manual{pdftricks, + Title = {PSTricks Support for pdf}, + Author = {Herbert Voss}, + Organization = {}, + Address = {\url{http://PSTricks.de/pdf/pdfoutput.phtml}}, + Note = {}, + year = 2002, +} + +@Manual{miwi, + Title = {References for \TeX{} and Friends}, + Author = {Michael Wiedmann and Peter Karp}, + Organization = {}, + Address = {\url{http://www.miwie.org/tex-refs/}}, + Note = {}, + year = 2003, +} + + +@Article{dtk02.2:jackson.voss:plot-funktionen, + author = {Laura E. Jackson and Herbert Vo{\ss}}, + title = {Die {P}lot-{F}unktionen von {\texttt{pst-plot}}}, + journal = dtk, + year = 2002, + volume = {2/02}, + altvolume = 2, + altnumber = 14, + month = jun, + pages = {27--34}, + annote = bretter, + keywords = {}, + abstract = { Im letzten Heft wurden die mathematischen Funktionen von + \PS~im Zusammenhang mit dem {\LaTeX}-Paket + \texttt{pst-plot} zum Zeichnen von Funktionen beschrieben + und durch Beispiele erl{\"a}utert. In diesem Teil werden + die bislang nur erw{\"a}hnten Plot-Funktionen f{\"u}r + externe Daten behandelt. } +} + +@Article{dtk02.1:voss:mathematischen, + author = {Herbert Vo{\ss}}, + title = {Die mathematischen {F}unktionen von {P}ostscript}, + journal = dtk, + year = 2002, + volume = {1/02}, + altvolume = 1, + altnumber = 14, + month = mar, + pages = {40-47}, + annote = bretter, + keywords = {}, + abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im + Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es + darum geht zu beurteilen, was es denn nun im eigentlichen + Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, + bei denen sonst auf externe Programme zur{\"u}ckgegriffen + wird. Dies wird im Folgenden f{\"u}r die mathematischen + Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} + gezeigt. } +} + + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Serbastian Rahtz and Denis Roegel and Herbert Vo\ss}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + year = {2007}, + edition = {2nd}, + address = {Reading, Mass.} +} + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {5.}, + publisher = {DANTE/Lehmanns Media}, + year = {2008}, + address = {Heidelberg/Berlin} +} + +@Book{voss:math, + author = {Herbert Vo\ss}, + title = {Mathematik mit \LaTeX}, + publisher = {{DANTE/Lehmanns Media}}, + year = {2009}, + address = {Heidelberg/Berlin} +} + diff --git a/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.pdf b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.pdf Binary files differnew file mode 100644 index 00000000000..79ca40cd86b --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.tex b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.tex new file mode 100644 index 00000000000..3be402bebd2 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-bezier/pst-bezier-doc.tex @@ -0,0 +1,365 @@ +%% $Id: pst-bezier-doc.tex 86 2009-01-29 10:34:00Z herbert $ +\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings + headexclude,footexclude,oneside]{pst-doc} +\usepackage[utf8]{inputenc} +\usepackage{pst-bezier} +\usepackage{esvect} +\let\vec\vv + +\let\pstBezierFV\fileversion +\lstset{pos=l,wide=false,language=PSTricks, + morekeywords={multidipole,parallel},basicstyle=\footnotesize\ttfamily} +% +\begin{document} + +\title{\texttt{pst-bezier}} +\subtitle{A PSTricks package for drawing Bezier curves; v.\pstBezierFV} +\author{Tobias Nähring \\Herbert Vo\ss} +\docauthor{} +\date{\today} +\maketitle + +\tableofcontents + +\clearpage + +\begin{abstract} +\noindent +The \LPack{pstricks} package provides (essentially) two main macros for +drawing curves: \Lcs{pscurve} and \Lcs{psbezier}. Both macros +employ Bezier \Index{spline}s. + +The \Lcs{pscurve} macro takes multiple interpolated points as +arguments. Thus, it is easy to draw long multiply bent curves. The +problem with \Lcs{pscurve} is that there is no easy +way to change the automatically computed +control points without simultaneously changing the interpolated +points. Note that some control is possible via the +\Lkeyword{curvature} option. + +The \Lcs{psbezier} macro gives full control over the +interpolation points and the control points of one Bezier polynominal +of degree three (two interpolated points and two control +points). + +\vfill\noindent +Thanks to: \\ + Jean-C\^ome Charpentier. +\end{abstract} + +%% Author: Tobias N"ahring + +\section{Introduction} + +If one demands for the access to certain control points of one +multiply bent curve one has to use multiple instances of the +\Lcs{psbezier} macro. With this approache each inner interpolation +point of the curve has to be input twice. Furthermore, if one needs +smooth joints one has to compute control points symmetrically to the +corresponding interpolation points for every joint even if one does +not care so much about the exact tangential direction at some of those +joints. That can be rather tedious. + +The \Lcs{psbcurve} macro of the package \LPack{pst-bezier} is intented to +demonstrate a way to combine the nice properties of the macros +\Lcs{pscurve} and \Lcs{psbezier}. It provides an easy input +format to describe `arbitrarily' many interpolation points of a curve +and to fix the control points at some freely selected interpolation +points. + +Note, that \LPack{pst-bezier} is \emph{no final package} (e.g. +the automatical computation of the control points is not as refined as +that one for the macro \Lcs{pscurve}). + +\section{Installation and usage of \texttt{pst-bezier.tex}} +\paragraph{Installation:} +As prerequisites for \LPack{pst-bezier} you need resent working +versions of \LaTeX{} and \LPack{pstricks}. The files +\LFile{pst-bezier.tex} and \LFile{pst-bezier.sty} must be somewhere +in your \TeX-input path. Further more, the file +\LFile{pst-bezier.pro} must be in some path, where \Lprog{dvips} can +find it. + +\paragraph{Usage:} +As usual, load the packages \LPack{pstricks} and \LPack{pst-bezier} +in that order via the \Lcs{usepackage} macro. + +Now you are ready to use the \Lcs{psbcurve} macro within your document +body. This macro is described in the next section with all its options. + +Whith the following simple \LaTeX-source code you can test whether you have +correctly installed the package: + +\begin{LTXexample} +\documentclass{minimal} +\usepackage{pstricks} +\usepackage{pst-bezier} +\begin{document} + \begin{pspicture}(6,4) + \psbcurve(1,2)(5,2) % Draw just one straight line. + \end{pspicture} +\end{document} +\end{LTXexample} + + +\section{The \nxLcs{psbcurve} macro} +In the most simple form you can specify any number of interpolation +points as the argument of \Lcs{psbcurve}. + +\begin{LTXexample} +\begin{pspicture}[showgrid=true](5,3) + \psbcurve(1,1)(2,2)(3,1)(4,2) +\end{pspicture} +\end{LTXexample} + +As usual, options can be specified within brackets. + + +\begin{LTXexample} +\begin{pspicture}[showgrid=true](5,3) + \psbcurve[showpoints=true](1,1)(2,2)(3,1)(4,2) +\end{pspicture} +\end{LTXexample} + +As you can see in the above example, the \Lkeyword{showpoints} feature works +(partially) with \Lcs{psbcurve}. + +The next figure shows again the curve from the first example. This +time labels are added to the points (this is just for the following +description, it is not a feature of \Lcs{psbcurve}). + +\begin{LTXexample} +\begin{pspicture}[showgrid=true](5,3) + \psbcurve[showpoints=true](1,1)(2,2)(3,1)(4,2) + \uput[-90](1,1){$\vec{p}_{0}=\vec{l}_{1}$} + \uput[90](1.5,2){$\vec{r}_{1}$} + \uput[90](2,2){$\vec{p}_{1}$} + \uput[90](2.5,2){$\vec{l}_{2}$} + \uput[-90](2.5,1){$\vec{r}_{2}$} + \uput[-90](3,1){$\vec{p}_{2}$} + \uput[-90](3.5,1){$\vec{l}_{3}$} + \uput[90](4,2){$\vec{r}_{3}=\vec{p}_{3}$} +\end{pspicture} +\end{LTXexample} + +The points labeled with $\vec{p}_{k}$ $(k=0,\dots,3)$ are the +interpolation points, these ones labelled with $\vec{l}_{1},\hdots,\vec{l}_{3}$, +and these ones labelled with $\vec{r}_{1},\hdots,\vec{r}_{3}$ are the left and +right control points, respectively. + +Between each consecutive pair $\vec{p}_{k-1},\vec{p}_{k}$ of interpolation +points the \Lcs{psbcurve} macro draws a cubic Bezier spline. +The control points $\vec{l}_{k}$ and $\vec{r}_{k}$ determine the tangential +direction of the bezier spline at the interpolation points. More +exactly, the bezier spline from $\vec{p}_{k-1}$ to $\vec{p}_{k}$ is tangent to +the vector $\vec{l}_{k}-\vec{p}_{k-1}$ at the point $\vec{p}_{k-1}$ and tantengial +to the vektor $\vec{r}_{k}-\vec{p}_{k}$ at the point $\vec{p}_{k}$. + +Without any optional modifier arguments (described later in this text) +the control points are computed automatically +from the interpolation points by the formulas\footnote{Note that this + method is very crude. To compute the curve such that the curvature + is continuous would require solving a nonlinear system of + equations. That is not implemented yet.} +% +\begin{align*} + \vec{l}_{1}&= \vec{p}_{0}\\ + \vec{l}_{k}&= t_{k}(\vec{p}_{k}-\vec{p}_{k-2})&&\text{for }k=2,\hdots,n\\ + \vec{r}_{k}&= t_{k}(\vec{p}_{k-1}-\vec{p}_{k+1})&&\text{for }k=1,\hdots,n-1\\ + \vec{r}_{n}&= \vec{p}_{n} +\end{align*} +% +where $t_{k}$ $(k=1,\hdots,n)$ are real coefficients which are called +tension and which default to the value \Lkeyword{bcurveTension}=0.25. + +You can change the appearance of the curve by several modifiers. +First of all you can directly set the left and right control points +via the modifiers \Lnotation{l}\Largr{\CAny} and \Lnotation{r}\Largr{\CAny}, resp., as +shown in the next two examples. The unmodified curve is drawn in the +background in {\color{blue}blue} color. + + + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)l(2,1)(2,2)(3,1)r(4,1)(4,2) +\uput[-90](2,1){$\vec{l}_{1}$} +\uput[-90](4,1){$\vec{r}_{3}$} +\endpspicture +\end{LTXexample} + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)l(2,1)(3,1)(4,2) +\uput[-90](2,1){$\vec{l}_{2}$} +\endpspicture +\end{LTXexample} + + +On the right hand side the last example is shown once more without grid and +with \Lkeyset{showpoints=false}. There, you see that there is a corner at the second +interpolation point. + + +\begin{LTXexample} +\pspicture(5,3) +\psbcurve(1,1)(2,2)l(2,1)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +If you change some left control point $\vec{l}_{k}$ with the help of the +\Lnotation{L}\Largr{\CAny} modifier then the control point +$\vec{r}_{k-1}$ is set symmetrically to $\vec{l}_{k}$ with respect to the +interpolation point $\vec{p}_{k-1}$. In that way you get a smooth joint as +demonstrated in the next example. + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psset{showpoints=true} +\psbcurve(1,1)(2,2)L(2,1)(3,1)(4,2) +\uput[-90](2,1){$\vec{l}_{2}$} +\uput[0](2,2){$\vec{p}_{1}$} +\uput[0](2,3){$\vec{r}_{1}$} +\endpspicture +\end{LTXexample} + +With the \Lnotation{t}\Largb{t} modifier you can change the tension of the +automatically computed control points of the current Bezier spline. + + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)t{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +As you can see from the example both control points of the current +spline are affected by the \Lnotation{t}\Largb{t} modifier. +If you want to change the tension of just the left or right control +point you can use the \Lnotation{tl}\Largb{t} or \Lnotation{tr}\Largb{t} modifier, +respectively, as demonstrated in the following two examples. + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)% + (2,2)tl{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)tr{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +The \Lnotation{ts}\Largb{t} modifier changes the tension of the left and right +control points next to the interpolation point which stands in front +of the modifier. In the next example a negative tension value leads to +a rather surprising effect. + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)ts{-0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + +The default value of the tension can be set with the option +\Lkeyword{bcurveTension} as in the following example. + + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve[bcurveTension=0.5](1,1)% + (2,2)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +You can set this option also with the help of the \Lcs{psset} macro. +% +It is even possible to change the value of \Lkeyword{bcurveTension} in the +middle of a \Lcs{psbcurve}. Just use the modifier \Lnotation{T}\Largb{t} for +that purpose as shown in the following example. + +\begin{LTXexample} +\pspicture[showgrid=true](5,6) +\psset{showpoints=true} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2)(4,4)(3,5)% + (2,4)(1,5) +\psbcurve(1,1)(2,2)(3,1)(4,2)% + T{0.5}(4,4)(3,5)(2,4)(1,5) +\endpspicture +\end{LTXexample} + +Certainly, you can use the \Lnotation{T}\Largb{t} modifier several times in one +curve. (Try it for yourself.) +% +The \texttt{linestyle} and \texttt{fillstyle} options (and several +more) are respected by \Lcs{psbcurve} as the following example shows. + +\begin{LTXexample} +\pspicture[showgrid=true](5,3) +\psbcurve[linestyle=dashed, + linewidth=3pt, + dash=0.5 0.2, + fillstyle=solid, + fillcolor=blue](1,1)(2,2)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +\section{Things that do not work (`known bugs')} +As already mentioned this project is something like an experiment. So, +there are many things that do not work. + +\begin{itemize} +\item new lines inside the argument list are not ignored. +\item The control points are computed in a rather crude way (see + above). The \Lkeyword{curvature} option is not recognised. +\item If \Lkeyword{fillstyle} is set to \Lkeyword{solid} and + \Lkeyset{showpoints=true} then the fill color covers the interpolation and control points. +\item arrow heads do not work. +\end{itemize} + + +\section{List of all optional arguments for \texttt{pst-bezier}} + +\xkvview{family=pst-bezier,columns={key,type,default}} + + +\bgroup +\raggedright +\nocite{*} +\bibliographystyle{plain} +\bibliography{pst-bezier-doc} +\egroup + +\printindex +\end{document} + + diff --git a/Master/texmf-dist/dvips/pst-bezier/pst-bezier.pro b/Master/texmf-dist/dvips/pst-bezier/pst-bezier.pro new file mode 100644 index 00000000000..560d027a807 --- /dev/null +++ b/Master/texmf-dist/dvips/pst-bezier/pst-bezier.pro @@ -0,0 +1,109 @@ +%% $Id: pst-bezier.pro 87 2009-01-29 10:37:06Z herbert $ +%% PostScript prologue for pstricks-add.tex. +%% +%% Version 0.01, 2009/01/29 +%% +%% For distribution, see pst-bezier.tex. +%% +%% +tx@Dict begin + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Auxiliary routines: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% [x1 y1] [x2 y2] -> [ x1+y1 x2+y2 ] +/AddArrays2d { + [ 3 1 roll %% Get the operands + 2 copy + 0 get exch + 0 get add %% first component finished + %% second component: + 3 1 roll + 1 get exch + 1 get add ]} bind def + +%% [x1 y1] [x2 y2] -> [ x1-x2 y1-y2 ] +/SubArrays2d { + [ 3 1 roll exch + 2 copy + 0 get exch 0 get sub + 3 1 roll + 1 get exch + 1 get sub ] } bind def + +%% [x y] s -> [s*x s*y] +/ScaleArray2d { + [ 3 1 roll exch + 2 copy + 0 get mul + 3 1 roll + 1 get mul + ] } bind def + + +%% << [Array of Bezier splines] /K 1 >> -> empty stack +%% Thereby, a Bezier spline is described by an array: +%% [x0 y0 x1 y1 x2 y2 x3 y3 sl sr] +%% (x0,y0) is the right control point +/pstBCurve { +begin %% LaTeX provides the dictionary (see above comments) + 1 1 Splines length 1 sub { + /K exch def % K is the index of the spline. +%% + %% First control point: + Splines K get 0 get dup %% switch the cases /n and /s... + /n eq { %% `not specified' -> automatically computed + Splines K get 0 %% l(k) is going to be set... + %% | -> p(k-1)+(p(k)-p(k-2))*sl(k) + Splines K get 4 2 getinterval + Splines K 2 sub get 4 2 getinterval + SubArrays2d + Splines K get 6 get ScaleArray2d + Splines K 1 sub get 4 2 getinterval + AddArrays2d + putinterval %% ...setting l(k) + } if + /s eq { %% `symmetric' -> compute from r(k-1) + Splines K get 0 %% l(k):= + %% | -> 2*p(k-1)-r(k-1) + Splines K 1 sub get 4 2 getinterval 2 ScaleArray2d + Splines K 1 sub get 2 2 getinterval SubArrays2d + putinterval %% + } if + + %% Second control point: + Splines K get 2 get dup %% (cases /n and /s) + /n eq { %% `not specified' -> automatically computed + Splines K get 2 + %% | -> p(k)+(p(k+1)-p(k-1))*sr(k) + Splines K 1 sub get 4 2 getinterval + Splines K 1 add get 4 2 getinterval + SubArrays2d + Splines K get 7 get ScaleArray2d + Splines K get 4 2 getinterval + AddArrays2d + putinterval + } if + /s eq { %% `symmetric' -> compute from l(k+1) + Splines K get 2 + %% | -> 2*p(k)-l(k+1) + Splines K get 4 2 getinterval 2 ScaleArray2d + Splines K 1 add get 0 2 getinterval SubArrays2d + putinterval + } if + } for %% all splines. + %% + %% The current point is already correctly set by the LaTeX macro. + %% So get ride of the 0th dummy spline. + Splines 1 Splines length 1 sub getinterval {% + aload pop pop pop %% get ride of the array itself and the scaling factor. + curveto% now the actual spline is on the stack... + } forall %% splines. + /Points [ %% now save the points for the showpoints-feature. + Splines 0 get 4 2 getinterval aload pop + Splines 1 Splines length 1 sub getinterval { aload pop pop pop } forall + ] + end def %% Put points in the top dictionary + } bind def +end %% tx@Dict diff --git a/Master/texmf-dist/source/generic/pst-bezier/Makefile b/Master/texmf-dist/source/generic/pst-bezier/Makefile new file mode 100644 index 00000000000..ff81d4e1edb --- /dev/null +++ b/Master/texmf-dist/source/generic/pst-bezier/Makefile @@ -0,0 +1,68 @@ +# `Makefile' for `pst-circ.pdf', hv, 2007/03/17 + +.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps + +PACKAGE = pst-bezier + +MAIN = $(PACKAGE)-doc + +LATEX = latex + +ARCHNAME = $(MAIN)-$(shell date +%y%m%d) + +ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Changes Makefile + +TDS = ~/PSTricks/PSTricks-TDS + +all : doc clean tds +doc: $(MAIN).pdf + +$(MAIN).pdf : $(MAIN).ps + GS_OPTIONS=-dAutoRotatePages=/None ps2pdf $< + +$(MAIN).ps : $(MAIN).dvi + dvips $< + +$(MAIN).dvi : $(MAIN).tex + $(LATEX) $< + $(LATEX) $< + if ! test -f $(basename $<).glo ; then touch $(basename $<).glo; fi + if ! test -f $(basename $<).idx ; then touch $(basename $<).idx; fi + makeindex -s gglo.ist -t $(basename $<).glg -o $(basename $<).gls \ + $(basename $<).glo + makeindex -t $(basename $<).ilg -o $(basename $<).ind \ + $(basename $<).idx + bibtex $(basename $<) + $(LATEX) $< + $(LATEX) $< + +clean : + $(RM) $(addprefix $(MAIN), .log .aux .glg .glo .gls .ilg .idx .ind .tmp .toc .out .blg .Roessler .bbl ) + $(RM) $(addprefix $(MAIN), .dvi .ps) + +veryclean : clean + $(RM) $(addprefix $(MAIN), .pdf .bbl .blg) + +arch : + zip $(ARCHNAME).zip $(ARCHFILES) + +tds: + cp -u Changes $(TDS)/doc/generic/$(PACKAGE)/ + cp -u README $(TDS)/doc/generic/$(PACKAGE)/ + cp -u $(MAIN).pdf $(TDS)/doc/generic/$(PACKAGE)/ +# + cp -u Changes $(TDS)/tex/latex/$(PACKAGE)/ + cp -u $(PACKAGE).sty $(TDS)/tex/latex/$(PACKAGE)/ +# + cp -u Changes $(TDS)/tex/generic/$(PACKAGE)/ + cp -u $(PACKAGE).tex $(TDS)/tex/generic/$(PACKAGE)/ +# + cp -u Changes $(TDS)/dvips/$(PACKAGE)/ + cp -u $(PACKAGE).pro $(TDS)/dvips/$(PACKAGE)/ +# + cp -u Changes $(TDS)/source/$(PACKAGE)/ + cp -u $(MAIN).tex $(TDS)/source/$(PACKAGE)/ + cp -u $(MAIN).bib $(TDS)/source/$(PACKAGE)/ + cp -u Makefile $(TDS)/source/$(PACKAGE)/ + +# EOF diff --git a/Master/texmf-dist/tex/generic/pst-bezier/pst-bezier.tex b/Master/texmf-dist/tex/generic/pst-bezier/pst-bezier.tex new file mode 100644 index 00000000000..a13a8fb239c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pst-bezier/pst-bezier.tex @@ -0,0 +1,335 @@ +%% $Id: pst-bezier.tex 87 2009-01-29 10:37:06Z herbert $ +%% +%% This is file `pst-bezier.tex', +%% +%% IMPORTANT NOTICE: +%% +%% Package `pst-bezier.tex' +%% +%% Tobias Nähring (www.tn-home.de) +%% Herbert Voss <voss@PSTricks.de> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory CTAN:/macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-bezier' is a PSTricks package to draw spline curves +%% +%% +\csname PSTbezierLoaded\endcsname +\let\PSTbezierLoaded\endinput + +\def\fileversion{0.01} +\def\filedate{2009/01/29} +\message{ v\fileversion, \filedate} + +\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi +\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi + +\edef\TheAtCode{\the\catcode`\@}\catcode`\@=11 + +\pst@addfams{pst-bezier} + +%% We need this: +\expandafter\if\csname gobble\endcsname\relax\def\gobble#1{}\fi +%% +%% \newcommand is not native TeX. Therefore the following definition. +%%%%%%%%%%%% +%% \defopt defines a macro with one optional argument. +%% Syntax: +%% \defopt\MyNewMacro{DefaultValue}[#1]#2{StuffToBeAssignedToMyNewMacro} +%% where \myNewMacro, DefaultValue, and StuffToBeAssignedToMyNewMacro +%% have the obvious meaning. Instead of #2 up to #9 arguments can be +%% specified. +\def\defopt#1#2{% + \def\defopt@tmp##1{% + \expandafter\def\csname##1\endcsname{% + \def\defopt@tmp{\futurelet\defopt@arg}% + \expandafter\defopt@tmp\csname##1@opt\endcsname% + }% + \expandafter\def\csname##1@opt\endcsname{% + \if\defopt@arg[%] + \def\next{\csname##1@@opt\endcsname}% + \else% + \def\next{\csname##1@@opt\endcsname[#2]}% + \fi\next}% + }% + \edef\defopt@arg{\expandafter\gobble\string#1} + \expandafter\defopt@tmp\expandafter{\defopt@arg}% + \expandafter\def\csname\expandafter\gobble\string#1@@opt\endcsname% +} +%% The postscript part of pst-bezier: +\pstheader{pst-bezier.pro} + +%% A list of TeX-code fragments is generated when parsing \psbcurve. +%% The list is managed with the help of these two counters: +\newcount\psbcurve@codeCntrEnd +\newcount\psbcurve@codeCntr +%% These counters should never be set globally. +%% Also the code fragments should never be set globally. +%% The list entries are numberated (therefore the entries can be +%% accessed via \csname only). +%% E. g. for the third entry you have the following items: +%% \csname psbcurve@code3l\endcsname (the left control point) +%% \csname psbcurve@code3r\endcsname (the right control point) +%% \csname psbcurve@code3\endcsname (the interpolated point) +%% \csname psbcurve@code3sl\endcsname (the left scaling factor) +%% \csname psbcurve@code3sr\endcsname (the right scaling factor) +%% \csname psbcurve@code3addon\endcsname (additional code that is run at +%% first) +%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Auxiliary macros for dealing +%% with the list TeX-code fragments +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Syntax: +%% \psbcurve@def[offset]{item}{TeXcode} +%% Where offset is some number (default:0), +%% and item is one of {l,r,sl,sr,addon}. +%% TeXcode will be assigned to the item of the list entry at +%% \psbcurve@codeCntrEnd + offset. +\defopt\psbcurve@def{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\def\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Essentially the same as \psbcurve@def, but +%% the list item will only be set if it is undefined. +\defopt\psbcurve@defIfVoid{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \let\next\relax + \advance\psbcurve@codeCntr by #1 + \expandafter\ifx\csname % + psbcurve@code\the\psbcurve@codeCntr#2\endcsname\relax% + \def\next{\expandafter\def\csname % + psbcurve@code\the\psbcurve@codeCntr#2\endcsname}% + \fi\next} + +%% Essentially the same as \psbcurve@def (just \def replaced by \let): +\defopt\psbcurve@let{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\let\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@letvar[offset]{item}\MyVarToBeSet +%% sets \MyVarToBeSet to the value of the list entry. +%% See the definition of \psbcurve@def for a description +%% of the list entry. +\defopt\psbcurve@letvar{0}[#1]#2#3{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \def#3{\noexpand#3}% + \expandafter\let\expandafter#3\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@ifx[offset]{item}\MyVarToBeCompared +%% That is essentially an \ifx with the list item compared to +%% \MyVarToBeCompared. +\defopt\psbcurve@ifx{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\ifx\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@get{item} +%% This expands to the macro corresponding to `item' from the +%% list entry at \psbcurve@codeCntr. +\def\psbcurve@get#1{\csname psbcurve@code\the\psbcurve@codeCntr#1\endcsname} + + +%% Auxiliary macros: +%%%%%%%%%%%%%%%%%%%%% +%% Multiple branching +%% Syntax: +%% \psbcurve@switch\ExpandingToKey{KeyI,\MacroI,KeyII,\MacroII,...and so on...} +%% If \ExpandingToKey expands to one of the keys KeyI, \KeyII, ... +%% the corresponding \MacroI, \MacroII, ..., resp. is called. +%% The key value \relax is special. Its corresponding \Macro is the +%% default action which is taken if none of the Keys matches. +\def\psbcurve@switch#1#2{% +\def\next##1,##2,##3|{% +\ifx#1##1\relax\def\next####1|{\let\next##2}\fi% +\ifx##1\relax\def\next####1|{\let\next##2}\fi% +\next##3|% +}% +\next#2,\relax,\relax,|\next} + +%% The user interface to psbcurve: +%% Usage: See description in pst-bezier-doc.tex. +%% The default value \relax for the optional argument indicates that +%% there are no optional arguments. +\defopt\psbcurve\relax[#1](#2){% + \bgroup% Makes optional pstricks-settings local to this \psbcurve call. + \ifx#1\relax\else% + \psset{#1}% + \fi% + \def\psbcurve@code{% + \moveto(#2)% + \code{ + << + /Splines [%] begin of the array of splines + [%] begin of the first dummy spline (just the start point) + /n /n /n /n } \coor(#2) \code{% + /n /n %[ + ] % end of the first dummy spline + }% end of \code + }% + %% Initialise the list of postscript code fragments: + \psbcurve@codeCntrEnd0% + \psbcurve@pointSetDefaults%% Init first spline. + \psbcurve@def{l}{\coor(#2)}%% Default left control point of the first spline. + \psbcurve@next%% Now, get the next arguments... +} + +%% The following macro declare the pstricks option psbcurveTension +%% and set it to its default value. +\define@key[psset]{pst-bezier}{bcurveTension}[0.25]{\def\psk@bcurveTension{#1}} +\psset{bcurveTension=0.25} + +%% Points of a spline that are not set yet +%% to a certain value or action +%% get the following value: +\def\psbcurve@ptNotDef{\code{ /n /n }} + +%% A newly allocated spline gets the following defaults: +\def\psbcurve@pointSetDefaults{% + \psbcurve@defIfVoid{l}{\psbcurve@ptNotDef}% + \psbcurve@defIfVoid{r}{\psbcurve@ptNotDef}% + \psbcurve@defIfVoid{sl}{\code{ \psk@bcurveTension\space}}% + \psbcurve@defIfVoid{sr}{\code{ \psk@bcurveTension\space}}% + \psbcurve@defIfVoid{addon}{}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Now, there comes a series of commands. Depending on the next optional modifier +%% in the argument list of \psbcurve one of these is called. If there follows a +%% point (x,y) without modifier \psbcurve@nextPoint is called. If there follows a token that +%% does not make sense to \psbcurve \psbcurve@end is called. + +%% the modifier l +\def\psbcurve@lPoint#1(#2){% + \psbcurve@def{l}{\coor(#2)}% + \psbcurve@next} + +%% the modifier r +\def\psbcurve@rPoint#1(#2){% + \psbcurve@def{r}{\coor(#2)}% + \psbcurve@next} + +%% the modifier L +\def\psbcurve@LPoint#1(#2){% + \psbcurve@def{l}{\coor(#2)}% + \psbcurve@def[-1]{r}{\code{ /s /s }}% + \psbcurve@next} + +%% the modifier T +\def\psbcurve@Tension#1#2{% + \psbcurve@def{addon}{\psset{bcurveTension=#2}}% + \psbcurve@next} + +%% The t modifier has some sub-modifiers +%% These are recognised by this macro and the +%% corresponding action is taken. +\def\psbcurve@tension#1{\futurelet\psbcurve@tmp\psbcurve@@tension} +%% +\def\psbcurve@@tension{% +\psbcurve@switch\psbcurve@tmp{% + l,\psbcurve@ltension,% + r,\psbcurve@rtension,% + s,\psbcurve@stension,% + \relax,\psbcurve@@@tension% +}} + +%% the modifier t without further sub-modifiers +\def\psbcurve@@@tension#1{% +\psbcurve@def{sr}{\code{ #1 }}% +\psbcurve@def{sl}{\code{ #1 }}% +\psbcurve@next} + +%% the modifier ts +\def\psbcurve@stension#1#2{% symmetric +\psbcurve@def[-1]{sr}{\code{ #2 }}% +\psbcurve@def{sl}{\code{ #2 }}% +\psbcurve@next} + +%% the modifier tl +\def\psbcurve@ltension#1#2{% left control point +\psbcurve@def{sl}{\code{ #2 }}% +\psbcurve@next} + +%% the modifier tr +\def\psbcurve@rtension#1#2{% right control point +\psbcurve@def{sr}{\code{ #2 }}% +\psbcurve@next} + +%% This macro is called if the next token is +%% no modifier but a point (x,y) +\def\psbcurve@nextPoint(#1){% + \psbcurve@def{}{\coor(#1)}% + \advance\psbcurve@codeCntrEnd by 1 + \psbcurve@pointSetDefaults% + \psbcurve@next} + +%% If the next token does not make sense to \psbcurve +%% the curve is finished. +\def\psbcurve@end{ + %% Do we need to set the last control point to its default? + \def\tmp{\psbcurve@ptNotDef}% + \psbcurve@ifx[-1]{r}\tmp% + \psbcurve@letvar[-1]{}\tmp% \tmp is set to the end point + \psbcurve@let[-1]{r}\tmp% last control point is set to \tmp + \fi% + %% pscustom deactivates showpoints: reverse this: + \let\if@psbcurve@showpoints\ifshowpoints% + \pscustom{% + %% Following, the TeX-code fragments in \psbcurve@code... + %% are executed. These compose the postscript spline array. + \psbcurve@code% + \psbcurve@codeCntr0 + \loop% + \code{[ %] + }% + \psbcurve@get{addon}% additional code + \psbcurve@get{l}% left control point + \psbcurve@get{r}% right control point + \psbcurve@get{}% interpolation point + \psbcurve@get{sl}% left scaling factor + \psbcurve@get{sr}% right scaling factor + \code{ %[ + ] }% end of the spline. + \advance\psbcurve@codeCntr by 1 + \ifnum\psbcurve@codeCntr<\psbcurve@codeCntrEnd% + \repeat% + \code{%[ + ] % end of the spline array + /K 1 + >> pstBCurve + }% + \if@psbcurve@showpoints% + \pst@OpenShowPoints %% works fine, only the dashed lines are missing: + \code{ \tx@BezierShowPoints }% + \fi% + }% + \egroup% +} + +%% The following macro reads the next argument from the \psbcurve argument list +%% recognises optional modifiers and branches to the corresponding macro. +\def\psbcurve@next{\futurelet\psbcurve@tmp\psbcurve@@next} +\def\psbcurve@@next{% + \psbcurve@switch\psbcurve@tmp{% +(,\psbcurve@nextPoint,%) +l,\psbcurve@lPoint,% +r,\psbcurve@rPoint,% +L,\psbcurve@LPoint,% +t,\psbcurve@tension,% +T,\psbcurve@Tension,% +\relax,\psbcurve@end}% +} + +\catcode`\@=\TheAtCode\relax +\endinput + diff --git a/Master/texmf-dist/tex/latex/pst-bezier/pst-bezier.sty b/Master/texmf-dist/tex/latex/pst-bezier/pst-bezier.sty new file mode 100644 index 00000000000..b92dfac4721 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pst-bezier/pst-bezier.sty @@ -0,0 +1,13 @@ +%% $Id: pst-bezier.sty 86 2009-01-29 10:34:00Z herbert $ +% +\RequirePackage{pstricks} +\ProvidesPackage{pst-bezier}[2009/01/29 v. 0.01 package wrapper for + pst-bezier.tex (hv)] +\input{pst-bezier.tex} +\ProvidesFile{pst-bezier.tex} + [\filedate\space v\fileversion\space `PST-bezier' (tn,hv)] +\IfFileExists{pst-bezier.pro}{% + \ProvidesFile{pst-bezier.pro} + [2009/01/29 v. 0.01, PostScript prologue file (tn,hv)] + \@addtofilelist{pst-bezier.pro}}{}% +\endinput |