<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[12pt]{amsart}
\usepackage{amsfonts,a4}
\usepackage{ebezier}
\newcommand{\D}{\displaystyle}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\setlength{\headsep}{25pt}
\setlength{\parskip}{1.5ex plus0.5ex minus0.5ex}
\setlength{\parindent}{0em}
\pagestyle{myheadings}

\begin{document}
\markboth{ \;\; \hrulefill \: Herbert M\"oller
\,\hrulefill}
{\hrulefill \; How to Generate \LaTeX{} Picture Environments
Using the GaPFilL Method
\,\hrulefill \;\quad }

\vspace*{-15mm}
\begin{center}
\Large{\textbf{How to Generate \LaTeX{} Picture Environments
Using the GaPFilL Method}}\\[7mm]
\large{Herbert M\"oller\footnote[1]{\mbox{\rule[0mm]{0mm}{5mm}}\copyright{}
Copyright 2006 by H. M\"oller 
(\texttt{mollerh@math.uni-muenster.de}). This documentation may be 
distributed and/or modified under the conditions of the LaTeX Project 
Public License.}}\\[7mm]
\end{center}

\begin{quote}
	{\small
\textsc{Abstract.} Drawing programs or geometry software and Perl
filter programs are used to create conveniently even complicated
figures with the \LaTeX{} \texttt{picture} environment.  The filter
programs parse PostScript files and generate \LaTeX\ code ready for
use.  The new method will be explained with two filter programs for
the geometry software Cabri-g\'{e}om\`{e}tre$^{\mathrm{TM}}$ II. The
first program only requires the package \texttt{ebezier} \cite{Ba}. 
Therefore the output is driver independent.  The second filter in
addition supplies the new package \texttt{pict2e} \cite{GaNi}.}

\end{quote}

\section{Introduction}

