summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lapdf
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/lapdf
Initial commit
Diffstat (limited to 'macros/latex/contrib/lapdf')
-rw-r--r--macros/latex/contrib/lapdf/README156
-rw-r--r--macros/latex/contrib/lapdf/arcs.pdfbin0 -> 49090 bytes
-rw-r--r--macros/latex/contrib/lapdf/arcs.tex162
-rw-r--r--macros/latex/contrib/lapdf/bezier.pdfbin0 -> 29686 bytes
-rw-r--r--macros/latex/contrib/lapdf/bezier.tex43
-rw-r--r--macros/latex/contrib/lapdf/bezinfo.pdfbin0 -> 183380 bytes
-rw-r--r--macros/latex/contrib/lapdf/bezinfo.tex433
-rw-r--r--macros/latex/contrib/lapdf/buttrfly.pdfbin0 -> 63591 bytes
-rw-r--r--macros/latex/contrib/lapdf/buttrfly.tex31
-rw-r--r--macros/latex/contrib/lapdf/cfamily.pdfbin0 -> 133879 bytes
-rw-r--r--macros/latex/contrib/lapdf/cfamily.tex124
-rw-r--r--macros/latex/contrib/lapdf/chrysant.pdfbin0 -> 64067 bytes
-rw-r--r--macros/latex/contrib/lapdf/chrysant.tex34
-rw-r--r--macros/latex/contrib/lapdf/circle.pdfbin0 -> 110915 bytes
-rw-r--r--macros/latex/contrib/lapdf/circle.tex37
-rw-r--r--macros/latex/contrib/lapdf/colors.pdfbin0 -> 46716 bytes
-rw-r--r--macros/latex/contrib/lapdf/colors.tex72
-rw-r--r--macros/latex/contrib/lapdf/conic.pdfbin0 -> 72567 bytes
-rw-r--r--macros/latex/contrib/lapdf/conic.tex68
-rw-r--r--macros/latex/contrib/lapdf/curve.pdfbin0 -> 41571 bytes
-rw-r--r--macros/latex/contrib/lapdf/curve.tex61
-rw-r--r--macros/latex/contrib/lapdf/curveto.pdfbin0 -> 41648 bytes
-rw-r--r--macros/latex/contrib/lapdf/curveto.tex75
-rw-r--r--macros/latex/contrib/lapdf/cycloid.pdfbin0 -> 99390 bytes
-rw-r--r--macros/latex/contrib/lapdf/cycloid.tex61
-rw-r--r--macros/latex/contrib/lapdf/drawing.pdfbin0 -> 26583 bytes
-rw-r--r--macros/latex/contrib/lapdf/drawing.tex60
-rw-r--r--macros/latex/contrib/lapdf/ellipse.pdfbin0 -> 47804 bytes
-rw-r--r--macros/latex/contrib/lapdf/ellipse.tex36
-rw-r--r--macros/latex/contrib/lapdf/fplot.pdfbin0 -> 227620 bytes
-rw-r--r--macros/latex/contrib/lapdf/fplot.tex271
-rw-r--r--macros/latex/contrib/lapdf/geometry.pdfbin0 -> 63809 bytes
-rw-r--r--macros/latex/contrib/lapdf/geometry.tex44
-rw-r--r--macros/latex/contrib/lapdf/grids.pdfbin0 -> 229252 bytes
-rw-r--r--macros/latex/contrib/lapdf/grids.tex69
-rw-r--r--macros/latex/contrib/lapdf/hippo.pdfbin0 -> 105081 bytes
-rw-r--r--macros/latex/contrib/lapdf/hippo.tex22
-rw-r--r--macros/latex/contrib/lapdf/lapdf.pdfbin0 -> 182669 bytes
-rw-r--r--macros/latex/contrib/lapdf/lapdf.sty1493
-rw-r--r--macros/latex/contrib/lapdf/lapdf.tex325
-rw-r--r--macros/latex/contrib/lapdf/licence.txt189
-rw-r--r--macros/latex/contrib/lapdf/line.pdfbin0 -> 19730 bytes
-rw-r--r--macros/latex/contrib/lapdf/line.tex45
-rw-r--r--macros/latex/contrib/lapdf/polygon.pdfbin0 -> 16663 bytes
-rw-r--r--macros/latex/contrib/lapdf/polygon.tex28
-rw-r--r--macros/latex/contrib/lapdf/polynom.pdfbin0 -> 71016 bytes
-rw-r--r--macros/latex/contrib/lapdf/polynom.tex44
-rw-r--r--macros/latex/contrib/lapdf/pplot.pdfbin0 -> 121582 bytes
-rw-r--r--macros/latex/contrib/lapdf/pplot.tex89
-rw-r--r--macros/latex/contrib/lapdf/preamble.tex14
-rw-r--r--macros/latex/contrib/lapdf/pythagor.pdfbin0 -> 39381 bytes
-rw-r--r--macros/latex/contrib/lapdf/pythagor.tex80
-rw-r--r--macros/latex/contrib/lapdf/qcircle.pdfbin0 -> 72118 bytes
-rw-r--r--macros/latex/contrib/lapdf/qcircle.tex50
-rw-r--r--macros/latex/contrib/lapdf/quartic.pdfbin0 -> 47720 bytes
-rw-r--r--macros/latex/contrib/lapdf/quartic.tex45
-rw-r--r--macros/latex/contrib/lapdf/rational.pdfbin0 -> 43159 bytes
-rw-r--r--macros/latex/contrib/lapdf/rational.tex58
-rw-r--r--macros/latex/contrib/lapdf/rcircle.pdfbin0 -> 192395 bytes
-rw-r--r--macros/latex/contrib/lapdf/rcircle.tex341
-rw-r--r--macros/latex/contrib/lapdf/rcurve.pdfbin0 -> 65806 bytes
-rw-r--r--macros/latex/contrib/lapdf/rcurve.tex98
-rw-r--r--macros/latex/contrib/lapdf/recttria.pdfbin0 -> 19394 bytes
-rw-r--r--macros/latex/contrib/lapdf/recttria.tex29
-rw-r--r--macros/latex/contrib/lapdf/roundtri.pdfbin0 -> 90600 bytes
-rw-r--r--macros/latex/contrib/lapdf/roundtri.tex37
-rw-r--r--macros/latex/contrib/lapdf/rparams.pdfbin0 -> 120228 bytes
-rw-r--r--macros/latex/contrib/lapdf/rparams.tex68
-rw-r--r--macros/latex/contrib/lapdf/superell.pdfbin0 -> 92445 bytes
-rw-r--r--macros/latex/contrib/lapdf/superell.tex49
-rw-r--r--macros/latex/contrib/lapdf/tplot.pdfbin0 -> 71803 bytes
-rw-r--r--macros/latex/contrib/lapdf/tplot.tex133
-rw-r--r--macros/latex/contrib/lapdf/trochoid.pdfbin0 -> 91080 bytes
-rw-r--r--macros/latex/contrib/lapdf/trochoid.tex78
-rw-r--r--macros/latex/contrib/lapdf/turtle.pdfbin0 -> 27780 bytes
-rw-r--r--macros/latex/contrib/lapdf/turtle.tex90
-rw-r--r--macros/latex/contrib/lapdf/vector.pdfbin0 -> 23475 bytes
-rw-r--r--macros/latex/contrib/lapdf/vector.tex46
78 files changed, 5288 insertions, 0 deletions
diff --git a/macros/latex/contrib/lapdf/README b/macros/latex/contrib/lapdf/README
new file mode 100644
index 0000000000..c24ae48be6
--- /dev/null
+++ b/macros/latex/contrib/lapdf/README
@@ -0,0 +1,156 @@
+Lapdf
+-----
+This is a short introduction for the Lapdf style. It has many instructive example
+files to show the usage of this macro package. I hope, this style helps you to
+produce nice graphics with the pdfTeX engine.
+
+This package is distributed under the GNU general pupblic licence (GPL) and it's
+free to use by everyone.
+
+
+What is it?
+-----------
+Lapdf needs pdfTeX and the calc style, which is included in the LaTeX tools
+folder as standard package. Lapdf is a drawing environment like the standard
+LaTeX picture environment. So you can design you graphic from within the LaTeX
+document. Lapdf uses pdfTeX to calculate everything and native PDF commands for
+drawing everything. It lets you also put typesetted text into the graphic, which
+is sometimes rather complicated in other packages.
+
+Additionally to all the PDF drawing commands, Lapdf has a unique set of it's own
+drawing primitives and other macros. Here is a list:
+
+Math functions: These macros are used internally, but they can be also used in
+ your own drawings.
+ Sin, Cos, Tan, Asin, Acos, Atan, Sinh, Cosh, Tanh, Asinh,
+ Acosh, Atanh, Exp, Pow, Ln, Log, Pot, Root, Sqrt, Abs, Sig,
+ Mod, Len, Hypot, Direc, Rotpoint
+
+Loop macros: There are two looping macros for repeating tasks:
+ - Whilenum{condition}{commands}
+ - Whiledim{condition}{commands}
+
+PDF commands: These are the available PDF drawing primitives. I used my own
+ names, which differ only a bit from the original names:
+ - Gsave
+ - Grestore
+ - Setclip
+ - Stroke
+ - Closepath
+ - Setwidth
+ - Setcap
+ - Setjoin
+ - Setflat
+ - Setmiter
+ - Setdash
+ - Bezier
+ - Concat
+ - Translate
+ - Scale
+ - Rotate
+ - Rect
+
+Typesetting: You can typeset text at position with direction with:
+ - Text
+
+Drawing macros: Lapdf fully supports color without the need of any style file. Color
+ usage is specified as an option [black | color] in the preamble:
+ - Setcol
+ - Setgray
+ For repreated color changes (especially in loops) there are 96
+ rainbow colors defined, wich can be used with these macros:
+ - Stepcol
+ - Nextcol
+ - Resetcol
+ Here are the standard drawing primitives:
+ - Moveto
+ - Lineto
+ - Line
+ - Polygon
+ - Vecto
+ - Vect
+ - Vpolygon
+ - Rectangle
+ - Triangle
+ - Epolygon
+ - Circle
+ - Point
+ - Ellipse
+ - Arc
+ - Sector
+ - Arcto
+ - Fill
+ - Gfill
+ - Sfill
+ These are special Bezier curve additions, which are unique. Lapdf
+ lets you draw integral and also rational Bezier curves up to a
+ degree of seven.
+ - Curveto
+ - Curve
+ - Rmoveto
+ - Rcurveto
+ - Rcurve
+ - Quadratic
+ - Cubic
+ There are 5 kinds of grids availabe:
+ - Lingrid
+ - Logxgrid
+ - Logygrid
+ - Logxygrid
+ - Polgrid
+ You can plot functions in three different ways: normal functions,
+ parameter functions, polar functions with these commands:
+ - Fplot
+ - Tplot
+ - Pplot
+ Additionally you can plot polynoms (degree <= 3) directly and also
+ Tangents:
+ - Polynom
+ - Tangent
+ For special tasks you can also compute polynom values, derivatives,
+ partial and total derivatives:
+ - Fpoly
+ - Dpoly
+ - Df
+ - Dtx
+ - Dty
+ - Dtt
+ - Dpx
+ - Dpy
+ - Dpt
+ Some macros are useful shortcuts, like these:
+ - Thick
+ - Thin
+ - Dash
+ - Black
+ - Dred
+ - Dgreen
+ - Dblue
+ - Dcyan
+ - Dmagenta
+ - Dyellow
+ - Dgray
+ - Gray
+ - Red
+ - Green
+ - Blue
+ - Cyan
+ - Magenta
+ - Yellow
+ - White
+
+Documentation:
+--------------
+There are several additional info files, which help you to use this package. I'm
+still working on the documentation, but the intro chapter completed. This Lapdf
+docs will be completed as soon as possible. The package itself will also be
+updated regularly. If you find errors or have any suggestions for improvements,
+please let me know.
+
+I wish you happy Texing with Lapdf!
+
+Detlef Reimers
+
+---------------------------------------------------------------------------------
+(Email: detlefreimers@gmx.de; Web: http://detlefreimers.de)
+
diff --git a/macros/latex/contrib/lapdf/arcs.pdf b/macros/latex/contrib/lapdf/arcs.pdf
new file mode 100644
index 0000000000..4030453bb7
--- /dev/null
+++ b/macros/latex/contrib/lapdf/arcs.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/arcs.tex b/macros/latex/contrib/lapdf/arcs.tex
new file mode 100644
index 0000000000..e61adb9efe
--- /dev/null
+++ b/macros/latex/contrib/lapdf/arcs.tex
@@ -0,0 +1,162 @@
+\input preamble.tex
+
+\Defnum(\a,-100)
+\Defnum(\b,20)
+\Defnum(\n,5)
+\Defdim(\r,1)
+
+% --------------------------------------------------------------------------
+\begin{document}
+\unitlength1.125cm
+
+\begin{center}
+{\Huge\bf{I. Arc}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Whilenum{\b<380}{\Stepcol(0,23,4)
+ \Arc(\n)(0,0)(\a,\b)(\Np\r) \Stroke
+ \Dadd(\r,0.35) \Sub(\a,10) \Add(\b,20) \Add(\n,5)}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{II. Sector}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Resetcol
+ \Whilenum{\b<380}{\Stepcol(0,23,4)
+ \Sector(\n)(0,0)(\a,\b)(\Np\r)
+ \Stroke
+ \Dadd(\r,0.35) \Sub(\a,10) \Add(\b,20) \Add(\n,5)}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{III. Arcto}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Setwidth(0.02)
+ \Moveto(-5,0)
+ \Red
+ \Arcto(64)(-5,+5)(+0,+5)(5)
+ \Green
+ \Arcto(64)(+5,+5)(+5,+0)(5)
+ \Blue
+ \Arcto(64)(+5,-5)(+0,-5)(5)
+ \Cyan
+ \Arcto(64)(-5,-5)(-5,+0)(5)
+
+ \Moveto(-2.83,+2.83)
+ \Red
+ \Arcto(64)(+0,+5.66)(+2.83,+2.83)(4)
+ \Green
+ \Arcto(64)(+5.66,+0)(+2.83,-2.83)(4)
+ \Blue
+ \Arcto(64)(+0,-5.66)(-2.83,-2.83)(4)
+ \Cyan
+ \Arcto(64)(-5.66,+0)(-2.83,+2.83)(4)
+
+ \Moveto(-6,0)
+ \Red
+ \Arcto(64)(-6,+6)(+0,+6)(2)
+ \Green
+ \Arcto(64)(+6,+6)(+6,+0)(2)
+ \Blue
+ \Arcto(64)(+6,-6)(+0,-6)(2)
+ \Cyan
+ \Arcto(64)(-6,-6)(-6,+0)(2)
+
+ \Moveto(-7,0)
+ \Red
+ \Arcto(64)(-7,+7)(+0,+7)(3)
+ \Green
+ \Arcto(64)(+7,+7)(+7,+0)(3)
+ \Blue
+ \Arcto(64)(+7,-7)(+0,-7)(3)
+ \Cyan
+ \Arcto(64)(-7,-7)(-7,+0)(3)
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{IV. Arcto}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Setwidth(0.02)
+ \Black
+ \Moveto(-0.5,3.5)
+ \Arcto(16)(-0.5,-6)(-3,-6)(2.5)
+ \Arcto(16)(-6,-6)(-6,-3)(2.5)
+ \Arcto(16)(-6,-0.5)(3,-0.5)(2.5)
+ \Arcto(16)(6,-0.5)(6,-3)(2.5)
+ \Arcto(16)(6,-6)(3,-6)(2.5)
+ \Arcto(16)(0.5,-6)(0.5,3)(2.5)
+ \Arcto(16)(0.5,6)(3,6)(2.5)
+ \Arcto(16)(6,6)(6,3)(2.5)
+ \Arcto(16)(6,0.5)(-3,0.5)(2.5)
+ \Arcto(16)(-6,0.5)(-6,3)(2.5)
+ \Arcto(16)(-6,6)(-3,6)(2.5)
+ \Arcto(16)(-0.5,6)(-0.5,3.5)(2.5)
+
+ \Red
+ \Moveto(-2,-1)
+ \Arcto(32)(-4,+0)(-2,+1)(1)
+ \Arcto(16)(-1.25,+1.25)(-1,+2)(1)
+ \Arcto(32)(+0,+4)(+1,+2)(1)
+ \Arcto(16)(+1.25,+1.25)(+2,+1)(1)
+ \Arcto(32)(+4,+0)(+2,-1)(1)
+ \Arcto(16)(+1.25,-1.25)(+1,-2)(1)
+ \Arcto(32)(+0,-4)(-1,-2)(1)
+ \Arcto(16)(-1.25,-1.25)(-2,-1)(1)
+
+ \Green
+ \Moveto(-4,-2)
+ \Arcto(32)(-8,+0)(-4,+2)(2)
+ \Arcto(16)(-2.5,+2.5)(-2,+4)(2)
+ \Arcto(32)(+0,+8)(+2,+4)(2)
+ \Arcto(16)(+2.5,+2.5)(+4,+2)(2)
+ \Arcto(32)(+8,+0)(+4,-2)(2)
+ \Arcto(16)(+2.5,-2.5)(+2,-4)(2)
+ \Arcto(32)(+0,-8)(-2,-4)(2)
+ \Arcto(16)(-2.5,-2.5)(-4,-2)(2)
+
+ \Blue
+ \Moveto(-6,0)
+ \Arcto(32)(-6,+6)(+0,+6)(5)
+ \Arcto(32)(+6,+6)(+6,+0)(5)
+ \Arcto(32)(+6,-6)(+0,-6)(5)
+ \Arcto(32)(-6,-6)(-6,+0)(5)
+
+ \Cyan
+ \Moveto(-2.83,+2.83)
+ \Arcto(32)(+0,+5.66)(+2.83,+2.83)(4)
+ \Arcto(32)(+5.66,+0)(+2.83,-2.83)(4)
+ \Arcto(32)(+0,-5.66)(-2.83,-2.83)(4)
+ \Arcto(32)(-5.66,+0)(-2.83,+2.83)(4)
+
+ \Magenta
+ \Moveto(-7,0)
+ \Arcto(32)(-7,+7)(+0,+7)(3)
+ \Arcto(32)(+7,+7)(+7,+0)(3)
+ \Arcto(32)(+7,-7)(+0,-7)(3)
+ \Arcto(32)(-7,-7)(-7,+0)(3)
+
+ \Yellow
+ \Moveto(-6.5,0)
+ \Arcto(32)(-6.5,+6.5)(+0,+6.5)(2.5)
+ \Arcto(32)(+6.5,+6.5)(+6.5,+0)(2.5)
+ \Arcto(32)(+6.5,-6.5)(+0,-6.5)(2.5)
+ \Arcto(32)(-6.5,-6.5)(-6.5,+0)(2.5)
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/bezier.pdf b/macros/latex/contrib/lapdf/bezier.pdf
new file mode 100644
index 0000000000..ae4acbeb25
--- /dev/null
+++ b/macros/latex/contrib/lapdf/bezier.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/bezier.tex b/macros/latex/contrib/lapdf/bezier.tex
new file mode 100644
index 0000000000..cba3df1352
--- /dev/null
+++ b/macros/latex/contrib/lapdf/bezier.tex
@@ -0,0 +1,43 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge\bf{Quadratic}}
+\bigskip
+
+\begin{lapdf}(16,8)(-8,-4)
+ \Blue
+ \Quadratic(-8,0)
+ (-4,+8)(+0,0)
+ (+4,-8)(+8,0)
+ (+4,+8)(+0,0)
+ (-4,-8)(-8,0) \Stroke
+ \Point(1)(-8,0)
+ \Point(1)(+0,0)
+ \Point(1)(+8,0)
+\end{lapdf}
+
+\em{4 quadratic Bezier curves}
+\end{center}
+\bigskip
+
+\begin{center}
+{\Huge\bf{Cubic}}
+\bigskip
+
+\begin{lapdf}(16,6)(-8,-3)
+ \Red
+ \Cubic(-8,0)
+ (-5,-8)(-3,8)(+0,0)
+ (+3,-8)(+5,8)(+8,0)
+ (+5,-8)(+3,8)(+0,0)
+ (-3,-8)(-5,8)(-8,0) \Stroke
+ \Point(1)(-8,0)
+ \Point(1)(+0,0)
+ \Point(1)(+8,0)
+\end{lapdf}
+
+\em{4 cubic Bezier curves}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/bezinfo.pdf b/macros/latex/contrib/lapdf/bezinfo.pdf
new file mode 100644
index 0000000000..87536f0d6e
--- /dev/null
+++ b/macros/latex/contrib/lapdf/bezinfo.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/bezinfo.tex b/macros/latex/contrib/lapdf/bezinfo.tex
new file mode 100644
index 0000000000..9cee401ee4
--- /dev/null
+++ b/macros/latex/contrib/lapdf/bezinfo.tex
@@ -0,0 +1,433 @@
+\documentclass[titlepage,a4paper,11pt]{report}
+\usepackage{shortvrb}
+\usepackage{array}
+\usepackage[color]{lapdf}
+
+\textheight24.92cm
+\textwidth15.92cm
+\oddsidemargin0cm
+\evensidemargin0cm
+\topmargin-0.3cm
+\headheight0cm
+\topskip0cm
+\headsep0cm
+\unitlength1cm
+
+\MakeShortVerb{\|}
+
+\def\it{\textit}
+\def\tt{\texttt}
+\def\sf{\textsf}
+\def\bf{\textbf}
+\def\em{\textit}
+\def\mr{\mathrm}
+\def\mb{\mathbf}
+\def\fr{\frac}
+\def\qq{\qquad}
+
+\def\syn{\item[Syntax]}
+\def\fun{\item[Function]}
+\def\exa{\item[Example]}
+\def\see{\item[See Also]}
+
+% -------------------------------------------
+\title{
+ \bf{\Huge Bezier Curves} \\ \vspace{0.6cm}
+ \bf{An Introduction}}
+\author{ \\
+ Detlef Reimers\\
+ detlefreimers@gmx.de\\
+ http://detlefreimers.de}
+\date{\today}
+
+% -------------------------------------------------------------------------
+\begin{document}
+
+\parindent0cm
+\maketitle
+
+% -------------------------------------------------------------------------
+\chapter{Bezier Curve Basics}
+\section{Linear Interpolation}
+This section will give you a basic introduction to bezier curves. We begin
+with the simplest curve form, a straight line. We can express any point
+$\mb{x}$ on this straight line by the two given points and the parameter $t$:
+\begin{equation}
+ \mb{x}=\mb{x}(t)=(t-1)\mb{a}+t\mb{b}.
+\end{equation}
+For $t=0$ the straight line passes through $\mb{a}$, and for $t=1$
+it passes through $\mb{b}$. For $0\le t\le 1$ the point $\mb{x}$
+is between $\mb{a}$ and $\mb{b}$, while for all other values of $t$
+it is outside (see Figure 1).
+\begin{center}
+\begin{lapdf}(6,3.6)(0,-0.3)
+ \Dash(0)
+ \Red
+ \Line(0,0)(6,3) \Stroke
+ \Point(1)(1,0.5)
+ \Point(0)(2.5,1.25)
+ \Point(1)(5,2.5)
+ \Text(1,0.7,bc){$\mb{a}$}
+ \Text(2.5,1.45,bc){$\mb{x}$}
+ \Text(5,2.7,bc){$\mb{b}$}
+ \Text(1.8,0.5,bc){$t$}
+ \Text(2.5,0.7,bc){:}
+ \Text(4.1,1.5,bc){$1-t$}
+\end{lapdf}
+
+\it{\bf{Figure 1}: Line interpolation on a straight line}
+\end{center}
+The point $\mb{x}$ divides the straight line segment between $\mb{a}$
+and $\mb{b}$ in the ratio $t:1-t$ and any point on the straight line can be
+calculated by changing this parameter. If t lies between $\mb{a}$ and
+$\mb{b}$, then $t\in [0,1]$. We can remove this restriction for $t$, if
+we define $t=(u-a)/(b-a)$ with $u\in [a,b]$, we get:
+\begin{equation}
+ \mb{x}=\mb{x}(t)=\fr{b-u}{b-a}\mb{a}+\fr{u-a}{b-a}\mb{b}.
+\end{equation}
+For $u=a$ the point is $\mb{x}=\mb{a}$ and for $u=b$ it is $\mb{x}=\mb{b}$
+accordingly. Notice, that the value of the ratio $t:1-t$ did not change
+after this reparametrisation.
+\begin{equation}
+ ratio(\mb{a,x,b}):=\fr{t}{1-t}=\fr{u-a}{b-u}.
+\end{equation}
+One of the most fundamental properties of the linear interpolation is its
+\it{affine invariance}. This means, if you apply any affine map like
+translation, scaling, rotation, shearing or parallel projection to the
+points and then calculate $\mb{x}$, the result will the same as if you first
+calculated the point and then applied the affine map to the three points.
+
+It should also be mentioned, that from a numerical point of view the linear
+interpolation is a stable mathematical operation. This means that small changes
+in the supplied values never lead to sudden great changes in the result. The well
+known Horner's schema for instance, which can be used to evaluate polynomials,
+is a bad example in this area.
+
+\section{Quadratic Bezier Curves}
+We now want to use the results from the linear case to develop the
+most elementary nonlinear curve form, the \it{parabola}. The main idea
+is very simple: we use repeated linear interpolations to compute a point
+on a parabola (a quadratic curve). Let $\mb{p}_0,\mb{p}_1,\mb{p}_2$ be
+three given points and let $t\in \mb{\Re}$. Now we build:
+\begin{eqnarray*}
+ \mb{p}_0^1(t) & = & (1-t)\mb{p}_0+t\mb{p}_1 \\
+ \mb{p}_1^1(t) & = & (1-t)\mb{p}_1+t\mb{p}_2 \\
+ \mb{p}_0^2(t) & = & (1-t)\mb{p}_0^1(t)+t\mb{p}_1^1(t).
+\end{eqnarray*}
+Inserting the first two equations into the third one, we get:
+\begin{eqnarray}
+ \mb{p}_0^2(t) & = & (1-t)^2\mb{p}_0+2(1-t)t\mb{p}_1+t^2\mb{p}_2.
+\end{eqnarray}
+This formula represents a quadratic expression in $t$. We use the
+superscript here to denote the curve degree. So, we can say that
+$\mb{p}_0^2$ traces out a parabolic curve, if $t$ varies from $-\infty$
+to $+\infty$. The first three expressions clearly show that we only used
+repeated linear interpolation to compute a curve point and we can state,
+that this curve construction is \it{affine invariant}. Look at Figure 2
+for the geometric construction of the curve point $\mb{p}_0^2$ for $t=1/3$.
+\begin{center}
+\begin{lapdf}(10,7.6)(0,0.2)
+ \Setwidth(0.01)
+ \Black
+ \Polygon(1,2)(7,7)(9,1) \Stroke
+ \Dash(1)
+ \Line(3,3.667)(7.667,5) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Curve(64)(1,2)(7,7)(9,1) \Stroke
+ \Point(1)(1,2)
+ \Point(1)(7,7)
+ \Point(1)(9,1)
+ \Point(1)(3,3.667)
+ \Point(1)(7.667,5)
+ \Point(0)(4.556,4.111)
+ \Text(1,1.6,bc){$\mb{p}_0$}
+ \Text(7,7.2,bc){$\mb{p}_1$}
+ \Text(9,0.6,bc){$\mb{p}_2$}
+ \Text(2.7,3.7,bc){$\mb{p}_0^1$}
+ \Text(8,4.9,bc){$\mb{p}_1^1$}
+ \Text(4.556,3.62,bc){$\mb{p}_0^2$}
+\end{lapdf}
+
+\it{\bf{Figure 2}: Repeated Line interpolation on a parabola}
+\end{center}
+For $t\in [0,1]$ the curve lies in the triangle formed by
+$\mb{p}_0,\mb{p}_1,\mb{p}_2$. This is called the \it{convex hull property}.
+As special points we have $\mb{p}^2(0)=\mb{p}_0$ and $\mb{p}^2(1)=\mb{p}_2$.
+If the point $\mb{p}_1$ only lies on the curve, it must be a straight line.
+The construction also shows the following property:
+\begin{equation}
+ ratio(\mb{p}_0,\mb{p}_0^1,\mb{p}_1)=ratio(\mb{p}_1,\mb{p}_1^1,\mb{p}_2)
+ =ratio(\mb{p}_0^1,\mb{p}_0^2,\mb{p}_1^1)=\fr{t}{1-t}.
+\end{equation}
+All ratios are equal, this proves the affine invariance of the curve
+construction. If you look at the generated curve, you see that for $t=0$
+the curve is tangent to the line $\mb{p}_0\mb{p}_1$ and for $t=1$ it is
+tangent to the line $\mb{p}_1\mb{p}_2$. We come back to this fact later.
+
+The geometric construction is based on the principle of repeated linear
+interpolation and the curve point is obtained by the last interpolation.
+This principle is the underlying concept for the construction of all
+\it{bezier curves} of any degree $n$. If we want to construct an $n$
+degree curve, we need $n+1$ \it{control points}. The number of linear
+interpolations, needed to compute a point on a curve of degree $n$, is:
+\begin{equation}
+ N=\fr{n(n+1)}{2}
+\end{equation}
+
+\section{Cubic Bezier Curves}
+Parabolas cannot form real space curves, because the three control points
+always build a plane. This leads us to the next class of curves, the cubic
+curves.
+
+Here we have four control points $\mb{p}_0,\mb{p}_1,\mb{p}_2,,\mb{p}_3$
+and let $t\in \mb{\Re}$. We compute a curve point with the following
+construction:
+\begin{eqnarray*}
+ \mb{p}_0^1(t) & = & (1-t)\mb{p}_0+t\mb{p}_1 \\
+ \mb{p}_1^1(t) & = & (1-t)\mb{p}_1+t\mb{p}_2 \\
+ \mb{p}_2^1(t) & = & (1-t)\mb{p}_2+t\mb{p}_3 \\
+ \mb{p}_0^2(t) & = & (1-t)\mb{p}_0^1(t)+t\mb{p}_1^1(t) \\
+ \mb{p}_1^2(t) & = & (1-t)\mb{p}_1^1(t)+t\mb{p}_2^1(t) \\
+ \mb{p}_0^3(t) & = & (1-t)\mb{p}_0^2(t)+t\mb{p}_1^2(t).
+\end{eqnarray*}
+Inserting the first three equations into the next two, we obtain:
+\begin{eqnarray*}
+ \mb{p}_0^2(t) & = & (1-t)^2\mb{p}_0+2(1-t)t\mb{p}_1+t^2\mb{p}_2 \\
+ \mb{p}_1^2(t) & = & (1-t)^2\mb{p}_1+2(1-t)t\mb{p}_2+t^2\mb{p}_3.
+\end{eqnarray*}
+Again, we insert these two equations into the last one, and get this:
+\begin{eqnarray*}
+ \mb{p}_0^3(t) & = & (1-t)^3\mb{p}_0+2(1-t)^2t\mb{p}_1+(1-t)t^2\mb{p}_2
+ +(1-t)^2t\mb{p}_1+2(1-t)t^2\mb{p}_2+t^3\mb{p}_3.
+\end{eqnarray*}
+After some simplifications, we obtain this result:
+\begin{eqnarray}
+ \mb{p}_0^3(t)=(1-t)^3\mb{p}_0+3(1-t)^2t\mb{p}_1+3(1-t)t^2\mb{p}_2
+ +t^3\mb{p}_3.
+\end{eqnarray}
+Now, $\mb{p}_0^3$ is our point on the curve at parameter value $t$ and
+we see that the construction is principally the same as in the quadratic
+case. In Figure 3 you see the geometric construction for $t=1/2$:
+\begin{center}
+\begin{lapdf}(10,7.4)(0,0.3)
+ \Setwidth(0.01)
+ \Black
+ \Polygon(1,2)(4,7)(8,6)(9,1) \Stroke
+ \Dash(1)
+ \Polygon(2.5,4.5)(6,6.5)(8.5,3.5) \Stroke
+ \Line(4.25,5.5)(7.25,5) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Curve(64)(1,2)(4,7)(8,6)(9,1) \Stroke
+ \Point(1)(1,2)
+ \Point(1)(4,7)
+ \Point(1)(8,6)
+ \Point(1)(9,1)
+ \Point(1)(2.5,4.5)
+ \Point(1)(6,6.5)
+ \Point(1)(8.5,3.5)
+ \Point(1)(4.25,5.5)
+ \Point(1)(7.25,5)
+ \Point(0)(5.75,5.25)
+ \Text(1,1.6,bc){$\mb{p}_0$}
+ \Text(4,7.2,bc){$\mb{p}_1$}
+ \Text(8,6.2,bc){$\mb{p}_2$}
+ \Text(9,0.6,bc){$\mb{p}_3$}
+ \Text(2.2,4.5,bc){$\mb{p}_0^1$}
+ \Text(6,6.7,bc){$\mb{p}_1^1$}
+ \Text(8.8,3.5,bc){$\mb{p}_2^1$}
+ \Text(4.0,5.6,bc){$\mb{p}_0^2$}
+ \Text(7.5,5.1,bc){$\mb{p}_1^2$}
+ \Text(5.75,4.7,bc){$\mb{p}_0^3$}
+\end{lapdf}
+
+\it{\bf{Figure 3}: Repeated Line interpolation on a cubic}
+\end{center}
+From equation (7) we see, that this is a cubic expression in $t$, so
+the obtained curve is a cubic curve. This is the first curve form that
+can build space curves, because four control points can live in space
+and not only in a plane.
+
+This curve is also affine invariant and we need 6 linear interpolations,
+to compute a point $\mb{p}_0^3$ on the curve. If we look at the curve
+form, we see that for $t=0$ the curve is tangent to the line
+$\mb{p}_0\mb{p}_1$ and for $t=1$ it is tangent to the line
+$\mb{p}_1\mb{p}_2$. We already mentioned this fact for the parabola.
+Cubic curve are always inside the convex hull of the four control points.
+
+Parametric cubic curves have much more form variations than parabolas,
+they can have inflection points, nodes (points of self intersection)
+or even a cusp (point, in which the curve has two tangents). Therefore
+these cubic curves are used as the major curve forms in Postscript, PDF
+or in vector drawing and CAD programs.
+
+\section{Rational Quadratic Bezier Curves}
+As last curve form I want to introduce rational quadratic bezier curves.
+They are very important, because they can exactly produce conic curves like
+parabolas, hyperbolas, ellipses and circles.
+
+These curves are a generalisation of their so called integral counterparts,
+because they include them but they have even more form variations than
+the integral bezier curves.
+
+Generally spoken, rational curves lie in another space as integral curves.
+If you draw a circle on a piece of paper and rotate the paper in front of
+your eyes, you'll see an ellipse. It's a so called projection of the circle.
+If you repeat this experiment with a parabola, you might see a hyperbola.
+If we look at this subject backwards, we can state that every rational
+quadratic bezier curve in 3D-space can be seen as a projection of an
+integral quadratic bezier curve in the plane. This is fundamental for the
+understanding of rational bezier curves.
+
+We can deal with rational curves just the way we did with integral curves,
+but we have to put them first in a so called homogeneous space. This has
+one more coordinate, the weight of a point. In the rational case, every
+bezier point has an $x$-value, an $y$-value and a weight $w$. In normal
+space, each point of a bezier curve has the weight $w=1$. This weight can
+be interpreted as the $z$-coordinate of a point.
+
+Here is the mathematical description of a rational quadratic bezier curve:
+\begin{eqnarray}
+ \mb{p}(t) & = & \fr{(1-t)^2w_0\mb{p}_0+2(1-t)tw_1\mb{p}_1+t^2w_2\mb{p}_2}
+ {(1-t)^2w_0+2(1-t)tw_1+t^2w_2}.
+\end{eqnarray}
+As you can see, every point is associated with it's own weight. This is the
+general form of a rational quadratic bezier curve. With some more involved
+math it can be translated into a simpler form, which is called the
+\it{standard form} and it looks like this:
+\begin{eqnarray}
+ \mb{p}(t) & = & \fr{(1-t)^2\mb{p}_0+2(1-t)tw\mb{p}_1+t^2\mb{p}_2}
+ {(1-t)^2+2(1-t)tw+t^2}.
+\end{eqnarray}
+The outer weights $w_0$ and $w_2$ are gone (their value is 1) and the central inner weight is transformed to $w$. The term \it{rational} simply reflects the fact, that every rational bezier curve is build from a rational expression, which is much more complicated then the expression for integral curves.
+
+But now comes the magic of homogeneous coordinates. If we do the following
+transformation at the very beginning of our curve calculation:
+\begin{eqnarray}
+ x \rightarrow x \cdot w & y \rightarrow y \cdot w & z \rightarrow w,
+\end{eqnarray}
+we can compute the curve points without any fractional math in the same way
+as we did in the integral case. But before we draw the point, we have to
+transform it back to the so called affine space (here: our normal 2D-space)
+with the following caculations:
+\begin{eqnarray}
+ x \rightarrow x / w & y \rightarrow y / w & z \rightarrow 1,
+\end{eqnarray}
+I'm not going to explain the mathematical background, but I want to mention
+that this is the reason, why homogeneous coordinates are used in so many
+advanced graphic algorithms. If we go back to our paper example, we can say
+that changing from affine space to homogeneous space is like the projective
+view of the original shape and changing it back gives us the original. In the style file you can look up the |Rcurve| macro to see how this is
+implemented in \TeX. \it{Figure 4} shows several conic curves, which all share the same bezier points, only the inner weight $w$ changes.
+\begin{center}
+\begin{lapdf}(11,9.5)(-5.5,-3.3)
+ \Setwidth(0.01)
+ \Black
+ \Polygon(-5,0.5)(2,6)(5,-0.5) \Stroke
+ \Dash(1)
+ \Line(-1,-3)(2,6) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rcurve(64)(-5,0.5,1)(2,6,3)(5,-0.5,1) \Stroke
+ \Green
+ \Rcurve(64)(-5,0.5,1)(2,6,1)(5,-0.5,1) \Stroke
+ \Blue
+ \Rcurve(64)(-5,0.5,3)(2,6,1)(5,-0.5,3) \Stroke
+ \Cyan
+ \Rcurve(64)(-5,0.5,3)(2,6,0)(5,-0.5,1) \Stroke
+ \Magenta
+ \Rcurve(96)(-5,0.5,3)(2,6,-1)(5,-0.5,3) \Stroke
+ \Point(1)(-5,0.5)
+ \Point(1)(2,6)
+ \Point(1)(5,-0.5)
+ \Point(1)(1.5,4.5)
+ \Point(1)(1,3)
+ \Point(1)(0.5,1.5)
+ \Point(1)(0,0)
+ \Point(1)(-1,-3)
+ \Text(-5.1,0.55,br){$P_0$}
+ \Text(2,6.2,bc){$P_1$}
+ \Text(5.1,-0.5,bl){$P_2$}
+ \Text(-0.9,-3,bl){$-1/3$}
+ \Text(0.15,0.05,bl){$w=0$}
+ \Text(0.65,1.5,bl){$1/3$}
+ \Text(1.15,3.05,bl){$1$}
+ \Text(1.62,4.55,bl){$3$}
+ \Text(-5.6,5.5,tl){$w^2>1$: Hyperbola}
+ \Text(-5.6,4.9,tl){$w^2=1$: Parabola}
+ \Text(-5.6,4.3,tl){$w^2<1$: Ellipse}
+ \Text(-5.6,3.7,tl){$w^2=0$: Line}
+\end{lapdf}
+
+\it{\bf{Figure 4}: Various conic arcs defined by $w=(3,1,1/3,0,-1/3)$}.
+\end{center}
+To the left of the picture is the curve form classification corresponding to
+different values of $w$. You may ask now: ``\it{Where is the circle?}''. Well, that's no real problem. Without any proof here follows the answer. Let's first name the angle, formed by the bezier polygon. We call it $a$. As we saw before, the circle is simply a special case of an ellipse. The ellipse is actually a circle, if the following condition holds:
+\begin{eqnarray}
+ w & = & \cos(a).
+\end{eqnarray}
+Here is an example of a circle, build with two rational quadratic bezier curves:
+\begin{center}
+\begin{lapdf}(6,8)(-3,-2.6)
+ \Setwidth(0.01)
+ \Black
+ \Polygon(+2.167,+1.25)(+0.00,+5.0)(-2.167,+1.25) \Stroke
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+2.167,+1.25,2)
+ \Rcurveto(64)(+0.00,+5.0,1)(-2.167,+1.25,2)
+ \Rcurveto(96)(+0.00,+5.0,-1)(+2.167,+1.25,2) \Stroke
+ \Point(1)(+2.167,+1.25)
+ \Point(1)(+0.00,+5.0)
+ \Point(1)(-2.167,+1.25)
+ \Text(0,4.6,tc){$a$}
+ \Text(1,4.73,tl){$w=\cos 60^\circ=0.5$}
+ \Text(0,2.2,tc){$w=0.5$}
+ \Text(0,-2.2,bc){$w=-0.5$}
+ \Text(-2.24,+1.29,br){$P_0$}
+ \Text(+0.05,+5.13,bc){$P_1$}
+ \Text(+2.22,+1.28,bl){$P_2$}
+\end{lapdf}
+
+\it{\bf{Figure 5}: A full circle with two rational quadratic bezier curves.}
+\end{center}
+Both curves share the same bezier points, but the lower one (the complementary curve) has negative weight $-w$. Everytime you want to draw the complementary rational curve, you only have to negate the weight value.
+
+Now it's up to you. I hope, this short introduction into the world of bezier
+curves has risen your appetite. There are many good books around, which deal
+with this subject. Look at the end of this paper for some suggestions.
+
+\section{Additional Readings}
+Depending on the levels of insight you want to achieve, there are lots of
+good books and free literature on the market and on the internet. I want
+to give you some suggestions for literature, that will help you to learn
+more about graphics programming.
+
+\begin{thebibliography}{0}
+ \bibitem{1} MORTENSON M.E.: \textsl{Mathematics for Computer Graphics
+ Applications},
+ Industrial Press, Inc., 2 ed. 1999.
+
+ \bibitem{2} FOLEY, VAN DAM.: \textsl{Computer Graphics -- Principles
+ and Practice}, Addison-Wesley, 2 ed. 1996.
+
+ \bibitem{3} PAETH, ALAN W.: \textsl{Graphics GEMS I-V},
+ AP Professional, 1995.
+
+ \bibitem{4} ABRASH, MICHAEL.: \textsl{Graphics Programming Black Book},
+ Coriolis Group Books, 1997.
+
+ \bibitem{5} FARIN G.: \it{Curves and Surfaces For Computer Aided
+ Geometric Design -- A Practical Guide}, Academic Press, 2 ed. 1999.
+
+ \bibitem{6} FARIN G.: \it{NURBS -- from Projective Geometry to
+ Practical Use}, A K Peters Ltd., Natick, MA, 2 ed. 1990.
+
+ \bibitem{7} PIEGL L. \& TILLER W.: \it{The NURBS Book}, Springer, 2 ed. 1997.
+\end{thebibliography}
+
+\end{document}
diff --git a/macros/latex/contrib/lapdf/buttrfly.pdf b/macros/latex/contrib/lapdf/buttrfly.pdf
new file mode 100644
index 0000000000..097d1c9f39
--- /dev/null
+++ b/macros/latex/contrib/lapdf/buttrfly.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/buttrfly.tex b/macros/latex/contrib/lapdf/buttrfly.tex
new file mode 100644
index 0000000000..df8ea18e6d
--- /dev/null
+++ b/macros/latex/contrib/lapdf/buttrfly.tex
@@ -0,0 +1,31 @@
+% ---------------------------------------------------------------------------
+% The butterfly curve is defined by the equation:
+% r=exp(cos(a))-2*cos(4*a)+sin^5(a/n). (we use n = 14)
+% ---------------------------------------------------------------------------
+\input preamble.tex
+
+\Defnum(\n,0)
+\newcount\m
+\newdimen\x
+\newdimen\y
+\newdimen\z
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{The Butterfly Curve}}
+\bigskip
+
+\begin{lapdf}(16,16)(-7,-8)
+ \col=6
+ \def\Px(#1,#2){\Dset(\x,#1) \y=4\x \z=0.0714\x
+ \Cos(\Np\x,\x) \Exp(\Np\x,#2) \Cos(\Np\y,\y) \Mul(\y,2)
+ \Sin(\Np\z,\z) \Pot(\Np\z,5,\z) \Sub(#2,\y) \Add(#2,\z) #2=2.2#2}
+
+ \Whilenum{\n<24}{%
+ \m=\n \Add(\m,1) \Stepcol(0,23, 2) \Pplot(100)(\n,\m) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$r(\phi)=exp(\cos(\phi))-2cos(4\phi)+sin^5(\phi/14)$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/cfamily.pdf b/macros/latex/contrib/lapdf/cfamily.pdf
new file mode 100644
index 0000000000..beffafd29c
--- /dev/null
+++ b/macros/latex/contrib/lapdf/cfamily.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/cfamily.tex b/macros/latex/contrib/lapdf/cfamily.tex
new file mode 100644
index 0000000000..49d36366ff
--- /dev/null
+++ b/macros/latex/contrib/lapdf/cfamily.tex
@@ -0,0 +1,124 @@
+\input preamble.tex
+
+\Defdim(\k,-0.7)
+\newdimen\a
+\newdimen\b
+\newdimen\x
+\newdimen\y
+
+\def\dsp{\displaystyle}
+
+% -------------------------------------------------------------------------
+\begin{document}
+\unitlength1.3cm
+
+\begin{center}
+{\huge \bf{Curve Family I}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Lingrid(10)(1,3)(-7,7)(-7,7)
+ \Rect(-7,-7,14,14)
+ \Setclip
+ \def\FamilyI(#1){\Polynom(-7,+7)(0.1,#1,0,#1) \Stroke}
+ \Whiledim{\k<0.8}{\Stepcol(0,23,2) \FamilyI(\Np\k) \Dadd(\k,0.1)}
+ \Setwidth(0.01)
+ \Black
+ \Dash(1)
+ \Polynom(-7,+7)(-0.05,0,-0.15,0) \Stroke
+ \Dash(0)
+ \Point(1)(+4.67,-5.78)
+ \Point(1)(+4.00,-3.80)
+ \Point(1)(+3.33,-2.35)
+ \Point(1)(+2.67,-1.35)
+ \Point(1)(+2.00,-0.70)
+ \Point(1)(+1.33,-0.32)
+ \Point(1)(+0.67,-0.11)
+ \Point(1)(+0.00,+0.00)
+ \Point(1)(-0.67,+0.11)
+ \Point(1)(-1.33,+0.32)
+ \Point(1)(-2.00,+0.70)
+ \Point(1)(-2.67,+1.35)
+ \Point(1)(-3.33,+2.35)
+ \Point(1)(-4.00,+3.80)
+ \Point(1)(-4.67,+5.78)
+ \Text(-5.8,5,rb){$k=7$}
+ \Text(5.8,-5,lt){$k=-7$}
+ \Text(-4.6,6.2,lb){$f_{e}(x)=-\dsp\frac{1}{20}(x^3+3x)$}
+\end{lapdf}
+
+$f_{k}(x)=\dsp\frac{1}{10}(x^3+kx^2+k)$ \qquad $k = -7 \dots +7$
+
+\newpage
+
+{\huge \bf{Curve Family II}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Lingrid(10)(1,3)(-7,7)(-7,7)
+ \Rect(-7,-7,14,14)
+ \Setclip
+ \def\FamilyII(#1){\Polynom(-7,+7)(0.1,#1,0.1,0) \Stroke}
+ \Whiledim{\k<0.8}{\Stepcol(0,23,2) \FamilyII(\Np\k) \Dadd(\k,0.1)}
+ \Setwidth(0.01)
+ \Black
+ \Dash(1)
+ \Polynom(-7,+7)(-0.05,0,0.05,0) \Stroke
+ \Dash(0)
+ \Point(1)(+4.59,-4.62)
+ \Point(1)(+3.91,-2.80)
+ \Point(1)(+3.23,-1.52)
+ \Point(1)(+2.54,-0.69)
+ \Point(1)(+1.82,-0.21)
+ \Point(1)(+1.00,+0.00)
+ \Point(1)(+0.00,+0.00)
+ \Point(1)(-1.00,+0.00)
+ \Point(1)(-1.82,+0.21)
+ \Point(1)(-2.54,+0.69)
+ \Point(1)(-3.23,+1.52)
+ \Point(1)(-3.91,+2.80)
+ \Point(1)(-4.59,+4.62)
+ \Text(-5.6,4.1,rb){$k=7$}
+ \Text(5.6,-4.1,lt){$k=-7$}
+ \Text(-4.9,6.2,lb){$f_{e}(x)=-\dsp\frac{1}{20}(x^3-x)$}
+\end{lapdf}
+
+$f_{k}(x)=\dsp\frac{1}{10}(x^3+kx^2+x)$ \qquad $k = -7 \dots +7$
+
+\newpage
+
+{\huge \bf{Curve Family III}}
+\bigskip
+
+\begin{lapdf}(13,11)(-5,-3)
+ \Lingrid(10)(1,3)(-5,8)(-3,8)
+ \Rect(-5,-3,13,11)
+ \Setclip
+ \def\Fx(#1,#2){\Dset(\x,#1) \y=2\k \Sub(\y,\x)
+ \Exp(\Np\y,#2) \Add(#2,\x) \y=3\k \Sub(#2,\y)}
+ \Dset(\k,-1)
+ \Whiledim{\k<3.5}{
+ \a=\k \Dsub(\a,3.25) \b=\k \Dadd(\b,8)
+ \Stepcol(0,23,2) \Fplot(96)(\Np\a,\Np\b) \Stroke \Dadd(\k,0.5)}
+ \Setwidth(0.01)
+ \Black
+ \Dash(1)
+ \Polynom(-4,+7)(0,0,-0.5,1) \Stroke
+ \Dash(0)
+ \Point(1)(-2.0,+2.0)
+ \Point(1)(-1.0,+1.5)
+ \Point(1)(+0.0,+1.0)
+ \Point(1)(+1.0,+0.5)
+ \Point(1)(+2.0,+0.0)
+ \Point(1)(+3.0,-0.5)
+ \Point(1)(+4.0,-1.0)
+ \Point(1)(+5.0,-1.5)
+ \Point(1)(+6.0,-2.0)
+ \Text(-4.7,7.7,lt){$k=-1$}
+ \Text(+2.9,7.7,lt){$k=+3$}
+ \Text(-4.9,2.1,lb){$y_e=1-\dsp\frac{x}{2}$}
+\end{lapdf}
+
+$f_{k}(x)=e^{\dsp{2k-x}}+x-3k$ \qquad $k = -1 \dots +3$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/chrysant.pdf b/macros/latex/contrib/lapdf/chrysant.pdf
new file mode 100644
index 0000000000..c268ecd199
--- /dev/null
+++ b/macros/latex/contrib/lapdf/chrysant.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/chrysant.tex b/macros/latex/contrib/lapdf/chrysant.tex
new file mode 100644
index 0000000000..351c497878
--- /dev/null
+++ b/macros/latex/contrib/lapdf/chrysant.tex
@@ -0,0 +1,34 @@
+% ---------------------------------------------------------------------------
+% The chrysanteme curve is defined by the equation:
+% r=5(1+sin(11a/5)-4sin^4(17a/3)*sin^8(2cos(3a)-14a)).
+% ---------------------------------------------------------------------------
+\input preamble.tex
+
+\Defnum(\n,0)
+\newcount\m
+\newdimen\a
+\newdimen\x
+\newdimen\y
+\newdimen\z
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength0.88cm
+
+\begin{center}
+{\Huge \bf{The Chrysanteme Curve}}
+\bigskip
+
+\begin{lapdf}(18,20)(-9,-10)
+ \def\Px(#1,#2){\Dset(\a,#1) \x=2.2\a \y=5.667\a \z=3\a \a=14\a
+ \Sin(\Np\x,#2) \Dadd(#2,1) #2=1.25#2 \Sin(\Np\y,\y)
+ \Cos(\Np\z,\z) \Sub(\z,\a) \Add(\z,\z) \Sin(\Np\z,\z)
+ \Dmul(\z,\z) \Dmul(\y,\z) \Pot(\Np\y,4,\y) \Sub(#2,\y) #2=4#2}
+
+ \Whilenum{\n<24}{%
+ \m=\n \Add(\m,1) \Nextcol(0, 23) \Pplot(100)(\n,\m) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$r(\phi)=5(1+\sin(11\phi/5)-4\sin^4(17\phi/3)\sin^8(2\cos(3\phi)-14\phi))$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/circle.pdf b/macros/latex/contrib/lapdf/circle.pdf
new file mode 100644
index 0000000000..7c47190401
--- /dev/null
+++ b/macros/latex/contrib/lapdf/circle.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/circle.tex b/macros/latex/contrib/lapdf/circle.tex
new file mode 100644
index 0000000000..55ad9bc03e
--- /dev/null
+++ b/macros/latex/contrib/lapdf/circle.tex
@@ -0,0 +1,37 @@
+\input preamble.tex
+
+\Defdim(\d,0)
+\Defdim(\t,0)
+\Defdim(\x,0)
+\Defdim(\y,0)
+
+\def\Ncirc(#1){%
+ \Rad(#1,\t)
+ \Cos(\Np\t,\x) \Dmul(\x,4.8pt)
+ \Sin(\Np\t,\y) \Dmul(\y,4.8pt)
+ \Circle(64)(\Np\x,\Np\y,4) \Stroke}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge\bf{Circle I}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Whiledim{\d<9}{\Dadd(\d,0.3) \Nextcol(0,23) \Circle(96)(0,0,\Np\d) \Stroke}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{Circle II}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Setwidth(0.02)
+ \Resetcol
+ \Whiledim{\d<360}{\Nextcol(0,23) \Ncirc(\Np\d) \Dadd(\d,15)}
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/colors.pdf b/macros/latex/contrib/lapdf/colors.pdf
new file mode 100644
index 0000000000..9c8d3baa4f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/colors.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/colors.tex b/macros/latex/contrib/lapdf/colors.tex
new file mode 100644
index 0000000000..1e28ebc447
--- /dev/null
+++ b/macros/latex/contrib/lapdf/colors.tex
@@ -0,0 +1,72 @@
+\input preamble.tex
+
+\newcount\k
+\newcount\m
+\newcount\n
+\newcount\ra
+\newcount\rb
+
+\newdimen\a
+\newdimen\w
+\newdimen\xa
+\newdimen\ya
+\newdimen\xb
+\newdimen\yb
+
+\gdef\Segment(#1,#2){%
+ \n=0
+ \Whilenum{\n<360}{%
+ \m=\n \Mod(\m,15)
+ \ifnum\m=0 \Nextcol(\k,96) \fi
+ \Dset(\w,0.054) \Mul(\w,#2) \Setwidth(\Np\w)
+ \Dset(\a,\n) \Dsub(\a,5.8) \Rad(\Np\a,\a)
+ \Cos(\Np\a,\xa) \xb=#2\xa \Mul(\xa,#1)
+ \Sin(\Np\a,\ya) \yb=#2\ya \Mul(\ya,#1)
+ \Moveto(\Np\xa,\Np\ya) \Lineto(\Np\xb,\Np\yb) \Stroke \Add(\n,3)}
+ \White
+ \Setwidth(0.03)
+ \ifnum#2<5 \Arc(128)(0,0)(0,360)(#2) \Stroke \fi}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.5cm
+
+\begin{center}
+{\Huge \bf{\Lapdf{} Step-Colors}}
+\bigskip
+
+\begin{lapdf}(12,12)(-6,-7)
+ \Setcap(0)
+ \rb=5
+ \k=0
+ \Whilenum{\rb>1}{%
+ \ra=\rb \Sub(\ra,1)
+ {\Segment(\ra,\rb)} \Add(\k,24) \Sub(\rb,1)}
+
+ \n=0
+ \White
+ \Setwidth(0.03)
+ \Whilenum{\n<360}{%
+ \Dset(\a,\n) \Dsub(\a,7.5) \Rad(\Np\a,\a)
+ \Cos(\Np\a,\xa) \xb=5\xa
+ \Sin(\Np\a,\ya) \yb=5\ya
+ \Moveto(\Np\xa,\Np\ya) \Lineto(\Np\xb,\Np\yb) \Stroke \Add(\n,15)}
+
+ \n=0
+ \Dset(\xa,-4.75)
+ \Setwidth(0.105)
+ \Resetcol
+ \Whilenum{\n<96}{%
+ \Nextcol(0,96)
+ \Line(\Np\xa,-7)(\Np\xa,-6) \Stroke \Dadd(\xa,0.1) \Add(\n,1)}
+
+ \Black
+ \Setwidth(0.02)
+ \Rectangle(-4.8,-7)(9.6,1)(0) \Stroke
+\end{lapdf}
+\bigskip
+
+These are the 96 colors, used for {\it Stepcol(c1,c2,s)} and
+{\it Nextcol(c1,c2)}.
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/conic.pdf b/macros/latex/contrib/lapdf/conic.pdf
new file mode 100644
index 0000000000..0145129f83
--- /dev/null
+++ b/macros/latex/contrib/lapdf/conic.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/conic.tex b/macros/latex/contrib/lapdf/conic.tex
new file mode 100644
index 0000000000..61109d2b8a
--- /dev/null
+++ b/macros/latex/contrib/lapdf/conic.tex
@@ -0,0 +1,68 @@
+\input preamble.tex
+
+\def\bf{\textbf}
+\def\it{\textit}
+\def\tt{\texttt}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength0.85cm
+
+\begin{center}
+{\Huge \bf{Drawing with \pdfTeX} \bigskip}
+\end{center}
+
+Now you can draw arbitrary lines, polygons, integral and rational bezier
+curves up to a degree of seven within your \pdfTeX{} document. The \Lapdf{}
+style allows to draw directly with PDF, without any other files. You can
+scale your drawing and use drawing primitives that look and function like
+corresponding postscript commands. You can use PDF drawing primitives and
+also \LaTeX{} typesetting of text in the same environment.
+
+\begin{center}
+\begin{lapdf}(18,18)(-9,-6)
+ \Red
+ \Rcurve(64)(-8,0,1)(2,12,3)(8,0,1) \Stroke
+ \Green
+ \Rcurve(64)(-8,0,1)(2,12,1)(8,0,1) \Stroke
+ \Blue
+ \Rcurve(64)(-8,0,3)(2,12,1)(8,0,3) \Gfill(0.9)
+ \Dgray
+ \Rcurve(64)(-8,0,1)(2,12,0)(8,0,1) \Stroke
+ \Magenta
+ \Rcurve(64)(-8,0,3)(2,12,-1)(8,0,3) \Gfill(0.9)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Black
+ \Polygon(-8,0)(2,12)(8,0) \Stroke
+ \Line(-1,-6)(2,12) \Stroke
+ \Dash(0)
+ \Point(0)(-8,0)
+ \Point(0)(2,12)
+ \Point(0)(8,0)
+ \Point(1)(1.5,9)
+ \Point(1)(1,6)
+ \Point(1)(0.5,3)
+ \Point(1)(0,0)
+ \Point(1)(-1,-6)
+ \Text(-8.0,0.2,br){$P_0$}
+ \Text(2,12.2,bc){$P_1$}
+ \Text(8.0,0.2,bl){$P_2$}
+ \Text(-0.8,-5.8,bl){$-1/3$}
+ \Text(0.2,0.2,bl){$w=0$}
+ \Text(0.7,3.2,bl){$1/3$}
+ \Text(1.2,6.2,bl){$1$}
+ \Text(1.7,9.2,bl){$3$}
+\end{lapdf}
+
+\it{Various conic arcs defined by $w=(3,1,1/3,0,-1/3)$}.
+\end{center}
+
+This file shows some capabilities of the \Lapdf{} style. Rational quadratic
+bezier curves can form all conic curves. These enable you to exactly draw any
+parabolas, hyperbolas, ellipses and circles.
+
+The above curves share the same control points, the only difference are the
+curve's weights, which control the curve shape. \Lapdf{} has commands like
+\it{Stroke, Fill, Setcol} and many others and it supports color.
+\end{document}
diff --git a/macros/latex/contrib/lapdf/curve.pdf b/macros/latex/contrib/lapdf/curve.pdf
new file mode 100644
index 0000000000..0a11285325
--- /dev/null
+++ b/macros/latex/contrib/lapdf/curve.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/curve.tex b/macros/latex/contrib/lapdf/curve.tex
new file mode 100644
index 0000000000..ecdf6b253f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/curve.tex
@@ -0,0 +1,61 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.125cm
+
+\begin{center}
+{\Huge \bf{Integral Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Dgray
+ \Rect(-8,-8,16,16) \Gfill(.9)
+ \Black
+ \Curve(80)(-8,-8)(8,8) \Stroke
+ \Red
+ \Curve(80)(-8,-8)(0,8)(8,-8) \Stroke
+ \Green
+ \Curve(80)(-8,-8)(-4,8)(4,-8)(8,8) \Stroke
+ \Blue
+ \Curve(80)(-8,-8)(-8,0)(12,-12)(0,8)(8,8) \Stroke
+ \Cyan
+ \Curve(96)(0,-8)(-8,-8)(-8,8)(8,8)(8,-8)(0,-8) \Stroke
+ \Magenta
+ \Curve(96)(-8,-8)(0,-8)(-8,0)(0,8)(8,0)(0,-8)(8,-8) \Stroke
+ \Yellow
+ \Curve(96)(-8,0)(-5.715,8)(-3.43,-16)(-1.145,8)(1.145,-8)(3.43,16)
+ (5.715,-8)(8,0) \Stroke
+\end{lapdf}
+
+\em{Curve-Degree: 1 black, 2 red, 3 green, 4 blue, 5 cyan, 6 magenta, 7 dyellow}
+\end{center}
+
+\newpage
+\unitlength1cm
+
+\begin{center}
+{\Huge \bf{Rational Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Dgray
+ \Rect(-9,-9,18,18) \Gfill(.9)
+ \Red
+ \Rcurve(80)(-9,9,1)(0,-9,4)(9,9,1) \Stroke
+ \Green
+ \Rcurve(80)(-9,-9,0.1)(-4.5,9,2.8)(4.5,-9,2.8)(9,9,0.1) \Stroke
+ \Blue
+ \Rcurve(80)(-9,9,0.1)(-4.5,-9,0.7)(0,9,1)(4.5,-9,0.7)(9,9,0.1) \Stroke
+ \Cyan
+ \Rcurve(96)(3,0,3)(0,3,1)(-3,0,1)(0,-3,1)(3,0,3) \Stroke
+ \Magenta
+ \Rcurve(96)(4,0,1)(4,16,0.2)(-12,8,0.2)(-12,-8,0.2)(4,-16,0.2)(4,0,1)
+ \Stroke
+ \Yellow
+ \Rcurve(96)(0,-9,1)(-9,-9,2)(-9,9,1)(9,9,1)(9,-9,2)(0,-9,1) \Stroke
+\end{lapdf}
+
+\em{Curve-Degree: 2 red, 3 green, 4 blue, 5 cyan, 6 magenta, 7 dyellow}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/curveto.pdf b/macros/latex/contrib/lapdf/curveto.pdf
new file mode 100644
index 0000000000..08e5ba85af
--- /dev/null
+++ b/macros/latex/contrib/lapdf/curveto.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/curveto.tex b/macros/latex/contrib/lapdf/curveto.tex
new file mode 100644
index 0000000000..f1f9bd032a
--- /dev/null
+++ b/macros/latex/contrib/lapdf/curveto.tex
@@ -0,0 +1,75 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.125cm
+
+\begin{center}
+{\Huge \bf{Integral Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Dgray
+ \Rect(-8,-8,16,16) \Gfill(.9)
+ \Black
+ \Moveto(-8,-8)
+ \Curveto(80)(8,8) \Stroke
+ \Red
+ \Moveto(-8,-8)
+ \Curveto(80)(0,8)(8,-8) \Stroke
+ \Green
+ \Moveto(-8,-8)
+ \Curveto(80)(-4,8)(4,-8)(8,8) \Stroke
+ \Blue
+ \Moveto(-8,-8)
+ \Curveto(80)(-8,0)(12,-12)(0,8)(8,8) \Stroke
+ \Cyan
+ \Moveto(0,-8)
+ \Curveto(96)(-8,-8)(-8,8)(8,8)(8,-8)(0,-8) \Stroke
+ \Magenta
+ \Moveto(-8,-8)
+ \Curveto(96)(-8,-8)(0,-8)(-8,0)(0,8)(8,0)(0,-8)(8,-8) \Stroke
+ \Yellow
+ \Moveto(-8,0)
+ \Curveto(96)(-5.715,8)(-3.43,-16)(-1.145,8)(1.145,-8)(3.43,16)
+ (5.715,-8)(8,0) \Stroke
+\end{lapdf}
+
+\em{Curve-Degree: 1 black, 2 red, 3 green, 4 blue, 5 cyan, 6 magenta,
+7 dyellow}
+\end{center}
+
+\newpage
+\unitlength1cm
+
+\begin{center}
+{\Huge \bf{Rational Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Dgray
+ \Rect(-9,-9,18,18) \Gfill(.9)
+ \Red
+ \Rmoveto(-9,9,1)
+ \Rcurveto(80)(0,-9,4)(9,9,1) \Stroke
+ \Green
+ \Rmoveto(-9,-9,0.1)
+ \Rcurveto(80)(-4.5,9,2.8)(4.5,-9,2.8)(9,9,0.1) \Stroke
+ \Blue
+ \Rmoveto(-9,9,0.1)
+ \Rcurveto(80)(-4.5,-9,0.7)(0,9,1)(4.5,-9,0.7)(9,9,0.1) \Stroke
+ \Cyan
+ \Rmoveto(3,0,3)
+ \Rcurveto(96)(0,3,1)(-3,0,1)(0,-3,1)(3,0,3) \Stroke
+ \Magenta
+ \Rmoveto(4,0,1)
+ \Rcurveto(96)(4,16,0.2)(-12,8,0.2)(-12,-8,0.2)(4,-16,0.2)(4,0,1)
+ \Stroke
+ \Yellow
+ \Rmoveto(0,-9,1)
+ \Rcurveto(96)(-9,-9,2)(-9,9,1)(9,9,1)(9,-9,2)(0,-9,1) \Stroke
+\end{lapdf}
+
+\em{Curve-Degree: 2 red, 3 green, 4 blue, 5 cyan, 6 magenta, 7 dyellow}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/cycloid.pdf b/macros/latex/contrib/lapdf/cycloid.pdf
new file mode 100644
index 0000000000..d7a06a2eac
--- /dev/null
+++ b/macros/latex/contrib/lapdf/cycloid.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/cycloid.tex b/macros/latex/contrib/lapdf/cycloid.tex
new file mode 100644
index 0000000000..e868d76bed
--- /dev/null
+++ b/macros/latex/contrib/lapdf/cycloid.tex
@@ -0,0 +1,61 @@
+\input preamble.tex
+
+\Defnum(\n,2)
+\newdimen\x
+\newdimen\y
+\def\ds{\displaystyle}
+
+% -------------------------------------------------------------------------
+% 1. Epicycloid:
+% x(t)=r/(n+1)*[n*cos(t)-cos(n*t)]
+% y(t)=r/(n+1)*[n*sin(t)-sin(n*t)]
+% -------------------------------------------------------------------------
+\def\Epicycloid(#1,#2){\Dset(\y,#2) \Dset(\x,#1) \Dadd(\x,1) \Ddiv(\y,\x)
+ \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \Dset(\x,##1) \x=#1\x
+ \Cos(\Np\x,\x) \Sub(##2,\x) \Dmul(##2,\y)}
+ \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \Dset(\x,##1) \x=#1\x
+ \Sin(\Np\x,\x) \Sub(##2,\x) \Dmul(##2,\y)}
+ \Tplot(200)(0,6.2832)}
+
+% -------------------------------------------------------------------------
+% 2. Hypocycloid:
+% x(t)=r/(n+1)*[n*cos(t)+cos(n*t)]
+% y(t)=r/(n+1)*[n*sin(t)-sin(n*t)]
+% -------------------------------------------------------------------------
+\def\Hypocycloid(#1,#2){\Dset(\y,#2) \Dset(\x,#1) \Dadd(\x,1) \Ddiv(\y,\x)
+ \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \Dset(\x,##1) \x=#1\x
+ \Cos(\Np\x,\x) \Add(##2,\x) \Dmul(##2,\y)}
+ \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \Dset(\x,##1) \x=#1\x
+ \Sin(\Np\x,\x) \Sub(##2,\x) \Dmul(##2,\y)}
+ \Tplot(200)(0,6.2832)}
+
+% -------------------------------------------------------------------------
+\begin{document}
+\unitlength1.5cm
+
+\begin{center}
+{\Huge\bf{I. Epicycloids}}
+\bigskip
+
+\begin{lapdf}(12,12)(-6,-6)
+ \Polgrid(1,2)(6)
+ \Whilenum{\n<7}{\Stepcol(0,23,4) \Epicycloid(\n,6) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=\frac{\ds r}{\ds{n+1}}[n\cos(t)-\cos(nt)]$ \qquad
+$y(t)=\frac{\ds r}{\ds{n+1}}[n\sin(t)-\sin(nt)]$
+\newpage
+
+{\Huge\bf{II. Hypocycloids}}
+\bigskip
+
+\begin{lapdf}(12,12)(-6,-6)
+ \Resetcol
+ \Polgrid(1,2)(6)
+ \Whilenum{\n<7}{\Stepcol(0,23,4) \Hypocycloid(\n,6) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=\frac{\ds r}{\ds{n+1}}[n\cos(t)+\cos(nt)]$ \qquad
+$y(t)=\frac{\ds r}{\ds{n+1}}[n\sin(t)-\sin(nt)]$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/drawing.pdf b/macros/latex/contrib/lapdf/drawing.pdf
new file mode 100644
index 0000000000..e1feffb676
--- /dev/null
+++ b/macros/latex/contrib/lapdf/drawing.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/drawing.tex b/macros/latex/contrib/lapdf/drawing.tex
new file mode 100644
index 0000000000..49ca039071
--- /dev/null
+++ b/macros/latex/contrib/lapdf/drawing.tex
@@ -0,0 +1,60 @@
+\input preamble
+
+% --------------------------------------------------------------------------
+\begin{document}
+\unitlength0.93cm
+
+\begin{center}
+{\Huge \bf{Drawing with \Lapdf}}
+\bigskip
+
+\begin{lapdf}(12,12)(-6,-6)
+ \Setwidth(0.01)
+ \Rect(-6,-6,12,12)
+ \Line(-6,0)(+6,0) \Stroke
+ \Line(0,-6)(0,+6) \Stroke
+ \Dash(2)
+ \Line(-6,-6)(+6,+6) \Stroke
+ \Dash(0)
+ \Gsave
+ \Dash(1)
+ \Moveto(-6,0)
+ \Lineto(-2,6)
+ \Lineto(2,-6)
+ \Lineto(6,0) \Stroke
+ \Grestore
+ \Setwidth(0.02)
+ \Red
+ \Curve(64)(-6,0)(-2,6)(2,-6)(6,0) \Closepath \Gfill(0.9)
+ \Cyan
+ \Dash(2)
+ \Rcurve(96)(-5,0,3)(0,8,1)(5,0,3) \Stroke
+ \Rcurve(96)(-5,0,3)(0,8,-1)(5,0,3) \Stroke
+ \Dash(0)
+ \Green
+ \Rcurve(96)(-5,0,1)(0,8,1)(5,0,1) \Stroke
+ \Yellow
+ \Rcurve(96)(-5,0,1)(0,8,3)(5,0,1) \Stroke
+ \Rcurve(96)(-5,0,1)(0,8,0)(5,0,1) \Stroke
+ \Magenta
+ \Circle(64)(0,0,5) \Stroke
+ \Setcol(0.3,0.3,0.3)
+ \Curve(64)(-5,0)(0,-8)(5,0) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(12,12)(-6,-6)
+ \Setwidth(0.02)
+ \Setjoin(1)
+ \Red
+ \Rotate(45)
+ \Scale(1,0.8)
+ \Circle(64)(0,0,1.86)
+ \Circle(64)(0,0,4)
+ \Circle(64)(0,0,6)
+ \Fill(1,1,0)
+ \Polygon(0,6)(3.527,-4.854)(-5.706,1.854)(5.706,1.854)(-3.527,-4.854)(0,6)
+ \Fill(0,1,1)
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/ellipse.pdf b/macros/latex/contrib/lapdf/ellipse.pdf
new file mode 100644
index 0000000000..372e25a646
--- /dev/null
+++ b/macros/latex/contrib/lapdf/ellipse.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/ellipse.tex b/macros/latex/contrib/lapdf/ellipse.tex
new file mode 100644
index 0000000000..d12bb62c2d
--- /dev/null
+++ b/macros/latex/contrib/lapdf/ellipse.tex
@@ -0,0 +1,36 @@
+\input preamble.tex
+
+\Defdim(\d,0)
+\Defdim(\e,9)
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Ellipse I}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Whiledim{\d<9}{
+ \Nextcol(0,23)
+ \Dadd(\d,0.5)
+ \Ellipse(32)(0,0)(\Np\d,\Np\e,0) \Stroke
+ \Dsub(\e,0.5)}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge \bf{Ellipse II}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Setwidth(0.02)
+ \Dset(\d,0)
+ \Whiledim{\d<180}{
+ \Nextcol(0,23)
+ \Ellipse(20)(0,0)(9,3,\Np\d) \Stroke
+ \Dadd(\d,7.5)}
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/fplot.pdf b/macros/latex/contrib/lapdf/fplot.pdf
new file mode 100644
index 0000000000..c5817eb489
--- /dev/null
+++ b/macros/latex/contrib/lapdf/fplot.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/fplot.tex b/macros/latex/contrib/lapdf/fplot.tex
new file mode 100644
index 0000000000..a1bbaf03ad
--- /dev/null
+++ b/macros/latex/contrib/lapdf/fplot.tex
@@ -0,0 +1,271 @@
+\input preamble.tex
+
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\huge \bf{Trigonometric Functions}}
+\bigskip
+
+\begin{lapdf}(12,10.3)(-6,-5)
+ \Lingrid(10)(1,3)(-6,6)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Sin(#1,#2)}
+ \Fplot(50)(-6,6) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Cos(#1,#2)}
+ \Fplot(50)(-6,6) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Tan(#1,#2)}
+ \Fplot(50)(-6,-4.91) \Stroke
+ \Fplot(50)(-4.515,-1.768) \Stroke
+ \Fplot(50)(-1.373,1.373) \Stroke
+ \Fplot(50)(1.768,4.515) \Stroke
+ \Fplot(50)(4.91,6) \Stroke
+\end{lapdf}
+\bigskip
+
+{\huge \bf{Arcus Functions}}
+
+\begin{lapdf}(12,7.3)(-6,-3)
+ \Lingrid(10)(1,3)(-6,6)(-3,4)
+ \Red
+ \def\Fx(#1,#2){\Asin(#1,#2)}
+ \Fplot(50)(-1,1) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Acos(#1,#2)}
+ \Fplot(50)(-1,1) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Atan(#1,#2)}
+ \Fplot(50)(-6,6) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\huge \bf{Hyperbolic Functions}}
+
+\begin{lapdf}(12,10.3)(-6,-5)
+ \Lingrid(10)(1,3)(-6,6)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Sinh(#1,#2)}
+ \Fplot(50)(-2.31,2.31) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Cosh(#1,#2)}
+ \Fplot(50)(-2.3,2.3) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Tanh(#1,#2)}
+ \Fplot(50)(-6,6) \Stroke
+\end{lapdf}
+\bigskip
+
+{\huge \bf{Area Functions}}
+
+\begin{lapdf}(12,10.3)(-6,-5)
+ \Lingrid(10)(1,3)(-6,6)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Asinh(#1,#2)}
+ \Fplot(50)(-6,6) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Acosh(#1,#2)}
+ \Fplot(80)(1,6) \Stroke
+ \def\Fx(#1,#2){\Acosh(#1,#2) #2=-#2}
+ \Fplot(80)(1,6) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Atanh(#1,#2)}
+ \Fplot(80)(-1,1) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\huge \bf{Log and Exponential Functions}}
+
+\begin{lapdf}(10,10.3)(-3,-3)
+ \Lingrid(10)(1,3)(-3,7)(-3,7)
+ \Red
+ \def\Fx(#1,#2){\Ln(#1,#2)}
+ \Fplot(80)(0.05,7) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Log(1.5,#1,#2)}
+ \Fplot(80)(0.3,7) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Exp(#1,#2)}
+ \Fplot(50)(-3,1.946) \Stroke
+ \Cyan
+ \def\Fx(#1,#2){\Pow(1.5,#1,#2)}
+ \Fplot(50)(-3,4.8) \Stroke
+\end{lapdf}
+\bigskip
+
+{\huge \bf{Square and Square Root Functions}}
+
+\begin{lapdf}(10,10.3)(-3,-3)
+ \Lingrid(10)(1,3)(-3,7)(-3,7)
+ \Red
+ \def\Fx(#1,#2){\Dset(\x,#1) \Dmul(\x,\x) #2=\x}
+ \Fplot(100)(-2.64,2.64) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Sqrt(#1,#2)}
+ \Fplot(100)(0,7) \Stroke
+ \def\Fx(#1,#2){\Sqrt(#1,#2) #2=-#2}
+ \Fplot(100)(0,7) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\huge \bf{Power and Root Functions}}
+\bigskip
+
+\begin{lapdf}(18,22)(0,0)
+ \Lingrid(10)(1,3)(0,18)(0,22)
+ \Rect(0,0,18,22)
+ \Setclip
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.0,#2)}
+ \Fplot(100)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.1,#2)}
+ \Fplot(100)(0,16.6) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.2,#2)}
+ \Fplot(100)(0,13.2) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.3,#2)}
+ \Fplot(100)(0,10.8) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.4,#2)}
+ \Fplot(100)(0,9.2) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.5,#2)}
+ \Fplot(100)(0,7.9) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,1.7,#2)}
+ \Fplot(100)(0,6.3) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,2.0,#2)}
+ \Fplot(100)(0,4.8) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,2.5,#2)}
+ \Fplot(100)(0,3.5) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,3.0,#2)}
+ \Fplot(50)(0,2.8) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,3.5,#2)}
+ \Fplot(30)(0,2.45) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Pow(#1,4.0,#2)}
+ \Fplot(23)(0,2.2) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.1,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.2,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.3,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.4,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.5,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,1.7,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,2.0,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,2.5,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,3.0,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,3.5,#2)}
+ \Fplot(300)(0,18) \Stroke
+ \Stepcol(0,23,2)
+ \def\Fx(#1,#2){\Root(#1,4.0,#2)}
+ \Fplot(300)(0,18) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\huge \bf{Hyperbolas}}
+
+\begin{lapdf}(10,10.3)(-5,-5)
+ \Lingrid(10)(1,3)(-5,5)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Dset(\x,#1) \Dset(\y,1) \Ddiv(\y,\x) #2=\y}
+ \Fplot(50)(-5,-0.2) \Stroke
+ \Fplot(50)(0.2,5) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Dset(\x,#1) \Dmul(\x,\x) \Dset(\y,1) \Ddiv(\y,\x) #2=\y}
+ \Fplot(50)(-5,-0.447) \Stroke
+ \Fplot(50)(0.447,5) \Stroke
+\end{lapdf}
+\bigskip
+
+{\huge \bf{Other Functions}}
+
+\begin{lapdf}(10,10.3)(-5,-5)
+ \Lingrid(10)(1,3)(-5,5)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Dset(\x,#1) \y=\x \x=2.5\x \Sin(\Np\x,#2) \Ddiv(#2,\y) #2=2#2}
+ \Fplot(100)(-5,5) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Dset(\x,#1) \Dmul(\x,\x) \Dadd(\x,1) \Dset(\y,5) \Ddiv(\y,\x) #2=\y}
+ \Fplot(100)(-5,5) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Dset(\x,#1) \y=9\x \Dmul(\x,\x) \Dadd(\x,1) \Ddiv(\y,\x) #2=\y}
+ \Fplot(100)(-5,5) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\huge \bf{Damped Oszillator}}
+
+\begin{lapdf}(14,11.3)(-2,-5)
+ \Lingrid(10)(1,3)(-2,12)(-5,6)
+ \Red
+ \def\Fx(#1,#2){\Dset(#2,#1) #2=3#2 \Sin(\Np#2,#2)\Dset(\x,#1) \x=-0.2\x \Exp(\Np\x,\x) \Dmul(#2,\x) #2=4#2}
+ \Fplot(300)(-2,12) \Stroke
+ \Dgray
+ \Dash(1)
+ \def\Fx(#1,#2){\Dset(#2,#1) #2=-0.2#2 \Exp(\Np#2,#2) #2=4#2}
+ \Fplot(50)(-1.6,12) \Stroke
+ \def\Fx(#1,#2){\Dset(#2,#1) #2=-0.2#2 \Exp(\Np#2,#2) #2=-4#2}
+ \Fplot(50)(-0.6,12) \Stroke
+\end{lapdf}
+\bigskip
+
+{\huge \bf{Function, Derivatives \& Asymptotes}}
+
+\begin{lapdf}(12,10.3)(-5,-5)
+ \Lingrid(10)(1,3)(-5,7)(-5,5)
+ \Red
+ \def\Fx(#1,#2){\Dset(\x,#1) \Dsub(\x,2) \y=#1\x \Dsub(\y,3) \y=0.2\y \Dset(#2,1) \Ddiv(#2,\x) \Add(#2,\y)}
+ \Fplot(100)(-4.47,1.765) \Stroke
+ \Fplot(100)(2.18,6.28) \Stroke
+ \Green
+ \def\Fx(#1,#2){\Dset(#2,#1) \Dsub(#2,1) \x=#2 \Dsub(\x,1) \Dmul(\x,\x) #2=0.4#2 \Dset(\y,1) \Ddiv(\y,\x) \Sub(#2,\y)}
+ \Fplot(100)(-5,1.56) \Stroke
+ \Fplot(100)(2.422,7) \Stroke
+ \Blue
+ \def\Fx(#1,#2){\Dset(#2,2) \Dset(\x,#1) \Dsub(\x,2) \Pot(\Np\x,3,\x) \Ddiv(#2,\x) \Dadd(#2,0.4)}
+ \Fplot(100)(-5,1.282) \Stroke
+ \Fplot(100)(2.758,7) \Stroke
+ \Black
+ \Setwidth(0.01)
+ \def\Fx(#1,#2){\Dset(#2,#1) \Dadd(#2,1) \Dset(\x,#1) \Dsub(\x,3) \Dmul(#2,\x) #2=0.2#2}
+ \Fplot(100)(-4.4,6.43) \Stroke
+ \Dash(1)
+ \Line(2,-5)(2,5) \Stroke
+ \Line(-5,0.4)(7,0.4) \Stroke
+ \Line(-5,-2.4)(7,2.4) \Stroke
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/geometry.pdf b/macros/latex/contrib/lapdf/geometry.pdf
new file mode 100644
index 0000000000..6a04391228
--- /dev/null
+++ b/macros/latex/contrib/lapdf/geometry.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/geometry.tex b/macros/latex/contrib/lapdf/geometry.tex
new file mode 100644
index 0000000000..96b54cd4ac
--- /dev/null
+++ b/macros/latex/contrib/lapdf/geometry.tex
@@ -0,0 +1,44 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Geometric Sketch}}
+\bigskip
+
+\begin{lapdf}(14,18)(-9,-12)
+ \Lingrid(10)(1,3)(-9,5)(-12,6)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Polygon(-4,0)(3,6)(4,0) \Stroke
+ \Polygon(-6,-12)(3,6) \Stroke
+ \Dash(0)
+ \Line(-7.849,-11.396)(3.049,1.796) \Stroke
+ \Line(-5.882,-1.924)(1.082,-7.676) \Stroke
+ \Setwidth(0.02)
+ \Red
+ \Rcurve(128)(-4,0,3)(3,6,2)(4,0,3) \Stroke
+ \Rcurve(128)(-4,0,3)(3,6,-2)(4,0,3) \Stroke
+ \Green
+ \Rcurve(96)(-4,0,2)(3,6,1)(4,0,2) \Stroke
+ \Rcurve(96)(-4,0,2)(3,6,-1)(4,0,2) \Stroke
+ \Blue
+ \Rcurve(64)(-4,0,4)(3,6,1)(4,0,4) \Stroke
+ \Rcurve(64)(-4,0,4)(3,6,-1)(4,0,4) \Stroke
+ \Point(1)(-4,0)
+ \Point(1)(3,6)
+ \Point(1)(4,0)
+ \Point(1)(1.2,2.4)
+ \Point(1)(-6,-12)
+ \Point(1)(1,2)
+ \Point(1)(-3,-6)
+ \Point(1)(0.6,1.2)
+ \Point(1)(-1,-2)
+ \Point(1)(-2.4,-4.8)
+ \Point(1)(-7.849,-11.396)
+ \Point(1)(3.049,1.796)
+ \Point(1)(-5.882,-1.924)
+ \Point(1)(1.082,-7.676)
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/grids.pdf b/macros/latex/contrib/lapdf/grids.pdf
new file mode 100644
index 0000000000..95cbdfbd4f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/grids.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/grids.tex b/macros/latex/contrib/lapdf/grids.tex
new file mode 100644
index 0000000000..b6941968f2
--- /dev/null
+++ b/macros/latex/contrib/lapdf/grids.tex
@@ -0,0 +1,69 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge\bf{Lingrid}}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(-5,-5)
+ \Lingrid(10)(1,3)(-5,10)(-5,5)
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(-5,0)
+ \Lingrid(10)(1,3)(-5,10)(0,10)
+\end{lapdf}
+
+\newpage
+
+{\Huge\bf{Logxgrid}}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(0,-5)
+ \Logxgrid(10)(1,3)(-1,2)(-5,5)
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(0,0)
+ \Logxgrid(10)(1,3)(-1,2)(0,10)
+\end{lapdf}
+
+\newpage
+
+{\Huge\bf{Logygrid}}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(0,0)
+ \Logygrid(10)(1,3)(1,3)(0,15)
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(15.5,10.5)(-5,0)
+ \Logygrid(10)(1,3)(-1,1)(-5,10)
+\end{lapdf}
+
+\newpage
+
+{\Huge\bf{Logxygrid}}
+\bigskip
+
+\begin{lapdf}(15.5,20.5)(0,0)
+ \Logxygrid(10)(1,3)(1,4)(0,4)
+\end{lapdf}
+
+\newpage
+
+{\Huge\bf{Polgrid}}
+\bigskip
+
+\begin{lapdf}(11,10.5)(-5.5,-5)
+ \Polgrid(1,3)(5)
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(11,11.5)(-5.5,-5.8)
+ \Polgrid(1,4)(5)
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/hippo.pdf b/macros/latex/contrib/lapdf/hippo.pdf
new file mode 100644
index 0000000000..0011f18e2f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/hippo.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/hippo.tex b/macros/latex/contrib/lapdf/hippo.tex
new file mode 100644
index 0000000000..844dd0bc6c
--- /dev/null
+++ b/macros/latex/contrib/lapdf/hippo.tex
@@ -0,0 +1,22 @@
+\input preamble.tex
+
+\Defnum(\n,-1)
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.4cm
+
+\begin{center}
+{\Huge\bf{Hippopede Curves}}
+\bigskip
+
+\begin{lapdf}(12,14)(-6,-7)
+ \Polgrid(1,4)(6)
+ \def\Px(#1,#2){\Sin(#1,#2) \Dmul(#2,#2) #2=\n#2
+ \Dsub(#2,10) #2=-#2 \Sqrt(\Np#2,#2) #2=1.897#2}
+ \Whilenum{\n<10}{\Add(\n,1) \Stepcol(0,23,2) \Pplot(150)(0,2) \Stroke}
+\end{lapdf}
+
+$r(\phi)=6 \cdot \sqrt{1-c \cdot \sin^2\phi}$ with ($c=0,1 \dots 1,0$)
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/lapdf.pdf b/macros/latex/contrib/lapdf/lapdf.pdf
new file mode 100644
index 0000000000..f3c90f2836
--- /dev/null
+++ b/macros/latex/contrib/lapdf/lapdf.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/lapdf.sty b/macros/latex/contrib/lapdf/lapdf.sty
new file mode 100644
index 0000000000..541aa51b89
--- /dev/null
+++ b/macros/latex/contrib/lapdf/lapdf.sty
@@ -0,0 +1,1493 @@
+% =========================================================================
+% LAPDF.STY: Version 1.1, Copyright(C) 2006-2011, Detlef Reimers
+% Lapdf is distributed under the terms of the GNU general public licence
+% -------------------------------------------------------------------------
+% Email: detlefreimers@gmx.de Website: http://detlefreimers.de
+% =========================================================================
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{lapdf}[2006/04/09 v1.0 Drawing with pdfTeX]
+\RequirePackage{calc}
+
+\newtoks\@c \newtoks\@d \newtoks\@e \newtoks\@f
+
+\let\@ta\@tempcnta \let\@tb\@tempcntb \newcount\@@s
+\newcount\@@i \newcount\@@k \newcount\@@n \newcount\col
+\newcount\@az \newcount\@bz \newcount\@cz \newcount\@xz
+\newcount\@ca \newcount\@cb \newcount\@cc \newcount\@cd
+\newcount\@ce \newcount\@cf \newcount\@cg \newcount\@ch
+\newcount\@ci \newcount\@ck \newcount\@cl \newcount\@cm
+\newcount\@cn
+
+\let\@tbox\@tempboxa
+\let\@@a\@ovdx \let\@@b\@ovdy \let\@@t\@ovxx \let\@@u\@ovyy
+\newdimen\wid \newdimen\tmp
+\newdimen\@@d \newdimen\@@m \newdimen\@@x \newdimen\@@y
+\newdimen\@@A \newdimen\@@B \newdimen\@@C \newdimen\@@D
+\newdimen\@@T \newdimen\@@U \newdimen\@@X \newdimen\@@Y
+\newdimen\@CR \newdimen\@CG \newdimen\@CB
+\newdimen\@ax \newdimen\@ay \newdimen\@az
+\newdimen\@bx \newdimen\@by \newdimen\@bz
+\newdimen\@cx \newdimen\@cy \newdimen\@cz
+\newdimen\@dx \newdimen\@dy \newdimen\@dz
+\newdimen\@ex \newdimen\@ey \newdimen\@ez
+\newdimen\@fx \newdimen\@fy \newdimen\@fz
+\newdimen\@gx \newdimen\@gy \newdimen\@gz
+\newdimen\@hx \newdimen\@hy \newdimen\@hz
+\newdimen\@rx \newdimen\@ry \newdimen\@rz \newdimen\@rw
+\newdimen\@sx \newdimen\@sy \newdimen\@tx \newdimen\@ty
+\newdimen\@ux \newdimen\@uy \newdimen\@vx \newdimen\@vy
+\newdimen\@wx \newdimen\@wy
+\newdimen\@xx \newdimen\@xy \newdimen\@xz
+\newdimen\@zx \newdimen\@zy \newdimen\@zz
+\newdimen\@yx \newdimen\@yy
+
+% -------------------------------------------------------------------------
+\@ck=0
+\wid=0.35pt
+
+% -------------------------------------------------------------------------
+\DeclareOption{black}{%
+ \@cl=0
+ \gdef\Resetcol{}
+ \gdef\Stepcol(#1,#2,#3){}
+ \gdef\Nextcol(#1,#2){}
+}
+\DeclareOption{color}{%
+ \@cl=1
+ \gdef\Resetcol{\col=-1}
+ \gdef\Stepcol(#1,#2,#3){%
+ \@cc=\col \Add(\@cc,#3)
+ \ifnum#1<0 \@ca=0 \else \@ca=#1 \fi
+ \ifnum#2>95 \@cb=95 \else \@cb=#2 \fi
+ \ifnum\col<\@ca \col=\@ca \else
+ \ifnum\col>\@cb \col=\@ca \else
+ \ifnum\@cc<\@ca \col=\@ca \else
+ \ifnum\@cc>\@cb \col=\@ca \else \col=\@cc \fi\fi\fi\fi
+ \ifnum\col<96%
+ \Colval(\col,8,\@rx)
+ \Colval(\col,0,\@gx)
+ \Colval(\col,16,\@bx)
+ \Setcol(\Np\@rx,\Np\@gx,\Np\@bx) \fi}
+ \gdef\Nextcol(#1,#2){\Stepcol(#1,#2,1)}
+}
+
+% -------------------------------------------------------------------------
+% Calculates the cromatic intensity of a specific color. n is the color,
+% d is the color offset (r: 8, g: 0, b: 16) and r is the result register.
+% \Colval(n,d,r)
+% -------------------------------------------------------------------------
+\gdef\Colval(#1,#2,#3){%
+ \ifnum#1>71 \@cm=3 \else \ifnum#1>47 \@cm=2 \else
+ \ifnum#1>23 \@cm=1 \else \@cm=0 \fi \fi \fi
+ \@cn=#1 \Add(\@cn,#2) \Mod(\@cn,24)
+ \Sub(\@cn,8) \Abs(\@cn)
+ \ifnum\@cn<4 \Dset(#3,1) \else
+ \ifnum\@cn<8 \Dset(#3,8) \Dsub(#3,\@cn)
+ \Div(#3,4) \else \Dset(#3,0) \fi \fi
+ \Dset(\@tx,5) \Dsub(\@tx,\@cm) \Dmul(#3,\@tx) \Div(#3,5) \Crnd(#3)}
+
+% -------------------------------------------------------------------------
+% This macro is only necessary, because my TeX compiler under MacOS9.2
+% says 'out of color stack space' without the rounding. With this function,
+% all color values have two digits or less. \Crnd(col)
+% -------------------------------------------------------------------------
+\gdef\Crnd(#1){\Ddiv(#1,0.0999pt) \Mul(#1,10) \Dint(#1) \Ddiv(#1,100pt)}
+
+% -------------------------------------------------------------------------
+\ExecuteOptions{black}
+\ProcessOptions
+ \ifnum\@cl>0 \AtBeginDocument{\Resetcol} \fi
+
+% -------------------------------------------------------------------------
+% Strips the pt dimension
+% -------------------------------------------------------------------------
+{\catcode`t=12\catcode`p=12\gdef\nP#1pt{#1}}
+\gdef\Np#1{\expandafter\nP\the#1}%
+
+% -------------------------------------------------------------------------
+% \Lapdf{} the Lapdf logo
+% -------------------------------------------------------------------------
+\def\Lapdf{L\kern-.2em\lower.5ex\hbox{A}\kern-.15emPDF}
+
+% -------------------------------------------------------------------------
+% \pdfTeX{} a pdfTeX logo
+% -------------------------------------------------------------------------
+\def\pdfTeX{\hbox{pdf}\kern+.05em\TeX{}}
+
+% -------------------------------------------------------------------------
+% \PDF{cmd} for the pdf specials, which are used here
+% -------------------------------------------------------------------------
+\gdef\PDF#1{\@killglue\special{pdf:#1}}
+
+% -------------------------------------------------------------------------
+% \lapdf(x1,y1)(x2,y2) the lapdf environment
+% -------------------------------------------------------------------------
+\newcommand{\pdf}{\Gsave \Scale(\Np\unitlength,\Np\unitlength)
+ \Setwidth(0.02) \Setcap(1) \Setdash([] 0)}
+\def\endpdf{\Grestore}
+
+\newcommand{\lapdf}{\@pdfpict}
+ \gdef\@pdfpict(#1,#2)(#3,#4){\begin{picture}(#1,#2)(#3,#4) \begin{pdf}}
+\def\endlapdf{\end{pdf} \end{picture}}
+
+% -------------------------------------------------------------------------
+% Gets the unit length from document. Define and set a register.
+% -------------------------------------------------------------------------
+\gdef\Ul{\unitlength}
+\gdef\Set(#1,#2){#1=#2}
+\gdef\Dset(#1,#2){#1=#2pt}
+\gdef\Defnum(#1,#2){\newcount#1 #1=#2}
+\gdef\Defdim(#1,#2){\newdimen#1 #1=#2pt}
+
+% -------------------------------------------------------------------------
+% Two macros for count or dimen registers. If nested, you have to use
+% brackets around the inner looop.
+% \whilenum{num condition}{commands} \whiledim{dim condition}{commands}
+% -------------------------------------------------------------------------
+\gdef\Whilenum#1#2{\loop\ifnum#1#2\repeat}
+\gdef\Whiledim#1#2{\loop\ifdim#1pt#2\repeat}
+
+% -------------------------------------------------------------------------
+% Arithmetic with count registers.
+% -------------------------------------------------------------------------
+\gdef\Add(#1,#2){\advance#1#2}
+\gdef\Sub(#1,#2){\advance#1-#2}
+\gdef\Mul(#1,#2){\multiply#1#2}
+\gdef\Div(#1,#2){\divide#1#2}
+\gdef\@Abs(#1){\ifnum#1<\z@ #1=-#1 \@@s=-1 \else \@@s=1 \fi}
+\gdef\Abs(#1){\ifnum#1<\z@ #1=-#1 \fi}
+\gdef\Sig(#1,#2){\ifnum#1<\z@ \Set(#2,-1) \else \Set(#2,1) \fi}
+\gdef\Mod(#1,#2){\@@i=#1 \Div(\@@i,#2) \Mul(\@@i,#2) \Sub(#1,\@@i)}
+
+% -------------------------------------------------------------------------
+% Arithmetic with dimen registers. Dmul & Ddiv use the calc package.
+% -------------------------------------------------------------------------
+\gdef\Dadd(#1,#2){\advance#1#2pt}
+\gdef\Dsub(#1,#2){\advance#1-#2pt}
+\gdef\Dmul(#1,#2){\setlength{#1}{#1*\ratio{#2}{1pt}}}
+\gdef\Ddiv(#1,#2){\setlength{#1}{1pt*\ratio{#1}{#2}}}
+\gdef\@Dabs(#1){\ifdim#1<\z@ #1=-#1 \@@s=-1 \else \@@s=1 \fi}
+\gdef\Dabs(#1){\ifdim#1<\z@ #1=-#1 \fi}
+\gdef\Dint(#1){\@@i=#1 \Div(\@@i,65536) \Dset(#1,\@@i)}
+\gdef\Dsig(#1,#2){\ifdim#1<\z@ \Set(#2,-1) \else \Set(#2,1) \fi}
+\gdef\Dmod(#1,#2){\@@m=#1 \Ddiv(\@@m,#2pt)
+ \Dint(\@@m) \Dmul(\@@m,#2pt) \Sub(#1,\@@m)}
+
+% -------------------------------------------------------------------------
+% Conversion to radian or degree.
+% \Rad(x,result) \Deg(x,result)
+% -------------------------------------------------------------------------
+\gdef\Rad(#1,#2){\Dset(#2,#1) #2=0.017453#2}
+\gdef\Deg(#1,#2){\Dset(#2,#1) #2=57.29578#2}
+
+% -------------------------------------------------------------------------
+% Calculates the sinus of an angle r in radian. The result is returned
+% in register r. First, we reduce the argument to [0,2pi]. \Sin(x,r)
+% -------------------------------------------------------------------------
+\gdef\Sin(#1,#2){%
+ \Dset(\@@x,#1) \Dmod(\@@x,6.2832)
+ \@@y=\@@x \@@a=\@@x
+ \Dset(\@@d,1) \@ta=1
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
+ \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
+ \@@a=-\@@a \Add(\@@y,\@@a) \@@d=\@@a \Dabs(\@@d)} #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the cosinus of an angle r in radian. The result is returned
+% in register r. First, we reduce the argument to [0,2pi]. \Cos(x,r)
+% -------------------------------------------------------------------------
+\gdef\Cos(#1,#2){%
+ \Dset(\@@x,#1) \Dmod(\@@x,6.2832)
+ \Dset(\@@d,1) \@ta=0
+ \Dset(\@@y,1) \Dset(\@@a,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
+ \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
+ \@@a=-\@@a \Add(\@@y,\@@a) \@@d=\@@a \Dabs(\@@d)} #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the tangens of an angle r in radian. The result is returned
+% in register r. First, we reduce the argument to [0,2pi]. We limit the
+% maximum value at |n/2*pi| to 5. \Tan(x,r)
+% -------------------------------------------------------------------------
+\gdef\Tan(#1,#2){%
+ \Dset(\@@U,#1) \Dmod(\@@U,6.2832)
+ \Sin(\Np\@@U,\@@X) \Cos(\Np\@@U,\@@Y)
+ \ifdim\@@Y=0pt \Dset(\@@X,5) \else \Ddiv(\@@X,\@@Y) \fi
+ #2=\@@X}
+
+% -------------------------------------------------------------------------
+% Calculates the arcus sinus of x. The result is returned in register r.
+% \Asin(x,r)
+% -------------------------------------------------------------------------
+\gdef\Asin(#1,#2){%
+ \Dset(\@@x,#1) \@ta=1
+ \ifdim\@@x<1.0pt
+ \ifdim\@@x>-1.0pt
+ \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Mul(\@@t,\@ta) \Dmul(\@@t,\@@x) \Add(\@ta,1)
+ \Div(\@@t,\@ta) \Dmul(\@@t,\@@x) \Add(\@ta,1)
+ \@@u=\@@t \Div(\@@t,\@ta) \Add(\@@y,\@@t)
+ \@@d=\@@t \Dabs(\@@d) \@@t=\@@u}
+ \else \Dset(\@@y,-1.5708) \fi
+ \else \Dset(\@@y,1.5708) \fi #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the arcus cosinus of x. The result is returned in register r.
+% \Acos(x,r)
+% -------------------------------------------------------------------------
+\gdef\Acos(#1,#2){%
+ \Asin(#1,\@@y) \Dset(#2,1.5708) \Sub(#2,\@@y)}
+
+% -------------------------------------------------------------------------
+% Calculates the arcus tangens of x. The result is returned in register r.
+% Because the power series of atan converges too slowly, we use the
+% addition theorem of atan and split the calculation to get accurate
+% results. \Atan(x,r)
+% -------------------------------------------------------------------------
+\gdef\Atan(#1,#2){%
+ \Dset(\@@x,#1) \@ta=1 \@Dabs(\@@x)
+ \ifdim\@@x<0.2500pt \Dset(\@@u,0.00000)
+ \@@a=1.0\@@x \Dsub(\@@a,0) \@@b=0.0\@@x \Dadd(\@@b,1)
+ \else
+ \ifdim\@@x<0.6875pt \Dset(\@@u,0.46365)
+ \@@a=2.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,2)
+ \else
+ \ifdim\@@x<1.1875pt \Dset(\@@u,0.78540)
+ \@@a=1.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,1)
+ \else
+ \ifdim\@@x<3.375pt \Dset(\@@u,0.98279)
+ \@@a=2.0\@@x \Dsub(\@@a,3) \@@b=3.0\@@x \Dadd(\@@b,2)
+ \else \Dset(\@@u,1.57080)
+ \@@a=0.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,0)
+ \fi\fi\fi\fi
+ \Ddiv(\@@a,\@@b) \@@x=\@@a \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Add(\@ta,2)
+ \Dmul(\@@t,\@@x) \Div(\@@t,\@ta)
+ \@@t=-\@@t \Add(\@@y,\@@t)
+ \@@d=\@@t \ifdim\@@d<0pt \@@d=-\@@d \fi}
+ \Add(\@@y,\@@u) \Mul(\@@y,\@@s) #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the sinus hyperbolicus. The result is returned in register r.
+% \Sinh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Sinh(#1,#2){%
+ \Dset(\@@x,#1) \@ta=1
+ \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
+ \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
+ \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the cosinus hyperbolicus. The result is returned in register
+% r. \Cosh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Cosh(#1,#2){%
+ \Dset(\@@x,#1) \@ta=0
+ \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
+ \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
+ \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the tangens hyperbolicus. The result is returned in register
+% r. \Tanh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Tanh(#1,#2){%
+ \Dset(\@@a,#1) \Dset(\@@b,#1)
+ \Cosh(#1,\@@a) \Sinh(#1,\@@b)
+ \Ddiv(\@@b,\@@a) #2=\@@b}
+
+% -------------------------------------------------------------------------
+% Calculates the area sinus of x. The result is returned register r.
+% \Asinh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Asinh(#1,#2){%
+ \Dset(\@@a,#1) \Dmul(\@@a,\@@a)
+ \Dadd(\@@a,1) \Sqrt(\Np\@@a,\@@a)
+ \Dadd(\@@a,#1) \Ln(\Np\@@a,\@@a) #2=\@@a}
+
+% -------------------------------------------------------------------------
+% Calculates the area cosinus of x. The result is returned register r.
+% \Acosh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Acosh(#1,#2){%
+ \Dset(\@@a,#1)
+ \ifdim\@@a<12pt \Dmul(\@@a,\@@a)
+ \Dsub(\@@a,1) \Sqrt(\Np\@@a,\@@a)
+ \Dadd(\@@a,#1) \Ln(\Np\@@a,\@@a)
+ \else \Add(\@@a,\@@a) \Ln(\Np\@@a,\@@a) \fi #2=\@@a}
+
+% -------------------------------------------------------------------------
+% Calculates the area tangens of x. The result is returned register r.
+% We limit the maximum value of atanh to 5. \Atanh(x,r)
+% -------------------------------------------------------------------------
+\gdef\Atanh(#1,#2){%
+ \Dset(\@@a,#1) \@Dabs(\@@a)
+ \ifdim\@@a>0.9999pt \Dset(\@@a,5) \else
+ \Dset(\@@b,1) \Sub(\@@b,\@@a) \Dadd(\@@a,1)
+ \Ln(\Np\@@a,\@@a) \Ln(\Np\@@b,\@@b)
+ \Sub(\@@a,\@@b) \Div(\@@a,2) \fi
+ \Mul(\@@a,\@@s) #2=\@@a}
+
+% -------------------------------------------------------------------------
+% Calculates the natural logarithm. The result is returned in register r.
+% For large numbers we reduce the argument x, using ln(x)=ln(x/e^k)+k.
+% For small numbers we enlarge the argument x, using ln(x)=ln(x*e^k)-k.
+% The value of k is added at the end. \Ln(x,r)
+% -------------------------------------------------------------------------
+\gdef\Ln(#1,#2){%
+ \Dset(\@@x,#1) \Dset(\@@t,2.71828) \@ta=1 \@tb=0
+ \@whiledim{\@@x>\@@t}\do{\Ddiv(\@@x,\@@t) \Add(\@tb,1)}
+ \@whiledim{\@@x<1pt}\do{\Dmul(\@@x,\@@t) \Sub(\@tb,1)}
+ \@@t=\@@x \Dadd(\@@t,1)
+ \Dsub(\@@x,1) \Ddiv(\@@x,\@@t)
+ \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Dmul(\@@t,\@@x)
+ \@@u=\@@t \Add(\@ta,2) \Div(\@@t,\@ta)
+ \Add(\@@y,\@@t) \@@d=\@@t \ifdim\@@d<0pt \@@d=-\@@d \fi
+ \@@t=\@@u} \Mul(\@@y,2) \Dadd(\@@y,\@tb) #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the logarithm of x to basis a. The result is returned in
+% register r. \Log(a,x,r)
+% -------------------------------------------------------------------------
+\gdef\Log(#1,#2,#3){%
+ \Ln(#1,\@ax) \Ln(#2,\@@x)
+ \Ddiv(\@@x,\@ax) #3=\@@x}
+
+% -------------------------------------------------------------------------
+% Calculates the natural power of x. The result is returned in register r.
+% \Exp(x,r)
+% -------------------------------------------------------------------------
+\gdef\Exp(#1,#2){%
+ \Dset(\@@x,#1) \@ta=1
+ \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
+ \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
+
+% -------------------------------------------------------------------------
+% Calculates the x-th power of number a. The result is returned in
+% register r. \Pow(a,x,r)
+% -------------------------------------------------------------------------
+\gdef\Pow(#1,#2,#3){%
+ \Dset(\@@x,#1) \Dset(\@@y,#2)
+ \ifdim\@@y=1.0pt #3=\@@x \else
+ \ifdim\@@x>0pt
+ \Ln(#1,\@@y) \Dset(\@@x,#2) \Dmul(\@@x,\@@y) \@ta=1
+ \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
+ \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)}
+ #3=\@@y \else #3=\@@x \fi \fi}
+
+% -------------------------------------------------------------------------
+% Calculates the n-th root of a number x. The result is returned in
+% register r. \Root(x,n,r)
+% -------------------------------------------------------------------------
+\gdef\Root(#1,#2,#3){%
+ \Dset(\@@x,#1) \Dset(\@@y,#2)
+ \ifdim\@@y=1pt #3=\@@x \else
+ \ifdim\@@x>0pt
+ \Ln(#1,\@@x) \Dset(\@@y,#2) \Ddiv(\@@x,\@@y) \@ta=1
+ \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
+ \@whiledim{\@@d>0pt}\do{%
+ \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
+ \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)}
+ #3=\@@y \else #3=\@@x \fi \fi}
+
+% -------------------------------------------------------------------------
+% Calculates the n-th potenz (pos or neg integer) of a number a. The
+% result is returned in register r. \Pot(a,n,r)
+% -------------------------------------------------------------------------
+\gdef\Pot(#1,#2,#3){%
+ \Dset(\@@x,1) \@cm=#2 \@Abs(\@cm) \@ta=0
+ \@whilenum{\@ta<\@cm}\do{%
+ \Dmul(\@@x,#1pt) \Add(\@ta,1)}
+ \ifnum\@@s<0 \Dset(#3,1) \Ddiv(#3,\@@x) \else #3=\@@x \fi}
+
+% -------------------------------------------------------------------------
+% Calculates the square root of a number x. The result is returned in
+% register r. First we reduce the argument to get fewer steps. \Sqrt(x,r)
+% -------------------------------------------------------------------------
+\gdef\Sqrt(#1,#2){%
+ \Dset(\@@t,#1) \Dset(\@@x,1) \@@d=\@@x \@@b=\@@x
+ \ifdim\@@t=0pt \Dset(#2,0) \else
+ \@whiledim{\@@t>4pt}\do{\Div(\@@t,4) \Mul(\@@b,2)}
+ \@whiledim{\@@d>0pt}\do{\@@y=\@@t
+ \Ddiv(\@@y,\@@x) \Sub(\@@y,\@@x) \Div(\@@y,2)
+ \@@d=\@@y \Dabs(\@@d) \Add(\@@x,\@@y)} #2=\Np\@@b\@@x \fi}
+
+% -------------------------------------------------------------------------
+% Calculates the distance between two points. The result is returned in
+% register r. \Len(x1,y1)(x2,y2)(r)
+% -------------------------------------------------------------------------
+\gdef\Len(#1,#2)(#3,#4)(#5){%
+ \Dset(\@@a,#3) \Sub(\@@a,#1pt)
+ \Dset(\@@b,#4) \Sub(\@@b,#2pt)
+ \Dmul(\@@a,\@@a) \Dmul(\@@b,\@@b)
+ \Add(\@@a,\@@b) \Sqrt(\Np\@@a,#5)}
+
+% -------------------------------------------------------------------------
+% Calculates the hypothenuse of a rectangular triangle. The result is
+% returned in register r. \Hypot(a,b,r)
+% -------------------------------------------------------------------------
+\gdef\Hypot(#1,#2,#3){%
+ \Dset(\@@a,#1) \Dset(\@@b,#2)
+ \Dmul(\@@a,\@@a) \Dmul(\@@b,\@@b)
+ \Add(\@@a,\@@b) \Sqrt(\Np\@@a,#3)}
+
+% -------------------------------------------------------------------------
+% Calculates the directional angle between two points. The result in rad
+% is returned in register r. The first point is the reference point.
+% \Direc(x1,y1)(x2,y2)(r)
+% -------------------------------------------------------------------------
+\gdef\Direc(#1,#2)(#3,#4)(#5){%
+ \Dset(\@@X,#3) \Dset(\@@A,#1) \Sub(\@@X,\@@A)
+ \Dset(\@@Y,#4) \Dset(\@@B,#2) \Sub(\@@Y,\@@B)
+ \@@U=\@@X \Abs(\@@U)
+ \ifdim\@@U<0.001pt \Dset(\@@A,1.5708)
+ \ifdim\@@Y<0pt \Dadd(\@@A,3.1416) \fi
+ \else \@@A=\@@Y \Ddiv(\@@A,\@@X) \Atan(\Np\@@A,\@@A)
+ \ifdim\@@X<0pt \Dadd(\@@A,3.1416)
+ \else \ifdim\@@Y<0pt \Dadd(\@@A,6.2832) \fi\fi\fi #5=\@@A}
+
+% -------------------------------------------------------------------------
+% Rotate a point around the origin by angle a. The result is returned in
+% x2,y2. \Rotpoint(a)(x1,y1)(x2,y2)
+% -------------------------------------------------------------------------
+\gdef\Rotpoint(#1)(#2,#3)(#4,#5){%
+ \Dset(\@zx,#2) \Dset(\@zy,#3)
+ \Dset(\@yx,#2) \Dset(\@yy,#3)
+ \Rad(#1,\@@U)
+ \Sin(\Np\@@U,\@@A) \Cos(\Np\@@U,\@@B)
+ \Dmul(\@zx,\@@B) \Dmul(\@zy,\@@A)
+ \Dmul(\@yx,\@@A) \Dmul(\@yy,\@@B)
+ \Sub(\@zx,\@zy) \Add(\@yx,\@yy)
+ #4=\@zx #5=\@yx}
+
+% -------------------------------------------------------------------------
+% Draws a small point, filled with gray value g (0..1) at x,y.
+% \Point(g)(x,y)
+% -------------------------------------------------------------------------
+\gdef\Point(#1)(#2,#3){\Gsave \Setwidth(0.01) \Setcol(0,0,0)%
+ \Circle(32)(#2,#3,0.065) \Fill(#1,#1,#1) \Grestore}
+
+% -------------------------------------------------------------------------
+% TeX typesetting a text at x,y with positional specification s. We have
+% to temporary leave lapdf and reenter afterwords. If you want to add any
+% macro from the picture environment, you have to use the same procedure.
+% \Text(x,y,s){text}
+% -------------------------------------------------------------------------
+\gdef\Text(#1,#2,#3)#4{%
+ \end{pdf} \normalsize \put(#1,#2){\makebox(0,0)[#3]{#4}} \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% \Setcol(r,g,b) set a color
+% \Setgray(v) set a gray
+% \@setcol(switch,r,g,b) helper function
+% rg and g are fore filling (f is first param)
+% RG and G are fore stroking (s is first param)
+% -------------------------------------------------------------------------
+\gdef\@setcol(#1,#2,#3,#4){\def\@c{#1}
+ \Dset(\@CR,#2) \Dset(\@CG,#3) \Dset(\@CB,#4)
+ \ifnum\@cl=1
+ \if\@c f \@f={rg} \else \@f={RG} \fi
+ \def\@e{#2 #3 #4}
+ \else
+ \ifdim\@ax=1.0pt \def\@e{1} \else \def\@e{0} \fi
+ \fi
+ \PDF{\@e\space \the\@f}}
+
+\gdef\Setcol(#1,#2,#3){\@setcol(s,#1,#2,#3)}
+\gdef\Setgray(#1){\@setcol(s,#1,#1,#1)}
+
+% -------------------------------------------------------------------------
+% Some useful predefined colors. All names start with capital letters.
+% -------------------------------------------------------------------------
+\gdef\Black{\Setcol(0,0,0)}
+\gdef\Dred{\Setcol(0.7,0,0)}
+\gdef\Dgreen{\Setcol(0,0.7,0)}
+\gdef\Dblue{\Setcol(0,0,0.7)}
+\gdef\Dcyan{\Setcol(0,0.7,0.7)}
+\gdef\Dmagenta{\Setcol(0.7,0,0.7)}
+\gdef\Dyellow{\Setcol(0.7,0.7,0)}
+\gdef\Dgray{\Setcol(0.4,0.4,0.4)}
+\gdef\Gray{\Setcol(0.8,0.8,0.8)}
+\gdef\Red{\Setcol(1,0,0)}
+\gdef\Green{\Setcol(0,1,0)}
+\gdef\Blue{\Setcol(0,0,1)}
+\gdef\Cyan{\Setcol(0,1,1)}
+\gdef\Magenta{\Setcol(1,0,1)}
+\gdef\Yellow{\Setcol(1,1,0)}
+\gdef\White{\Setcol(1,1,1)}
+
+% -------------------------------------------------------------------------
+% The first macro strokes with current and fills with specified color.
+% \Fill(r,g,b)
+% The second macro simply uses gray instead of a color value
+% \Gfill(gr)
+% The third strokes and fills with the current color (CR, CG, CB).
+% \Sfill
+% -------------------------------------------------------------------------
+\gdef\Fill(#1,#2,#3){\@setcol(f,#1,#2,#3) \PDF{B*}}
+\gdef\Gfill(#1){\@setcol(f,#1,#1,#1) \PDF{B*}}
+\gdef\Sfill{\Fill(\Np\@CR,\Np\@CG,\Np\@CB)}
+
+% -------------------------------------------------------------------------
+% The main PDF commands, please read a PDF-Specification fore their meaning
+% and also the documentation of Lapdf
+% -------------------------------------------------------------------------
+\gdef\Gsave{\PDF{q}}
+\gdef\Grestore{\PDF{Q}}
+\gdef\Setclip{\PDF{W* n}}
+\gdef\Stroke{\PDF{S}}
+\gdef\Closepath{\PDF{h}}
+\gdef\Setwidth(#1){\PDF{#1 w}}
+\gdef\Thick{\PDF{0.03 w}}
+\gdef\Thin{\PDF{0.01 w}}
+\gdef\Setcap(#1){\PDF{#1 J}}
+\gdef\Setjoin(#1){\PDF{#1 j}}
+\gdef\Setflat(#1){\PDF{#1 i}}
+\gdef\Setmiter(#1){\PDF{#1 M}}
+\gdef\Setdash(#1){\PDF{#1 d}}
+\gdef\Bezier(#1,#2,#3,#4,#5,#6){\PDF{#1 #2 #3 #4 #5 #6 c}}
+\gdef\Concat(#1,#2,#3,#4,#5,#6){\PDF{#1 #2 #3 #4 #5 #6 cm}}
+\gdef\Translate(#1,#2){\PDF{1 0 0 1 #1 #2 cm}}
+\gdef\Scale(#1,#2){\PDF{#1 0 0 #2 0 0 cm}}
+\gdef\Rotate(#1){\Cos(#1,\@ax) \Sin(#1,\@bx)
+ \@cx=-\@bx \@rotate(\Np\@ax,\Np\@bx,\Np\@cx)}
+ \gdef\@rotate(#1,#2,#3){\PDF{#1 #2 #3 #1 0 0 cm}}
+\gdef\Rect(#1,#2,#3,#4){\PDF{#1 #2 #3 #4 re}}
+
+% -------------------------------------------------------------------------
+% \Dash(n) 4 predefined standard dashes (0..3).
+% -------------------------------------------------------------------------
+\gdef\Dash(#1){\def\@c{#1}
+ \ifnum\@c=0 \PDF{[] 0 d} \fi
+ \ifnum\@c=1 \PDF{[0.1 0.1] 0 d} \fi
+ \ifnum\@c=2 \PDF{[0.1 0.1 0.025 0.1] 0 d} \fi
+ \ifnum\@c=3 \PDF{[0.025 0.1] 0 d} \fi}
+
+% -------------------------------------------------------------------------
+% Move to point and line drawing in affine space.
+% \Moveto(x1,y1) \Lineto(x1,y1) \Line(x1,y1,x2,y2)
+% -------------------------------------------------------------------------
+\gdef\Moveto(#1,#2){\Dset(\@xx,#1) \Dset(\@xy,#2) \PDF{#1 #2 m}}
+\gdef\Lineto(#1,#2){\Dset(\@xx,#1) \Dset(\@xy,#2) \PDF{#1 #2 l}}
+\gdef\Line(#1,#2)(#3,#4){\Moveto(#1,#2) \Lineto(#3,#4)}
+
+% -------------------------------------------------------------------------
+% Move to point in homogeneous space.
+% \Rmoveto(x1,y1,z1)
+% -------------------------------------------------------------------------
+\gdef\Rmoveto(#1,#2,#3){\Dset(\@xx,#1) \Dset(\@xy,#2) \Dset(\@xz,#3)
+ \PDF{#1 #2 m}}
+
+% -------------------------------------------------------------------------
+% Helper macros for all the grid drawings.
+% -------------------------------------------------------------------------
+\gdef\@Putline(#1,#2)(#3,#4)(#5){\put(#1,#2){\line(#3,#4){#5}}}
+\gdef\@Putvector(#1,#2)(#3,#4)(#5){\put(#1,#2){\vector(#3,#4){#5}}}
+\gdef\@Puttext(#1,#2)[#3]#4{\put(#1,#2){\makebox(0,0)[#3]{#4}}}
+
+% -------------------------------------------------------------------------
+% Helper: Draws a graphic dot at point (x,y).
+% \@Gdot(x,y)
+% -------------------------------------------------------------------------
+\gdef\@Gbox{\setbox\@tbox\hbox{\hskip-\@halfwidth%
+ \vrule\@height\@halfwidth\@depth\@halfwidth\@width\@wholewidth}}
+
+\gdef\@Gdot(#1,#2){\@killglue
+ \raise#2\hb@xt@\z@{\kern#1\unhcopy\@tbox\hss}}
+
+% -------------------------------------------------------------------------
+% Helper: Draws a dashed line with n points per unitlength from current
+% point to x,y. \@Gline(n)(x,y)
+% -------------------------------------------------------------------------
+\gdef\@Gline(#1)(#2,#3){%
+ \@cm=#1 \@ci=0
+ \@dx=#2\Ul \@dy=#3\Ul
+ \Div(\@dx,\@cm) \Div(\@dy,\@cm)
+ \Add(\@cm,1) \@Gbox
+ \@whilenum{\@ci<\@cm}\do{%
+ \@@X=\@ci\@dx \@@Y=\@ci\@dy
+ \@Gdot(\@@X,\@@Y) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Helper: Draws a dashed circle of radius r with 10 points per unitlength.
+% \@Gcircle(r)
+% -------------------------------------------------------------------------
+\gdef\@Gcircle(#1){%
+ \@cm=#1 \Mul(\@cm,63) \@ci=0
+ \Dset(\@dx,6.2832) \Div(\@dx,\@cm) \@Gbox
+ \@whilenum{\@ci<\@cm}\do{%
+ \@dy=\@ci\@dx
+ \Cos(\Np\@dy,\@@X) \@@X=#1\@@X
+ \Sin(\Np\@dy,\@@Y) \@@Y=#1\@@Y
+ \@Gdot(\Np\@@X\Ul,\Np\@@Y\Ul) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a linear grid with n points per unitlength. A grid is drawn if g>0.
+% Value a may be 0 (no axes), 1 (simple axes), 2 (additional tickmarks)
+% or 3 (additional values). \Lingrid(n)(g,a)(xmin,max)(ymin,ymax)
+% -------------------------------------------------------------------------
+\gdef\Lingrid(#1)(#2,#3)(#4,#5)(#6,#7){%
+ \end{pdf}
+ \scriptsize
+ \linethickness{\wid}
+ \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=#4 \@cc=#5 \Add(\@cc,1)
+ \ifnum#4=0
+ \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,0)[rc]{0} \fi \fi
+ \ifnum#6=0
+ \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(0,-0.15)[ct]{0} \fi \fi
+ \@whilenum{\@cb<\@cc}\do{%
+ \ifnum#2=1 \put(\@cb,#6){\@Gline(\@cg)(0,\@cd)} \fi
+ \ifnum\@cb=0 \else
+ \ifnum#3>1 \@Putline(\@cb,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(\@cb,-0.15)[ct]{\the\@cb} \fi \fi
+ \Add(\@cb,1)}
+ \@cd=#5 \Sub(\@cd,#4) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=#6 \@cc=#7 \Add(\@cc,1)
+ \@whilenum{\@cb<\@cc}\do{%
+ \ifnum#2=1 \put(#4,\@cb){\@Gline(\@cg)(\@cd,0)} \fi
+ \ifnum\@cb=0 \else
+ \ifnum#3>1 \@Putline(-0.1,\@cb)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,\@cb)[rc]{\the\@cb} \fi \fi
+ \Add(\@cb,1)}
+ \Dset(\@@X,#5) \Dsub(\@@X,#4) \Dadd(\@@X,0.4)
+ \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Dadd(\@@Y,0.4)
+ \ifnum#3>0 \@Putvector(#4,0)(1,0)(\Np\@@X)
+ \@Putvector(0,#6)(0,1)(\Np\@@Y) \fi
+ \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% Draws a grid with n points per unitlength. It is horizontal logarithmic
+% and vertical linear. A grid is drawn if g>0. Value a may be 0 (no axes),
+% 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
+% \Logxgrid(n)(g,a)(xmin,max)(ymin,ymax)
+% -------------------------------------------------------------------------
+\gdef\Logxgrid(#1)(#2,#3)(#4,#5)(#6,#7){%
+ \end{pdf}
+ \scriptsize
+ \linethickness{\wid}
+ \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=1 \@cc=0 \@ca=#4
+ \ifnum#6=0
+ \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(0,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi
+ \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@X) \Dadd(\@@X,\@cc) \Mul(\@@X,5)
+ \ifnum#2=1 \put(\Np\@@X,#6){\@Gline(\@cg)(0,\@cd)} \fi
+ \ifnum\@cb<10 \Add(\@cb,1)
+ \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
+ \ifnum#3>1 \@Putline(\Np\@@X,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(\Np\@@X,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi}
+ \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=#6 \@cc=#7 \Add(\@cc,1)
+ \@whilenum{\@cb<\@cc}\do{%
+ \ifnum#2=1 \put(0,\@cb){\@Gline(\@cg)(\@cd,0)} \fi
+ \ifnum#3>1 \@Putline(-0.1,\@cb)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,\@cb)[rc]{\the\@cb} \fi \Add(\@cb,1)}
+ \Dset(\@@X,#5) \Dsub(\@@X,#4) \Mul(\@@X,5) \Dadd(\@@X,0.4)
+ \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Dadd(\@@Y,0.4)
+ \ifnum#3>0 \@Putvector(-0.1,0)(1,0)(\Np\@@X)
+ \@Putvector(0,#6)(0,1)(\Np\@@Y) \fi
+ \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% Draws a grid with n points per unitlength. It is horizontal linear and
+% vertical logarithmic. A grid is drawn if g>0. Value a may be 0 (no axes),
+% 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
+% \Logygrid(n)(g,a)(xmin,max)(ymin,ymax)
+% -------------------------------------------------------------------------
+\gdef\Logygrid(#1)(#2,#3)(#4,#5)(#6,#7){%
+ \end{pdf}
+ \scriptsize
+ \linethickness{\wid}
+ \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=1 \@cc=0 \@ca=#4
+ \ifnum#6=0
+ \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,0)[rc]{$10^{\the\@ca}$} \fi \fi
+ \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@Y) \Dadd(\@@Y,\@cc) \Mul(\@@Y,5)
+ \ifnum#2=1 \put(#6,\Np\@@Y){\@Gline(\@cg)(\@cd,0)} \fi
+ \ifnum\@cb<10 \Add(\@cb,1)
+ \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
+ \ifnum#3>1 \@Putline(-0.1,\Np\@@Y)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,\Np\@@Y)[rc]{$10^{\the\@ca}$} \fi \fi}
+ \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=#6 \@cc=#7 \Add(\@cc,1)
+ \@whilenum{\@cb<\@cc}\do{%
+ \ifnum#2=1 \put(\@cb,0){\@Gline(\@cg)(0,\@cd)} \fi
+ \ifnum#3>1 \@Putline(\@cb,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(\@cb,-0.15)[ct]{\the\@cb} \fi \Add(\@cb,1)}
+ \Dset(\@@Y,#5) \Dsub(\@@Y,#4) \Mul(\@@Y,5) \Dadd(\@@Y,0.4)
+ \Dset(\@@X,#7) \Dsub(\@@X,#6) \Dadd(\@@X,0.4)
+ \ifnum#3>0 \@Putvector(#6,0)(1,0)(\Np\@@X)
+ \@Putvector(0,-0.1)(0,1)(\Np\@@Y) \fi
+ \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% Draws a grid with n points per unitlength. It is logarithmic in both
+% directions. A grid is drawn if g>0. Value a may be 0 (no axes),
+% 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
+% \Logxygrid(n)(g,a)(xmin,max)(ymin,ymax)
+% -------------------------------------------------------------------------
+\gdef\Logxygrid(#1)(#2,#3)(#4,#5)(#6,#7){%
+ \end{pdf}
+ \scriptsize
+ \linethickness{\wid}
+ \@cd=#7 \Sub(\@cd,#6) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=1 \@cc=0 \@ca=#4
+ \ifnum#6=0
+ \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(0,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi
+ \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@X) \Dadd(\@@X,\@cc) \Mul(\@@X,5)
+ \ifnum#2=1 \put(\Np\@@X,#6){\@Gline(\@cg)(0,\@cd)} \fi
+ \ifnum\@cb<10 \Add(\@cb,1)
+ \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
+ \ifnum#3>1 \@Putline(\Np\@@X,-0.1)(0,1)(0.1) \fi
+ \ifnum#3>2 \@Puttext(\Np\@@X,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi}
+ \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
+ \@cb=1 \@cc=0 \@ca=#6
+ \ifnum#6=0
+ \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,0)[rc]{$10^{\the\@ca}$} \fi \fi
+ \@whilenum{\@ca<#7}\do{\Log(10,\@cb,\@@Y) \Dadd(\@@Y,\@cc) \Mul(\@@Y,5)
+ \ifnum#2=1 \put(#6,\Np\@@Y){\@Gline(\@cg)(\@cd,0)} \fi
+ \ifnum\@cb<10 \Add(\@cb,1)
+ \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
+ \ifnum#3>1 \@Putline(-0.1,\Np\@@Y)(1,0)(0.1) \fi
+ \ifnum#3>2 \@Puttext(-0.15,\Np\@@Y)[rc]{$10^{\the\@ca}$} \fi \fi}
+ \Dset(\@@X,#5) \Dsub(\@@X,#4) \Mul(\@@X,5) \Dadd(\@@X,0.4)
+ \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Mul(\@@Y,5) \Dadd(\@@Y,0.4)
+ \ifnum#3>0 \@Putvector(-0.1,0)(1,0)(\Np\@@X)
+ \@Putvector(0,-0.1)(0,1)(\Np\@@Y) \fi
+ \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% Draws a polar grid with 10 points per unitlength and maximum radius r.
+% If g>0, a grid is drawn. Value a may be 0 (no axes), 1 (simple axes),
+% 2 (additional tickmarks), 3 (additional values, angles in degree) or
+% 4 (like 3, but angles in multiples of pi). \Polgrid(g,a)(r)
+% -------------------------------------------------------------------------
+\gdef\Polgrid(#1,#2)(#3){%
+ \end{pdf}
+ \scriptsize
+ \linethickness{\wid}
+ \@ca=0
+ \@whilenum{\@ca<#3}\do{%
+ \Add(\@ca,1) \ifnum#1>0 \@Gcircle(\@ca) \fi
+ \ifnum#2>1
+ \ifnum\@ca=0 \else
+ \@Putline(\@ca,-0.1)(0,1)(0.1) \@Putline(-\@ca,-0.1)(0,1)(0.1)
+ \@Putline(-0.1,\@ca)(1,0)(0.1) \@Putline(-0.1,-\@ca)(1,0)(0.1)
+ \ifnum#2>2 \@Puttext(\@ca,-0.15)[tc]{\the\@ca} \fi \fi \fi}
+ \@ca=0 \@cb=0
+ \@whilenum{\@ca<360}\do{%
+ \@cb=#3 \Mul(\@cb,10) \Rad(\@ca,\@ax)
+ \ifnum#1>0
+ \Cos(\Np\@ax,\@@X) \Mul(\@@X,#3)
+ \Sin(\Np\@ax,\@@Y) \Mul(\@@Y,#3)
+ \put(0,0){\@Gline(\@cb)(\Np\@@X,\Np\@@Y)} \fi
+ \ifnum#2>2
+ \Dset(\@@U,#3) \Dadd(\@@U,0.35)
+ \Cos(\Np\@ax,\@@X) \Dmul(\@@X,\@@U)
+ \Sin(\Np\@ax,\@@Y) \Dmul(\@@Y,\@@U)
+ \ifnum#2>3 \@cb=\@ca \Div(\@cb,15)
+ \ifnum\@ca=0 \@Puttext(\Np\@@X,\Np\@@Y)[cc]{0}
+ \else \@cc=\@cb \Mod(\@cc,6)
+ \ifnum\@cc=0 \Div(\@cb,6)
+ \ifnum\@cb=2 \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\pi$}
+ \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\frac{\the\@cb}{2}\pi$} \fi
+ \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\frac{\the\@cb}{12}\pi$} \fi \fi
+ \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\the\@ca^{\circ}$} \fi \fi
+ \Add(\@ca,15)}
+ \ifnum#2>0 \Dset(\@@X,#3) \Mul(\@@X,2)
+ \@Putline(-#3,0)(1,0)(\Np\@@X) \@Putline(0,-#3)(0,1)(\Np\@@X) \fi
+ \begin{pdf}}
+
+% -------------------------------------------------------------------------
+% Plots a function with n line segments from x1 to x2. You have to define
+% a function \Fx with the command: \def\Fx(#1,#2){..}. #1 is the x value
+% and #2 is the result register. \Fplot(n)(x1,x2) Examples:
+% \def\Fx(#1,#2){\Sin(#1,#2) \Mul(#2,3) \Dadd(#2,1)} y=3*sin(x)+1
+% \def\Fx(#1,#2){\Dset(\x,#1) \Dsub(\x,2) \Exp(\Np\x,#2)} y=exp(x-2)
+% -------------------------------------------------------------------------
+\gdef\Fplot(#1)(#2,#3){%
+ \Dset(\@dx,#3) \Dsub(\@dx,#2) \Div(\@dx,#1)
+ \Dset(\@ux,#2) \Fx(\Np\@ux,\@uy)
+ \Moveto(\Np\@ux,\Np\@uy)
+ \@whiledim{\@ux<#3pt}\do{\Add(\@ux,\@dx)
+ \ifdim\@ux>#3pt \Dset(\@ux,#3) \fi
+ \Fx(\Np\@ux,\@uy) \Lineto(\Np\@ux,\Np\@uy)}}
+
+% -------------------------------------------------------------------------
+% Plots a parametric function with n line segments for t1 to t2. You have
+% to define two functions \Tx and \Ty with the commands: \def\Tx(#1,#2){..}
+% and \def\Ty(#1,#2){..}. Here #1 is the t value and #2 is the result
+% register. \Tplot(n)(t1,t2) Example:
+% \def\Tx(#1,#2){\Dset(#2,#1) \Mul(#2,2) \Dsub(#2,1)} x=2*t-1
+% \def\Ty(#1,#2){\Dset(\t,#1) #2=\t \Dmul(#2,#2) \Add(#2,\t)} y=t^2+t
+% -------------------------------------------------------------------------
+\gdef\Tplot(#1)(#2,#3){%
+ \Dset(\@dx,#3) \Dsub(\@dx,#2) \Div(\@dx,#1)
+ \Dset(\@@U,#2) \Tx(\Np\@@U,\@ux)
+ \Dset(\@@U,#2) \Ty(\Np\@@U,\@uy)
+ \Moveto(\Np\@ux,\Np\@uy)
+ \@whiledim{\@@U<#3pt}\do{\Add(\@@U,\@dx)
+ \ifdim\@@U>#3pt \Dset(\@@U,#3) \fi
+ \Tx(\Np\@@U,\@ux) \Ty(\Np\@@U,\@uy)
+ \Lineto(\Np\@ux,\Np\@uy)}}
+
+% -------------------------------------------------------------------------
+% Converts a polar function r=f(a) to parametric cartesian form with:
+% x=f(a)*cos(a), y=f(a)*sin(a). The result is returned in regs x and y.
+% \Pxy(a,x,y)
+% -------------------------------------------------------------------------
+\gdef\Pxy(#1,#2,#3){%
+ \Px(#1,#2) #3=#2
+ \Cos(#1,\@@T) \Dmul(#2,\@@T)
+ \Sin(#1,\@@T) \Dmul(#3,\@@T)}
+
+% -------------------------------------------------------------------------
+% Plots a polar function with n line segments from a1 to a2. You have to
+% define a function \Px with the command: \def\Px(#1,#2){..}. #1 is the x
+% value and #2 is the result register. \Pplot(n)(a1,a2) Examples:
+% \def\Px(#1,#2){\Dset(\a,#1) #2=2\a \Sin(\Np#2,#2)} r=cos(2a)
+% \def\Px(#1,#2){\Dset(\Sin(#1,#2) \Dadd(#2,1)} r=1+sin(a)
+% -------------------------------------------------------------------------
+\gdef\Pplot(#1)(#2,#3){%
+ \Dset(\@tx,#2) \Dset(\@ty,#3)
+ \Dmul(\@tx,3.14159pt) \Dmul(\@ty,3.14159pt)
+ \@dx=\@ty \Sub(\@dx,\@tx) \Div(\@dx,#1)
+ \@@U=\@tx \Pxy(\Np\@@U,\@ux,\@uy)
+ \Moveto(\Np\@ux,\Np\@uy)
+ \@whiledim{\@@U<\@ty}\do{\Add(\@@U,\@dx)
+ \ifdim\@@U>\@ty \@@U=\@ty \fi
+ \Pxy(\Np\@@U,\@ux,\@uy)
+ \Lineto(\Np\@ux,\Np\@uy)}}
+
+% -------------------------------------------------------------------------
+% Calculates the derivative dy/dx of a predefined real function \Fx.
+% The value is x and the result is stored in register n. \Df(x,n)
+% -------------------------------------------------------------------------
+\gdef\Df(#1,#2){%
+ \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
+ \Fx(\Np\@dy,#2) \Fx(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
+
+% -------------------------------------------------------------------------
+% Calculates the partial derivative dx/dt of a predefined parameter curve
+% \Tx. The value is t and the result is stored in register n. \Dtx(t,n)
+% -------------------------------------------------------------------------
+\gdef\Dtx(#1,#2){%
+ \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
+ \Tx(\Np\@dy,#2) \Tx(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
+
+% -------------------------------------------------------------------------
+% Calculates the partial derivative dy/dt of a predefined parameter curve
+% \Ty. The value is t and the result is stored in register n. \Dty(t,n)
+% -------------------------------------------------------------------------
+\gdef\Dty(#1,#2){%
+ \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
+ \Ty(\Np\@dy,#2) \Ty(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
+
+% -------------------------------------------------------------------------
+% Calculates the total derivative dy/dx of a predefined parameter curve
+% \Ty, \Tx. The value is t and the result is stored in register n. \Dtt(t,n)
+% -------------------------------------------------------------------------
+\gdef\Dtt(#1,#2){%
+ \Dty(#1,#2) \Dtx(#1,\@dz) \Ddiv(#2,\@dz)}
+
+% -------------------------------------------------------------------------
+% Calculates the partial derivative dx/da of a predefined polar curve \Px.
+% The value is a and the result is stored in register n. \Dpx(a,n)
+% -------------------------------------------------------------------------
+\gdef\Dpx(#1,#2){%
+ \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
+ \Px(\Np\@dy,#2) \Cos(\Np\@dy,\@dy) \Dmul(#2,\@dy)
+ \Px(\Np\@dx,\@tx) \Cos(\Np\@dx,\@dx) \Dmul(\@tx,\@dx)
+ \Sub(#2,\@tx) #2=32#2}
+
+% -------------------------------------------------------------------------
+% Calculates the partial derivative dy/da of a predefined polar curve \Px.
+% The value is a and the result is stored in register n. \Dpy(a,n)
+% -------------------------------------------------------------------------
+\gdef\Dpy(#1,#2){%
+ \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
+ \Px(\Np\@dy,#2) \Sin(\Np\@dy,\@dy) \Dmul(#2,\@dy)
+ \Px(\Np\@dx,\@tx) \Sin(\Np\@dx,\@dx) \Dmul(\@tx,\@dx)
+ \Sub(#2,\@tx) #2=32#2}
+
+% -------------------------------------------------------------------------
+% Calculates the total derivative dy/dx of a predefined polar curve \Px.
+% The value is a and the result is stored in register n. \Dtp(a,n)
+% -------------------------------------------------------------------------
+\gdef\Dtp(#1,#2){%
+ \Dpy(#1,#2) \Dpx(#1,\@dz) \Ddiv(#2,\@dz)}
+
+% -------------------------------------------------------------------------
+% Draws a full ellipse with two rational quadratic bezier curves. x,y is
+% the center, a and b are the diameters, n is the number of segments and c
+% is the rotation angle in degree. \Ellipse(n)(x,y)(a,b,c)
+% -------------------------------------------------------------------------
+\gdef\Ellipse(#1)(#2,#3)(#4,#5,#6){%
+ \@tb=#1 \Mul(\@tb,3) \Rad(#6,\@sx)
+ \Dset(\@ux,#2) \Dset(\@uy,#3)
+ \Dset(\@vx,#2) \Dset(\@vy,#3)
+ \Dset(\@wx,#2) \Dset(\@wy,#3)
+ \Dset(\@ax,#4) \Dset(\@ay,#5)
+ \Sin(\Np\@sx,\@sy) \Cos(\Np\@sx,\@sx)
+ \@bx=0.866\@ax \@by=0.500\@ay
+ \@cx=\@bx \@cy=\@by
+ \Dmul(\@bx,\@sx)\Dmul(\@by,\@sy)
+ \Dmul(\@cx,\@sy)\Dmul(\@cy,\@sx)
+ \Sub(\@ux,\@bx) \Sub(\@ux,\@by)
+ \Sub(\@uy,\@cx) \Add(\@uy,\@cy)
+ \Add(\@wx,\@bx) \Sub(\@wx,\@by)
+ \Add(\@wy,\@cx) \Add(\@wy,\@cy)
+ \@bx=0.000\@ax \@by=2.000\@ay
+ \@cx=\@bx \@cy=\@by
+ \Dmul(\@bx,\@sx)\Dmul(\@by,\@sy)
+ \Dmul(\@cx,\@sy)\Dmul(\@cy,\@sx)
+ \Add(\@vx,\@bx) \Sub(\@vx,\@by)
+ \Add(\@vy,\@cx) \Add(\@vy,\@cy)
+ \Rmoveto(\Np\@ux,\Np\@uy,2)
+ \Rcurveto(#1)(\Np\@vx,\Np\@vy,1)(\Np\@wx,\Np\@wy,2)
+ \Rcurveto(\@tb)(\Np\@vx,\Np\@vy,-1)(\Np\@ux,\Np\@uy,2)}
+
+% -------------------------------------------------------------------------
+% Draws a full circle with two rational quadratic Bezier curves.
+% \Circle(n)(x,y,radius)
+% -------------------------------------------------------------------------
+\gdef\Circle(#1)(#2,#3,#4){%
+ \Set(\@tb,#1) \Mul(\@tb,2)
+ \Dset(\@ux,#2) \Dset(\@uy,#3)
+ \Dset(\@vx,#2) \Dset(\@vy,#3)
+ \Dset(\@wx,#2) \Dset(\@wy,#3)
+ \Dset(\@ax,#4) \Dset(\@ay,#4) \Dset(\@az,#4)
+ \@ax=0.866\@ax \@ay=0.500\@ay \@az=2.000\@az
+ \Sub(\@ux,\@ax) \Add(\@wx,\@ax)
+ \Sub(\@uy,\@ay) \Sub(\@vy,\@az) \Sub(\@wy,\@ay)
+ \Rmoveto(\Np\@ux,\Np\@uy,2)
+ \Rcurveto(#1)(\Np\@vx,\Np\@vy,1)(\Np\@wx,\Np\@wy,2)
+ \Rcurveto(\@tb)(\Np\@vx,\Np\@vy,-1)(\Np\@ux,\Np\@uy,2)}
+
+% -------------------------------------------------------------------------
+% Draws a rectangle between two points, rotated at point x1,y1 by angle a
+% in degree. \Rectangle(x1,y1)(x2,y2)(a)
+% -------------------------------------------------------------------------
+\gdef\Rectangle(#1,#2)(#3,#4)(#5){%
+ \Dset(\@cx,#3) \Dset(\@cy,#4) \Dset(\@@U,#5)
+ \@bx=\@cx \Dset(\@by,0) \Dset(\@dx,0) \@dy=\@cy
+ \Rotpoint(#5)(\Np\@bx,\Np\@by)(\@ux,\@uy)
+ \Rotpoint(#5)(\Np\@cx,\Np\@cy)(\@vx,\@vy)
+ \Rotpoint(#5)(\Np\@dx,\Np\@dy)(\@wx,\@wy)
+ \Dadd(\@ux,#1) \Dadd(\@uy,#2)
+ \Dadd(\@vx,#1) \Dadd(\@vy,#2)
+ \Dadd(\@wx,#1) \Dadd(\@wy,#2)
+ \Polygon(#1,#2)(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy)(\Np\@wx,\Np\@wy)(#1,#2)}
+
+% -------------------------------------------------------------------------
+% Draws a triangle between three points, rotated at point x1,y1 by angle a
+% in degree. \Triangle(x1,y1)(x2,y2)(x3,y3)(a)
+% -------------------------------------------------------------------------
+\gdef\Triangle(#1,#2)(#3,#4)(#5,#6)(#7){%
+ \Dset(\@bx,#3) \Dsub(\@bx,#1)
+ \Dset(\@by,#4) \Dsub(\@by,#2)
+ \Dset(\@cx,#5) \Dsub(\@cx,#1)
+ \Dset(\@cy,#6) \Dsub(\@cy,#2)
+ \Rotpoint(#7)(\Np\@bx,\Np\@by)(\@ux,\@uy)
+ \Rotpoint(#7)(\Np\@cx,\Np\@cy)(\@vx,\@vy)
+ \Dadd(\@ux,#1) \Dadd(\@uy,#2)
+ \Dadd(\@vx,#1) \Dadd(\@vy,#2)
+ \Polygon(#1,#2)(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy)(#1,#2)}
+
+% -------------------------------------------------------------------------
+% Draws a equilateral polygon with radius r and n vertices. It is rotated
+% around the center x,y by an angle a in degree. The first (unrotated)
+% point is r,0. \Epolygon(n)(x,y)(r,a)
+% -------------------------------------------------------------------------
+\gdef\Epolygon(#1)(#2,#3)(#4,#5){%
+ \Rotpoint(#5)(#4,0)(\@vx,\@vy)
+ \Dadd(\@vx,#2) \Dadd(\@vy,#3)
+ \@ch=0
+ \Moveto(\Np\@vx,\Np\@vy)
+ \@whilenum{\@ch<#1}\do{\Add(\@ch,1)
+ \Dset(\@ax,6.2832) \Div(\@ax,#1) \Mul(\@ax,\@ch)
+ \Cos(\Np\@ax,\@vx) \Dmul(\@vx,#4pt)
+ \Sin(\Np\@ax,\@vy) \Dmul(\@vy,#4pt)
+ \Rotpoint(#5)(\Np\@vx,\Np\@vy)(\@vx,\@vy)
+ \Dadd(\@vx,#2) \Dadd(\@vy,#3)
+ \Lineto(\Np\@vx,\Np\@vy)}}
+
+% -------------------------------------------------------------------------
+% Draws a sector of a circle with center xm,ym, radius r, direction a and
+% angle b in degree with n segments. \Sector(n)(xm,ym)(a,b)(r)
+% -------------------------------------------------------------------------
+\gdef\Sector(#1)(#2,#3)(#4,#5)(#6){%
+ \Dset(\@ax,#4) \Dset(\@bx,#5) \Dset(\@rx,#6) \@ch=0
+ \Rad(#4,\@sx) \Cos(\Np\@sx,\@sx) \Dmul(\@sx,\@rx)
+ \Rad(#4,\@sy) \Sin(\Np\@sy,\@sy) \Dmul(\@sy,\@rx)
+ \Dadd(\@sx,#2) \Dadd(\@sy,#3)
+ \Line(#2,#3)(\Np\@sx,\Np\@sy)
+ \@whilenum{\@ch<#1}\do{\Add(\@ch,1)
+ \Dset(\@dx,#5) \Div(\@dx,#1) \Mul(\@dx,\@ch) \Dadd(\@dx,#4)
+ \Rad(\Np\@dx,\@sx) \Cos(\Np\@sx,\@sx) \Dmul(\@sx,\@rx)
+ \Rad(\Np\@dx,\@sy) \Sin(\Np\@sy,\@sy) \Dmul(\@sy,\@rx)
+ \Dadd(\@sx,#2) \Dadd(\@sy,#3) \Lineto(\Np\@sx,\Np\@sy)} \Lineto(#2,#3)}
+
+% -------------------------------------------------------------------------
+% These draw a circular arc (or a circular vector) with center xm,ym,
+% radius r, direction a and angle b in degree with n segments. Both use
+% \@Arc. \Arc(n)(xm,ym)(a,b)(r) \Varc(n)(xm,ym)(a,b)(r)
+% -------------------------------------------------------------------------
+\gdef\Arc(#1)(#2,#3)(#4,#5)(#6){\@Arc(#1)(#2,#3)(#4,#5)(#6,0)}
+\gdef\Varc(#1)(#2,#3)(#4,#5)(#6){\@Arc(#1)(#2,#3)(#4,#5)(#6,1)}
+
+% -------------------------------------------------------------------------
+% Helper macro that draws a circular arc (t=0) or vector (t=1).
+% It is called by \Arc and \Varc. \@Arc(n)(xm,ym)(a,b)(r,t)
+% -------------------------------------------------------------------------
+\gdef\@Arc(#1)(#2,#3)(#4,#5)(#6,#7){%
+ \Dset(\@ax,#4) \Dset(\@bx,#5) \Dset(\@rx,#6) \@ch=0
+ \Rad(#4,\@vx) \Cos(\Np\@vx,\@vx) \Dmul(\@vx,\@rx)
+ \Rad(#4,\@vy) \Sin(\Np\@vy,\@vy) \Dmul(\@vy,\@rx)
+ \Dadd(\@vx,#2) \Dadd(\@vy,#3)
+ \@whilenum{\@ch<#1}\do{\Add(\@ch,1) \@ux=\@vx \@uy=\@vy
+ \Dset(\@dx,#5) \Div(\@dx,#1) \Mul(\@dx,\@ch) \Dadd(\@dx,#4)
+ \Rad(\Np\@dx,\@vx) \Cos(\Np\@vx,\@vx) \Dmul(\@vx,\@rx)
+ \Rad(\Np\@dx,\@vy) \Sin(\Np\@vy,\@vy) \Dmul(\@vy,\@rx)
+ \Dadd(\@vx,#2) \Dadd(\@vy,#3)
+ \ifnum#7=0 \Polygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \else
+ \ifnum\@ch<#1 \Polygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \else
+ {\Vpolygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \Stroke} \fi \fi}}
+
+% -------------------------------------------------------------------------
+% Draws a circular arc with center xm,ym, radius r, direction a and angle b
+% with n segments. The incoming direction goes from the current point. The
+% last point x2, y2 gives the outgoing direcion. Lines from the current
+% point and to the end point are also drawn. \Arcto(n)(x1,y1)(x2,y2)(r)
+% -------------------------------------------------------------------------
+\gdef\Arcto(#1)(#2,#3)(#4,#5)(#6){%
+ \Dset(\@yx,#2) \Dset(\@yy,#3)
+ \Dset(\@zx,#4) \Dset(\@zy,#5) \Dset(\@rx,#6)
+ \Direc(#2,#3)(\Np\@xx,\Np\@xy)(\@ax)
+ \Direc(#2,#3)(\Np\@zx,\Np\@zy)(\@ay)
+ \Len(\Np\@yx,\Np\@yy)(\Np\@xx,\Np\@xy)(\@dx)
+ \Len(\Np\@yx,\Np\@yy)(\Np\@zx,\Np\@zy)(\@dy)
+ \Len(\Np\@xx,\Np\@xy)(\Np\@zx,\Np\@zy)(\@dz)
+ \Cos(\Np\@ay,\@ex) \Dmul(\@ex,\@dx) \Add(\@ex,\@xx)
+ \Add(\@ex,\@yx) \@ex=0.5\@ex
+ \Sin(\Np\@ay,\@ey) \Dmul(\@ey,\@dx) \Add(\@ey,\@xy)
+ \Add(\@ey,\@yy) \@ey=0.5\@ey
+ \Direc(\Np\@yx,\Np\@yy)(\Np\@ex,\Np\@ey)(\@az)
+ \@cy=2.0\@dx \Dmul(\@cy,\@dy)
+ \Dmul(\@dx,\@dx) \Dmul(\@dy,\@dy) \Dmul(\@dz,\@dz)
+ \Add(\@dx,\@dy) \Sub(\@dx,\@dz) \Ddiv(\@dx,\@cy)
+ \Acos(\Np\@dx,\@cx) \@cy=0.5\@cx
+ \Dset(\@@U,1.5708) \Sub(\@@U,\@cy)
+ \Tan(\Np\@@U,\@dx) \Dmul(\@dx,\@rx) \Cos(\Np\@@U,\@@U)
+ \Cos(\Np\@ax,\@ux) \Dmul(\@ux,\@dx) \Add(\@ux,\@yx)
+ \Sin(\Np\@ax,\@uy) \Dmul(\@uy,\@dx) \Add(\@uy,\@yy)
+ \Cos(\Np\@ay,\@vx) \Dmul(\@vx,\@dx) \Add(\@vx,\@yx)
+ \Sin(\Np\@ay,\@vy) \Dmul(\@vy,\@dx) \Add(\@vy,\@yy)
+ \Polygon(\Np\@xx,\Np\@xy)(\Np\@ux,\Np\@uy) \Stroke
+ \Rcurve(#1)(\Np\@ux,\Np\@uy,1)(#2,#3,\Np\@@U)(\Np\@vx,\Np\@vy,1)
+ \Lineto(#4,#5) \Stroke}
+
+% -------------------------------------------------------------------------
+% Draws a vector from point x1,y1 to point x2,y2. \Vect(x1,y1)(x2,y2)
+% -------------------------------------------------------------------------
+\gdef\Vect(#1,#2)(#3,#4){%
+ \Dset(\@ux,#1) \Dset(\@uy,#2)
+ \Len(\Np\@ux,\Np\@uy)(#3,#4)(\@tx)
+ \Direc(\Np\@ux,\Np\@uy)(#3,#4)(\@ty)
+ \@cd=0 \Deg(\Np\@ty,\@ty)
+ \@dx=\@tx \Dsub(\@dx,0.20) \Dset(\@dy,0.05)
+ \@ex=\@dx \@ey=-\@dy
+ \Rotpoint(\Np\@ty)(\Np\@dx,\Np\@dy)(\@dx,\@dy)
+ \Rotpoint(\Np\@ty)(\Np\@ex,\Np\@ey)(\@ex,\@ey)
+ \Add(\@dx,\@ux) \Add(\@dy,\@uy)
+ \Add(\@ex,\@ux) \Add(\@ey,\@uy)
+ \Polygon(\Np\@ux,\Np\@uy)(#3,#4)(\Np\@dx,\Np\@dy)(\Np\@ex,\Np\@ey)(#3,#4)
+ \Sfill}
+
+% -------------------------------------------------------------------------
+% Draws a vector from the current point to point x1,y1. \Vecto(x1,y1)
+% -------------------------------------------------------------------------
+\gdef\Vecto(#1,#2){\Vect(\Np\@xx,\Np\@xy)(#1,#2)}
+
+% -------------------------------------------------------------------------
+% Computes the function value of a polynom (dregree <= 3) at x and stores
+% the result in y. \Fpoly(x,y)
+% -------------------------------------------------------------------------
+\gdef\Fpoly(#1,#2){#2=\@ax
+ \Dmul(#2,#1) \Add(#2,\@bx)
+ \Dmul(#2,#1) \Add(#2,\@cx)
+ \Dmul(#2,#1) \Add(#2,\@dx)}
+
+% -------------------------------------------------------------------------
+% Computes the first derivative of a polynom (degree <= 3) at x and stores
+% the result in y. \Dpoly(x,y)
+% -------------------------------------------------------------------------
+\gdef\Dpoly(#1,#2){#2=\@ax
+ \Dmul(#2,#1) \Mul(#2,3)
+ \Add(#2,\@bx) \Add(#2,\@bx)
+ \Dmul(#2,#1) \Add(#2,\@cx)}
+
+% -------------------------------------------------------------------------
+% Draws a polynom y=ax^3+bx^2+cx+d from x1 to x2 with a cubic bezier curve.
+% All coefficients may be zero. So you can draw lines, parabolas and cubics.
+% \Polynom(x1,x2)(a,b,c,d)
+% -------------------------------------------------------------------------
+\gdef\Polynom(#1,#2)(#3,#4,#5,#6){%
+ \Dset(\@sx,#1) \Dset(\@vx,#2)
+ \Dset(\@ax,#3) \Dset(\@bx,#4)
+ \Dset(\@cx,#5) \Dset(\@dx,#6)
+ \@zx=\@vx \Sub(\@zx,\@sx)
+ \Div(\@zx,3)
+ \@tx=\@sx \Add(\@tx,\@zx)
+ \@ux=\@vx \Sub(\@ux,\@zx)
+ \Dpoly(\@sx,\@wx) \Dmul(\@wx,\@zx)
+ \Dpoly(\@vx,\@wy) \Dmul(\@wy,\@zx)
+ \Fpoly(\@sx,\@sy) \Fpoly(\@vx,\@vy)
+ \@ty=\@sy \Add(\@ty,\@wx)
+ \@uy=\@vy \Sub(\@uy,\@wy)
+ \Moveto(\Np\@sx,\Np\@sy)
+ \Bezier(\Np\@tx,\Np\@ty,\Np\@ux,\Np\@uy,\Np\@vx,\Np\@vy)}
+
+% -------------------------------------------------------------------------
+% Draws the tangent of a polynom y=ax^3+bx^2+cx+d at abszissa x from x1
+% to x2 and marks the touching point. \Tangent(x)(x1,x2)(a,b,c,d)
+% -------------------------------------------------------------------------
+\gdef\Tangent(#1)(#2,#3)(#4,#5,#6,#7){%
+ \Dset(\@xx,#1)
+ \Dset(\@sx,#2) \Dset(\@tx,#3)
+ \Dset(\@ax,#4) \Dset(\@bx,#5)
+ \Dset(\@cx,#6) \Dset(\@dx,#7)
+ \Fpoly(\@xx,\@xy) \Dpoly(\@xx,\@wx)
+ \@sy=\@wx \@ty=\@wx
+ \Dmul(\@sy,\@sx) \Dmul(\@ty,\@tx)
+ \Add(\@sy,\@xy) \Add(\@ty,\@xy)
+ \Dmul(\@wx,\@xx)
+ \Sub(\@sy,\@wx) \Sub(\@ty,\@wx)
+ \Line(\Np\@sx,\Np\@sy)(\Np\@tx,\Np\@ty)
+ \Stroke
+ \Point(1)(#1,\Np\@xy)}
+
+% -------------------------------------------------------------------------
+% Draws a sequence of line segments. You have to provide m points
+% with m=i+1 (i=1,2,..). \Polygon(x1,y1)(x2,y2)...(xm,ym)
+% -------------------------------------------------------------------------
+\gdef\Polygon{\@ifnextchar ({\@polygon}{\@ck=0}}
+ \gdef\@polygon(#1,#2){\@ifnextchar ({\@pdraw(#1,#2)}{\@ck=0}}
+ \gdef\@pdraw(#1,#2)(#3,#4){\ifnum\@ck=0 \@ck=1 \Moveto(#1,#2) \fi
+ \Lineto(#3,#4) \Polygon(#3,#4)}
+
+% -------------------------------------------------------------------------
+% Draws a sequence of vector segments. You have to provide m points
+% with m=i+1 (i=1,2,..). \Vpolygon(x1,y1)(x2,y2)...(xm,ym)
+% -------------------------------------------------------------------------
+\gdef\Vpolygon{\@ifnextchar ({\@Vdraw}{\relax}}
+ \gdef\@Vdraw(#1,#2){\@ifnextchar ({\@Vcoord(#1,#2)}{\relax}}
+ \gdef\@Vcoord(#1,#2)(#3,#4){\Vect(#1,#2)(#3,#4) \Vpolygon(#3,#4)}
+
+% -------------------------------------------------------------------------
+% Draws a sequence of quadratic bezier curves.
+% You have to provide m points with m=2*i+1 (i=1,2,..).
+% \Quadratic(x1,y1)(x2,y2)(x3,y3)...(xm,ym)
+% -------------------------------------------------------------------------
+\gdef\Quadratic{\@ifnextchar ({\@Qdraw}{\relax}}
+\gdef\@Qdraw(#1,#2){\@ifnextchar ({\@Qcoord(#1,#2)}{\relax}}
+\gdef\@Qcoord(#1,#2)(#3,#4)(#5,#6){%
+ \Dset(\@ax,#1) \Dset(\@ay,#2)
+ \Dset(\@bx,#3) \Dset(\@by,#4)
+ \Dset(\@cx,#5) \Dset(\@cy,#6)
+ \Mul(\@bx,2) \Mul(\@by,2)
+ \Add(\@ax,\@bx)\Div(\@ax,3)
+ \Add(\@ay,\@by)\Div(\@ay,3)
+ \Add(\@cx,\@bx)\Div(\@cx,3)
+ \Add(\@cy,\@by)\Div(\@cy,3)
+ \Moveto(#1,#2) \Bezier(\Np\@ax,\Np\@ay,\Np\@cx,\Np\@cy,#5,#6)
+ \Quadratic(#5,#6)}
+
+% -------------------------------------------------------------------------
+% Draws a sequence of n cubic bezier curves.
+% You have to provide m points with m=3*i+1 (i=1,2,..).
+% \Cubic(x1,y1)(x2,y2)(x3,y3)(x4,y4)...(xm,ym)
+% -------------------------------------------------------------------------
+\gdef\Cubic{\@ifnextchar ({\@Cdraw}{\relax}}
+\gdef\@Cdraw(#1,#2){\@ifnextchar ({\@Ccoord(#1,#2)}{\relax}}
+\gdef\@Ccoord(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
+ \Moveto(#1,#2) \Bezier(#3,#4,#5,#6,#7,#8)
+ \Cubic(#7,#8)}
+
+% -------------------------------------------------------------------------
+% This is the general macro for drawing integral bezier curves. It draws
+% bezier curves of degree 1..7. The degree depends on the number of
+% coordinates. If \@ce is zero, the curve is drawn, depending on the
+% counter \@ci. If \@ce is not zero, the coordinates are read until no
+% more open cordinates are found. \Curveto needs \Moveto in front to
+% draw from the current point.
+% \Curve(n)(x0,y0)..., \Curveto(n)(x1,y1)...
+% -------------------------------------------------------------------------
+\gdef\Curve{\@cg=0\@ce=1\@ifnextchar ({\@Draw}{\@Draw(0)}}
+\gdef\Curveto{\@cg=0\@ce=0\@ifnextchar ({\@Draw}{\@Draw(0)}}
+
+\gdef\@Draw(#1){\@ifnextchar ({\@Coord(#1)}{%
+ \@ci=0 \ifcase\@cf\or\@Acurve\or
+ \@Bcurve\or\@Ccurve\or\@Dcurve\or
+ \@Ecurve\or\@Fcurve\or\@Gcurve\fi}}
+
+\gdef\@Coord(#1)(#2,#3){%
+ \ifnum#1=0
+ \Add(\@cf,1) \Euclid(#2,#3)
+ \else
+ \@cf=0 \@ca=#1
+ \@cb=\@ca \Add(\@cb,1)
+ \ifnum\@ce=1
+ \Dset(\@ax,#2)\Dset(\@ay,#3)
+ \Moveto(\Np\@ax,\Np\@ay)
+ \else
+ \Add(\@cf,1)
+ \@ax=\@xx \@ay=\@xy
+ \Dset(\@bx,#2)\Dset(\@by,#3)
+ \fi\fi \Curve(0)}
+
+% -------------------------------------------------------------------------
+% This sets the points in euclidean (affine) coordinate space
+% -------------------------------------------------------------------------
+\gdef\Euclid(#1,#2){%
+ \ifcase\@cf\or
+ \Dset(\@bx,#1)\Dset(\@by,#2)\or
+ \Dset(\@cx,#1)\Dset(\@cy,#2)\or
+ \Dset(\@dx,#1)\Dset(\@dy,#2)\or
+ \Dset(\@ex,#1)\Dset(\@ey,#2)\or
+ \Dset(\@fx,#1)\Dset(\@fy,#2)\or
+ \Dset(\@gx,#1)\Dset(\@gy,#2)\or
+ \Dset(\@hx,#1)\Dset(\@hy,#2)\fi}
+
+% -------------------------------------------------------------------------
+% This is the general macro to draw rational bezier curves. It draws
+% bezier curves of degree 1..7. The degree depends on the number of
+% coordinates. If \@ce is zero, the curve is drawn, depending on the
+% counter \@ci. If \@ci is not zero, the coordinates are read until no
+% more open cordinates are found. \Rcurveto needs \Rmoveto in front to
+% draw from the current point.
+% \Rcurve(n)(x0,y0,z0)..., \Rcurveto(n)(x1,y1,z1)...
+% -------------------------------------------------------------------------
+\gdef\Rcurve{\@cg=1\@ce=1\@ifnextchar ({\@Rdraw}{\@Rdraw(0)}}
+\gdef\Rcurveto{\@cg=1\@ce=0\@ifnextchar ({\@Rdraw}{\@Rdraw(0)}}
+
+\gdef\@Rdraw(#1){\@ifnextchar ({\@Rcoord(#1)}{%
+ \@ci=0 \ifcase\@cf\or\@Acurve\or
+ \@Bcurve\or\@Ccurve\or\@Dcurve\or
+ \@Ecurve\or\@Fcurve\or\@Gcurve\fi}}
+
+\gdef\@Rcoord(#1)(#2,#3,#4){%
+ \ifnum#1=0
+ \Add(\@cf,1) \Homogen(#2,#3,#4)
+ \else
+ \@cf=0 \@ca=#1
+ \@cb=\@ca \Add(\@cb,1)
+ \ifnum\@ce=1
+ \Dset(\@ax,#2)\Dset(\@ay,#3)\Dset(\@az,#4)
+ \Rmoveto(\Np\@ax,\Np\@ay,\Np\@az)
+ \Dmul(\@ax,\@az)\Dmul(\@ay,\@az)
+ \else
+ \Add(\@cf,1)
+ \@ax=\@xx \@ay=\@xy \@az=\@xz
+ \Dmul(\@ax,\@az)\Dmul(\@ay,\@az)
+ \Dset(\@bx,#2)\Dset(\@by,#3)\Dset(\@bz,#4)
+ \Dmul(\@bx,\@bz)\Dmul(\@by,\@bz)
+ \fi\fi \Rcurve(0)}
+
+% -------------------------------------------------------------------------
+% For rational bezier curves, this adds a weight component to the points
+% and multiplies the components by the weights. Now, we can treat the
+% curve as integral bezier curve with 3 components (homogen coordinates)
+% px=px*w, py=py*w, pz=w. \Homogen(px,py,w)
+% -------------------------------------------------------------------------
+\gdef\Homogen(#1,#2,#3){%
+ \ifcase\@cf\or
+ \Dset(\@bx,#1)\Dset(\@by,#2)\Dset(\@bz,#3)\Dmul(\@bx,\@bz)\Dmul(\@by,\@bz)
+ \or
+ \Dset(\@cx,#1)\Dset(\@cy,#2)\Dset(\@cz,#3)\Dmul(\@cx,\@cz)\Dmul(\@cy,\@cz)
+ \or
+ \Dset(\@dx,#1)\Dset(\@dy,#2)\Dset(\@dz,#3)\Dmul(\@dx,\@dz)\Dmul(\@dy,\@dz)
+ \or
+ \Dset(\@ex,#1)\Dset(\@ey,#2)\Dset(\@ez,#3)\Dmul(\@ex,\@ez)\Dmul(\@ey,\@ez)
+ \or
+ \Dset(\@fx,#1)\Dset(\@fy,#2)\Dset(\@fz,#3)\Dmul(\@fx,\@fz)\Dmul(\@fy,\@fz)
+ \or
+ \Dset(\@gx,#1)\Dset(\@gy,#2)\Dset(\@gz,#3)\Dmul(\@gx,\@gz)\Dmul(\@gy,\@gz)
+ \or
+ \Dset(\@hx,#1)\Dset(\@hy,#2)\Dset(\@hz,#3)\Dmul(\@hx,\@hz)\Dmul(\@hy,\@hz)
+ \fi}
+
+% -------------------------------------------------------------------------
+% For rational bezier curves, this projects homogeneous coordinates into
+% affine space by dividing each component through the interpolated weight
+% if pz=0 px=py=0 else px=px/pz, py=py/pz. \Affine
+% -------------------------------------------------------------------------
+\gdef\Affine{%
+ \ifdim\@zz=\z@ \Dset(\@zx,0) \Dset(\@zy,0)
+ \else \Ddiv(\@zx,\@zz) \Ddiv(\@zy,\@zz)\fi}
+
+% -------------------------------------------------------------------------
+% Linear interpolation between two coordinates. We have to take care, not
+% to change the contents of #1 and #2, because these are fixed bezier
+% coordinates. The interpolation value is returned in register #3.
+% b0=a0+i*(a1-a0)/n
+% -------------------------------------------------------------------------
+\gdef\@One(#1,#2,#3){#3=#2
+ \Sub(#3,#1) \Mul(#3,\@ci)
+ \Div(#3,\@ca) \Add(#3,#1)}
+
+% -------------------------------------------------------------------------
+% Two degree interpolation between three coordinates.
+% c0=b0+i*(b1-b0)/n, c1=b1+i*(b2-b1)/n, c=c0+i*(c1-c0)/n
+% -------------------------------------------------------------------------
+\gdef\@Two(#1,#2,#3,#4){%
+ \@One(#1,#2,\@sx)
+ \@One(#2,#3,\@sy)
+ \@One(\@sx,\@sy,#4)}
+
+% -------------------------------------------------------------------------
+% Three degree interpolation between four coordinates.
+% d0=c0+i*(c1-c0)/n, d1=c1+i*(c2-c1)/n, d=d0+i*(d1-d0)/n
+% -------------------------------------------------------------------------
+\gdef\@Three(#1,#2,#3,#4,#5){%
+ \@Two(#1,#2,#3,\@tx)
+ \@Two(#2,#3,#4,\@ty)
+ \@One(\@tx,\@ty,#5)}
+
+% -------------------------------------------------------------------------
+% Four degree interpolation between five coordinates.
+% e0=d0+i*(d1-d0)/n, e1=d1+i*(d2-d1)/n, e=e0+i*(e1-e0)/n
+% -------------------------------------------------------------------------
+\gdef\@Four(#1,#2,#3,#4,#5,#6){%
+ \@Three(#1,#2,#3,#4,\@ux)
+ \@Three(#2,#3,#4,#5,\@uy)
+ \@One(\@ux,\@uy,#6)}
+
+% -------------------------------------------------------------------------
+% Five degree interpolation between six coordinates.
+% f0=e0+i*(e1-e0)/n, f1=e1+i*(e2-e1)/n, f=f0+i*(f1-f0)/n
+% -------------------------------------------------------------------------
+\gdef\@Five(#1,#2,#3,#4,#5,#6,#7){%
+ \@Four(#1,#2,#3,#4,#5,\@vx)
+ \@Four(#2,#3,#4,#5,#6,\@vy)
+ \@One(\@vx,\@vy,#7)}
+
+% -------------------------------------------------------------------------
+% Six degree interpolation between seven coordinates.
+% g0=f0+i*(f1-f0)/n, g1=f1+i*(f2-f1)/n, g=g0+i*(g1-g0)/n
+% -------------------------------------------------------------------------
+\gdef\@Six(#1,#2,#3,#4,#5,#6,#7,#8){%
+ \@Five(#1,#2,#3,#4,#5,#6,\@wx)
+ \@Five(#2,#3,#4,#5,#6,#7,\@wy)
+ \@One(\@wx,\@wy,#8)}
+
+% -------------------------------------------------------------------------
+% Seven degree interpolation between eight coordinates.
+% h0=g0+i*(g1-g0)/n, h1=g1+i*(g2-g1)/n, h=h0+i*(h1-h0)/n
+% -------------------------------------------------------------------------
+\gdef\@Seven(#1,#2,#3,#4,#5,#6,#7,#8,#9){%
+ \@Six(#1,#2,#3,#4,#5,#6,#7,\@yx)
+ \@Six(#2,#3,#4,#5,#6,#7,#8,\@yy)
+ \@One(\@yx,\@yy,#9)}
+
+% -------------------------------------------------------------------------
+% Draws a one degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Acurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@One(\@ax,\@bx,\@zx)
+ \@One(\@ay,\@by,\@zy)
+ \ifnum\@cg=1
+ \@One(\@az,\@bz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a two degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Bcurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Two(\@ax,\@bx,\@cx,\@zx)
+ \@Two(\@ay,\@by,\@cy,\@zy)
+ \ifnum\@cg=1
+ \@Two(\@az,\@bz,\@cz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a three degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Ccurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Three(\@ax,\@bx,\@cx,\@dx,\@zx)
+ \@Three(\@ay,\@by,\@cy,\@dy,\@zy)
+ \ifnum\@cg=1
+ \@Three(\@az,\@bz,\@cz,\@dz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a four degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Dcurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Four(\@ax,\@bx,\@cx,\@dx,\@ex,\@zx)
+ \@Four(\@ay,\@by,\@cy,\@dy,\@ey,\@zy)
+ \ifnum\@cg=1
+ \@Four(\@az,\@bz,\@cz,\@dz,\@ez,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a five degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Ecurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Five(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@zx)
+ \@Five(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@zy)
+ \ifnum\@cg=1
+ \@Five(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a six degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Fcurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Six(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@gx,\@zx)
+ \@Six(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@gy,\@zy)
+ \ifnum\@cg=1
+ \@Six(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@gz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+% Draws a seven degree bezier curve (integral or rational).
+% -------------------------------------------------------------------------
+\gdef\@Gcurve{%
+ \@whilenum{\@ci<\@cb}\do{%
+ \@Seven(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@gx,\@hx,\@zx)
+ \@Seven(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@gy,\@hy,\@zy)
+ \ifnum\@cg=1
+ \@Seven(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@gz,\@hz,\@zz)\Affine\fi
+ \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
+
+% -------------------------------------------------------------------------
+\endinput
+
+%% End of file `lapdf.sty'.
diff --git a/macros/latex/contrib/lapdf/lapdf.tex b/macros/latex/contrib/lapdf/lapdf.tex
new file mode 100644
index 0000000000..057ccc2c1d
--- /dev/null
+++ b/macros/latex/contrib/lapdf/lapdf.tex
@@ -0,0 +1,325 @@
+\documentclass[a4paper,11pt]{article}
+\usepackage[color]{lapdf}
+\usepackage{shortvrb}
+\textheight24.62cm
+\textwidth15.92cm
+\oddsidemargin0cm
+\topmargin-1cm
+\parindent0cm
+\parskip0cm
+\unitlength1cm
+\pagestyle{headings}
+
+\MakeShortVerb{\|}
+
+\newdimen\a
+\newdimen\x
+\newdimen\y
+\Defnum(\n,0)
+
+\title{\Huge{\bf\Lapdf} \\ \vspace{0.5cm}
+ \Large Drawing in \TeX{} with PDF commands \\ \vspace{0.5cm}
+ \normalsize Integral/Rational Bezier Curves \\
+ Many Useful Drawing Primitives \\
+ A Rich Set Of Math Functions \\
+ Function, Parametric \& Polar Plots and Grids \\ \vspace{0.8cm}
+ \begin{lapdf}(6,6.3)(-3,-3.3)
+ \Whilenum{\n<360}{%
+ \Nextcol(0,23) \Rad(\n,\a)
+ \Cos(\Np\a,\x) \Add(\x,\x)
+ \Sin(\Np\a,\y) \Add(\y,\y)
+ \Circle(64)(\Np\x,\Np\y,1.5) \Stroke
+ \Add(\n,15)}
+ \end{lapdf}}
+\author{Detlef Reimers, detlefreimers@gmx.de}
+\date{\today}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\maketitle
+
+\begin{abstract}
+This package started as a project for drawing arbitrary bezier curves.
+It implements the integral and rational bezier curves of degree one up
+to seven. Using quadratic rational bezier curves makes it possible to
+exactly draw arbitrary conics. Also implemented are most elementary math
+functions as power series and two loop commands for programming constructs.
+
+This basic functionality gives the ability to draw many geometric
+shapes like arbitray circles, rotated ellipses, rectangles and polygons.
+The package also implements function, parametric and polar plotting
+routines together with the possibility to draw special grids.
+
+You are invited to extend this package to your own needs. This is not
+very complicated, because you can use all of the math capabilities in
+your \TeX{} documents directly and so, you can program your drawings
+(see example above). The package also defines a rainbow color palette
+and you can step through the colors.
+
+This package needs the standard \LaTeX{} |calc| package for multiplication
+and division of dimensions. No other packages are needed. Most of the drawing
+primitives rely on the graphic capabilities of PDF, which is mostly like
+PostScript without programming. With the help of the \pdfTeX{} engine this
+programming possibility is back at the users hand. Now you can write your
+PDF-graphics directly in your \pdfTeX{} source file.
+
+The author hopes that \Lapdf{} may be useful and helps, to produce beautiful
+and sophisticated drawings. I will be thankful for contructive criticism and
+help from the users to further improve this package.
+\end{abstract}
+
+\tableofcontents
+\parskip0.2cm
+
+\section{Introduction}
+
+\subsection{What is it for?}
+
+\Lapdf{} is intended as a practical extension to the standard \LaTeX{}
+|picture| environment. It gives the user the ability to quickly
+draw many useful geometric shapes like arbitrary lines, circles,
+rotated ellipses, arcs, vectors, rectangles, triangles and equilateral
+polygons.
+
+You can also draw bezier curves of degree one to seven. You may
+choose the integral bezier form or the more general rational form.
+The letter one enables you to exactly draw all kind of conic curves
+like parabolas, hyperbolas, ellipses and circles. There is no need to
+approximate them with quadratic or cubic bezier curves.
+
+This package also implements a rich set of basic math functions like: |Sin|,
+|Cos|, |Tan|, |Asin|, |Acos|, |Atan|, |Sinh|, |Cosh|, |Tanh|, |Asinh|, |Acosh|,
+|Atanh|, |Exp|, |Pow|, |Ln|, |Log|, |Sqrt|, |Hypot|, |Len|. They can be used in
+your documents to program special plot functions or in loop constructs in
+connection with drawing functions. Al these functions are based on the ability
+to do floating point multiplication and division with dimension values and
+with dimension registers. These calculations are provided by the help of the
+|calc| package, which belongs to the standard \LaTeX{} tools.
+
+\subsection{How does it work?}
+
+\TeX{} and also \LaTeX{} were made to typeset arbirary complicated and
+structured text documents, with the special ability to integrate math formulas
+into the document. |Donald Knuth|, the inventor of this marvellous
+typesetting machine, only provided a small peephole to implement
+inline graphics in \TeX{} documents. The basic shape of these drawing
+capabilities is the |dot|. If you want to draw a line with pure \TeX{}
+commands, you have to draw lots of evenly spaced dots. This uses much of
+\TeX{} memory and it takes a lot of time to place them. |Leslie Lamport|,
+the inventor of the \LaTeX{} macro package, used this technique together with
+some specially designed graphic fonts for his implementation of the |picture|
+environment, which allows to produce simple to moderate comlicated graphics
+from inside the \LaTeX{} document. This approach is nice for simple
+drawings, but you are limited to only a small set of line or vector slopes,
+you only can draw circles of limited radii and so on. This is the price for
+general portability, because the line and circle fonts are limited to special
+drawing primitives.
+
+Other new drawing packages avoid these limitations by using the |Postscript|
+programming language for calculations and drawing. With the help of |DVIPS|
+you can produce arbitrary sophisticated drawings to be integrated into you
+\LaTeX{} file. But you are limited to output devices which can handle postscript.
+
+So, there were other approaches to implement more general drawing capabilities.
+The first one uses so called |Tpic| specials. |Tpic| is a simple graphic
+language from Unix systems, which was used together with |Groff| to produce
+documents with inline graphics. Another approach was done by
+|Eberhard Matthes| in his |EmTeX| distribution. He implemented a small but
+powerful set of graphic primitives into his DVI drivers, which could set
+points, draw arbitrary lines and set the linewidth.
+
+\Lapdf{} evolved out of my former |Ladraw| style, which had very similar
+capabilities, but no way to fill or clip graphics. \Lapdf{} uses the |PDF|
+capabilities directly, so it does not rely on other packages or tools with the
+exception of the |calc| style to perform floating point arithmetic in \TeX{}.
+
+The ability to draw arbitrary lines frees us from the use of single dots as
+basic drawing primitve. We don't need to calculate the number of dots to draw
+a smooth bezier curve, because we use straight line segments to draw them. This
+way, we never have white spaces in curve shapes, but we have to take care to use
+enough line segments to produce a smooth curve.
+
+The Bezier curve drawing is invoked by two general calling routines |Curve|
+for integral curves and |Rcurve| for rational curves. As an example, the
+command:
+\begin{verbatim}
+ \Curve(64)(0,0)(3,6)(6,-7)(9,0)
+\end{verbatim}
+will draw an integral cubic bezier curve (4 points), consisting of 64 line segments
+and the command:
+\begin{verbatim}
+ \Rcurve(96)(0,0,1)(5,8,2)(10,0,1)
+\end{verbatim}
+will draw a rational quadratic bezier curve (3 points) with the weights (will be
+explained later) $w_0=1$, $w_1=2$ and $w_2=1$, consisting of 96 line segments.
+
+This package uses round brackets around command parameters with the only
+exception of the |Text| command, where the last argument (the actual text)
+cannot be bracketed with round brackets. This convention makes some functions
+a little more static, but you don't have to remember complicated calling
+syntaxes. My first decision was to make this style very easy to use. All
+\Lapdf{} commands begin with a capital letter to distinguish them from other,
+equally spelled \TeX{} commands. I hope that the names of the graphic macros
+helps guessing what they do. The standiest one seems to be |concat|, which
+is a native |PDF| matrix calculation commands, the others tell the user
+what they mean.
+
+\subsection{How to use it?}
+
+Here are some simple examples that will show you the basic usage of the
+\Lapdf{} package. First, we want to draw an ellipse at (1,2), rotated by an
+angle of $30\deg$ with diameters $a=3cm$ and $b=2cm$ with red color and linewidth
+of $0.3pt$. We also want to draw two axes with tick marks. The center point will
+be marked and also the two main axes of the ellipse will be drawn dashed.
+\vspace{0.1cm}
+
+\begin{minipage}[c][7cm]{8cm}
+\small{
+\begin{verbatim}
+ \documentclass{article}
+ \usepackage[color]{Lapdf}
+ \unitlength1cm
+ \begin{document}
+ \begin{lapdf}(6,6)(-2,-1)
+ \Lingrid(10)(1,3)(-2,4)(-1,5)
+ \Red
+ \Ellipse(50)(1,2)(3,2,30) \Stroke
+ \Blue
+ \Dash(3)
+ \Line(-2,0.5)(4,3.5) \Stroke
+ \Line(-0.5,5)(2.5,-1) \Stroke
+ \Dash(0)
+ \Point(1)(1,2)
+ \Text(1.1,2.2,cb){C}
+ \end{lapdf}
+ \end{document}
+\end{verbatim}
+}
+\end{minipage}
+\begin{minipage}[c][7cm]{7cm}
+\begin{lapdf}(6,6.3)(-2,-1)
+ \Lingrid(10)(1,3)(-2,4)(-1,5)
+ \Red
+ \Ellipse(50)(1,2)(3,2,30) \Stroke
+ \Blue
+ \Dash(3)
+ \Line(-2,0.5)(4,3.5) \Stroke
+ \Line(-0.5,5)(2.5,-1) \Stroke
+ \Dash(0)
+ \Point(1)(1,2)
+ \Text(1.1,2.2,cb){C}
+\end{lapdf}
+\end{minipage}
+\vspace{0.1cm}
+
+From this example you can see how the package is invoked in the preamble
+of the document. If you only want to draw in black and white, you would
+use the option |black| instead of |color| or simply no option. This means that
+all color commands will be silently ignored. The ellipse is drawn with 50
+line segments in it's first part and with $2\cdot 50=100$ segments in
+the second part. |Line| draws a line (solid or dashed) between two points. The
+|Point| command draws a circle filled with a shade of gray (black..white).
+|Puttext| puts the bracketed text at a specific point with optional position
+parameters (here centered and bottom).
+
+Our next example shows how to plot the function $f(x)=2\sin x$ from $x=-4$
+to $x=4$. We also want to write the term into the picture. We have to
+supply the function definition in |Fx|.
+\vspace{0.1cm}
+
+\begin{minipage}[c][5.7cm]{7.3cm}
+\small{
+\begin{verbatim}
+ \documentclass{article}
+ \usepackage[color]{Lapdf}
+ \unitlength1cm
+ \begin{document}
+ \begin{lapdf}(8,4)(-7,-2)
+ \Lingrid(10)(1,3)(-4,4)(-2,2)
+ \Red
+ \def\Fx(#1,#2){\Sin(#1,#2) #2=2#2}
+ \Fplot(50)(-4,4) \Stroke
+ \Text(-2,1.2,cb){$y=2\sin x$}
+ \end{lapdf}
+ \end{document}
+\end{verbatim}
+}
+\end{minipage}
+\begin{minipage}[c][5.7cm]{8.5cm}
+\begin{lapdf}(8,4)(-4,-2)
+ \Lingrid(10)(1,3)(-4,4)(-2,2)
+ \Red
+ \def\Fx(#1,#2){\Sin(#1,#2) #2=2#2}
+ \Fplot(50)(-4,4) \Stroke
+ \Text(-2,1.2,cb){$y=2\sin x$}
+\end{lapdf}
+\end{minipage}
+\vspace{0.1cm}
+
+The function definition has two parameters. The first is the
+$x$-value and the second is the register for the function value
+$f(x)$. The |Sin| function also takes two parameters, the
+same way as |Fx| does. So, $\sin x$ is in register |\#2|.
+At last we have to multiply this value with 2 to get $2\sin x$.
+The function is plotted with 50 line segments. The last introductory
+example will draw several bezier curves (integral and rational) and
+axes without a grid. All curves are drawn in different colors.
+\vspace{0.1cm}
+
+\begin{minipage}[c][7.8cm]{9cm}
+\small{
+\begin{verbatim}
+ \documentclass{article}
+ \usepackage[color]{Lapdf}
+ \unitlength1cm
+ \begin{document}
+ \begin{lapdf}(6,6)(0,0)
+ \Lingrid(10)(0,2)(0,6)(0,6)
+ \Stepcol(0,23,4)
+ \Curve(32)(0,0)(6,6) \Stroke
+ \Stepcol(0,23,4)
+ \Curve(64)(0,0)(3,6)(6,0) \Stroke
+ \Stepcol(0,23,4)
+ \Curve(64)(0,3)(2,6)(4,0)(6,3) \Stroke
+ \Stepcol(0,23,4)
+ \Rcurve(64)(0,0,1)(3,6,5)(6,0,1) \Stroke
+ \Stepcol(0,23,4)
+ \Rcurve(64)(0,3,1)(2,6,10)(4,0,10)(6,3,1)
+ \Stroke
+ \end{lapdf}
+ \end{document}
+\end{verbatim}
+}
+\end{minipage}
+\begin{minipage}[c][7.8cm]{6.5cm}
+\begin{lapdf}(6,6)(0,0)
+ \Lingrid(10)(0,2)(0,6)(0,6)
+ \Stepcol(0,23,4)
+ \Curve(64)(0,0)(6,6) \Stroke
+ \Stepcol(0,23,4)
+ \Curve(64)(0,0)(3,6)(6,0) \Stroke
+ \Stepcol(0,23,4)
+ \Curve(64)(0,3)(2,6)(4,0)(6,3) \Stroke
+ \Stepcol(0,23,4)
+ \Rcurve(64)(0,0,1)(3,6,5)(6,0,1) \Stroke
+ \Stepcol(0,23,4)
+ \Rcurve(64)(0,3,1)(2,6,10)(4,0,10)(6,3,1)
+ \Stroke
+\end{lapdf}
+\end{minipage}
+\vspace{0.1cm}
+
+The grid is disabled with the first 0 value in |Lingrid|. The next
+value 2 only shows ticks mark without text. The first three curves are
+integral bezier curves with degree 1, 2 and 3. The next two are
+rational bezier curves with degree 2 and 3. All curves are drawn with
+64 line segments. The rational form needs a so called |weight| parameter.
+Usually, the first and the last values are set to 1, the other may have
+arbitrary values. If $w>1$, the curve is pulled into the direction of
+the bezier point, otherwise it is pushed away from this point. This allows
+much more control over the shape of the bezier curve, compared to the
+integral form. The |Stepcol| command cycles between color 0 and color
+23 in step of length 4. Please look at the file |colors.tex| to see a
+whole color circle with all possible 96 colors.
+
+\end{document}
diff --git a/macros/latex/contrib/lapdf/licence.txt b/macros/latex/contrib/lapdf/licence.txt
new file mode 100644
index 0000000000..e06ef4846f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/licence.txt
@@ -0,0 +1,189 @@
+GNU GENERAL PUBLIC LICENSE
+
+Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+Preamble
+
+The GNU General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS
+0. Definitions.
+
+ÒThis LicenseÓ refers to version 3 of the GNU General Public License.
+
+ÒCopyrightÓ also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+ÒThe ProgramÓ refers to any copyrightable work licensed under this License. Each licensee is addressed as ÒyouÓ. ÒLicenseesÓ and ÒrecipientsÓ may be individuals or organizations.
+
+To ÒmodifyÓ a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a Òmodified versionÓ of the earlier work or a work Òbased onÓ the earlier work.
+
+A Òcovered workÓ means either the unmodified Program or a work based on the Program.
+
+To ÒpropagateÓ a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To ÒconveyÓ a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays ÒAppropriate Legal NoticesÓ to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+1. Source Code.
+
+The Òsource codeÓ for a work means the preferred form of the work for making modifications to it. ÒObject codeÓ means any non-source form of a work.
+
+A ÒStandard InterfaceÓ means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The ÒSystem LibrariesÓ of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A ÒMajor ComponentÓ, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The ÒCorresponding SourceÓ for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+2. Basic Permissions.
+
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+4. Conveying Verbatim Copies.
+
+You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+5. Conveying Modified Source Versions.
+
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+ * a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+ * b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to Òkeep intact all noticesÓ.
+ * c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+ * d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an ÒaggregateÓ if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+6. Conveying Non-Source Forms.
+
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+ * a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+ * b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+ * c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+ * d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+ * e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A ÒUser ProductÓ is either (1) a Òconsumer productÓ, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, Ònormally usedÓ refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+ÒInstallation InformationÓ for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+7. Additional Terms.
+
+ÒAdditional permissionsÓ are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+ * a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+ * b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+ * c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+ * d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+ * e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+ * f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+
+All other non-permissive additional terms are considered Òfurther restrictionsÓ within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+8. Termination.
+
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+9. Acceptance Not Required for Having Copies.
+
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+10. Automatic Licensing of Downstream Recipients.
+
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An Òentity transactionÓ is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+11. Patents.
+
+A ÒcontributorÓ is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's Òcontributor versionÓ.
+
+A contributor's Òessential patent claimsÓ are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, ÒcontrolÓ includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a Òpatent licenseÓ is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To ÒgrantÓ such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. ÒKnowingly relyingÓ means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is ÒdiscriminatoryÓ if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+12. No Surrender of Others' Freedom.
+
+If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+13. Use with the GNU Affero General Public License.
+
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+14. Revised Versions of this License.
+
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License Òor any later versionÓ applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+15. Disclaimer of Warranty.
+
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ÒAS ISÓ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+16. Limitation of Liability.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+17. Interpretation of Sections 15 and 16.
+
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/macros/latex/contrib/lapdf/line.pdf b/macros/latex/contrib/lapdf/line.pdf
new file mode 100644
index 0000000000..15e29efa88
--- /dev/null
+++ b/macros/latex/contrib/lapdf/line.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/line.tex b/macros/latex/contrib/lapdf/line.tex
new file mode 100644
index 0000000000..2fd0f67ceb
--- /dev/null
+++ b/macros/latex/contrib/lapdf/line.tex
@@ -0,0 +1,45 @@
+\input preamble.tex
+
+\Defnum(\n,10)
+\Defdim(\m,0)
+\Defdim(\r,7)
+\newdimen\a
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge\bf{Line}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Whiledim{\m<360}{\Rad(\Np\m,\a)
+ \Cos(\Np\a,\x) \Mul(\x,7)
+ \Sin(\Np\a,\y) \Mul(\y,7)
+ \Nextcol(0,23)
+ \Line(0,0)(\Np\x,\Np\y) \Stroke
+ \Dadd(\m,7.5)}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{Lineto}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Moveto(\Np\r,0)
+ \Whilenum{\n<1445}{\Rad(\n,\a)
+ \Cos(\Np\a,\x) \Dmul(\x,\r)
+ \Sin(\Np\a,\y) \Dmul(\y,\r)
+ \Nextcol(0,23)
+ \Lineto(\Np\x,\Np\y) \Stroke
+ \Moveto(\Np\x,\Np\y)
+ \Add(\n,10) \Dsub(\r,0.05)}
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/polygon.pdf b/macros/latex/contrib/lapdf/polygon.pdf
new file mode 100644
index 0000000000..b606f6e0f2
--- /dev/null
+++ b/macros/latex/contrib/lapdf/polygon.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/polygon.tex b/macros/latex/contrib/lapdf/polygon.tex
new file mode 100644
index 0000000000..4c20dba387
--- /dev/null
+++ b/macros/latex/contrib/lapdf/polygon.tex
@@ -0,0 +1,28 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge\bf{Polygon}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Dgray
+ \Polygon(-9,4)(-4,9)(4,9)(9,4)(9,-4)(4,-9)(-4,-9)(-9,-4)(-9,4) \Stroke
+ \Red
+ \Polygon(-6.928,0)(-6.5,6.5)(0,6.928)(6.5,6.5)(6.928,0)
+ (6.5,-6.5)(0,-6.928)(-6.5,-6.5)(-6.928,0) \Stroke
+ \Green
+ \Polygon(-6.928,0)(-6,3.464)(-3.464,6)(0,6.928)(3.464,6)(6,3.464)(6.928,0)
+ (6,-3.464)(3.464,-6)(0,-6.928)(-3.464,-6)(-6,-3.464)(-6.928,0) \Stroke
+ \Blue
+ \Epolygon(3)(0,0)(6.928,0) \Stroke
+ \Cyan
+ \Epolygon(3)(0,0)(6.928,30) \Stroke
+ \Magenta
+ \Epolygon(3)(0,0)(6.928,60) \Stroke
+ \Yellow
+ \Epolygon(3)(0,0)(6.928,90) \Stroke
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/polynom.pdf b/macros/latex/contrib/lapdf/polynom.pdf
new file mode 100644
index 0000000000..f82b2057f4
--- /dev/null
+++ b/macros/latex/contrib/lapdf/polynom.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/polynom.tex b/macros/latex/contrib/lapdf/polynom.tex
new file mode 100644
index 0000000000..6fcdb5a07a
--- /dev/null
+++ b/macros/latex/contrib/lapdf/polynom.tex
@@ -0,0 +1,44 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.4cm
+
+\begin{center}
+{\Huge\bf{Polynom, Derivatives \& Tangents}}
+\bigskip
+
+\begin{lapdf}(12,12.5)(-6,-6)
+ \Red
+ \Dash(0)
+ \Polynom(-4.80,+3.95)(+0.2,+0.2,-2.4,+0.0) \Stroke
+ \Polynom(-4,3)(+0.2,+0.2,-2.4,+0.0) \Gfill(0.95)
+ \Blue
+ \Polynom(-4.080,+3.42)(+0.0,+0.6,+0.4,-2.4) \Stroke
+ \Green
+ \Dash(0)
+ \Polynom(-5.30,+4.65)(+0.0,+0.0,+1.2,+0.4) \Stroke
+ \Lingrid(10)(1,3)(-6,6)(-6,6)
+ \Setwidth(0.01)
+ \Black
+ \Dash(3)
+ \Line(-2.36,0)(-2.36,+4.15) \Stroke
+ \Line(-0.33,0)(-0.33,+0.84) \Stroke
+ \Line(+1.69,0)(+1.69,-2.52) \Stroke
+ \Dash(0)
+ \Tangent(-2.361)(-3.86,-0.86)(+0.2,+0.2,-2.4,+0) \Stroke
+ \Tangent(+1.694)(+0.19,+3.19)(+0.2,+0.2,-2.4,+0) \Stroke
+ \Point(1)(-0.33,0.844)
+ \Point(1)(-2.36,0)
+ \Point(1)(-0.33,0)
+ \Point(1)(+1.69,0)
+ \Text(-2.4,+4.3,bc){$E_1$}
+ \Text(+1.65,-2.7,tc){$E_2$}
+ \Text(-0.5,+0.85,rc){$I$}
+ \Text(+1.0,-3.8,l){$y=0,2\cdot x^3+0,2\cdot x^2-2,4\cdot x$}
+ \Text(+0.922,-4.6,l){$y'=0,6\cdot x^2+0,4\cdot x-2,4$}
+ \Text(+0.844,-5.4,l){$y''=1,2\cdot x+0,4$}
+\end{lapdf}
+
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/pplot.pdf b/macros/latex/contrib/lapdf/pplot.pdf
new file mode 100644
index 0000000000..6be852aafc
--- /dev/null
+++ b/macros/latex/contrib/lapdf/pplot.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/pplot.tex b/macros/latex/contrib/lapdf/pplot.tex
new file mode 100644
index 0000000000..20416a1a7f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/pplot.tex
@@ -0,0 +1,89 @@
+\input preamble.tex
+
+\newdimen\a
+\newdimen\b
+\newdimen\c
+\newdimen\r
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Polar Functions I}}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-6)
+ \Polgrid(1,4)(4)
+ \Red
+ \def\Px(#1,#2){\Sin(#1,#2) \Dadd(#2,1) #2=2#2}
+ \Pplot(60)(0,2) \Stroke
+ \Cyan
+ \def\Px(#1,#2){\Sin(#1,#2) \Dsub(#2,1) #2=-2#2}
+ \Pplot(60)(0,2) \Stroke
+ \Green
+ \def\Px(#1,#2){\Cos(#1,#2) \Dadd(#2,1) #2=2#2}
+ \Pplot(60)(0,2) \Stroke
+ \Blue
+ \def\Px(#1,#2){\Cos(#1,#2) \Dsub(#2,1) #2=-2#2}
+ \Pplot(60)(0,2) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,10)(-5,-5)
+ \Polgrid(0,2)(5)
+ \Magenta
+ \def\Px(#1,#2){\Dset(#2,#1) \Mul(#2,4) \Div(#2,3) \Cos(\Np#2,#2) #2=5#2}
+ \Pplot(600)(0,6) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Polar Functions II}}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-6)
+ \Polgrid(1,2)(5)
+ \Magenta
+ \def\Px(#1,#2){\Dset(#2,#1) #2=0.2#2}
+ \Pplot(300)(0,8) \Stroke
+ \Green
+ \def\Px(#1,#2){\Dset(#2,#1) #2=0.1835#2 \Exp(\Np#2,#2) \Div(#2,20)}
+ \Pplot(200)(0,8) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,10)(-5,-5)
+ \Polgrid(1,3)(5)
+ \Red
+ \def\Px(#1,#2){\Dset(\a,#1) \b=2\a \c=6\a \a=4\a
+ \Cos(\Np\a,#2) #2=4#2 \Sin(\Np\b,\b) \Sin(\Np\c,\c) \Sub(#2,\b) \Add(#2,\c)}
+ \Pplot(200)(0,2) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Polar Functions III}}
+\bigskip
+
+\begin{lapdf}(10,12)(-5,-3)
+ \Lingrid(10)(0,2)(-5,5)(-2,8)
+ \Red
+ \def\Px(#1,#2){\Sin(#1,#2) \Dset(\a,#1) \a=2.5\a
+ \Sin(\Np\a,\a) \r=\a \Dmul(\r,\r) \Dmul(\a,\r) \Add(#2,\a) #2=4#2}
+ \Pplot(400)(0,4) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,10)(-5,-5)
+ \Lingrid(10)(0,2)(-5,5)(-5,5)
+ \Red
+ \def\Px(#1,#2){\Dset(#2,#1) \Cos(\Np#2,#2) #2=3#2 \Dadd(#2,1)}
+ \Pplot(100)(0,2) \Stroke
+ \Green
+ \def\Px(#1,#2){\Dset(#2,#1) \Sin(\Np#2,#2) #2=4#2 \Dadd(#2,0.5)}
+ \Pplot(100)(0,2) \Stroke
+ \Blue
+ \def\Px(#1,#2){\Dset(#2,#1) #2=0.1835#2 \Exp(\Np#2,#2) \Div(#2,20)}
+ \Pplot(200)(0,8) \Stroke
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/preamble.tex b/macros/latex/contrib/lapdf/preamble.tex
new file mode 100644
index 0000000000..b66aae5c9c
--- /dev/null
+++ b/macros/latex/contrib/lapdf/preamble.tex
@@ -0,0 +1,14 @@
+\documentclass[a4paper,11pt]{article}
+\usepackage[color]{lapdf}
+\textheight25.12cm
+\textwidth18.92cm
+\oddsidemargin-1.5cm
+\evensidemargin-1.5cm
+\topmargin-0.5cm
+\topskip0cm
+\headheight0cm
+\headsep0cm
+\parskip0.5cm
+\parindent0cm
+\unitlength1cm
+
diff --git a/macros/latex/contrib/lapdf/pythagor.pdf b/macros/latex/contrib/lapdf/pythagor.pdf
new file mode 100644
index 0000000000..e24db42a8a
--- /dev/null
+++ b/macros/latex/contrib/lapdf/pythagor.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/pythagor.tex b/macros/latex/contrib/lapdf/pythagor.tex
new file mode 100644
index 0000000000..053d4c5104
--- /dev/null
+++ b/macros/latex/contrib/lapdf/pythagor.tex
@@ -0,0 +1,80 @@
+\input preamble.tex
+
+\def\Disk(#1,#2){\Circle(16)(#1,#2,0.03) \Gfill(0)}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge\bf{Pythagoras I}}
+\bigskip
+
+\begin{lapdf}(14.9,16.4)(-8.5,-7.8)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Line(0,0)(0,3.6) \Stroke
+ \Dash(0)
+ \Arc(8)(+0.0,+3.6)(216.87,90)(0.4)
+ \Disk(+0.0,+3.4)
+ \Arc(8)(+0.0,+0.0)(90,90)(0.4)
+ \Disk(-0.18,+0.18)
+ \Varc(8)(-4.8,+0.0)(0,36.87)(1)
+ \Varc(8)(+2.7,+0.0)(180,-53.13)(1)
+ \Setwidth(0.02)
+ \Red
+ \Rectangle(-4.8,0)(6,6)(36.87) \Fill(1,0.9,0.9)
+ \Green
+ \Rectangle(2.7,0)(4.5,4.5)(36.87) \Fill(0.9,1,0.9)
+ \Blue
+ \Rectangle(2.7,0)(7.5,7.5)(180) \Fill(0.9,0.9,1)
+ \Text(+1.4,+2.1,c){$a$}
+ \Text(-2.6,+2.1,c){$b$}
+ \Text(-1.0,-0.3,c){$c$}
+ \Text(+0.8,+0.2,c){$p$}
+ \Text(-2.2,+0.2,c){$q$}
+ \Text(+0.2,+1.5,c){$h$}
+ \Text(+3.0,+3.1,c){$A_1$}
+ \Text(-4.5,+4.2,c){$A_2$}
+ \Text(-1.1,-3.7,c){$A_3=A_1+A_2$}
+ \Text(-4.2,+0.2,c){$\alpha$}
+ \Text(+2.1,+0.25,c){$\beta$}
+\end{lapdf}
+
+\newpage
+
+{\Huge\bf{Pythagoras II}}
+\bigskip
+
+\begin{lapdf}(12.5,11.8)(-7.5,-5.2)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Line(0,0)(0,4.8) \Stroke
+ \Dash(0)
+ \Arc(8)(+0.0,+4.8)(216.87,90)(0.4)
+ \Disk(+0.0,+4.6)
+ \Arc(8)(+0.0,+0.0)(90,90)(0.4)
+ \Disk(-0.15,+0.15)
+ \Varc(8)(-6.4,+0.0)(0,36.87)(1.2)
+ \Varc(8)(+3.6,+0.0)(180,-53.13)(1.2)
+ \Setwidth(0.02)
+ \Red
+ \Sector(64)(-3.2,+2.4)(36.87,180)(4.0) \Fill(1,0.9,0.9)
+ \Green
+ \Sector(64)(+1.8,+2.4)(-53.13,180)(3.0) \Fill(0.9,1,0.9)
+ \Blue
+ \Sector(64)(-1.4,+0.0)(180,180)(5.0) \Fill(0.9,0.9,1)
+ \Text(+1.9,+2.7,c){$a$}
+ \Text(-3.4,+2.7,c){$b$}
+ \Text(-1.0,-0.3,c){$c$}
+ \Text(+1.2,+0.2,c){$p$}
+ \Text(-3.0,+0.2,c){$q$}
+ \Text(+0.2,+2.0,c){$h$}
+ \Text(+2.9,+3.1,c){$A_1$}
+ \Text(-4.7,+3.8,c){$A_2$}
+ \Text(-1.4,-2.3,c){$A_3=A_1+A_2$}
+ \Text(-5.7,+0.2,c){$\alpha$}
+ \Text(+2.9,+0.25,c){$\beta$}
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/qcircle.pdf b/macros/latex/contrib/lapdf/qcircle.pdf
new file mode 100644
index 0000000000..d4a0bd023e
--- /dev/null
+++ b/macros/latex/contrib/lapdf/qcircle.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/qcircle.tex b/macros/latex/contrib/lapdf/qcircle.tex
new file mode 100644
index 0000000000..feea113e0a
--- /dev/null
+++ b/macros/latex/contrib/lapdf/qcircle.tex
@@ -0,0 +1,50 @@
+\input preamble.tex
+
+\Defdim(\r,0)
+\newdimen\rr \newdimen\rx \newdimen\ry \newdimen\rz
+\newdimen\ax \newdimen\ay \newdimen\bx \newdimen\by
+\newdimen\cx \newdimen\cy \newdimen\dx \newdimen\dy
+\newdimen\ex \newdimen\ey \newdimen\fx \newdimen\fy
+
+\def\Qcircle(#1)(#2,#3,#4){%
+ \Dset(\rr,#4)
+ \Dset(\rx,#4) \Mul(\rx,2)
+ \Dset(\ry,#4) \Mul(\ry,3)
+ \Dset(\rz,#4) \Mul(\rz,4)
+ \Dset(\ax,#2) \Dset(\ay,#3) \Add(\ay,\rr)
+ \Dset(\bx,#2) \Dset(\by,#3) \Add(\bx,\rz) \Add(\by,\rr)
+ \Dset(\cx,#2) \Dset(\cy,#3) \Add(\cx,\rx) \Sub(\cy,\ry)
+ \Dset(\dx,#2) \Dset(\dy,#3) \Sub(\dx,\rx) \Sub(\dy,\ry)
+ \Dset(\ex,#2) \Dset(\ey,#3) \Sub(\ex,\rz) \Add(\ey,\rr)
+ \Dset(\fx,#2) \Dset(\fy,#3) \Add(\fy,\rr)
+ \Rcurve(#1)(\Np\ax,\Np\ay,5)(\Np\bx,\Np\by,1)(\Np\cx,\Np\cy,1)
+ (\Np\dx,\Np\dy,1)(\Np\ex,\Np\ey,1)(\Np\fx,\Np\fy,5)}
+
+\def\ba{\left(\begin{array}{c}} \def\ea{\end{array}\right)}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge\bf{Quintic Circles}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Whiledim{\r<8}{\Dadd(\r,0.5) \Nextcol(0,23) \Qcircle(128)(0,0,\Np\r)
+ \Stroke}
+\end{lapdf}
+\end{center}
+
+You can draw a full circle with one rational quintic Bezier curve. This is
+the lowest possible Bezier degree to do this. These are the control points
+for a circle at $(x,y)$ with radius $r$ (the third components are the
+weights):
+\parskip0.1cm
+\begin{center}
+$P_0=\ba x \\y+r \\5 \ea$,
+$P_1=\ba x+4r\\y+r \\1 \ea$,
+$P_2=\ba x+2r\\y-3r\\1 \ea$,
+$P_3=\ba x-2r\\y-3r\\1 \ea$,
+$P_4=\ba x-4r\\y+r \\1 \ea$,
+$P_5=\ba x \\y+r \\5 \ea$.
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/quartic.pdf b/macros/latex/contrib/lapdf/quartic.pdf
new file mode 100644
index 0000000000..d99630456c
--- /dev/null
+++ b/macros/latex/contrib/lapdf/quartic.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/quartic.tex b/macros/latex/contrib/lapdf/quartic.tex
new file mode 100644
index 0000000000..b51af6c3e2
--- /dev/null
+++ b/macros/latex/contrib/lapdf/quartic.tex
@@ -0,0 +1,45 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Full Rational Quartic Bezier Curve}}
+\bigskip
+
+\begin{lapdf}(18,17.5)(-9,-8)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Polygon(-9,-6)(-8,+3)(+0,+8)(+8,+2)(+9,-6) \Stroke
+ \Setwidth(0.02)
+ \Dash(0)
+ \Red
+ \Rcurve(96)(-9,-6,+4)(-8,+3,+3)(+0,+8,+5)(8,+2,+3)(+9,-6,+4) \Stroke
+ \Blue
+ \Rcurve(96)(-9,-6,+4)(-8,+3,-3)(+0,+8,+5)(8,+2,-3)(+9,-6,+4) \Stroke
+ \Black
+ \Point(0)(-9,-6)
+ \Point(1)(-8,+3)
+ \Point(1)(+0,+8)
+ \Point(1)(+8,+2)
+ \Point(0)(+9,-6)
+ \Text(-9.2,-5.8,tr){$P_0$}
+ \Text(-8.2,+3.2,tr){$P_1$}
+ \Text(+0.0,+8.2,bc){$P_2$}
+ \Text(+8.2,+2.2,tl){$P_3$}
+ \Text(+9.2,-5.8,tl){$P_4$}
+\end{lapdf}
+\end{center}
+\parskip0.2cm
+$P_1$ and $P_3$ of the blue curve have negative weights, but both curves
+share the same Bezier points and absolute weight values. Now we can see
+the complete Bezier curve. The proof for this needs some insight in
+projective geometry and it's rather involved, so I only give here the
+general rule for drawing complete rational Bezier curves: Make every odd
+weight negative and you'll get the complementary Bezier curve.
+
+You should notice that in this case the Bezier curve no longer lies in
+the convex hull of it's control polygon, because his is only holds if all
+weights are positive. It should also be mentioned that negative weights for
+other points can cause numerical problems, because the denominator can
+become zero.
+\end{document}
diff --git a/macros/latex/contrib/lapdf/rational.pdf b/macros/latex/contrib/lapdf/rational.pdf
new file mode 100644
index 0000000000..afd574edcb
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rational.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/rational.tex b/macros/latex/contrib/lapdf/rational.tex
new file mode 100644
index 0000000000..eae95a1764
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rational.tex
@@ -0,0 +1,58 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Integral And Rational Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Polygon(+0,+9)(+9,+9)
+ (+9,+3)(-9,-3)(+9,-9)
+ (+0,-9)(-9,-9)(+9,-3)
+ (-9,+3)(-9,+9)(+0,+9) \Stroke
+ \Setwidth(0.02)
+ \Dash(0)
+ \Red
+ \Curve(96)(+0,+9)(+9,+9)(+9,+3)(-9,-3)(+9,-9)(+0,-9)
+ \Curve(96)(+0,+9)(-9,+9)(-9,+3)(+9,-3)(-9,-9)(+0,-9) \Stroke
+ \Blue
+ \Rcurve(128)(+0,+9,1)(+9,+9,6)(+9,+3,1)(-9,-3,6)(+9,-9,6)(+0,-9,1)
+ \Rcurve(128)(+0,+9,1)(-9,+9,6)(-9,+3,1)(+9,-3,6)(-9,-9,6)(+0,-9,1) \Stroke
+ \Black
+ \Point(0)(+0,+9)
+ \Point(1)(+9,+9)
+ \Point(1)(+9,+3)
+ \Point(1)(-9,-3)
+ \Point(1)(+9,-9)
+ \Point(0)(+0,-9)
+ \Point(1)(-9,-9)
+ \Point(1)(+9,-3)
+ \Point(1)(-9,+3)
+ \Point(1)(-9,+9)
+ \Text(+0.0,+8.8,tc){$w=1$}
+ \Text(+8.8,+8.8,tr){$w=6$}
+ \Text(+8.8,+3.2,br){$w=1$}
+ \Text(-8.8,-3.0,lc){$w=6$}
+ \Text(+8.8,-8.8,br){$w=6$}
+ \Text(+0.0,-8.8,bc){$w=1$}
+ \Text(-8.8,-8.8,bl){$w=6$}
+ \Text(+8.8,-3.0,rc){$w=6$}
+ \Text(-8.8,+3.2,bl){$w=1$}
+ \Text(-8.8,+8.8,tl){$w=6$}
+\end{lapdf}
+\end{center}
+
+Both curves are degree five bezier curves and they share the same
+control points. The red one consists of two integral curves and the
+blue one consists of two rational curves with diffent weights, which
+are shown at their control points. Integral Bezier curves can be thought
+as rational curves with all weights set to one.
+
+As you can see, the curve is pulled towards the points, depending on
+their weights. Thus you will have much more control over the curve
+shape. Rational curves also allow to draw exact conics like ellipses,
+circles, parabolas and hyperbolas.
+\end{document}
diff --git a/macros/latex/contrib/lapdf/rcircle.pdf b/macros/latex/contrib/lapdf/rcircle.pdf
new file mode 100644
index 0000000000..5d7310c179
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rcircle.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/rcircle.tex b/macros/latex/contrib/lapdf/rcircle.tex
new file mode 100644
index 0000000000..a4e3159973
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rcircle.tex
@@ -0,0 +1,341 @@
+\input preamble.tex
+
+\Defdim(\a,0)
+\Defdim(\d,0)
+\Defdim(\x,0)
+\Defdim(\y,0)
+
+\def\Ncirc(#1){\Rad(#1,\a)
+ \Cos(\Np\a,\x) \Add(\x,\x)
+ \Sin(\Np\a,\y) \Add(\y,\y)
+ \Circle(64)(\Np\x,\Np\y,2) \Stroke}
+
+\def\ctitle#1{{\huge\bf{#1}}}
+
+\title{\Huge \bf{Drawing Circles \\
+ with \\
+ Rational Quadratic Bezier Curves}}
+\author{Detlef Reimers, detlefreimers@gmx.de}
+\date{\today}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\maketitle
+
+\begin{center}
+\begin{lapdf}(8, 10)(-4,-5)
+ \Whiledim{\d<360}{\Nextcol(0,23) \Ncirc(\Np\d) \Dadd(\d,15)}
+\end{lapdf}
+
+\ctitle{Description}
+\end{center}
+This document explains, how to calculate the bezier points for
+complete circles. These can be drawn with the \texttt{Rcurve}
+commmand from the \texttt{lapdf.sty}. If the weight of the point
+$P_1$ is $w=\cos(\alpha)$, where $\alpha$ ist the angle between
+$P_{0}P_{1}$ and $P_{1}P_{2}$, then the conic will be a circular
+arc, if also both length $P_{0}P_{1}$ and $P_{1}P_{2}$ are equal.
+
+We have to smothly join several of these arcs together, to get
+a full circle. Only in the case of two segments, we have have to
+use one negative weight. In all other cases we only have positive
+weights. In all of the following calculations and drawings we assume,
+that the center of the circle lies at the origin.
+
+\pagebreak
+\parskip0.3cm
+
+\begin{center}
+\ctitle{General calculation scheme}
+
+\begin{lapdf}(14,13.5)(-7,-6.5)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+0.00,-5.00)
+ (+3.63,-5.00)(+4.76,-1.55)
+ (+5.88,+1.91)(+2.94,+4.05)
+ (+0.00,+6.18)(-2.94,+4.05)
+ (-5.88,+1.91)(-4.76,-1.55)
+ (-3.63,-5.00)(+0.00,-5.00) \Stroke
+ \Line(+0.00,+0.00)(+0.00,-5.00) \Stroke
+ \Line(+0.00,+0.00)(+3.63,-5.00) \Stroke
+ \Line(+0.00,+0.00)(+4.76,-1.55) \Stroke
+ \Line(+0.00,+0.00)(+5.88,+1.91) \Stroke
+ \Line(+0.00,+0.00)(+2.94,+4.05) \Stroke
+ \Line(+0.00,+0.00)(+0.00,+6.18) \Stroke
+ \Line(+0.00,+0.00)(-2.94,+4.05) \Stroke
+ \Line(+0.00,+0.00)(-5.88,+1.91) \Stroke
+ \Line(+0.00,+0.00)(-4.76,-1.55) \Stroke
+ \Line(+0.00,+0.00)(-3.63,-5.00) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Blue
+ \Circle(96)(0,0,6.18) \Stroke
+ \Red
+ \Circle(96)(0,0,5) \Stroke
+ \Black
+ \Rcurve(64)(+0.00,-1.30,1)(+0.42,-1.30,0.5)(0.76,-1.05,1) \Stroke
+ \Point(1)(+3.63,-5.00)
+ \Point(1)(+4.76,-1.55)
+ \Point(1)(+5.88,+1.91)
+ \Point(1)(+2.94,+4.05)
+ \Point(1)(+0.00,+6.18)
+ \Point(1)(-2.94,+4.05)
+ \Point(1)(-5.88,+1.91)
+ \Point(1)(-4.76,-1.55)
+ \Point(1)(-3.63,-5.00)
+ \Point(1)(+0.00,-5.00)
+ \Text(+3.63,-5.10,tl){$P_1$}
+ \Text(+4.86,-1.55,tl){$P_2$}
+ \Text(+5.98,+2.01,cl){$P_3$}
+ \Text(+3.04,+4.15,bl){$P_4$}
+ \Text(+0.00,+6.38,bc){$P_5$}
+ \Text(-3.04,+4.15,br){$P_6$}
+ \Text(-5.98,+2.01,cr){$P_7$}
+ \Text(-4.86,-1.55,tr){$P_8$}
+ \Text(-3.63,-5.10,tr){$P_9$}
+ \Text(+0.00,-5.10,tc){$P_0=P_{10}$}
+ \Text(0.10,-2.90,cl){$r$}
+ \Text(0.10,+3.10,cl){$R$}
+ \Text(0.25,-0.80,cc){$\alpha$}
+\end{lapdf}
+\end{center}
+We always put $P_0$ at the bottom of the circle and all other points
+follow counterclockwise.
+This is the general procedure for circle construction with rational
+quadratic bezier curves (see picture):
+\begin{enumerate}
+\item Set the radius $r$.
+\item Set the number of bezier segments $n$.
+\item Calculate $\alpha = \displaystyle {360^\circ \over 2n}$.
+\item Calculate outer radius $R=\displaystyle {r \over \cos(\alpha)}$.
+\item Calculate all even bezier points
+ $P_{2i} = \displaystyle {+r \cdot \sin(2i\cdot\alpha)
+ \choose -r \cdot \cos(2i\cdot\alpha)}$ for $i=0 \dots n$.
+\item Calculate odd bezier points
+ $P_{2i+1} = \displaystyle {+R \cdot \sin((2i+1)\cdot\alpha)
+ \choose -R \cdot \cos((2i+1)\cdot\alpha)}$ for $i=0 \dots n-1$.
+\end{enumerate}
+You can control your calculations, if you check your endpoint $P_{2n}$.
+This point is equal with $P_0$. All curves are drawn with the
+{\tt Rmoveto()} and {\tt Rcurveto()} combination.
+
+\pagebreak
+
+\parskip1cm
+\begin{center}
+\ctitle{2 Segments}
+
+\begin{lapdf}(6,7.5)(-3,-3)
+ \Lingrid(5)(0,1)(-3,3)(-3,5)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+2.165,+1.25)
+ (+0.00,+5.0)(-2.165,+1.25) \Stroke
+ \Dash(0)
+ \Red
+ \Setwidth(0.02)
+ \Rmoveto(+2.165,+1.25,1)
+ \Rcurveto(64)(+0.00,+5.0,+0.5)(-2.165,+1.25,1)
+ \Rcurveto(64)(+0.00,+5.0,-0.5)(+2.165,+1.25,1) \Stroke
+ \Black
+ \Point(1)(+2.165,+1.25)
+ \Point(1)(+0.000,+5.00)
+ \Point(1)(-2.165,+1.25)
+\end{lapdf}
+
+Circle with $2n+1=5$ points ($w_{2n}=1$ and $w_{2n+1} = \pm \cos(60^\circ) = \pm 0.5$).
+\end{center}
+\begin{center}
+\ctitle{3 Segments}
+
+\begin{lapdf}(6,7.5)(-3,-3)
+ \Lingrid(5)(0,1)(-5,5)(-3,5)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+0.00,-2.50)
+ (+4.333,-2.50)(+2.165,+1.25)
+ (+0.000,+5.00)(-2.165,+1.25)
+ (-4.333,-2.50)(+0.000,-2.50) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+0.000,-2.50,1)
+ \Rcurveto(64)(+4.33,-2.50,0.5)(+2.165,+1.25,1)
+ \Rcurveto(64)(+0.00,+5.00,0.5)(-2.165,+1.25,1)
+ \Rcurveto(64)(-4.33,-2.50,0.5)(+0.000,-2.50,1) \Stroke
+ \Black
+ \Point(1)(+0.000,-2.50)
+ \Point(1)(+4.333,-2.50)
+ \Point(1)(+2.165,+1.25)
+ \Point(1)(+0.000,+5.00)
+ \Point(1)(-2.165,+1.25)
+ \Point(1)(-4.333,-2.50)
+\end{lapdf}
+
+Circle with $2n+1=7$ points ($w_{2n}=1$ and $w_{2n+1} = \cos(60^\circ) = 0.5$).
+\end{center}
+
+\pagebreak
+
+\begin{center}
+\ctitle{4 Segments}
+
+\begin{lapdf}(6,6)(-3,-3)
+ \Lingrid(5)(0,1)(-3,3)(-3,3)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+2.50,+0.00)
+ (+2.50,+2.50)(+0.00,+2.50)
+ (-2.50,+2.50)(-2.50,+0.00)
+ (-2.50,-2.50)(+0.00,-2.50)
+ (+2.50,-2.50)(+2.50,+0.00) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+2.50,+0.00,1)
+ \Rcurveto(64)(+2.50,+2.50,0.707)(+0.00,+2.50,1)
+ \Rcurveto(64)(-2.50,+2.50,0.707)(-2.50,+0.00,1)
+ \Rcurveto(64)(-2.50,-2.50,0.707)(+0.00,-2.50,1)
+ \Rcurveto(64)(+2.50,-2.50,0.707)(+2.50,+0.00,1) \Stroke
+ \Black
+ \Point(1)(+2.50,+0.00)
+ \Point(1)(+2.50,+2.50)
+ \Point(1)(+0.00,+2.50)
+ \Point(1)(-2.50,+2.50)
+ \Point(1)(-2.50,+0.00)
+ \Point(1)(-2.50,-2.50)
+ \Point(1)(+0.00,-2.50)
+ \Point(1)(+2.50,-2.50)
+\end{lapdf}
+
+Circle with $2n+1=9$ points ($w_{2n}=1$ and $w_{2n+1} = \cos(45^\circ) = 0.707$).
+\end{center}
+\begin{center}
+\ctitle{5 Segments}
+
+\begin{lapdf}(6,6)(-3,-3)
+ \Lingrid(5)(0,1)(-3,3)(-3,3)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+0.00,-2.50)
+ (+1.815,-2.500)(+2.38,-0.775)
+ (+2.940,+0.905)(+1.47,+2.025)
+ (+0.000,+3.090)(-1.47,+2.025)
+ (-2.940,+0.905)(-2.38,-0.775)
+ (-1.815,-2.500)(+0.00,-2.500) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+0.00,-2.500,1)
+ \Rcurveto(64)(+1.815,-2.500,0.809)(+2.380,-0.775,1)
+ \Rcurveto(64)(+2.940,+0.905,0.809)(+1.470,+2.025,1)
+ \Rcurveto(64)(+0.000,+3.090,0.809)(-1.470,+2.025,1)
+ \Rcurveto(64)(-2.940,+0.905,0.809)(-2.380,-0.775,1)
+ \Rcurveto(64)(-1.815,-2.500,0.809)(+0.000,-2.500,1) \Stroke
+ \Black
+ \Point(1)(+1.815,-2.500)
+ \Point(1)(+2.380,-0.775)
+ \Point(1)(+2.940,+0.905)
+ \Point(1)(+1.470,+2.025)
+ \Point(1)(+0.000,+3.090)
+ \Point(1)(-1.470,+2.025)
+ \Point(1)(-2.940,+0.905)
+ \Point(1)(-2.380,-0.775)
+ \Point(1)(-1.815,-2.500)
+ \Point(1)(+0.000,-2.500)
+\end{lapdf}
+
+Circle with $2n+1=11$ points ($w_{2n}=1$ and $w_{2n+1} = \cos(36^\circ) = 0.809$).
+\end{center}
+
+\pagebreak
+
+\begin{center}
+\ctitle{6 Segments}
+
+\begin{lapdf}(6,6)(-3,-3)
+ \Lingrid(5)(0,1)(-3,3)(-3,3)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+2.50,+0.00)
+ (+2.50,+1.445)(+1.25,+2.165)
+ (+0.00,+2.885)(-1.25,+2.165)
+ (-2.50,+1.445)(-2.50,+0.000)
+ (-2.50,-1.445)(-1.25,-2.165)
+ (+0.00,-2.885)(+1.25,-2.165)
+ (+2.50,-1.445)(+2.50,+0.000) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+2.50,+0.000,1)
+ \Rcurveto(64)(+2.50,+1.445,0.866)(+1.25,+2.165,1)
+ \Rcurveto(64)(+0.00,+2.885,0.866)(-1.25,+2.165,1)
+ \Rcurveto(64)(-2.50,+1.445,0.866)(-2.50,+0.000,1)
+ \Rcurveto(64)(-2.50,-1.445,0.866)(-1.25,-2.165,1)
+ \Rcurveto(64)(+0.00,-2.885,0.866)(+1.25,-2.165,1)
+ \Rcurveto(64)(+2.50,-1.445,0.866)(+2.50,+0.000,1) \Stroke
+ \Black
+ \Point(1)(+2.50,+0.000)
+ \Point(1)(+2.50,+1.445)
+ \Point(1)(+1.25,+2.165)
+ \Point(1)(+0.00,+2.885)
+ \Point(1)(-1.25,+2.165)
+ \Point(1)(-2.50,+1.445)
+ \Point(1)(-2.50,+0.000)
+ \Point(1)(-2.50,-1.445)
+ \Point(1)(-1.25,-2.165)
+ \Point(1)(+0.00,-2.885)
+ \Point(1)(+1.25,-2.165)
+ \Point(1)(+2.50,-1.445)
+\end{lapdf}
+
+Circle with $2n+1=13$ points ($w_{2n}=1$ and $w_{2n+1} = \cos(30^\circ) = 0.866$).
+\end{center}
+
+\begin{center}
+\ctitle{7 Segments}
+
+\begin{lapdf}(6,6)(-3,-3)
+ \Lingrid(5)(0,1)(-3,3)(-3,3)
+ \Dash(1)
+ \Setwidth(0.01)
+ \Polygon(+0.00,-2.50)
+ (+1.205,-2.50)(+1.955,-1.560)
+ (+2.705,-0.62)(+2.440,+0.555)
+ (+2.170,+1.73)(+1.085,+2.255)
+ (+0.000,+2.78)(-1.085,+2.255)
+ (-2.170,+1.73)(-2.440,+0.555)
+ (-2.705,-0.62)(-1.955,-1.560)
+ (-1.205,-2.50)(+0.000,-2.500) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rmoveto(+0.000,-2.500,1)
+ \Rcurveto(64)(+1.205,-2.50,0.901)(+1.905,-1.560,1)
+ \Rcurveto(64)(+2.705,-0.62,0.901)(+2.440,+0.555,1)
+ \Rcurveto(64)(+2.170,+1.73,0.901)(+1.085,+2.255,1)
+ \Rcurveto(64)(+0.000,+2.78,0.901)(-1.085,+2.255,1)
+ \Rcurveto(64)(-2.170,+1.73,0.901)(-2.440,+0.555,1)
+ \Rcurveto(64)(-2.705,-0.62,0.901)(-1.905,-1.560,1)
+ \Rcurveto(64)(-1.205,-2.50,0.901)(+0.000,-2.500,1) \Stroke
+ \Black
+ \Point(1)(+0.000,-2.500)
+ \Point(1)(+1.205,-2.500)
+ \Point(1)(+1.905,-1.560)
+ \Point(1)(+2.705,-0.620)
+ \Point(1)(+2.440,+0.555)
+ \Point(1)(+2.170,+1.730)
+ \Point(1)(+1.085,+2.255)
+ \Point(1)(+0.000,+2.780)
+ \Point(1)(-1.085,+2.255)
+ \Point(1)(-2.170,+1.730)
+ \Point(1)(-2.440,+0.555)
+ \Point(1)(-2.705,-0.620)
+ \Point(1)(-1.905,-1.560)
+ \Point(1)(-1.205,-2.500)
+\end{lapdf}
+
+Circle with $2n+1=15$ points ($w_{2n}=1$ and $w_{2n+1} = \cos(25.71^\circ) = 0.901$).
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/rcurve.pdf b/macros/latex/contrib/lapdf/rcurve.pdf
new file mode 100644
index 0000000000..8bddf67122
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rcurve.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/rcurve.tex b/macros/latex/contrib/lapdf/rcurve.tex
new file mode 100644
index 0000000000..67780549e5
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rcurve.tex
@@ -0,0 +1,98 @@
+\input preamble.tex
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{I. Rational Quadratic Bezier Curves}}
+\bigskip
+
+\begin{lapdf}(16,20)(-8,-10)
+ \Dgray
+ \Dash(1)
+ \Polygon(-8,0)(0,10)(8,0) \Stroke
+ \Dash(0)
+ \Red
+ \Rcurve(64)(-8,0,7)(0,10,1)(8,0,7) \Stroke
+ \Green
+ \Rcurve(64)(-8,0,6)(0,10,1)(8,0,6) \Stroke
+ \Blue
+ \Rcurve(64)(-8,0,5)(0,10,1)(8,0,5) \Stroke
+ \Cyan
+ \Rcurve(64)(-8,0,4)(0,10,1)(8,0,4) \Stroke
+ \Magenta
+ \Rcurve(64)(-8,0,3)(0,10,1)(8,0,3) \Stroke
+ \Yellow
+ \Rcurve(64)(-8,0,2)(0,10,1)(8,0,2) \Stroke
+ \Black
+ \Rcurve(64)(-8,0,1)(0,10,1)(8,0,1) \Stroke
+ \Red
+ \Rcurve(64)(-8,0,1)(0,10,2)(8,0,1) \Stroke
+ \Green
+ \Rcurve(64)(-8,0,1)(0,10,3)(8,0,1) \Stroke
+ \Blue
+ \Rcurve(64)(-8,0,1)(0,10,4)(8,0,1) \Stroke
+ \Cyan
+ \Rcurve(64)(-8,0,1)(0,10,5)(8,0,1) \Stroke
+ \Magenta
+ \Rcurve(64)(-8,0,1)(0,10,6)(8,0,1) \Stroke
+ \Yellow
+ \Rcurve(64)(-8,0,1)(0,10,7)(8,0,1) \Stroke
+ \Black
+ \Rcurve(64)(-8,0,1)(0,10,0)(8,0,1) \Stroke
+ \Red
+ \Rcurve(64)(-8,0,7)(0,10,-1)(8,0,7) \Stroke
+ \Green
+ \Rcurve(64)(-8,0,6)(0,10,-1)(8,0,6) \Stroke
+ \Blue
+ \Rcurve(64)(-8,0,5)(0,10,-1)(8,0,5) \Stroke
+ \Cyan
+ \Rcurve(64)(-8,0,4)(0,10,-1)(8,0,4) \Stroke
+ \Magenta
+ \Rcurve(64)(-8,0,3)(0,10,-1)(8,0,3) \Stroke
+ \Yellow
+ \Rcurve(64)(-8,0,2)(0,10,-1)(8,0,2) \Stroke
+ \Point(1)(-8,0)
+ \Point(1)(+0,10)
+ \Point(1)(+8,0)
+ \Text(-8.0,0.2,rb){$P_0$}
+ \Text(+0.2,+10.3,rb){$P_1$}
+ \Text(+8.0,0.2,lb){$P_2$}
+\end{lapdf}
+\end{center}
+All curves share the same Bezier points, but they differ in the weights of
+the points. The black curve is a parabola {$w = 1$}. Above of this all
+curves are hyperbolas with increasing weigts, below of this are elliptic curves
+with decreasing weights. The line has a weight of {$w = 0$}. After this
+the weights are negative increasing. The curves are the complementare
+elliptical arcs to the positive counterparts.
+
+\newpage
+\unitlength1.16cm
+
+\begin{center}
+{\Huge \bf{II. Conic Curves}}
+\bigskip
+
+\begin{lapdf}(16,16)(0,0)
+ \Dgray
+ \Rcurve(64)(4,10.333,2)(0,3.4,1)(8,3.4,2)
+ \Rcurve(80)(4,10.333,2)(0,3.4,-1)(8,3.4,2) \Stroke
+ \Red
+ \Rcurve(64)(4,9.7,2)(0,4.7,1)(8,4.7,2)
+ \Rcurve(80)(4,9.7,2)(0,4.7,-1)(8,4.7,2) \Stroke
+ \Green
+ \Rcurve(64)(9.7,4,2)(4.7,0,1)(4.7,8,2)
+ \Rcurve(80)(9.7,4,2)(4.7,0,-1)(4.7,8,2) \Stroke
+ \Blue
+ \Rcurve(64)(16,16,1)(8,8,5)(16,0,1) \Stroke
+ \Cyan
+ \Rcurve(64)(0,16,1)(8,8,5)(0,0,1) \Stroke
+ \Magenta
+ \Rcurve(64)(0,16,1)(8,0,1)(16,16,1) \Stroke
+ \Yellow
+ \Rcurve(64)(0,0,1)(8,16,1)(16,0,1) \Stroke
+\end{lapdf}
+
+\large Circle, Ellipse, Parabola, Hyperbola
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/recttria.pdf b/macros/latex/contrib/lapdf/recttria.pdf
new file mode 100644
index 0000000000..23113c546d
--- /dev/null
+++ b/macros/latex/contrib/lapdf/recttria.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/recttria.tex b/macros/latex/contrib/lapdf/recttria.tex
new file mode 100644
index 0000000000..c7fc3e2c4f
--- /dev/null
+++ b/macros/latex/contrib/lapdf/recttria.tex
@@ -0,0 +1,29 @@
+\input preamble.tex
+
+\Defnum(\a,0)
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.2cm
+
+\begin{center}
+{\Huge \bf{Rectangle}}
+\bigskip
+
+\begin{lapdf}(15,15)(-7.5,-7.5)
+ \Whilenum{\a<360}{%
+ \Stepcol(0,23,2) \Rectangle(0,0)(4.5,6)(\a) \Stroke \Add(\a,15)}
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Triangle}}
+\bigskip
+
+\begin{lapdf}(15,15)(-7.5,-7.5)
+ \Resetcol
+ \Whilenum{\a<360}{%
+ \Stepcol(0,23,2) \Triangle(0,0)(0,4.5)(6,4.5)(\a) \Stroke \Add(\a,15)}
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/roundtri.pdf b/macros/latex/contrib/lapdf/roundtri.pdf
new file mode 100644
index 0000000000..97b009e574
--- /dev/null
+++ b/macros/latex/contrib/lapdf/roundtri.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/roundtri.tex b/macros/latex/contrib/lapdf/roundtri.tex
new file mode 100644
index 0000000000..9d38ee35f0
--- /dev/null
+++ b/macros/latex/contrib/lapdf/roundtri.tex
@@ -0,0 +1,37 @@
+% ---------------------------------------------------------------------------
+% Rounded Triangles: x=a*exp(cos(t)), y =a*exp(sin(t))
+% ---------------------------------------------------------------------------
+\input preamble.tex
+
+\Defdim(\a,1)
+\newdimen\x
+\newdimen\y
+
+\def\Roundtriangle(#1,#2){
+ \def\Tx(##1,##2){\Cos(##1,\x) \Pow(2,\Np\x,##2) \Dmul(##2,\a)
+ ##2=#1##2}
+ \def\Ty(##1,##2){\Sin(##1,\y) \Pow(2,\Np\y,##2) \Dmul(##2,\a)
+ ##2=#2##2}
+ \Tplot(100)(0,6.2832) \Stroke}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+
+\begin{center}
+{\Huge\bf{Rounded Triangles}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Lingrid(10)(1,2)(-9,9)(-9,9)
+ \Whiledim{\a<5}{
+ \Stepcol(0,23,2)
+ \Roundtriangle(+1,+1)
+ \Roundtriangle(-1,+1)
+ \Roundtriangle(-1,-1)
+ \Roundtriangle(+1,-1)
+ \Dadd(\a,0.5)}
+\end{lapdf}
+
+$x=a \cdot 2^{\cos t}$ \qquad $y=a \cdot 2^{\sin t}$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/rparams.pdf b/macros/latex/contrib/lapdf/rparams.pdf
new file mode 100644
index 0000000000..3a8402c04c
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rparams.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/rparams.tex b/macros/latex/contrib/lapdf/rparams.tex
new file mode 100644
index 0000000000..4a81feee35
--- /dev/null
+++ b/macros/latex/contrib/lapdf/rparams.tex
@@ -0,0 +1,68 @@
+\input preamble.tex
+
+\def\fr{\displaystyle\frac}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.125cm
+
+\begin{center}
+{\Huge \bf{Ellipse Parameters}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-11)
+ \Lingrid(10)(1,1)(-8,8)(-11,5)
+ \Setwidth(0.01)
+ \Dash(1)
+ \Polygon(-7.2,-3.2)(0,4)(7.2,-3.2)(-7.2,-3.2)(0,-10.4)(7.2,-3.2) \Stroke
+ \Polygon(5.33,-1.33)(-5.33,-1.33)(0,-6.67)(5.33,-1.33) \Stroke
+ \Polygon(4.5,-0.5)(-4.5,-0.5)(0,-5)(4.5,-0.5) \Stroke
+ \Dash(0)
+ \Setwidth(0.02)
+ \Red
+ \Rcurve(128)(-4,0,3)(0,4,2)(4,0,3) \Stroke
+ \Rcurve(128)(-4,0,3)(0,4,-2)(4,0,3) \Stroke
+ \Green
+ \Rcurve(96)(-4,0,2)(0,4,1)(4,0,2) \Stroke
+ \Rcurve(96)(-4,0,2)(0,4,-1)(4,0,2) \Stroke
+ \Blue
+ \Rcurve(64)(-4,0,3)(0,4,1)(4,0,3) \Stroke
+ \Rcurve(64)(-4,0,3)(0,4,-1)(4,0,3) \Stroke
+ \Point(1)(-4,0)
+ \Point(1)(0,4)
+ \Point(1)(4,0)
+ \Point(1)(7.2,-3.2)
+ \Point(1)(4,-6.4)
+ \Point(1)(0,-10.4)
+ \Point(1)(-4,-6.4)
+ \Point(1)(-7.2,-3.2)
+ \Point(1)(-5.33,-1.33)
+ \Point(1)(-4,-2.67)
+ \Point(1)(0,-6.67)
+ \Point(1)(4,-2.67)
+ \Point(1)(5.33,-1.33)
+ \Point(1)(-4.5,-0.5)
+ \Point(1)(-4,-1)
+ \Point(1)(0,-5)
+ \Point(1)(4,-1)
+ \Point(1)(4.5,-0.5)
+ \Point(0)(0,-3.2)
+ \Point(0)(0,-1.33)
+ \Point(0)(0,-0.5)
+\end{lapdf}
+{\large $w=2/3$, $w=1/2$, $w=1/3$}
+\end{center}
+\parskip0.2cm
+We know the center $M=(x_m,y_m)$ and the values of $a$ and $b$. We want
+to calculate the curve points $P_0$, $P_1$ and $P_2$ and the weight
+$w$ to draw the ellipse. With $r=\sqrt{a^2+b^2}$ we get:
+\begin{equation}
+P_0={{x_m-\fr{a^2}{r}}\choose{y_m+\fr{b^2}{r}}} \quad
+P_1={{xm}\choose{ym+r}} \quad
+P_2={{x_m+\fr{a^2}{r}}\choose{y_m+\fr{b^2}{r}}} \quad
+w_0=1 \quad
+w_1=\pm\fr{b}{r} \quad
+\end{equation}
+With these weights we can draw the ellipse with two segments. One segment
+uses the positive and the other the negative weight $w_1$.
+\end{document}
diff --git a/macros/latex/contrib/lapdf/superell.pdf b/macros/latex/contrib/lapdf/superell.pdf
new file mode 100644
index 0000000000..6b273f42ea
--- /dev/null
+++ b/macros/latex/contrib/lapdf/superell.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/superell.tex b/macros/latex/contrib/lapdf/superell.tex
new file mode 100644
index 0000000000..7ef338a910
--- /dev/null
+++ b/macros/latex/contrib/lapdf/superell.tex
@@ -0,0 +1,49 @@
+% ---------------------------------------------------------------------------
+% The superellipse curve is defined by the equations:
+% x(t) = a*sig(cos(t))*|cos(t)|^n y(t) = b*sig(sin(t))*|sin(t)|^n.
+% ---------------------------------------------------------------------------
+\input preamble.tex
+
+\newcount\s
+\newcount\n
+\Defdim(\a,9)
+\Defdim(\b,9)
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+% We express the exponent n as a fraction N/D. If we simply used \Pow(x,n)
+% instead of the two functions \Root(x,D) and then \Pot(x,N), we would get
+% a numerical overflow of a dimension register.
+% ---------------------------------------------------------------------------
+\gdef\Superell(#1,#2){
+ \def\Tx(##1,##2){
+ \Dset(\x,##1) \Cos(\Np\x,\x) \Dsig(\x,\s) \Dabs(\x)
+ \Root(\Np\x,#2,\x) \Pot(\Np\x,#1,##2) \Dmul(##2,\a) \Mul(##2,\s)}
+ \def\Ty(##1,##2){
+ \Dset(\y,##1) \Sin(\Np\y,\y) \Dsig(\y,\s) \Dabs(\y)
+ \Root(\Np\y,#2,\y) \Pot(\Np\y,#1,##2) \Dmul(##2,\b) \Mul(##2,\s)}
+ \Stepcol(0,23,3) \Tplot(200)(-3.1416,3.1416) \Stroke}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{The Superellipse}}
+\bigskip
+
+\begin{lapdf}(18,18)(-9,-9)
+ \Lingrid(10)(1,0)(-9,9)(-9,9)
+ \Set(\n,16)
+ \Whilenum{\n>1}{\Superell(\n,2)
+ \ifnum\n>6 \Sub(\n,2) \else \Sub(\n,1) \fi}
+ \Superell(2,3)
+ \Set(\n,5)
+ \Whilenum{\n<10}{\Superell(2,\n)
+ \ifnum\n<6 \Add(\n,1) \else \Add(\n,2) \fi}
+ \Superell(0,1)
+\end{lapdf}
+
+$x(t)=a \cdot sig(\cos(t)) \cdot |\cos(t)|^n$ \qquad
+$x(t)=b \cdot sig(\sin(t)) \cdot |\sin(t)|^n$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/tplot.pdf b/macros/latex/contrib/lapdf/tplot.pdf
new file mode 100644
index 0000000000..42d831cf4e
--- /dev/null
+++ b/macros/latex/contrib/lapdf/tplot.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/tplot.tex b/macros/latex/contrib/lapdf/tplot.tex
new file mode 100644
index 0000000000..ad907cefc3
--- /dev/null
+++ b/macros/latex/contrib/lapdf/tplot.tex
@@ -0,0 +1,133 @@
+\input preamble.tex
+
+\newdimen\a
+\newdimen\b
+\newdimen\c
+\newdimen\t
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\begin{center}
+{\Huge \bf{Parametric I}}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-6)
+ \Lingrid(10)(0,3)(-5,5)(-5,5)
+ \Red
+ \def\Tx(#1,#2){\Sin(#1,#2) #2=3#2}
+ \def\Ty(#1,#2){\Cos(#1,#2) #2=5#2}
+ \Tplot(100)(0,6.2832) \Stroke
+ \Green
+ \def\Tx(#1,#2){\Sin(#1,#2) #2=5#2}
+ \Tplot(100)(0,6.2832) \Stroke
+ \Blue
+ \def\Ty(#1,#2){\Cos(#1,#2) #2=3#2}
+ \Tplot(100)(0,6.2832) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,10)(-5,-5)
+ \Lingrid(10)(0,3)(-5,5)(-5,5)
+ \Red
+ \def\Tx(#1,#2){\Dset(\x,#1) \Dmul(\x,\x) #2=\x}
+ \def\Ty(#1,#2){\Dset(\t,#1) \y=\t \Dmul(\y,\y) \Dsub(\y,3) \Dmul(\y,\t) #2=\y}
+ \Tplot(50)(-2.26,2.26) \Stroke
+ \Blue
+ \def\Tx(#1,#2){\Sin(#1,#2) #2=5#2}
+ \def\Ty(#1,#2){\Dset(\t,#1) \Mul(\t,2) \Sin(\Np\t,#2) #2=5#2}
+ \Tplot(100)(0,6.2832) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Parametric II}}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-6)
+ \Lingrid(10)(0,3)(-5,5)(-5,5)
+ \Red
+ \def\Tx(#1,#2){\Dset(\t,#1) \Cos(\Np\t,\x) \Div(\x,5) \Dmul(\x,\t) #2=\x}
+ \def\Ty(#1,#2){\Dset(\t,#1) \Sin(\Np\t,\y) \Div(\y,5) \Dmul(\y,\t) #2=\y}
+ \Tplot(300)(0,25.13) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,10)(-5,-5)
+ \Lingrid(10)(0,3)(-5,5)(-5,5)
+ \Blue
+ \def\Tx(#1,#2){\Dset(\x,#1) \Mul(\x,3) \Cos(\Np\x,#2) #2=5#2}
+ \def\Ty(#1,#2){\Dset(\y,#1) \Mul(\y,5) \Sin(\Np\y,#2) #2=5#2}
+ \Tplot(300)(0,6.2832) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Parametric III}}
+\bigskip
+
+\begin{lapdf}(16,16)(-8,-8)
+ \Lingrid(10)(1,3)(-7,7)(-7,7)
+ \Red
+ \def\Tx(#1,#2){\Cos(#1,\x) \Dadd(\x,1) \Sin(#1,#2) \Dmul(#2,\x) #2=-5#2}
+ \def\Ty(#1,#2){\Sin(#1,\y) \Dadd(\y,1) \Cos(#1,#2) \Dmul(#2,\y) #2=-5#2}
+ \Tplot(200)(0,6.2832) \Stroke
+ \Dash(1)
+ \Blue
+ \Line(-7,-7)(7,7) \Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,6)(-5,-3)
+ \Lingrid(10)(0,2)(-5,5)(-3,3)
+ \Red
+ \def\Tx(#1,#2){\Cos(#1,#2) #2=5#2}
+ \def\Ty(#1,#2){\Tx(#1,#2) \Sin(#1,\x) \Dmul(#2,\x)}
+ \Tplot(250)(0,6.2832) \Stroke
+ \Blue
+ \def\Tx(#1,#2){\Cos(#1,#2) \Sin(#1,\x) \Dmul(\x,\x) \Dadd(\x,1) \Ddiv(#2,\x) #2=5#2}
+ \def\Ty(#1,#2){\Tx(#1,#2) \Sin(#1,\x) \Dmul(#2,\x)}
+ \Tplot(250)(0,6.2832) \Stroke
+\end{lapdf}
+
+\newpage
+
+{\Huge \bf{Parametric IV}}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-6)
+ \Lingrid(10)(0,1)(-5,5)(-5,5)
+ \def\Tx(#1,#2){\Dset(\x,#1) \a=3\x \b=7\x \c=17\x \Cos(\Np\a,#2)
+ \Cos(\Np\b,\b) \Div(\b,2) \Sin(\Np\c,\c) \Div(\c,3) \Add(#2,\b) \Add(#2,\c) #2=3#2}
+ \def\Ty(#1,#2){\Dset(\x,#1) \a=3\x \b=7\x \c=17\x \Sin(\Np\a,#2)
+ \Sin(\Np\b,\b) \Div(\b,2) \Cos(\Np\c,\c) \Div(\c,3) \Add(#2,\b) \Add(#2,\c) #2=3#2}
+ \Red
+ \Tplot(150)(0.0000,1.5708)\Stroke
+ \Green
+ \Tplot(150)(1.5708,3.1416)\Stroke
+ \Blue
+ \Tplot(150)(3.1416,4.7124)\Stroke
+ \Cyan
+ \Tplot(150)(4.7124,6.2832)\Stroke
+\end{lapdf}
+\bigskip
+
+\begin{lapdf}(10,11)(-5,-5)
+ \Lingrid(10)(0,1)(-5,5)(-5,5)
+ \def\Tx(#1,#2){\Dset(\x,#1) \a=\x \b=7\x \c=17\x \Cos(\Np\a,#2)
+ \Cos(\Np\b,\b) \Div(\b,2) \Sin(\Np\c,\c) \Div(\c,3) \Add(#2,\b) \Add(#2,\c) #2=3#2}
+ \def\Ty(#1,#2){\Dset(\x,#1) \a=\x \b=7\x \c=17\x \Sin(\Np\a,#2)
+ \Sin(\Np\b,\b) \Div(\b,2) \Cos(\Np\c,\c) \Div(\c,3) \Add(#2,\b) \Add(#2,\c) #2=3#2}
+ \Red
+ \Tplot(150)(0.0000,1.5708) \Stroke
+ \Green
+ \Tplot(150)(1.5708,3.1416) \Stroke
+ \Blue
+ \Tplot(150)(3.1416,4.7124) \Stroke
+ \Cyan
+ \Tplot(150)(4.7124,6.2832) \Stroke
+\end{lapdf}
+
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/trochoid.pdf b/macros/latex/contrib/lapdf/trochoid.pdf
new file mode 100644
index 0000000000..bd44437545
--- /dev/null
+++ b/macros/latex/contrib/lapdf/trochoid.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/trochoid.tex b/macros/latex/contrib/lapdf/trochoid.tex
new file mode 100644
index 0000000000..2a2ed6d710
--- /dev/null
+++ b/macros/latex/contrib/lapdf/trochoid.tex
@@ -0,0 +1,78 @@
+\input preamble.tex
+
+\Defnum(\n,0)
+\Defdim(\m,-2.5)
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+% 1. Trochoids: In case of a=b the graph is a cycloid.
+% x(t)=a*t-b*sint
+% y(t)=a-b*cost
+% ---------------------------------------------------------------------------
+\def\Trochoid(#1,#2){
+\def\Tx(##1,##2){\Dset(##2,##1) ##2=#1##2 \Sin(##1,\y) \y=#2\y \Sub(##2,\y)}
+\def\Ty(##1,##2){\Dset(##2,#1) \Cos(##1,\y) \y=#2\y \Sub(##2,\y)}
+\Tplot(200)(-6.2832,6.2832)}
+
+% ---------------------------------------------------------------------------
+% 2. Epitrochoid:
+% x(t)=a*cos(t)-b*cos(a/2*t)
+% y(t)=a*sin(t)-b*sin(a/2*t)
+% ---------------------------------------------------------------------------
+\def\Epitrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
+ \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \y=##1\x \Cos(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
+ \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \y=##1\x \Sin(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
+ \Tplot(360)(0,12.5664)}
+
+% ---------------------------------------------------------------------------
+% 3. Hypotrochoid:
+% x(t)=a*cos(t)+b*cos(a/2*t)
+% y(t)=a*sin(t)-b*sin(a/2*t)
+% ---------------------------------------------------------------------------
+\def\Hypotrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
+ \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \y=##1\x \Cos(\Np\y,\y) \y=#2\y \Add(##2,\y) ##2=0.5##2}
+ \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \y=##1\x \Sin(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
+ \Tplot(360)(0,12.5664)}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge \bf{I. Trochoids}}
+\bigskip
+
+\begin{lapdf}(14,7)(-7,-2)
+ \Lingrid(10)(0,2)(-7,7)(-2,4)
+ \Whiledim{\m<3}{\Stepcol(0,23,4) \Trochoid(1,\Np\m) \Stroke \Dadd(\m,0.5)}
+\end{lapdf}
+
+$x(t)=a \cdot t - b\sin(t)$ \qquad$y(t)=a-b\cos(t)$
+
+\newpage
+
+{\Huge\bf{II. Epitrochoids}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Polgrid(0,2)(7)
+ \Whilenum{\n<6}{\Stepcol(0,23,4) \Epitrochoid(8,\n) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=a\cos(t)-b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
+
+\newpage
+
+{\Huge\bf{III. Hypotrochoids}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Resetcol
+ \Polgrid(0,2)(7)
+ \Whilenum{\n<6}{\Stepcol(0,23,4) \Hypotrochoid(8,\n) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=a\cos(t)+b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/turtle.pdf b/macros/latex/contrib/lapdf/turtle.pdf
new file mode 100644
index 0000000000..f5c62b5b74
--- /dev/null
+++ b/macros/latex/contrib/lapdf/turtle.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/turtle.tex b/macros/latex/contrib/lapdf/turtle.tex
new file mode 100644
index 0000000000..88c4720427
--- /dev/null
+++ b/macros/latex/contrib/lapdf/turtle.tex
@@ -0,0 +1,90 @@
+% ---------------------------------------------------------------------------
+% Draws turtle graphics in pdfTeX with Lapdf. The procedures are taken
+% from Abelson's introductory book for object logo on the Macintosh.
+% ---------------------------------------------------------------------------
+\input preamble.tex
+
+\newcount\i
+\newcount\pen
+\newdimen\a
+\newdimen\b
+\newdimen\t
+\newdimen\dir
+\newdimen\ax
+\newdimen\tx
+\newdimen\ty
+\newdimen\ux
+\newdimen\uy
+
+% ---------------------------------------------------------------------------
+% This is a simple Lapdf implementation of turtle graphics. The commands
+% are: Initturtle, Home, Penup, Pendown, Forward, Back, Right, Left.
+% ---------------------------------------------------------------------------
+\def\Home{\Moveto(0,0)}
+\def\Penup{\pen=0}
+\def\Pendown{\pen=1}
+
+\def\Initturtle{\Home \col=-1 \Dset(\dir,0) \Setwidth(0.02) \Pendown}
+
+\def\Forward(#1){\Dset(\ax,#1) \Rad(\Np\dir,\ty)
+ \Sin(\Np\ty,\tx) \Dmul(\tx,\ax) \Add(\ux,\tx)
+ \Cos(\Np\ty,\tx) \Dmul(\tx,\ax) \Add(\uy,\tx)
+ \ifnum\pen=0 \Moveto(\Np\ux,\Np\uy) \else \Lineto(\Np\ux,\Np\uy) \fi}
+
+\def\Back(#1){\Dset(\ax,#1) \Rad(\Np\dir,\ty)
+ \Sin(\Np\ty,\tx) \Dmul(\tx,\ax) \Sub(\ux,\tx)
+ \Cos(\Np\ty,\tx) \Dmul(\tx,\ax) \Add(\uy,\tx)
+ \ifnum\pen=0 \Moveto(\Np\ux,\Np\uy) \else \Lineto(\Np\ux,\Np\uy) \fi}
+
+\def\Right(#1){\Dset(\ax,#1) \Add(\dir,\ax) {\Dmod(\dir,360)}}
+\def\Left(#1){\Dset(\ax,#1) \Sub(\dir,\ax) {\Dmod(\dir,360)}}
+
+% ---------------------------------------------------------------------------
+% These are our own special drawing macros.
+% ---------------------------------------------------------------------------
+\def\Arcleft(#1,#2){\i=0 \Dset(\t,#1) \Dmul(\t,0.017453pt)
+ \Whilenum{\i<#2}{\Forward(\Np\t) \Left(1) \Add(\i,1)}}
+
+\def\Arcright(#1,#2){\i=0 \Dset(\t,#1) \Dmul(\t,0.017453pt)
+ \Whilenum{\i<#2}{\Forward(\Np\t) \Right(1) \Add(\i,1)}}
+
+\def\Fullcirc(#1){{\Arcright(#1,360)} \Stroke}
+
+\def\Square(#1){\i=0
+ \Whilenum{\i<4}{\Forward(#1) \Right(90) \Add(\i,1)} \Stroke \Home}
+
+\def\Rosette(#1,#2){\i=0 \Dset(\t,360) \Div(\t,#2)
+ \Whilenum{\i<#2}{\Nextcol(0,23) {\Square(#1)} \Right(\Np\t) \Add(\i,1)}}
+
+\def\Petal(#1){\Arcright(#1,60) \Right(120) \Arcright(#1,60)
+ \Right(120) \Stroke \Home}
+
+\def\Flower(#1){\i=0
+ \Whilenum{\i<6}{\Stepcol(0,23,4) {\Petal(#1)} \Right(60) \Add(\i,1)}}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge\bf{Turtle Graphics with \Lapdf}}
+\bigskip
+
+\begin{lapdf}(9,9)(-4.5,-4.5)
+ \Initturtle
+ \Rosette(3,24)
+ \Initturtle
+ \Penup
+ \Forward(4.243)
+ \Right(90)
+ \Pendown
+ \Dgray
+ \Fullcirc(4.243)
+\end{lapdf}
+
+\begin{lapdf}(9,9)(-4.5,-4.5)
+ \Initturtle
+ \Flower(5)
+\end{lapdf}
+\end{center}
+\end{document}
diff --git a/macros/latex/contrib/lapdf/vector.pdf b/macros/latex/contrib/lapdf/vector.pdf
new file mode 100644
index 0000000000..a02add5620
--- /dev/null
+++ b/macros/latex/contrib/lapdf/vector.pdf
Binary files differ
diff --git a/macros/latex/contrib/lapdf/vector.tex b/macros/latex/contrib/lapdf/vector.tex
new file mode 100644
index 0000000000..f07e8fe62b
--- /dev/null
+++ b/macros/latex/contrib/lapdf/vector.tex
@@ -0,0 +1,46 @@
+\input preamble.tex
+
+\Defnum(\n,10)
+\Defdim(\m,0)
+\Defdim(\r,7)
+\newdimen\a
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge\bf{Vect}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Whiledim{\m<360}{%
+ \Rad(\Np\m,\a)
+ \Cos(\Np\a,\x) \Mul(\x,7)
+ \Sin(\Np\a,\y) \Mul(\y,7)
+ \Nextcol(0,23)
+ \Vect(0,0)(\Np\x,\Np\y)
+ \Dadd(\m,7.5)}
+\end{lapdf}
+\end{center}
+
+\newpage
+
+\begin{center}
+{\Huge\bf{Vecto}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Moveto(\Np\r,0)
+ \Whilenum{\n<1445}{%
+ \Rad(\n,\a)
+ \Cos(\Np\a,\x) \Dmul(\x,\r)
+ \Sin(\Np\a,\y) \Dmul(\y,\r)
+ \Nextcol(0,23)
+ \Vecto(\Np\x,\Np\y)
+ \Add(\n,10) \Dsub(\r,0.05)}
+\end{lapdf}
+\end{center}
+\end{document}