\setlength{\baselineskip}{17pt}
The package \texttt{pict2e}, created by \textsc{Hubert
G\"a}{\ss}\textsc{lein} and \textsc{Rolf Niepraschk}, e\-lim\-inates
the most serious restrictions of the \LaTeX{} \texttt{picture}
environment.  Henceforth, essentially the problem of positioning the
objects remains.  An important suggestion, using the package
$\mathrm{P_{\D I}C}$\TeX{} of \textsc{Michael J. Wichura} \cite{Wi},
was introduced in 1999 by \textsc{Robert W.D. Nickalls} with the
MS\,DOS filter program `Maths\-PIC' \cite{Ni}.  Afterwards, it was
extended by him and by \textsc{Apostolos Syropoulos} to a Perl filter
program \cite{NiSy}.  However, the convenient input achieved is on the
expence of about 90 further commands.

Hence the question arose whether \LaTeX{} figures can also be 
constructed without using control commands. This seemed to be 
feasible because the PostScript files generated by graphic programs 
and used by the \LaTeX{} command \verb|\special| evidently contain 
all necessary information. The answer is a method which consists of 
four steps:

\begin{enumerate}
	\item  Generating the desired figure with a drawing program or with
	geometry software;

	\item  ``Printing'' (or exporting) the construction as a
	PostScript file;

	\item  Applying a  filter program to the PostScript text;

	\item  Copying the resulting code or parts of it into a \LaTeX{}
	document.
\end{enumerate}

Because of this structure, the method is called ``GaPFilL''
(\emph{Graphics as PostScript Filtered for \LaTeX}).  Since the steps
(1) and (2) and the packages used in the \LaTeX{} document may vary,
it is necessary to apply different filter programs.  In the following
the context will be described as an example by means of two
prototypes: \texttt{CABebez.pl} only requires the macro package
\texttt{ebezier}; \texttt{CABpict.pl} in addition uses the above
mentioned package \texttt{pict2e}.

\section{The Drawing Program or Geometry Software}

Most programs which generate graphical objects are suited for the
GaPFilL meth\-od.  To create diagrams and simple illustrations, it is
sufficient to use draw\-ing programs belonging to office packages.  The
fine drawing program \texttt{Draw} of \texttt{OpenOffice.org} is even
free of charge.  For the representation of geometrical facts, geometry
software is preferable since, apart from the construction of the objects,
it offers a lot of transformations and combinations such as
reflection, bisection of angles, transfer of measurement and
generation of loci.

In the educational system, Cabri-g\'{e}om\`{e}tre$^{\mathrm{TM}}$ II 
(in the following: Cabri Geometry) is a powerful ``dynamic'' 
geometry software with wide distribution for the operating systems 
Windows$^{\D \circledR}$ and Mac$^{\D \circledR}$OS. Since 1987 it was 
developed by \textsc{Jean-Marie Laborde} and \textsc{Franck Bellemain}
at the `Institut d'Informa\-tique et Math\'{e}matiques Appliqu\'{e}es' 
of the Joseph Fourier University in Grenoble. Among other things, due 
to numerous courses of further education for teachers and due to the 
implementation of adapted versions in the hand-held computers TI-92, 
Voyage$^{\mathrm{TM}}$ 200 and other calculators of Texas 
Instruments$^{\D \circledR}$ it is widely used.

Since many people are familiar with these programs, we
will only describe the pecularities which are important for the
generation of \LaTeX{} figures.  In 2004, improved versions
Cabri-g\'{e}om\`{e}tre$^{\mathrm{TM}}$ II plus both for Windows and
Macintosh computers were published. The differences will be mentioned 
where appropriate.

\section{The Use of Colours}

With the aid of colours additional information is conveyed to the
filter program.  Colouring of objects in the \LaTeX{} \texttt{picture}
environment objects is carried out on demand with commands of the
\texttt{color} package when the work is to be finished (see Section
8).  The names of the colours used in the following come from the
Macintosh version of Cabri Geometry, where only eleven colours are
available.  The Mac\,OS version of Cabri Geometry II plus has a
palette with 36 colours.  In both new versions the RGB values of
colours may be set by the user.  In Section 7 it will be described how
to change the assignment of colours in the filter program.  \\[-8mm]

\begin{list}{$\bullet$}{
	\setlength{\labelwidth}{3mm}
	\setlength{\leftmargin}{7mm}
	}
	\item  All \emph{straight lines, rays, line segments, circles and
	conic sections} which are coloured \fbox{yellow} serve as 
	\emph{drawing aids} because they are ignored by the filter program.
	The red points shown by Cabri Geometry will be disregarded by the
	filter program too. Straight lines, rays, parabolas and hyperbolas
	are cut off at the boundary of the drawing section. Since the filter
	program calculates the exact ``bounding box'', these figures should
	only be used as drawing aid if the resulting shape is not the
	desired one.\vspace{1mm}

	\item  \emph{Continuous lines and polygons} have to be 
	\fbox{green}.\vspace{1mm}
	
	\item \emph{Arrows} must be drawn in \fbox{violet}.\vspace{1mm}
	
	\item  \emph{Dotted objects (line segments, arrow lines, polygons,
	circles, arcs)} are obtained by using the colour \fbox{dark green}.
	\vspace{1mm}

	\item  \emph{Quadratic} and \emph{cubic B\'ezier curves} are entered as
	\fbox{blue} polygons with three respectively four corners (see Figures
	1 and 2). The corresponding curves may be viewed with Cabri Geometry
	by using macros. This will be explained in Section 4.

%Figures 1 and 2
\begin{figure}[tbh]
	\setlength{\unitlength}{1pt}
	\begin{minipage}[b]{8.0cm}
		\setlength{\unitlength}{1pt}
\begin{picture}(147,84)(-19,19)
\linethickness{0.8pt}
\thicklines
%Lines, polygons and BŽzier curves
%Dotted line
\linethickness{1.2pt}
\Lbezier[23](71.811024,96.377953)(30.236220,30.23622)
\Lbezier[42](30.236220,30.23622)(168.188976,54.80315)
\Lbezier[31](168.188976,54.80315)(71.811024,96.377953)
%Quadratic BŽzier curve
\Qbezier[279](71.811024,96.377953)(30.236220,30.23622)(168.188976,54.80315)
\put(60.968504,93.543307){1}
\put(21.566929,29.84252){2}
\put(163.905512,44.464567){3}
\put(77,18){Figure 1}
\end{picture}
	\end{minipage}\hfill
\raisebox{6mm}{
\begin{minipage}[b]{5.0cm}
\begin{picture}(138,68)(33,14)
\linethickness{0.8pt}
\thicklines
%Lines, polygons and BŽzier curves
%Dotted line
\linethickness{1.2pt}
\Lbezier[37](28.346457,16.062992)(152.125984,14.173228)
\Lbezier[30](152.125984,14.173228)(59.527559,55.748031)
\Lbezier[25](59.527559,55.748031)(139.842520,81.259843)
\Lbezier[38](139.842520,81.259843)(28.346457,16.062992)
%Cubic BŽzier curve
\cbezier[280](28.346457,16.062992)(152.125984,14.173228)(59.527559,55.748031)(139.842520,81.259843)
\put(23.622047,20.566929){1}
\put(150.236220,18.732283){2}
\put(50.078740,53.188976){3}
\put(137.952756,70.866142){4}
\put(69,-4){Figure 2}
\end{picture}
	\end{minipage}}
	\end{figure}

	\item  \emph{Polygons} have to be \emph{closed} by clicking on the 
	starting point or by double clicking. Using the colour \fbox{navy 
	blue}, the last line of the polygon will be suppressed so that 
	\emph{open polygons} can also be entered conveniently.\vspace{1mm}
	
	\item  \emph{Text or formula places} are positioned by using \fbox{blue}
	polygons with two corners. For the bounding box to be calculated 
	correctly, the marking line should approximately be the diagonal 
	beginning at the lower left corner of the smallest rectangle 
	enclosing the text or formula. In the \LaTeX{} output a serial 
	number will be written at the position of the starting point.\vspace{1mm}

	\item  The remaining five colours are used for the \emph{filling, 
	hatching and dotting} of areas bordered by \emph{polygons.} For that 
	the filter program cuts up the polygon area into triangles which have 
	the starting point of the polygon as a common corner. To avoid 
	overlap, the given area must be devided by polygons such that for 
	each polygon the triangles which arise from connecting the starting 
	point with the other corners have at most one side in common with 
	the other triangles (see Figures 3 and 4).\\[-7mm]

%Figures 3 and 4
\begin{figure}[tbh]
	\setlength{\unitlength}{1pt}
	\begin{minipage}[b]{8.0cm}
		\setlength{\unitlength}{1pt}
\begin{picture}(110,95)(-38,12)
\linethickness{0.8pt}
\thicklines
%Lines, polygons and BŽzier curves
\Lbezier[153](37.795276,19.84252)(25.511811,95.433071)
\Lbezier[80](25.511811,95.433071)(51.023622,64.251969)
\Lbezier[112](51.023622,64.251969)(86.929134,107.716535)
\Lbezier[94](86.929134,107.716535)(76.535433,61.417323)
\put(76.535433,61.417323){\line(4,-1){60.472441}}
\Lbezier[205](137.007874,46.299213)(37.795276,19.84252)
%Dotted line
\linethickness{1.2pt}
\Lbezier[13](37.795276,19.84252)(51.023622,64.251969)
\Lbezier[30](37.795276,19.84252)(86.929134,107.716535)
\Lbezier[17](37.795276,19.84252)(76.535433,61.417323)
\put(27.732283,16.897638){A}
\put(22.007874,98.212598){B}
\put(37.795276,59.582677){C}
\put(89.598425,104.992126){D}
\put(80.761464,63.360815){E}
\put(135.503937,34.795276){F}
\put(60,1){Figure 3}
\end{picture}
	\end{minipage}\hfill
\raisebox{2mm}{
\begin{minipage}[b]{5.0cm}
\begin{picture}(150,102)(21,9)
\linethickness{0.8pt}
\thicklines
%Lines, polygons and BŽzier curves
\Lbezier[128](64.251969,108.661417)(116.372861,70.793372)
\Lbezier[128](116.372861,70.793372)(96.464452,9.521588)
\put(96.464452,9.521588){\line(-1,0){64.424967}}
\Lbezier[128](32.039485,9.521588)(12.131076,70.793372)
\Lbezier[128](12.131076,70.793372)(64.251969,108.661417)
\Lbezier[49](51.817323,66.028346)(76.422047,66.292913)
\Lbezier[49](76.422047,66.292913)(76.686614,41.688189)
\Lbezier[49](76.686614,41.688189)(52.081890,41.423622)
\Lbezier[49](52.081890,41.423622)(51.817323,66.028346)
%Dotted line
\linethickness{1.2pt}
\Lbezier[14](12.131076,70.793372)(51.817323,66.028346)
\Lbezier[17](12.131076,70.793372)(52.081890,41.423622)
\Lbezier[14](32.039485,9.521588)(52.081890,41.423622)
\Lbezier[14](76.686614,41.688189)(96.464452,9.521588)
\Lbezier[16](51.817323,66.028346)(64.251969,108.661417)
\Lbezier[16](64.251969,108.661417)(76.422047,66.292913)
\Lbezier[15](76.422047,66.292913)(116.372861,70.793372)
\Lbezier[17](116.372861,70.793372)(76.686614,41.688189)
%Dotted triangle
\linethickness{0.8pt}
\multiput(36,68)(4,0){5}{\line(1,0){0.8}}
\multiput(22,70)(4,0){8}{\line(1,0){0.8}}
\multiput(16,72)(4,0){10}{\line(1,0){0.8}}
\multiput(18,74)(4,0){10}{\line(1,0){0.8}}
\multiput(20,76)(4,0){9}{\line(1,0){0.8}}
\multiput(26,78)(4,0){8}{\line(1,0){0.8}}
\multiput(28,80)(4,0){7}{\line(1,0){0.8}}
\multiput(30,82)(4,0){7}{\line(1,0){0.8}}
\multiput(32,84)(4,0){7}{\line(1,0){0.8}}
\multiput(34,86)(4,0){6}{\line(1,0){0.8}}
\multiput(36,88)(4,0){6}{\line(1,0){0.8}}
\multiput(42,90)(4,0){5}{\line(1,0){0.8}}
\multiput(44,92)(4,0){4}{\line(1,0){0.8}}
\multiput(46,94)(4,0){4}{\line(1,0){0.8}}
\multiput(48,96)(4,0){4}{\line(1,0){0.8}}
\multiput(50,98)(4,0){3}{\line(1,0){0.8}}
\multiput(56,100)(4,0){2}{\line(1,0){0.8}}
\multiput(58,102)(4,0){2}{\line(1,0){0.8}}
\multiput(60,104)(4,0){1}{\line(1,0){0.8}}
\multiput(62,106)(4,0){1}{\line(1,0){0.8}}
\multiput(64,108)(4,0){1}{\line(1,0){0.8}}
%Dotted triangle
\multiput(54,42)(4,0){0}{\line(1,0){0.8}}
\multiput(52,44)(4,0){1}{\line(1,0){0.8}}
\multiput(46,46)(4,0){2}{\line(1,0){0.8}}
\multiput(44,48)(4,0){3}{\line(1,0){0.8}}
\multiput(42,50)(4,0){3}{\line(1,0){0.8}}
\multiput(40,52)(4,0){3}{\line(1,0){0.8}}
\multiput(38,54)(4,0){4}{\line(1,0){0.8}}
\multiput(36,56)(4,0){4}{\line(1,0){0.8}}
\multiput(30,58)(4,0){6}{\line(1,0){0.8}}
\multiput(28,60)(4,0){6}{\line(1,0){0.8}}
\multiput(26,62)(4,0){7}{\line(1,0){0.8}}
\multiput(24,64)(4,0){7}{\line(1,0){0.8}}
\multiput(22,66)(4,0){8}{\line(1,0){0.8}}
\multiput(16,68)(4,0){5}{\line(1,0){0.8}}
\multiput(14,70)(4,0){2}{\line(1,0){0.8}}
%Dotted triangle
\multiput(34,10)(4,0){0}{\line(1,0){0.8}}
\multiput(32,12)(4,0){1}{\line(1,0){0.8}}
\multiput(34,14)(4,0){1}{\line(1,0){0.8}}
\multiput(32,16)(4,0){2}{\line(1,0){0.8}}
\multiput(30,18)(4,0){2}{\line(1,0){0.8}}
\multiput(32,20)(4,0){2}{\line(1,0){0.8}}
\multiput(30,22)(4,0){3}{\line(1,0){0.8}}
\multiput(28,24)(4,0){4}{\line(1,0){0.8}}
\multiput(30,26)(4,0){4}{\line(1,0){0.8}}
\multiput(28,28)(4,0){4}{\line(1,0){0.8}}
\multiput(26,30)(4,0){5}{\line(1,0){0.8}}
\multiput(28,32)(4,0){5}{\line(1,0){0.8}}
\multiput(26,34)(4,0){6}{\line(1,0){0.8}}
\multiput(24,36)(4,0){7}{\line(1,0){0.8}}
\multiput(26,38)(4,0){6}{\line(1,0){0.8}}
\multiput(24,40)(4,0){7}{\line(1,0){0.8}}
\multiput(22,42)(4,0){8}{\line(1,0){0.8}}
\multiput(24,44)(4,0){7}{\line(1,0){0.8}}
\multiput(22,46)(4,0){6}{\line(1,0){0.8}}
\multiput(20,48)(4,0){6}{\line(1,0){0.8}}
\multiput(22,50)(4,0){5}{\line(1,0){0.8}}
\multiput(20,52)(4,0){5}{\line(1,0){0.8}}
\multiput(18,54)(4,0){5}{\line(1,0){0.8}}
\multiput(20,56)(4,0){4}{\line(1,0){0.8}}
\multiput(18,58)(4,0){3}{\line(1,0){0.8}}
\multiput(16,60)(4,0){3}{\line(1,0){0.8}}
\multiput(18,62)(4,0){2}{\line(1,0){0.8}}
\multiput(16,64)(4,0){2}{\line(1,0){0.8}}
\multiput(14,66)(4,0){2}{\line(1,0){0.8}}
\multiput(16,68)(4,0){0}{\line(1,0){0.8}}
\multiput(14,70)(4,0){0}{\line(1,0){0.8}}
%Dotted triangle
\multiput(98,10)(4,0){0}{\line(1,0){0.8}}
\multiput(96,12)(4,0){1}{\line(1,0){0.8}}
\multiput(94,14)(4,0){1}{\line(1,0){0.8}}
\multiput(96,16)(4,0){1}{\line(1,0){0.8}}
\multiput(94,18)(4,0){2}{\line(1,0){0.8}}
\multiput(92,20)(4,0){2}{\line(1,0){0.8}}
\multiput(90,22)(4,0){3}{\line(1,0){0.8}}
\multiput(88,24)(4,0){4}{\line(1,0){0.8}}
\multiput(90,26)(4,0){3}{\line(1,0){0.8}}
\multiput(88,28)(4,0){4}{\line(1,0){0.8}}
\multiput(86,30)(4,0){5}{\line(1,0){0.8}}
\multiput(84,32)(4,0){5}{\line(1,0){0.8}}
\multiput(82,34)(4,0){6}{\line(1,0){0.8}}
\multiput(84,36)(4,0){6}{\line(1,0){0.8}}
\multiput(82,38)(4,0){6}{\line(1,0){0.8}}
\multiput(80,40)(4,0){7}{\line(1,0){0.8}}
\multiput(78,42)(4,0){8}{\line(1,0){0.8}}
\multiput(80,44)(4,0){7}{\line(1,0){0.8}}
\multiput(86,46)(4,0){6}{\line(1,0){0.8}}
\multiput(88,48)(4,0){6}{\line(1,0){0.8}}
\multiput(90,50)(4,0){5}{\line(1,0){0.8}}
\multiput(92,52)(4,0){5}{\line(1,0){0.8}}
\multiput(94,54)(4,0){5}{\line(1,0){0.8}}
\multiput(100,56)(4,0){3}{\line(1,0){0.8}}
\multiput(102,58)(4,0){3}{\line(1,0){0.8}}
\multiput(104,60)(4,0){3}{\line(1,0){0.8}}
\multiput(106,62)(4,0){2}{\line(1,0){0.8}}
\multiput(108,64)(4,0){2}{\line(1,0){0.8}}
\multiput(110,66)(4,0){2}{\line(1,0){0.8}}
\multiput(116,68)(4,0){0}{\line(1,0){0.8}}
\multiput(118,70)(4,0){0}{\line(1,0){0.8}}
%Dotted triangle
\multiput(78,42)(4,0){0}{\line(1,0){0.8}}
\multiput(80,44)(4,0){0}{\line(1,0){0.8}}
\multiput(78,46)(4,0){2}{\line(1,0){0.8}}
\multiput(80,48)(4,0){2}{\line(1,0){0.8}}
\multiput(78,50)(4,0){3}{\line(1,0){0.8}}
\multiput(80,52)(4,0){3}{\line(1,0){0.8}}
\multiput(78,54)(4,0){4}{\line(1,0){0.8}}
\multiput(80,56)(4,0){5}{\line(1,0){0.8}}
\multiput(78,58)(4,0){6}{\line(1,0){0.8}}
\multiput(80,60)(4,0){6}{\line(1,0){0.8}}
\multiput(78,62)(4,0){7}{\line(1,0){0.8}}
\multiput(80,64)(4,0){7}{\line(1,0){0.8}}
\multiput(78,66)(4,0){8}{\line(1,0){0.8}}
\multiput(92,68)(4,0){6}{\line(1,0){0.8}}
\multiput(110,70)(4,0){2}{\line(1,0){0.8}}
%Dotted triangle
\multiput(76,68)(4,0){4}{\line(1,0){0.8}}
\multiput(78,70)(4,0){8}{\line(1,0){0.8}}
\multiput(76,72)(4,0){10}{\line(1,0){0.8}}
\multiput(78,74)(4,0){9}{\line(1,0){0.8}}
\multiput(76,76)(4,0){9}{\line(1,0){0.8}}
\multiput(74,78)(4,0){9}{\line(1,0){0.8}}
\multiput(76,80)(4,0){7}{\line(1,0){0.8}}
\multiput(74,82)(4,0){7}{\line(1,0){0.8}}
\multiput(72,84)(4,0){7}{\line(1,0){0.8}}
\multiput(74,86)(4,0){6}{\line(1,0){0.8}}
\multiput(72,88)(4,0){6}{\line(1,0){0.8}}
\multiput(70,90)(4,0){5}{\line(1,0){0.8}}
\multiput(72,92)(4,0){4}{\line(1,0){0.8}}
\multiput(70,94)(4,0){4}{\line(1,0){0.8}}
\multiput(68,96)(4,0){4}{\line(1,0){0.8}}
\multiput(70,98)(4,0){3}{\line(1,0){0.8}}
\multiput(68,100)(4,0){3}{\line(1,0){0.8}}
\multiput(70,102)(4,0){1}{\line(1,0){0.8}}
\multiput(68,104)(4,0){1}{\line(1,0){0.8}}
\multiput(66,106)(4,0){1}{\line(1,0){0.8}}
\multiput(68,108)(4,0){0}{\line(1,0){0.8}}
%Hatched triangle
\Lbezier[7](65.2359207037011,105.235920811786)(62.4363140016148,102.4363141097)
\Lbezier[15](66.1285055587812,102.1285056742)(60.7892551048443,96.7892552202636)
\Lbezier[22](67.0210904138612,99.0210905366148)(59.1421962080738,91.1421963308273)
\put(67.9136752689413,95.9136753990291){\line(-1,-1){10.4185379576379}}
\put(68.8062601240213,92.8062602614434){\line(-1,-1){12.9581817094884}}
\put(69.6988449791014,89.6988451238577){\line(-1,-1){15.497825461339}}
\put(70.5914298341814,86.591429986272){\line(-1,-1){18.0374692131895}}
\put(71.4840146892615,83.4840148486863){\line(-1,-1){17.4316358238517}}
\put(72.3765995443415,80.3765997111006){\line(-1,-1){14.2807424059155}}
\put(73.2691843994216,77.2691845735149){\line(-1,-1){11.1298489879793}}
\Lbezier[22](74.1617692545016,74.1617694359292)(66.1828136844585,66.1828138658861)
\Lbezier[13](75.0543541095817,71.0543542983436)(70.2262919574748,66.2262921462366)
\Lbezier[4](75.9469389646618,67.9469391607579)(74.269770230491,66.2697704265871)
%Hatched triangle
\Lbezier[10](53.4382060465256,41.438206152038)(49.8144047931543,37.8144048986667)
\put(57.4816843197205,41.4816844416667){\line(-1,-1){14.4271554953665}}
\put(61.5251625929154,41.5251627312953){\line(-1,-1){25.2305097373617}}
\put(65.5686408661102,41.5686410209239){\line(-1,-1){28.2271651916524}}
\put(69.6121191393051,41.6121193105525){\line(-1,-1){17.9612717829661}}
\Lbezier[21](73.6555974125,41.6555976001812)(65.9602190382202,33.9602192259014)
%Hatched triangle
\Lbezier[10](33.521588,9.52158800460102)(37.3414757050646,13.3414757096656)
\put(37.521588,9.52158801701857){\line(1,1){14.1292594695494}}
\put(41.521588,9.52158802943611){\line(1,1){24.4386312340343}}
\put(45.521588,9.52158804185366){\line(1,1){31.5463756065196}}
\put(49.521588,9.5215880542712){\line(1,1){29.0693750607577}}
\put(53.521588,9.52158806668875){\line(1,1){26.5923745149957}}
\put(57.521588,9.5215880791063){\line(1,1){24.1153739692337}}
\put(61.521588,9.52158809152384){\line(1,1){21.6383734234717}}
\put(65.521588,9.52158810394139){\line(1,1){19.1613728777097}}
\put(69.521588,9.52158811635893){\line(1,1){16.6843723319477}}
\put(73.521588,9.52158812877648){\line(1,1){14.2073717861858}}
\put(77.521588,9.52158814119403){\line(1,1){11.7303712404238}}
\Lbezier[26](81.521588,9.52158815361157)(90.7749586946618,18.7749588482734)
\Lbezier[19](85.521588,9.52158816602912)(92.2979581488998,16.2979583149289)
\Lbezier[12](89.521588,9.52158817844666)(93.8209576031378,13.8209577815845)
\Lbezier[5](93.521588,9.52158819086421)(95.3439570573758,11.3439572482401)
\put(2.503937,67.19685){1}
\put(55.692913,55.748031){2}
\put(120.834646,67.307087){3}
\put(19.393701,7.559055){4}
\put(48,-8){Figure 4}
\end{picture}
	\end{minipage}}
	\end{figure}\vspace{2mm}	

    \hspace{-4mm}\fbox{Red} \emph{polygons} are \emph{filled} without
	boundery. For the \emph{hatching with visible boundary lines} the colour
	\fbox{orange} has to be chosen for the polygon; \emph{without boundary 
	lines} the colour \fbox{brown} will do it. If the polygon is coloured
	\fbox{purple}, the area will be \emph{dotted with visible boundary lines};
	with the colour \fbox{violet} an area can be \emph{dotted without boundary 
	lines}. The previous assignments of colours are summarized in the 
	following table.\vspace{3mm}

\begin{center}
		\begin{tabular}{|c|c|}
			\hline
			\rule[-1mm]{0mm}{4.5mm}
			Type &amp; Colour \\
			\hline
			\rule[0mm]{0mm}{4mm}
			auxiliary line &amp; yellow \\
			unbroken object &amp; green \\
			arrow &amp; violet \\
			dotted object &amp; dark green \\
			B\'ezier curve or text &amp; blue \\
			open polygon &amp; navy blue \\
			filling without border &amp; red \\
			hatching with border &amp; orange \\
			hatching without border &amp; brown \\
			dotting with border &amp; purple \\
			dotting without border &amp; dark brown \\
			\hline
		\end{tabular}\\	
\end{center}\vspace{3mm}

	\item  With Cabri Geometry semicircles and quadrants of a circle, 
	which in \LaTeX{} are also connected with the \verb|\oval| command, 
	must be constructed as circular arcs determined by three points on a 
	circle. For those circular arcs which have at their ends radii 
	parallel to the coordinate axes, the input is simplified by using 
	coloured circles. The next table contains the assigned colours. With 
	the Macintosh version of Cabri Geometry, the respective colours of 
	the objects can be preset in the ``standard settings''.
	\vspace{3mm}
	
\begin{center}
			\begin{tabular}{|c|c|}
			\hline
			\rule[-1mm]{0mm}{4.5mm}
			Type &amp; Colour \\
			\hline
			\rule[0mm]{0mm}{4mm}
			auxiliary circle &amp; yellow \\
			unbroken circle &amp; navy blue \\
			dotted arc or circle &amp; dark green \\
			left semicircle &amp; purple \\
			right semicircle &amp; red \\
			bottom semicircle &amp; orange \\
			top semicircle &amp; dark brown \\
			left bottom quadrant of a circle &amp; blue \\
			left top quadrant of a circle &amp; green \\
			right bottom quadrant of a circle &amp; brown \\
			right top quadrant of a circle &amp; violet \\
			\hline
		\end{tabular}
\end{center}
\end{list}\vspace{2mm}

\section{Macros for B\'ezier Curves with Cabri Geometry}

In contrast to many drawing programs, Cabri Geometry does not offer 
the tool `B\'ezier curve' which yields a substantial part of the 
efficiency of \LaTeX{} figures. This deficiency can be compensated by 
``loci'' which are generated with the aid of macros described in the 
following.

In the mathematical representation we use vectors instead of the 
spanning points because the geometrical meaning is better known from 
vector geometry than from complex numbers.

If $t$ with $0 \le t \le 1$ is the running parameter, then the
\emph{quadratic B\'ezier curve} spanned by
$\vec{x}_{1},\,\vec{x}_{2},\,\vec{x}_{3}$ can be written in the 
following form with the abbreviation $t_{1}:\,=1-t$:
\[\vec{x}(t)=t_{1}\left(t_{1}\vec{x}_{1}+t\,\vec{x}_{2}\right)+
t\left(t_{1}\vec{x}_{2}+t\,\vec{x}_{3}\right).\]\\[-5mm]
Since all three linear combinations belonging to the plus signs have 
the same coefficients $t_{1}$ and $t$, each point of the quadratic
B\'ezier curve can be obtained by dividing three line segments with 
the same division ratio $t:t_{1}.$ Since
\[t_{1}\vec{x}_{i}+t\,\vec{x}_{i+1}
=\vec{x}_{i}+t\left(\vec{x}_{i+1}-\vec{x}_{i}\right),\;i=1,\,2,\]\\[-6mm]
at first the two ``connecting line segments'' from $\vec{x}_{1}$ to
$\vec{x}_{2}$ and from $\vec{x}_{2}$ to $\vec{x}_{3}$ are divided with
ratio $t:t_{1}.$ If
$\vec{x}\;\!'_{\!i}:\,=t_{1}\vec{x}_{i}+t\,\vec{x}_{i+1},\;i=1,\,2,$
are the accompanying ``division vectors'', then the division of the
connecting line segment from $\vec{x}\;\!'_{\!1}$ to
$\vec{x}\;\!'_{\!2}$ with ratio $t:t_{1}$ yields the vector
$\vec{x}(t)$ belonging to the parameter $t.$

Correspondingly, the quadratic B\'ezier curve can be constructed as 
locus. After the input of three different points $P_{1},\,P_{2},\,P_{3},$
the line segment connecting $P_{1}$ and $P_{3}$ is drawn as ``track'' 
of the locus, and a point $T$ is placed on it $\:\:$(see Figure 5).\mbox{}
\vspace{-7.2mm}\\

%Figur 5
\begin{figure}[tbh]
	\setlength{\unitlength}{1pt}
\raisebox{6mm}
{\begin{minipage}[b]{7.5cm}
		\setlength{\unitlength}{1pt}
\begin{picture}(150,84)(0,19)
\linethickness{0.8pt}
\thicklines
%Lines, polygons and BŽzier curves
%Dotted line
\linethickness{1.2pt}
\Lbezier[42](30.236220,30.23622)(168.188976,54.80315)
\linethickness{0.8pt}
\Lbezier[209](168.188976,54.80315)(71.811024,96.377953)
\Lbezier[144](71.811024,96.377953)(33.429250,35.31604)
\Lbezier[268](30.236220,30.23622)(162.281911,53.751207)
\Lbezier[141](44.502084,52.931913)(114.874262,46.886839)
%Filled triangle
\linethickness{0.1pt}
\put(30.3016,30.43622){\line(1,0){0.0603}}
\put(30.367,30.63622){\line(1,0){0.1206}}
\put(30.4325,30.83622){\line(1,0){0.1809}}
\put(30.4979,31.03622){\line(1,0){0.2412}}
\put(30.5633,31.23622){\line(1,0){0.3015}}
\put(30.6288,31.43622){\line(1,0){0.3617}}
\put(30.6942,31.63622){\line(1,0){0.422}}
\put(30.7596,31.83622){\line(1,0){0.4823}}
\put(30.8251,32.03622){\line(1,0){0.5426}}
\put(30.8905,32.23622){\line(1,0){0.6029}}
\put(30.9559,32.43622){\line(1,0){0.6632}}
\put(31.0214,32.63622){\line(1,0){0.7234}}
\put(31.0868,32.83622){\line(1,0){0.7837}}
\put(31.1522,33.03622){\line(1,0){0.844}}
\put(31.2177,33.23622){\line(1,0){0.9043}}
\put(31.2831,33.43622){\line(1,0){0.9646}}
\put(31.3485,33.63622){\line(1,0){1.0248}}
\put(31.4139,33.83622){\line(1,0){1.0851}}
\put(31.4794,34.03622){\line(1,0){1.1454}}
\put(31.5448,34.23622){\line(1,0){1.2057}}
\put(31.6102,34.43622){\line(1,0){1.266}}
\put(31.6757,34.63622){\line(1,0){1.3263}}
\put(31.7411,34.83622){\line(1,0){1.3865}}
\put(31.8065,35.03622){\line(1,0){1.4468}}
\put(31.872,35.23622){\line(1,0){1.5071}}
\put(31.9374,35.43622){\line(1,0){1.4644}}
\put(32.0028,35.63622){\line(1,0){1.3534}}
\put(32.0683,35.83622){\line(1,0){1.2423}}
\put(32.1337,36.03622){\line(1,0){1.1313}}
\put(32.1991,36.23622){\line(1,0){1.0203}}
\put(32.2646,36.43622){\line(1,0){0.9092}}
\put(32.33,36.63622){\line(1,0){0.7982}}
\put(32.3954,36.83622){\line(1,0){0.6871}}
\put(32.4609,37.03622){\line(1,0){0.5761}}
\put(32.5263,37.23622){\line(1,0){0.465}}
\put(32.5917,37.43622){\line(1,0){0.354}}
\put(32.6572,37.63622){\line(1,0){0.2429}}
\put(32.7226,37.83622){\line(1,0){0.1319}}
\put(32.788,38.03622){\line(1,0){0.0208}}
\linethickness{0.8pt}
%Filled triangle
\linethickness{0.1pt}
\put(30.4447,30.43622){\line(-1,0){0.0828}}
\put(30.6532,30.63622){\line(-1,0){0.1656}}
\put(30.8617,30.83622){\line(-1,0){0.2483}}
\put(31.0702,31.03622){\line(-1,0){0.3311}}
\put(31.2786,31.23622){\line(-1,0){0.4139}}
\put(31.4871,31.43622){\line(-1,0){0.4966}}
\put(31.6956,31.63622){\line(-1,0){0.5794}}
\put(31.9041,31.83622){\line(-1,0){0.6621}}
\put(32.1125,32.03622){\line(-1,0){0.7449}}
\put(32.321,32.23622){\line(-1,0){0.8277}}
\put(32.5295,32.43622){\line(-1,0){0.9104}}
\put(32.738,32.63622){\line(-1,0){0.9932}}
\put(32.9464,32.83622){\line(-1,0){1.0759}}
\put(33.1549,33.03622){\line(-1,0){1.1587}}
\put(33.3634,33.23622){\line(-1,0){1.2415}}
\put(33.5719,33.43622){\line(-1,0){1.3242}}
\put(33.7803,33.63622){\line(-1,0){1.407}}
\put(33.9888,33.83622){\line(-1,0){1.4897}}
\put(34.1973,34.03622){\line(-1,0){1.5725}}
\put(34.4058,34.23622){\line(-1,0){1.6553}}
\put(34.6142,34.43622){\line(-1,0){1.738}}
\put(34.8227,34.63622){\line(-1,0){1.8208}}
\put(35.0312,34.83622){\line(-1,0){1.9035}}
\put(35.2397,35.03622){\line(-1,0){1.9863}}
\put(35.4481,35.23622){\line(-1,0){2.0691}}
\put(35.6566,35.43622){\line(-1,0){1.7004}}
\put(35.8651,35.63622){\line(-1,0){1.032}}
\put(36.0736,35.83622){\line(-1,0){0.3635}}
\linethickness{0.8pt}
%Filled triangle
\linethickness{0.1pt}
\put(161.11,51.6315371){\line(-1,0){0.3069}}
\put(161.5564,51.8315371){\line(-1,0){0.6138}}
\put(162.0028,52.0315371){\line(-1,0){0.9206}}
\put(162.4492,52.2315371){\line(-1,0){1.2275}}
\put(162.8956,52.4315371){\line(-1,0){1.5344}}
\put(163.342,52.6315371){\line(-1,0){1.8412}}
\put(163.7884,52.8315371){\line(-1,0){2.1481}}
\put(164.2348,53.0315371){\line(-1,0){2.455}}
\put(164.6812,53.2315371){\line(-1,0){2.7618}}
\put(165.1276,53.4315371){\line(-1,0){3.0687}}
\put(165.574,53.6315371){\line(-1,0){3.3756}}
\put(166.0204,53.8315371){\line(-1,0){3.2874}}
\put(166.4668,54.0315371){\line(-1,0){2.6107}}
\put(166.9132,54.2315371){\line(-1,0){1.934}}
\put(167.3596,54.4315371){\line(-1,0){1.2574}}
\put(167.806,54.6315371){\line(-1,0){0.5807}}
\linethickness{0.8pt}
%Filled triangle
\linethickness{0.1pt}
\put(161.9952,53.9512072){\line(1,0){1.4098}}
\put(161.7085,54.1512072){\line(1,0){2.8195}}
\put(161.4219,54.3512072){\line(1,0){4.2293}}
\put(161.1352,54.5512072){\line(1,0){5.639}}
\put(160.8485,54.7512072){\line(1,0){7.0488}}
\put(160.5619,54.9512072){\line(1,0){5.4768}}
\put(160.2752,55.1512072){\line(1,0){2.8587}}
\put(159.9885,55.3512072){\line(1,0){0.2406}}
\linethickness{0.8pt}
%Filled triangle
\linethickness{0.1pt}
\put(112.948,45.2653501){\line(1,0){1.0074}}
\put(113.1856,45.4653501){\line(1,0){2.0148}}
\put(113.4231,45.6653501){\line(1,0){3.0221}}
\put(113.6607,45.8653501){\line(1,0){4.0295}}
\put(113.8983,46.0653501){\line(1,0){5.0369}}
\put(114.1359,46.2653501){\line(1,0){6.0442}}
\put(114.3735,46.4653501){\line(1,0){5.4074}}
\put(114.6111,46.6653501){\line(1,0){2.8416}}
\put(114.8487,46.8653501){\line(1,0){0.2757}}
\linethickness{0.8pt}
%Filled triangle
\linethickness{0.1pt}
\put(120.2697,46.573321){\line(-1,0){1.7457}}
\put(119.687,46.773321){\line(-1,0){3.4913}}
\put(119.1044,46.973321){\line(-1,0){4.303}}
\put(118.5218,47.173321){\line(-1,0){3.8887}}
\put(117.9392,47.373321){\line(-1,0){3.4744}}
\put(117.3565,47.573321){\line(-1,0){3.0602}}
\put(116.7739,47.773321){\line(-1,0){2.6459}}
\put(116.1913,47.973321){\line(-1,0){2.2316}}
\put(115.6087,48.173321){\line(-1,0){1.8173}}
\put(115.026,48.373321){\line(-1,0){1.4031}}
\put(114.4434,48.573321){\line(-1,0){0.9888}}
\put(113.8608,48.773321){\line(-1,0){0.5745}}
\put(113.2782,48.973321){\line(-1,0){0.1603}}
\linethickness{0.8pt}
\put(56.0,93.543307){$P_{1}$}
\put(16.566929,28.84252){$P_{2}$}
\put(162.0,43.464567){$P_{3}$}
\put(28.125984,51.07874){$Q_{1}$}
\put(133.338583,73.425197){$T$}
\put(116.220472,35.795276){$Q_{2}$}
\put(90.818898,52.637795){$S$}
\put(135.118110,69.069013){\circle*{3}}
\put(94.653661,48.623818){\circle*{3}}
\put(77,16){Figure 5}
\end{picture}
	\end{minipage}}\hfill
	\begin{minipage}[b]{6.5cm}
		\setlength{\baselineskip}{17pt}
The distances of $P_{1}$ and $T$ and of $P_{1}$ and $P_{3}$ 
determined with the tool ``dis\-tance and length'' must be 
transferred into the window of the tool ``calculator''. They have to 
be divided. After putting the value of the ratio into the drawing 
window, it has
	\end{minipage}\\[-5mm]
\end{figure}

to be multiplied with the distances of $P_{1}$ and $P_{2}$
and of $P_{2}$ and $P_{3}$. To get the right division points $Q_{1}$
and $Q_{2}$, these resulting lengths have to be marked off on the 
vectors from $P_{1}$ to $P_{2}$ and from $P_{2}$ to $P_{3}$ with the 
tool ``transfer of measurement''. In the same way, the point $S$ of the
quadratic B\'ezier curve is constructed as division point on the vector 
from $Q_{1}$ to $Q_{2}.$

Calling the tool ``locus'' and clicking on the points $S$ and $T$ (in 
this order) the preset number of points of the quadratic B\'ezier curve 
will be drawn. Then, in the tool box ``macros'' the three points $P_{1},
\,P_{2},\,P_{3}$ and the locus have to be chosen respectively as 
source objects and as target object by clicking. Finally, with the 
tool ``macro name'' the macro can be saved.

The \emph{cubic B\'ezier curve} determined by the vectors 
$\vec{y}_{1},\,\vec{y}_{2},\,\vec{y}_{3},\,\vec{y}_{4}$ is obtained 
quite similar by six divisions of line segments with the same ratio
$t:t_{1}$ because the abbreviations\vspace{-1mm}
\[\vec{y}\;\!'_{\!j}:\,=
t_{1}\vec{y}_{j}+t\,\vec{y}_{j+1},\;j=1,\,2,\,3,\:\mbox{ and }\:
\vec{y}\;\!''_{\!k}:\,=
t_{1}\vec{y}\;\!'_{\!k}+t\,\vec{x}\;\!'_{\!k+1},\;k=1,\,2,\]\\[-7mm]
enable the representation
\vspace{-1mm}
\[\vec{y}(t)=t_{1}\vec{y}\;\!''_{\!1}+t\,\vec{y}\;\!''_{\!2}.\]\\[-4mm]
Therefore, the cubic B\'ezier curve can be constructed as locus in a 
way analogous to that one of the quadratic B\'ezier curve. At first, 
four different points have to be entered. Then the connecting line segment 
of the first and the last point is drawn as track of the locus. A 
point $T$ which has to be put on the track determines the division ratio 
of all six vectors occurring later. The first three vectors connect 
each of two points entered successively. The next two vectors lie 
between the three division points. The corresponding division of the 
sixth connecting vector yields the locus point belonging to $T$. 

The source objects of the macro are the four starting points, the 
target object is the locus. The Macintosh version of the two macros 
can be found in the Section ``Programs'' of the author's web site 
called \emph{Mathcompass} \cite{Mo}.

\section{PostScript Files}

The inclusion of graphics with the \LaTeX{} command \verb|\special| is 
extremely device dependent. This deficiency is reduced considerably by 
suitable \TeX{} macros which support many important drivers processing
PostScript code. The \LaTeX{} packages \texttt{graphicx, color} and
\texttt{pstricks} are examples which, among other possibilities, are 
described in \cite{GRM}.

Compared with the programming of such \TeX{} macros, the writing of 
filter programs for the extraction of data from EPS files (EPS\,=\,
Encapsulated PostScript) relevant for \LaTeX{} requires only little 
knowledge of PostScript, for example from \cite{Ad}. For the 
application with a fitting filter program, a standard EPS printer 
driver can be used without understanding PostScript. Suitable drivers 
can be downloaded free of charge from the driver web site of the 
Adobe Company (\texttt{http://www.adobe.com/support/downloads/main.html}).

The following explanations are given for people who want to
change or rewrite a filter program.  PostScript files can be opened
and edited with editor programs like \emph{Alpha} or \emph{BBEdit}
with MacOS, \emph{WinEdt} with Windows or \emph{Emacs} with Unix. 
Frequently these files have more than 1000 lines.  But even in this case,
only a very small part lying between `EndProlog' and `EOF' contains
\LaTeX{} relevant data.

For the application of filter programs it is advantageous that all
lines containing required numerical values are unambiguously marked
at the line end.  However, for the individual PostScript generators
the marking may be quite different.  The lines with the colour data
end, among other things, with `setrgbcolor' or with `:F4'.  The
object data follow one to three lines later. Here too, the marking
may be ``concrete'' or ``abstract''.  In case of a line segment, it 
is, for example, `lineto stroke' respectively `@b'. In the
second case, the concrete assignment can be found in the `Prolog' 
section.

The meaning and the order of the numerical values from different
PostScript generators are not uniform either.  For example, a circle
can be determined by its centre and radius or by two diagonal corners
of its bounding box.  Sometimes the x- and y-coordinates of points
are exchanged.  Furthermore, the numerical values do not always belong
to the same unit.  Usually it is `pt' which fits the \texttt{picture}
environment of \LaTeX. There may also occur integer values which have
to be multiplied with 0.25 in order to receive the point size.

All these differences can be clarified through systematic trials.  At
first, each of the different objects has to be constructed with the
graphic program.  After noting the measurements, the drawing must be
exported as a PostScript file.  Most of the graphic programs indicate
coordinates and lengths in millimetres.  The conversion factor to pt
is 2.845.  Through choice of suitable lattice points or through
variation of the figure, the position of the data in question can be
determined.  If it turns out that the y-coordinates in the
PostScript file are opposed to those in the graphic program,
either the drawing has to be reflected vertically before saving, or
in the filter program, each y-coordinate must be multiplied by -1.

\section{Perl}

The interpreter language Perl (as abbreviation of ``\textbf{P}ractical
\textbf{E}xtraction and \textbf{R}eport \textbf{L}anguage'') was
developed around 1988 by \textsc{Larry Wall} at first for scanning
arbitrary text files in order to extract and process information.  It
may be considered as a younger brother of the \TeX{} system published
around 1978 by \textsc{Donald E. Knuth} because many persons are
improving the systems since the beginning and because both systems
with numerous modules and aids are available free of charge in the
``Comprehensive \TeX{} Archive Network'' (CTAN) and in the ``Comprehensive 
Perl Archive Network'' (\texttt{http://www.Perl.com/CPAN}) respectively. 
Meanwhile Perl has become a universal script language with which many 
kinds of recurring tasks can be automated, for example in the system 
man\-age\-ment of computers and of their peripherals.  Along with the 
great power of Perl since Version 5, it is specially advantageous for 
the application together with \LaTeX{} that Perl systems are available 
on all platforms with wide distribution.  Therefore it is not surprising 
that the CTAN already contains numerous Perl programs.

Whoever has learned a higher programming language (like C, for
example) will hardly have difficulties writing or changing Perl filter
programs with the aid of some of the online manuals and looking at
examples like the ones described in the following section.  As with
\LaTeX, it may be expected that, now having reached the Perl version
number 5.8.7, there won't be considerable changes with respect to text
filtering.  Therefore it is reasonable to provide and to maintain Perl
filter programs at this time also for further combinations of graphic
programs, PostScript versions and \LaTeX{} packages.  That can be
achieved in the interest of the \LaTeX{} community by a few persons
because the main work has been accomplished developing
the filter structure and the subroutines.

\section{The filter programs \texttt{CABpict.pl} and \texttt{CABebez.pl}}

The Perl program \texttt{CABpict.pl}, which is 32 kB large, has 964
lines including the comment lines beginning with `\#' and the
lines with closing braces `\}'.  The program \texttt{CABebez.pl} is
only 29 lines shorter.  Therefore in the following only those lines
and blocks are commented which are important for better understanding
or which may play a part in modifications.

In case of matching, the lines from \texttt{CABpict.pl} are taken.  The
line numbers, which in both cases don't belong to the programs, may
be different even for matching lines.  In this documentation, the lines of
\texttt{CABebez.pl} are marked by a colon behind the numbers.

\begin{small}
\begin{verbatim}
   1 #!perl -w
   2 # CABpict.pl
\end{verbatim}
\vspace{-4mm}
\texttt{\mbox{\quad} 3 \# (c) Copyright 2006 H. M\"oller 
(mollerh@math.uni-muenster.de).\\
\mbox{\quad} 4 \# Version 1.1 for Cabri-g\'eom\`etre II with MacOS 
9.x, \ldots \mbox{ }.\\
\mbox{\quad} 5 \# This program may be distributed and/or modified under the\\
\mbox{\quad \quad} conditions of the LaTeX Project Public License, \ldots 
\mbox{ }.\\
\mbox{\quad} \ldots}
\vspace{-4mm}
\begin{verbatim}
   9 use POSIX('ceil','floor');
\end{verbatim}
\end{small}

The first line doesn't represent a comment line because it begins with
`\#!'.  This line may be missing in some Perl versions, for example,
if Perl programs are called by command line input or if no options are
used.  The option `\verb|-w|' causes Perl to print error messages.  It
can also be necessary to place the complete path name before
`\texttt{perl}', for example `\texttt{/usr/bin/perl}'.

Lines 2 to 8 are destined for version references.  Line 9 provides two
procedures from the Perl modul `POSIX'. They serve for rounding and
can be replaced (with caution) by own (sub-) routines using the
command `\texttt{int}'.

\begin{small}
\begin{verbatim}
  11 # Definable by the user:
  12 # Unitlength in pt:
  13 $ul = 1.0;
  14 # Fill factor (for filling with magnification up to 500 %)
  15 $fillf = 5;
  16 # Point factor:
  17 $pointf = 0.3;
  18 # Flag for dotting parabolic arcs (1: Dotting)
  19 $Qbezflag = 0;
  
\end{verbatim}
\vspace{-4mm}
\hspace{5.5pt}\texttt{16:\mbox{ }\# B\'ezier factor:}
\vspace{-4mm}
\begin{verbatim}
 17: $bezf = 2.0;
\end{verbatim}
\end{small}

Each of these five parameters may be changed before applying the
respective program. Afterwards all parameters should get their
original values unless the program is stored under a different name.

Varying the `unitlength' \verb|$ul| and using a saved PostScript
representation, each drawing can be reduced or magnified in the
\LaTeX{} \texttt{picture} environment.  The value \verb|$ul=1.0|
yields the figure in its original size from Cabri Geometry.

The `fill factor' \verb|$fillf| settles the distance of the horizontal
line segments filling polygons.  With \verb|$fillf=5| figures appear
completely filled with screen magnification up to 500 \% .

With \texttt{pict2e} alone, dotted curves can't be represented because
\texttt{pict2e} ignores the number of points of B\'ezier objects. 
Therefore in \texttt{CABpict.pl} the plot commands \verb|\Lbezier| and
\verb|\Qbezier| from the package \texttt{ebezier} are used
additionally.  With that the `point factor'\verb|$ pointf= 0.3| yields
the normal point distance (like in Figures 1 to 3).  To dot a
curve, setting the flag \verb|$Qbezflag=1| one can approximate
with arcs of parabolas for which possibly in the \LaTeX{}
\texttt{picture} environment the number of points at \verb|\Qbezier|
is to be adjusted.  In the normal case \verb|$Qbezflag=0|, the
parabolic arc is drawn with the plot command \verb|\qbezier| from
\texttt{pict2e}.

In \texttt{CABebez.pl} the `B\'ezier factor' \verb|$bezf= 2.0| yields a
point distance which with normal magnification and in print lets the
corresponding line appear closed.  Since the memory need of B\'ezier
curves with \texttt{ebezier} is often eight times as large as
with \texttt{pict2e}, \verb|$bezf| may be reduced in case of tight
memory.

\begin{small}
\begin{verbatim}
  21 # Constants:
  22 # Colour names:
  23 $yellow = "0.9843900.9511410.020249";
  24 $orange = "1.0000000.3927370.009949";
  25 $red = "0.8649270.0342110.025910";
  26 $purple = "0.9486080.0325630.519234";
  27 $violet = "0.2769050.0000000.645487";
  28 $navy = "0.0000000.0000000.828138";
  29 $blue = "0.0088040.6692610.917967";
  30 $green = "0.1215990.7170980.078874";
  31 $darkgreen = "0.0000000.3933010.069093";
  32 $darkbrown = "0.3359430.1742730.020081";
  33 $brown = "0.5657890.4428780.227359";
\end{verbatim}
\end{small}

Cabri Geometry writes the three RGB values into the PostScript file
with six decimal places and one digit before the decimal point. 
Through Lines 45 to 47, \texttt{CABpict.pl} looks for these lines
ending with \verb*| setrgbcolor | and removes the spaces as well as the
last word \verb|setrgbcolor|.  In this way the corresponding line
yields a single ``word'' which is placed before the respective
character strings later.  Through the assignment of easily remembered
colour names to this ``digit words'' it is easy to use other or
further colour names.  The names of 68 (DVIPS-) colours with CMYK
values can be found in the header file `\verb|color.pro|'. Without
colour values they also appear in the files `\verb|colordvi.sty|' and
`\verb|colordvi.tex|' (see \cite{Car}).

\begin{small}
\begin{verbatim}
  35 # Further Constants:
  36 # Pi:
  37 $Pi = "3.14159265358979";
  38 # Constants in dotted figures:
  39 $uli = sp(4 / $ul);
  40 $ule = sp(0.8 / $ul);

\end{verbatim}
\vspace{-5mm}
\hspace{5.5pt}\texttt{38:\mbox{ }\# Constant in cubic B\'ezier curves for quarters of a circle:}
\vspace{-3mm}
\begin{verbatim}
 39: $l90 = "0.552284749830794";
\end{verbatim}
\end{small}

To be able to dot areas which are contained in arbitrary closed
polygons, the points get absolute coordinates $(x,y)$ with regard to
the respective \verb|picture| environment, where $x$ and $y$ are even
integers and $x+y$ is divisible by 4.  Then \verb|$uli| and
\verb|$ule| deliver the horizontal distance and the length of the 0.8
pt thick line segments which form a point.

Like the ``circular number'' \verb|$Pi|, \verb|$l90| also represents a
number constant which is required for the approximation of circular arcs
through cubic B\'ezier curves.  It is deduced in \cite{Ba} (Page 6).

\begin{small}
\begin{verbatim}
  42 @lines = &lt;&gt;;
  43 do {
  44   $_ = $lines[$i++];
  45   if (/ setrgbcolor \s/o) {
  46     s/ //go;
  47     s/setrgbcolor\s/ /o;
  48     $c = $_;
  49     $_ = $lines[$i++];
  50     s/ moveto//o;
  51     s/lineto stroke/stroke/o;
  52     s/curveto stroke/curveto/o;
  53     s/ setlinewidth stroke//o;
  54     s/ lineto//go;
  55     if (/stroke/o) {
  56       $line[++$#line] = $c.$_;
  57     }
  58     elsif (/closepath fill/o) {
  59       $vector[++$#vector] = $c.$_;
  60     }
  61     elsif (/arc /o) {
  62       $circle[++$#circle] = $c.$_;
  63     }
  64     elsif (/arcn/o) {
  65       $arc[++$#arc] = $c.$_;
  66     }
  67     elsif (/curveto/o) {
  68       do {
  69         $conic[++$#conic] = $c.$_;
  70         $_ = $lines[$i++];
  71         s/ moveto//o;
  72         s/curveto stroke/curveto/o;
  73       }
  74       until $_ !~ /curveto/o;
  75     }
  76   }
  77 }
  78 until $i == $#lines;
\end{verbatim}
\end{small}

With Lines 42 to 78, the required data are extracted from the
PostScript file.  Initially the array \verb|@lines| contains all
lines.  The successive assignment of each individual line to the
general ``last result variable'' \verb|$_| takes place with Line 44. 
Next, the ``colour lines'' are looked for and condensed as described
above.  With Line 48, the result is assigned to the variable \verb|$c|.

In the present version, only the next line has to be analysed
subsequently.  The commands for searching and replacing in Lines 50 to
54 care for unambiguity and for pure number sequences (apart from the
last word).  With PostScript versions which contain the data in a
later line, it is helpful to attach the intermediate lines and the
data line by removing the line breaks.

Depending on the different line endings, the data are collected in
five arrays.  For example, Line 56 means that the array \verb|@line|,
whose last element has the index \verb|$#line|, is extended by one
field which holds the preceding colour variable \verb|$c| and the
character string of the coordinates of the starting point and the end
point of a line segment.

For any arrow, Cabri Geometry writes the coordinates of the four
arrowhead corners of a PSTricks style arrow into the
PostScript file.  With \texttt{CABpict.pl} these data are not needed
if the colour of the arrow is violet because the plot command
\verb|\vector| is then available.  Otherwise the arrowhead consists of two
filled triangles, and the arrow line is drawn as an unbroken or dotted
line segment according to the colouring.

The data of circles can be found in the lines ending with \verb*|arc |.
Additionally a full circle is characterized by 0 and 360 as fourth
and fifth value respectively.  Therefore, circular arcs entered
clockwise in Cabri Geometry can also be rec\-og\-nized in lines ending with
\verb*|arc | because they contain the starting angle and the ending
angle instead of 0 and 360.  Lines with the data of circular arcs
entered anticlockwise end with \verb|arcn|.

The Macintosh version of Cabri Geometry offers the possibility of
drawing con\-ic sections determined by five points.  In the linked
PostScript file, the data of approximating cubic B\'ezier curves are
stored, namely nine for ellipses and four for each open branch.  The
values from the corresponding lines ending with \verb|curveto stroke|
are stored in the array \verb|@conic|.  These data can be
processed directly with the plot command \verb|\cbezier|.

\begin{small}
\begin{verbatim}
  80 $pflag = 1;
  81 $sflag = 1;
  82 $thicknessflag = 1;
  83 $coun = 0;
  84 $xtex = "";
  85 $mtex = "";
  
 86: $bmax = 500;
 89: $btex = "\\documentclass{article}\n\\usepackage{ebezier}\n\n";
\end{verbatim}
\end{small}

These initialisations begin with flags for the starting corner of
polygons, for the starting values of the bounding box and for the
currently selected thickness of line segments.  The parameter \verb|$coun|
yields the numbers for the places of text and formulas.  With
\verb|$xtex|, the character string is set up which finally is written
as \LaTeX{} text into the Perl output window through a \texttt{print}
command. Since, in any case, the text markers have to be edited finally,
temporary storing in \verb|$mtex| enables the positioning at the end 
of the \LaTeX{} text where they can easily be found.

If B\'ezier curves with more than 500 points are generated with the
package \verb|ebezier|, it is necessary to enlarge the \LaTeX{} value
500 of \verb|\qbeziermax|.  Therefore, with the aid of the variable
\verb|$bmax| the maximum number of points of B\'ezier curves is
determined.  If \verb|$bmax| exceeds 500, the value of
\verb|\qbeziermax| is adjusted with \verb|\renewcommand| in the
character string \verb|$btex| which contains the beginning of the
corresponding \LaTeX{} program.  The insertion of \verb|$btex| and
\verb|$mtex| in \verb|$xtex| is described on page \pageref{Frame}.

\begin{small}
\begin{verbatim}
  87 # Lines and polygons
  88 $cflag = 1;
  89 foreach (@line) {
  90   @coo = split;
  91   $co0 = $coo[0];
  92   $co2 = (-1) * $coo[2];
  93   $co4 = (-1) * $coo[4];
  94   if (($co0 ne $violet) and ($co0 ne $yellow)) {
  95     if ($cflag) {
\end{verbatim}
\vspace{-4mm}
\texttt{\mbox{\quad}96}\hspace{14mm}\verb|$xtex .= "%Lines, arrows, polygons and |
\texttt{B\'ezier}\verb| curves\n";|
\vspace{-4mm}
\begin{verbatim}
  97       $cflag = 0;
  98     }
  99     if ($co0 ne $blue) {
 100       bound($coo[1],$co2);
 101       bound($coo[3],$co4);
 102     }
 103     if (($co0 ne $red) and ($co0 ne $blue) and ($co0 ne $brown)
 104       and ($co0 ne $darkbrown) and ($co0 ne $navy)) {
 105       lin($co0,$coo[1],$co2,$coo[3],$co4);
\end{verbatim}
\end{small}

Here begins the processing of the data of the arrays.  Since these
longer parts have a similar structure for most combinations of graphic
programs, PostScript versions and \LaTeX{} packages, only essential or
typical sections are explained as follows.

The flag \verb|$cflag| ensures that in the \LaTeX{} program, the
commentaries point\-ing out each of the emerging objects don't repeat
permanently.  With the \texttt{split} command the character strings
delivered by \texttt{foreach} are transformed into lists of character
strings which in our case are the numbers and the last words of the
evaluated PostScript lines.  In the shortened form of \texttt{split}
used here, the spaces cause the separation of the character string of
the last result value \verb|$_|.

Since most branchings depend on at least one colour, first the list
element with index 0 which contains the colour, is abbreviated. 
Subsequently the ``vertical reflection'' which is necessary in this
version takes place multiplying each y-coordinate by -1.

Line 96 yields a typical \LaTeX{} comment line because the character
string which is added to \verb|$xtex| by \verb|.=| begins with the
\verb|%| sign and ends with the line feed command \verb|\n| of Perl .

With each of the Lines 100 and 101, the subroutine `\texttt{bound}' for
the determination of the bounding box coordinates is called.  It is
defined in the Lines 944 to 957.  In this case the coordinates of the
starting point and the end point of line segments are evaluated. 
Objects with colour `\texttt{blue}' are excluded because the diagonal
marking text or formulas is a two point polygon, and because
for B\'ezier curves 51 points are considered.

There are nine subroutines which can be found
from Line 390 on (356 with \texttt{CABebez.pl}).  The order of the
subroutines plays no role.  Therefore most of these
procedures are described at their first appearance.

The subroutine `\texttt{lin}' generates all line segments which have
to be drawn.  In \texttt{CABpict.pl}, the extended \verb|\line|
command from \verb|pict2e| is available for unbroken line segments,
whereas dotted line segments have to be drawn with the command
\verb|\Lbezier| from the \texttt{ebezier} package.  In
\texttt{CABebez.pl} also all line segments which don't fulfill the
\LaTeX{} conditions for slopes or lengths must be built up with the
aid of \verb|\Lbezier|.

\begin{small}
\begin{verbatim}
 107     if (($co0 ne $green) and ($co0 ne $darkgreen)) {
 108       if ($pflag) {
 109         $cb1 = $coo[1];
 110         $cb2 = $co2;
 111         $pol = $co0." ".$cb1." ".$cb2;
 112         $pflag = 0;
 113       }
 114       else {
 115         $pol .= " ".$coo[1]." ".$co2;
 116         if (abs($coo[3] - $cb1) + abs($co4 - $cb2) &lt; 2.0E-6) {
 117           $poly[++$#poly] = $pol;
 118           $pflag = 1;
\end{verbatim}
\end{small}

Here, for each polygon which has to be filled, dotted or hatched, the
array \verb|@poly| emerges which contains the coordinates of
the corners.

\begin{small}
\begin{verbatim}
 123   if ($co0 eq $violet) {
 124       $xtex .= "%Arrow\n";
 ...
 127       $dx = $coo[3] - $coo[1];
 128       $dy = $co4 - $co2;
 129       $len = sp(abs($dx));
 130       if ($len &gt; 1.0E-3) {
 131         @p = best(abs($dy / $dx));
 132         $psx = sp($p[1]) * ($dx &lt;=&gt; 0);
 133         $psy = sp($p[0]) * ($dy &lt;=&gt; 0);
 ...
 140       $xb = sp($coo[1]);
 141       $yb = sp($co2);
 142       if (not $thicknessflag) {
 143         $xtex .= "\\linethickness{0.8pt}\n";
 144         $thicknessflag = 1;
 145       }
 146       $xtex .= "\\put(".$xb.",".$yb."){\\vector(".$psx.",".$psy.
    "){".$len."}}\n";  
\end{verbatim}
\end{small}

For the generation of unbroken line segments respectively of
complete arrows with the package \texttt{pict2e}, the subroutine
\texttt{best} is provided which yields the best possible numerators and
denominators for the rational approximations of the slope with the aid of
a continued fraction algorithm.  Since, particularly, both components are
relatively prime, it is practically no restraint that
they must lie in the interval $[-1000,\,1000]$.

With the two-line subroutine \texttt{sp}, the numbers which Cabri
Geometry hands over to the PostScript file with six decimal places, as
well as all other decimal numbers appearing in the \LaTeX{}
\texttt{picture} environment, are rounded off to three places
with removal of all concluding zeros.

\begin{small}
\begin{verbatim}
 150 foreach (@poly) {
 151   @po = split;
 152   $p0 = $po[0];
 153   $pon = $#po;
 154   if (($p0 eq $red) or ($p0 eq $purple) or ($p0 eq $darkbrown)
 155     or ($p0 eq $orange) or ($p0 eq $brown)) {
\end{verbatim}
\end{small}

The evaluation of the data of the array \verb|@poly| depends on
the colour and on the index \verb|$pon=$#po| of the last element.

\begin{small}
\begin{verbatim}
 156     if ($pon == 6) {
 157       tri($p0,$po[1],$po[2],$po[3],$po[4],$po[5],$po[6]);  
\end{verbatim}
\end{small}

If \verb|$pon = 6|, then the subroutine \texttt{tri} is
called which settles the filling, dotting and hatching of triangles .

\begin{small}
\begin{verbatim}
 159     elsif ($pon == 8) {
 160       ($p0,$u1,$v1,$u2,$v2,$u3,$v3,$u4,$v4) = @po;
 161       $s1 =  abs($u1 - $u4) + abs($u2 - $u3) + abs($v1 - $v2) +
    abs($v3 -$v4);
 162       $s2 =  abs($u1 - $u2) + abs($u3 - $u4) + abs($v1 - $v4) +
    abs($v2 -$v3);
 163       if (($s1 &lt; 4.0E-6) or ($s2 &lt; 4.0E-6)) {
  ...
 166         rect($p0,$u1,$v1,$u2,$v2,$u3,$v3,$u4,$v4);
 167       }
 168       else {
  ...
 173         tri($p0,$u1,$v1,$u2,$v2,$u3,$v3);
 174         tri($p0,$u1,$v1,$u3,$v3,$u4,$v4);
 175       }
 176     }
 177     elsif ($pon &gt; 8) {
 ...
 179       for (my $j = 3; $j &lt;= $pon - 3; $j += 2) {
 ...
 181         tri($p0,$po[1],$po[2],$po[$j],$po[$j + 1],$po[$j +
    2],$po[$j + 3]);
\end{verbatim}
\end{small}

In case of \verb|$pon = 8|, rectangles with sides parallel to the axes
are treated with the aid of the subroutine \texttt{rect}.  This is
simpler than the procedure for all other polygons which first have
to be cut up in triangles.

\begin{small}
\begin{verbatim}
 191   elsif ($p0 eq $blue) {
 192     if ($pon == 4) {
\end{verbatim}
\vspace{-3.5mm}
\hspace{5.5pt}\texttt{193\mbox{ }\# Text marker and B\'ezier curves:}
\vspace{-3.5mm}
\begin{verbatim}
 194     $coun++;
 ...
 201     $mtex .= "\\put(".$po1.",".$po2."){".$coun."}\n";
 202       }  
 203     elsif ($pon == 6) {
\end{verbatim}
\vspace{-3.5mm}
\hspace{6pt}\texttt{204}\hspace{14mm}\verb|$xtex .= "%Quadratic |
\texttt{B\'ezier}\verb| curve\n";|
\vspace{-3.5mm}
\begin{verbatim}
 205       qbez($po[1],$po[2],$po[3],$po[4],$po[5],$po[6]);
 206     }
 207     elsif ($pon == 8) {
\end{verbatim}
\vspace{-3.5mm}
\hspace{6pt}\texttt{208}\hspace{14mm}\verb|$xtex .= "%Cubic |
\texttt{B\'ezier}\verb| curve\n";|
\vspace{-3.5mm}
\begin{verbatim}
 209       cbez($po[1],$po[2],$po[3],$po[4],$po[5],$po[6],$po[7],
    $po[8]);
\end{verbatim}
\end{small}

With colour \verb|$blue|, \verb|$pon = 4| yields the text markers,
whereas \verb|$pon = 6| and \verb|$pon = 8| lead to the call of the
subroutines \texttt{qbez} for quadratic B\'ezier curves and
\texttt{cbez} for cubic B\'ezier curves respectively.

\begin{small}
\begin{verbatim}
 214 # Arrows
 215 foreach (@vector) {
 216   @ve = split;
 217   if ($ve[0] eq $darkgreen) { 
 ...
 235     tri($red,$vu0,$vu1,$vu2,$vu3,$ve[5],$ve[6]);
 236     tri($red,$vu0,$vu1,$vu6,$vu7,$ve[5],$ve[6]);
\end{verbatim}
\end{small}

Here, as already mentioned above, for arrows with a
dotted arrow line (and always for arrows in \texttt{CABebez.pl})
the arrowhead is put together joining two filled triangles.

\begin{small}
\begin{verbatim}
 258 # Circles, halves and quarters of circles
 259 $cflag = 1;
 260 $aflag = 1;
 261 foreach (@circle) {
 262   @po = split;
 263   $p0 = $po[0];
 264   if ($p0 ne $yellow) {
 265     $po[2] = (-1) * $po[2];
 266     $di = 2 * $po[3];
 267     if ($po[4] &gt; 1.0E-3 or abs($po[5] - 360) &gt; 1.0E-3) {
 268       if ($aflag) {
 269         $xtex .= "%Arcs\n";
 270         $aflag = 0;
 271       }
 272       $arce = ($po[4] &gt; 0) ? 360 - $po[4] : 0;
 273       $arcb = ($po[5] &gt; 0) ? 360 - $po[5] : 0;
 274       $darc = $arce - $arcb;
 275       if ($darc &lt; 0) {$darc += 360}
 276       $quar = int($darc / 90);
 277       if ($quar &gt; 0) {
 278         for (my $k = 1; $k &lt;= $quar; $k++) {
 279           arc($p0,$po[1],$po[2],$po[3],$arcb,$arcb + 90);
 280           $arcb += 90;
 281           if ($arcb &gt; 360) {$arcb -= 360}
 282         }
 283       }
 284       if ($darc &gt; $quar * 90) {
 285         arc($p0,$po[1],$po[2],$po[3],$arcb,$arce);
 286       }
 287     }
 288     else {
 289       if ($cflag) {
 290       $xtex .= "%Circles, halves and quarters of circles\n";
 291       $cflag = 0;
 292       }
 293       if ($p0 eq $navy) {
 294         $xtex .= "\\put(".$po[1].",".$po[2]."){\\circle{".$di.
    "}}\n";
 ...
 299       }
 300       elsif ($p0 eq $purple) {
 301         $xtex .= "\\put(".$po[1].",".$po[2]."){\\oval[".$di."]
    (".$di.",".$di.")[l]}\n";
 ...
 340       elsif ($p0 eq $darkgreen) {
 341         $r = $po[3];
 342         $le = int(2 * $pointf * $ul * $Pi * $r);
 343         $xtex .= "\\cCircle[".$le."](".$po[1].",".$po[2].")
    {".$r."}[f]\n";
\end{verbatim}
\end{small}

Circular arcs are cut up to quadrants of a circle and to a shorter
remaining arc.  In \texttt{CABebez.pl} the subroutine \texttt{quart}
approximates all quadrants of a circle (and with that, also circles and
semicircles) by a cubic B\'ezier curve.  With \texttt{pict2e}, the plot
commands \verb|\oval| and \verb|\circle| are available without
restraints.  For all remaining circular arcs the subroutine
\texttt{arc} supplies the approximation by a cubic B\'ezier curve.  The
plot command \verb|\cCircle| of the package \texttt{ebezier} is used
to get dotted circles in \texttt{CABpict.pl}.

\label{Frame}
\begin{small}
\begin{verbatim}
 379 # Frame
 380 if ($xtex . $mtex  ne "") {
 381 $xtex = "\\documentclass{article}\n\\usepackage{ebezier}\n".
 382 "\\usepackage[pdftex,pstarrows]{pict2e}\n\n
    \\begin{document}\n\n".
 383 "\\setlength{\\unitlength}{".$ul."pt}\n".
 384 "\\begin{picture}(".ceil(($xmax - $xmin)).",".
 385 ceil(($ymax - $ymin)).")(".floor($xmin).",".floor($ymin).")\n".
 386 "\\linethickness{0.8pt}\n"."\\thicklines\n".$xtex;
 387 $xtex .= $mtex."\\end{picture}\n\n\\end{document}";
 388 }
 389 print $xtex."\n";
 
342: if ($bmax &gt; 500) {
343:   $bmax = 100 * ceil($bmax / 100);
344:   $btex .= "\\renewcommand{\\qbeziermax}{".$bmax."}\n";
345: }
346: if ($xtex . $mtex  ne "") {
347: $xtex = $btex."\\begin{document}\n\n\\setlength{\\unitlength}{".
348: $ul."pt}\n"."\\begin{picture}(".ceil(($xmax - $xmin)).",".
349: ceil(($ymax - $ymin)).")(".floor($xmin).",".floor($ymin).")\n".
\end{verbatim}
\end{small}

Here the different parts of the character string \verb|$xtex|
are united and written into the Perl output window by the \verb|print|
command.

Since the subsequently assembled subroutines can be used in other
versions large\-ly unchanged, now follow only comments which explain the
underlying theory.  In the main part of \texttt{best}, the entered
decimal number is transformed into a continued fraction.  Then, among
all principal and intermediate convergents which are ``best
approximations'', the one with the greatest possible numerator or
denominator is determined.

\begin{small}
\begin{verbatim}
 536 # Triangles
 537 sub tri {
 538 my ($q0,$qx1,$qy1,$qx2,$qy2,$qx3,$qy3) = @_;
 ...
 545   if ($q0 eq $red) {
 546 # Filled triangle
 547     %ha = ($qx1,$qy1,$qx2+1e-07,$qy2+1e-07,$qx3+2e-07,
   $qy3+2e-07);
 548     @hb = ();
 549     @hc = ();
 550     foreach (sort { $ha{$a} &lt;=&gt; $ha{$b} } keys %ha) {
 551       $hb[++$#hb] = $_;
 552       $hc[++$#hc] = $ha{$_};
 553     }
 554     ($qx1,$qx2,$qx3) = @hb;
 555     ($qy1,$qy2,$qy3) = @hc;
\end{verbatim}
\end{small}

Each of the three parts of \texttt{tri} begins with sorting out
corners: For filling and dott\-ing, they are ordered according to the
size of the $y$-coordinates and for hatching, the order depends on the
difference of both coordinates.  For the sorting method used by Perl
for the data type ``hash'', it should be taken into account that in
our case, each of the two associated arrays must consist of different
elements.  Here, this is achieved by changing the seventh place behind
the decimal point.

If, after sorting, one imagines a straight line passing through the
first and third corner, linear algebra yields the half-plane bordered
by the straight line and containing the second corner.  Then, starting with
the connecting line segment of the first and third corner and
with distinction of cases concerning the second point,
the objects which have to be inserted are constructed.

The intermediate points of quadratic and cubic B\'ezier curves needed
for their bounding box are calculated with the formulas of Section 4. 
The coefficients of cubic B\'ezier curves which approximate parts of
quadrants of circles in the subroutine \texttt{arc} are
derived in \cite{Ba} (Pages 11\,f).

\section{The \texttt{picture} environment of \LaTeX}

Using the capacity of geometry software or of drawing programs,
also further advantages of the \LaTeX{} \texttt{picture} environment
compared with the \verb|\special| command come into effect:
\\[-6mm]

\begin{list}{$\bullet$}{
	\setlength{\labelwidth}{3mm}
	\setlength{\leftmargin}{7mm}
	}
	\item  All graphic data are integrated in the \TeX{} file.  Particularly,
	no graphic files can get lost during dissemination.\vspace{1mm}
	
	\item \LaTeX{} proves its flexibility mainly with the positioning
	using \texttt{minipages} or \texttt{floats} (sliding objects). 
	Since the filter programs yield the size of the bound\-ing box as
	well as the offset value (for the upper left corner), each figure
	can directly be placed in a \texttt{minipage}. Using that it
	can be moved horizontally and vertically, for example, applying
	the commands \verb|\hspace| and \verb|\raisebox| (see Figures
	1 to 5).\vspace{1mm}
	
	\item  The final processing of figures can be done in the usual 
	cycle edit-typeset-preview.\vspace{1mm}
	
	\item  Even in documents with numerous complicated figures,
	memory requirements can well be estimated and, particularly, applying
	\texttt{pict2e}, they are surpris\-ing\-ly low.  But also with the
	\texttt{ebezier} package, in \textsc{Big}\TeX{} versions no lack of
	memory has to be expected.\vspace{1mm}
	
	\item  If PDF files are generated from \LaTeX{} productions, the
	figures are taken over automatically.

	\end{list}

The completion of the \LaTeX{} \texttt{picture} environment with
commands from the \texttt{color} package mentioned in Section 3 is
possible only with restraints. Due to a technical difficulty,
\TeX{} possibly inserts vertical space at each change of colour (see
\cite{Car}, Page 6).  Therefore, without complicated corrections, only
figures can be coloured for which all connected parts have the same
colour.
	
The development of filter programs for \LaTeX{} was initiated by the
author's wish to take over about 80 figures created with the drawing
program STAD on Atari computers into a book designed with \LaTeX{} on
Macintosh computers.  The figures were traced with the drawing program
ClarisDraw, and the PostScript versions were transformed to \LaTeX{}
\texttt{picture} environments with an AppleScript program.  This first
functioning PostScript filter program can be found in \cite{Mo} in the
section `Programme'.

\begin{thebibliography}{9}
	\setlength{\baselineskip}{18pt}
	\bibitem{Ad}  Adobe, Systems Incorporated: PostScript Language 
	Reference Manual. Addison-Wesley, 2nd edition, 1995.
	
	\bibitem{Ba}  Bachmaier, Gerhard A.: Using \texttt{ebezier}. 
	Package in CTAN:\texttt{/macros/latex/contrib/ebe-} \texttt{zier}, 2002.
	
	\bibitem{Car}  Carlisle, David P.: Packages in the `graphics' bundle.
	CTAN:\texttt{/macros/latex/required} \texttt{/graphics/grfguide.pdf}, 
	1999/2004.
	
	\bibitem{GaNi}  G\"a{\ss}lein, Hubert and Niepraschk, Rolf: The
	\texttt{pict2e}-package. Package in
	CTAN:\texttt{/macros} \texttt{/latex/contrib/pict2e/pict2e.dtx}, 2003.
	
	\bibitem{GRM} Goossens, Michel, Rahtz, Sebastian and Mittelbach, 
	Frank: The \LaTeX{} Graphics Compan\-ion. Addison-Wesley, Reading MA, 
	1997. 
	
	\bibitem{Mo}  M\"oller, Herbert: \emph{Mathcompass} 
	(\texttt{http://wwwmath1.uni-muenster.de/u/mollerh}).

	\bibitem{Ni}  Nickalls, Richard W.D.: MathsPIC. 
	CTAN:\texttt{/graphics/pictex/mathspic}, 1999.
	
	\bibitem{NiSy} Nickalls, Richard W.D. and Apostolos Syropoulos:
	$mathsPIC_{Perl}.$ CTAN:\texttt{/graphics} \texttt{/pictex/mathspic/Perl},
	2005.
	
	\bibitem{Wi}  Wichura, Michael J.: The $\mathrm{P_{\D I}CT_{\D E}X}$ 
	Manual, 1992. Package in CTAN:\texttt{/graphics/pictex}.

\end{thebibliography}
\end{document}
</pre></body></html>