%% mpicp-comm-mathspic.tex
%% mathsPIC manual

\documentclass[mathsPICmanual.tex]{subfiles}
\begin{document}
%%=============================


%%-----------------
\chapter{\mathsPIC\ commands}

All {\mathsPIC} commands (except  macros) are case-\textit{in}sensitive.
This is a design feature which allows the user to customise the commands and make them easier to read.
\mathsPIC\ macros, however, \textit{are} case-sensitive, but since macro-names are created by the user they are customised from the outset by definition.

The arguments of {\mathsPIC} commands are either strings
(any legitimate {\TeX} or {\LaTeX} commands or characters which
can be put into an \verb!\hbox!),
point-names (e.g.~A, B2, C345), or numerical expressions.
Where appropriate, {\mathsPIC} allows scalar quantities in
commands to be represented by either a
numeric value (e.g.~$0.432$), a variable name (e.g.~r2), two point names representing the Pythagorean distance \hbox{between} two points (e.g.~$AB$), or even a mathematical expression\footnote{See the definition of  `numerical expression' in Section~\ref{sec:commands}.}.
 For example, the structure of the command
 \texttt{DrawCircle(\ab{centre},\ab{radius})} is
 quite flexible, as follows.

\begin{verbatim}
point(C){5,5}
drawCircle(C,4.32)
drawCircle(C,r2)
drawcircle(C,AB)
drawCircle(C, r3*tan(0.6)/4)
\end{verbatim}


%========================================
\section{Mathematics}
\label{sec:maths}

A leading zero must always be used  for decimals
 whose absolute value is $<1$. The argument of trigonometric functions is in radians. Inverse trigonometric functions return a value in radians.
 \begin{itemize}

 \item \textbf{Constants:}
 {\newline} for $\pi$ ($3.14159$\ldots) use \verb!_Pi_! or \verb!_pi_!;
 {\newline} for `e' ($2.718281$\ldots) use  \verb!_E_!  or \verb!_e_!;
 {\newline} for `180/Pi'  use  \verb!_R2D_!;  
 {\newline} for `Pi/180'  use  \verb!_D2R_!;  

\item \textbf{Trigonometric functions:} (arguments must be in radians)
    {\newline}\texttt{sin(), cos(), tan(), asin(), acos(), atan()}

\item  \textbf{Remainder:} \  \texttt{rem()};
\ e.g.~\texttt{var r = 12 rem(5)} $\rightarrow 2$

\item \textbf{Square root:} \ \texttt{sqrt()};
 \ e.g.~\texttt{var s = sqrt(14)}

\item \textbf{Exponentiation:} \ \texttt{**};
 \ e.g.~\texttt{var j = r**2}

 \item \textbf{Integer:} \ \texttt{int()};
 \ e.g.~\texttt{var s = int(3.867)} $\rightarrow 3$

 \item \textbf{Sign:} \ \texttt{sgn()} \ (returns -1, 0, or +1);
 \ e.g.~\texttt{var s = sgn(-2.987)} $\rightarrow -1$

  \item \textbf{Line thickness:} \ \verb!_linethickness_! \ (returns current value of the linethickness in current units);
 \ e.g.~\texttt{var t =} \verb!_linethickness_!

 \item \textbf{Area of triangle:} \ \texttt{area(ABC)}
 \  \ e.g.~\texttt{var t = area(ABC)}


\end{itemize}


%-----------------------
\subsection{Macros}
\label{sec:macros2}
\newcommand{\sit}[1]{\textit{#1}}


mathsPIC allows the definition of one-line macros with or without arguments, which evaluate to a `numerical expression' (see Section~\ref{sec:numexpr}) (i.e.~not strings).
 Macro definition has the following syntax:

\medskip
\syntax{\%def} \ab{macro-name} \syntax{(} [ \ab{parameters} ] \syntax{)} \ab{macro-code}
\medskip

{\noindent}where \ab{parameters} is a list of comma separated strings (e.g.~x,y,z). Always place a \verb!%! symbol at the end of the \ab{macro-code} to limit additonal white space. The \ab{macro-code} can be optionally delimited using round brackets
if  necessary to help make it more readable. Examples of valid macros are as follows:
\begin{verbatim}
%def two()2%    % a macro called two
%def two()(2)%
\end{verbatim}
Once a macro is defined it can be used or it can be undefined. A macro is removed (undefined) using the \verb!%undef!
command as follows.

\medskip
\syntax{\%undef} \ab{macro-name}
\medskip

Macros (see Section~\ref{sec:macros}) are very useful in mathematics.
Remember (a)~that if a macro does not use parameters then the \verb!()! are not 
used when  part of the command when it is used as a variable, (b)~that the macro-name must have the \verb!&!~prefix when it is used in a \mathsPIC\ command, and (c)~it is very important to place a \texttt{\%} symbol at the end of the macro command in order to stop \PiCTeX\ from collecting any following  white space and distorting the diagram.

Macros without a parameter can be
 very useful since they can be used to allocate a
 meaningful variable-name (or constant-name).
For example,  we can allocate the variable name \verb!SpeedOfLight!
to the value $2.9979\times 10^{8}$~metres per
second\footnote{Lloyd S (2000). Ultimate physical limits to computation. \textit{Nature}; \underline{406}, 1047--1054 (August 31, 2000).} and then manipulate it as follows.
\begin{verbatim}
%def SpeedOfLight()2.9979e8% metres/sec
var m=1000,  E = m*(&SpeedOfLight**2)
\end{verbatim}
Note the use of the \verb!&! symbol in the \verb!var! command above.
After running the above commands through \mathsPIC\ the output file would show the allocation of the variable \verb!E! as follows.
\begin{verbatim}
%def SpeedOfLight()2.9979e8% metres/sec
%% var m=1000, E = m*(2.9979e8**2)
%% m = 1000
%% E = 8.98740441e+19
\end{verbatim}
By way of another example, it is often useful to have meaningful names  for the factors used for converting degrees to radians and \textit{vice versa} (e.g.~$d2r$, $r2d$), as provided by the following two macros (without parameters).
\begin{verbatim}
%def d2r()_pi_/180%    % degrees to radians
%def r2d()180/_pi_%    % radians to degrees
\end{verbatim}
 For example, a variable of 30 degrees (say, \verb!d30!) could be converted to
 radians (say, \verb!r30!) in a \verb!var! command  using the new \verb!d2r! command as follows (remembering to include the \verb!&! prefix for the macro),
\begin{verbatim}
var d30=30, r30=d30*&d2r
\end{verbatim}
which is processed via \mathsPIC\ to
\begin{verbatim}
%% var d30=30, r30=d30*_pi_/180
%% d30 = 30
%% r30 = 0.523598775598299
\end{verbatim}

Macros which take a parameter can be useful in a slightly  different way.
For example, since Perl does not have separate commands for $log_{10}()$ and $log_{e}()$---it only has one \verb!log! command, namely \verb!log()! for $log_{e}()$---you may wish to define  separate commands to make it easy to distinguish between the two. This is easily done with macros taking a single parameter as follows.
\begin{verbatim}
%def loge(a)  log(a)%
%def log10(a) log(a)/log(10)%
\end{verbatim}
Now if you  type the command \verb!&loge(5)! in the \mathsPIC\ file you  will generate the value $log_e(5)$.
Similarly, the command \verb!&log10(3)! $\rightarrow log_{10}(3)$.

%---------------------------------
\subsection{Making a macro library}

If you regularly  use  particular macros then these can be easily stored in an ASCII file as a library (say, \verb!mathspic.lib!, as described in Section~\ref{sec:macrolibrary}) as follows.

\begin{verbatim}
%%--- mathspic.lib---
%def log10(a)log(a)/log(10)%
%def loge(a)log(a)%
%def mod(a)rem(a)%
%def d2r() _pi_/180%
%def r2d() 180/_pi_%
%%---end of library---
\end{verbatim}
This library file can then be input at the beginning of the {\mathsPIC} script, as follows.
\begin{verbatim}
inputfile{mathspic.lib}
\end{verbatim}

%%-----------------------


%-------------------------------
\section{Command definitions}
\label{sec:commands}


\subsection*{Names of points, constants and variables}
\label{sec:name}
The names of points, constants and variables all conform to the same name convention, as follows:
 The name  \textit{must} begin
with a \textit{single} letter (either upper or lower case),
and may have up to a \textit{maximum} of four\footnote{From \mathsPIC\ version~1.11 onwards.} following digits.

While constants and variables should not have the same name, it is quite possible for points and variables (and constants) to have the same name. Consequently, it is a useful rule to arrange for  points to  have uppercase letters and for  variables and constants  have lowercase letters, as follows:

\begin{Verbatim}
point(P25){0,0}
var a=2, b1360=4
const e=2.17
\end{Verbatim}



%----------------------------------
\subsection*{Numerical expressions}
\label{sec:numexpr}

When dealing with commands we will refer frequently  to the term `numerical expression' by which is meant either (a)~a number (integer or decimal), (b)~a numeric variable or constant (defined using the \verb!var! or \verb!const! command), (c)~any \mathsPIC\ function, macro, or mathematical expression  which evaluates to a number, or (d)~a pair of point names (e.g.~\verb!AB!) representing the Pythagorean distance between the two points.
A leading zero must be used  with decimal fractions having an absolute value less than one.
The syntax of the numerical expression, which we will refer to as \ab{expr} is therefore as follows:

\ab{expr} \syntax{::=} \ab{two-points} \syntax{|} \ab{number} \syntax{|} \ab{variable} \syntax{|} \ab{maths}


%---------------------
\subsection*{Units}
\label{sec:unit}

When dealing with commands we will refer frequently  to the term `unit' by which  is meant one of the valid \TeX\ units (see Knuth (1986) p.~57).

\medskip
\ab{unit} \syntax{::=} \ab{mm} \syntax{|} \ab{cm} \syntax{|} \ab{pt} \syntax{|} \ab{pc} \syntax{|} \ab{in} \syntax{|} \ab{dd} \syntax{|} \ab{cc}
\syntax{|} \ab{sp}

\medskip
{\noindent}A unit requires a scalar; for example, in the \texttt{units()} option in the \verb!paper{}! command we would write something like \verb!paper{units(1cm, 3cm), ..}! to define the scale for the $(x,\, y)$ axes etc.


%------------------------------
\subsection*{Line thickness}

Commands and parameters which control line-thickness
are described in Section~\ref{sec:linethickness}.


%-----------------------------
\subsection{Backslash}

\begin{itemize}
\item\framebox{\texttt{$\backslash$...}\ } \hspace{5mm}
       \framebox{\texttt{$\backslash${\textvisiblespace$\:$%
       \textvisiblespace}$\:$\ldots}\ }

\item{\textbf{Notes}}

A line having a \textit{leading} backslash is processed (copied
verbatim) slightly differently depending on whether the character
following the backslash is a space or not.

A leading backslash \textit{followed by a non-space character}
tells {\mathsPIC} to copy the
whole line verbatim (\textit{including} the backslash) through to the
output-file (thus a line leading with the  {\LaTeX} command
\verb!\begin{document}! will be copied unchanged).

However, a leading backslash \textit{followed by one
or more spaces}, (e.g.~\texttt{$\backslash${\textvisiblespace$\:$%
       \textvisiblespace}$\:$\ldots})
 tells {\mathsPIC} to copy the rest of the line
verbatim through to the output-file, but \textit{without} the
leading backslash.

\end{itemize}

%-------------------------
\subsection{ArrowShape}
This command defines the shape of an arrowhead, and allows
arrowheads to be customised (see Section~\ref{sec:arrows} for details).

%%\item \framebox{\tt Arrowshape(\textit{value[units], B, C})}
\begin{itemize}
\item\textbf{Syntax}

\syntax{ArrowShape(} \ab{expr} [\ab{units}] , \ab{expr} , \ab{expr} \syntax{)}

\syntax{ArrowShape(default)}

\item\textbf{Notes}

The first parameter is the length of the arrow head itself. If \ab{units} are not given then the current default units will be applied.
The last two parameters are angles (default is degrees) which define the shape of the arrow head (see Section~\ref{sec:arrows} for details).

The default arrow shape is equivalent to the
command  \verb!Arrowshape(2mm,30,40)!.
This default arrowhead shape can be reset  using
\verb!Arrowshape(default)! command.

\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
Arrowshape(4mm,30,60)
var h = 3
Arrowshape((3*h)mm,30,60)
drawArrow(AB)
Arrowshape(default)
drawArrow(PQ)
\end{verbatim}
\end{itemize}

%%============================
%-------------------------
\subsection{beginLoop ... endLoop environment}
---see Loop


%%============================
%-------------------------
\subsection{beginSkip ... endSkip environment}
---see Skip


%%==========================
%%-------------------
\subsection{Const}
The \verb!const! command is used to define  scalar  constants.
\begin{itemize}
\item\textbf{Syntax}

\syntax{const} \ab{name} \syntax{=} \ab{expr}  [\syntax{,} \ab{name} \syntax{=} \ab{expr} ] ...

\item\textbf{Notes}

The constant name  follows the same naming convention as points and variables (see Section~\ref{sec:name}).
The scalar argument can be  any numeric expression.
There is no terminal comma.
If  a new value is allocated to an existing constant name then  \mathsPIC\ issues an error message.

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
const h=5
const r = 20, r4 = r3*tan(0.3)
\end{verbatim}
\end{itemize}



%-------------------------
\subsection{DashArray}
The \texttt{dasharray} command  takes an arbitrary number of paired arguments that are used to specify a dash--gap--dash\ldots\  pattern.

\begin{itemize}
\item\textbf{Syntax}

 \syntax{dasharray (} \textsc{dash , gap} \syntax{[} \textsc{dash , gap} \syntax{]} ... \syntax{)}

\textsc{dash} \syntax{::=} \ab{expr} \ab{unit}

\textsc{gap} \syntax{::=} \ab{expr} \ab{unit}



\item\textbf{Notes}

There must be an even number of arguments. If a variable or expression is used then  it should be separated from the unit  either by a {\textvisiblespace} or with round brackets ( ) as shown below.

Macros are useful for allocating names to frequently used dashArray commands.

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
dasharray(6pt, 2pt, 1pt, 2pt)
var d=2
dasharray(6pt, 2pt, 1pt, d pt)
dasharray(6pt, 2pt, 1pt, (d)pt)
dasharray(6pt, 2pt, 1pt, (3*d)pt)
%def fancydashes()dasharray(6pt, 2pt, 1pt, 2pt)%
\end{verbatim}
\end{itemize}



%%------------------------
\subsection{DrawAngleArc}

This command draws an arc in the specified angle, a distance
\textit{radius} from the angle.
\begin{itemize}
\item\textbf{Syntax}

\syntax{drawAngleArc\{} \textsc{angle , radius , location ,  direction} \syntax{\}}

\textsc{angle} \syntax{::= angle(} \ab{three-points} \syntax{)}

\textsc{radius} \syntax{::= radius(} \ab{expr} \syntax{)}

\textsc{location} \syntax{::= internal | external}

\textsc{direction} \syntax{::= clockwise | anticlockwise}



%-----------------------------


\item\textbf{Notes}

 The angle location is either
\textit{internal} ($\leq 180^{\circ}$) or
\textit{external} ($\geq 180^{\circ}$).
The direction of the arc is
either  \textit{clockwise} or \textit{anticlockwise}, and this
direction must correspond with the letter sequence  specified
for the angle.
Strange and unexpected results will be produced if
the four parameters are not internally consistent.
The parameter order \url{angle/radius/internal/clockwise} etc is important.


\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
DrawAngleArc{angle(ABC), radius(3), external, clockwise}
var r = 2
DrawAngleArc{angle(PQR), radius(r), internal, anticlockwise}
\end{verbatim}
\end{itemize}


%%------------------------
\subsection{DrawAngleArrow}
This command draws an arrow in the specified angle, a distance
\textit{radius} from the angle.
\begin{itemize}
\item\textbf{Syntax}

\syntax{drawAngleArrow\{} \textsc{angle , radius , location ,  direction} \syntax{\}}

\textsc{angle} \syntax{::= angle(} \ab{three-points} \syntax{)}

\textsc{radius} \syntax{::= radius(} \ab{expr} \syntax{)}

\textsc{location} \syntax{::= internal | external}

\textsc{direction} \syntax{::= clockwise | anticlockwise}


%-----------------------------


\item\textbf{Notes}

 The angle location is either
\textit{internal} ($\leq 180^{\circ}$) or
\textit{external} ($\geq 180^{\circ}$).
The direction of the arrow is
either  \textit{clockwise} or \textit{anticlockwise}, and this
direction must correspond with the letter sequence  specified
for the angle.
Strange and unexpected results will be produced if
the four parameters are not internally consistent.
The parameter order \url{angle/radius/internal/clockwise} etc is important.

The radius can be any numerical expression.

\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
DrawAngleArrow{angle(ABC), radius(3), external, clockwise}
var r = 2
DrawAngleArrow{angle(PQR), radius(r), internal, anticlockwise}
\end{verbatim}
\end{itemize}


%------------------------
\subsection{DrawArrow}

This command draws  an arrow(s)  joining
two points.
\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{drawArrow (} \ab{two-points} [ \syntax{,} \ab{two-points} ] \ldots\ \syntax{)}


\item\textbf{Notes}

The direction of the arrow is in the  point order specified.
The shape of the arrowhead is controlled by the
\verb!ArrowShape! command (see Section~\ref{sec:arrows}).
Commands and parameters which control line-thickness
are described in Section~\ref{sec:linethickness}.


\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawArrow(AB)
drawArrow(FG, HJ)
\end{verbatim}
\end{itemize}


%%-------------------
\subsection{DrawCircle}

Draws  a circle with its centre at a given point and with a given radius.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawCircle (} \textsc{centre} , \textsc{radius} \syntax{)}

\textsc{centre} \syntax{::=} \ab{point}

\textsc{radius} \syntax{::=} \ab{expr}

\item\textbf{Notes}

Note that \PiCTeX\ draws circles with the
\verb!\circulararc! command, using a radius
equivalent to the distance from the centre to the point at
which it starts drawing the arc.
Consequently, if the units of the  $x$ and $y$ axes are
different, circles may be drawn strangely. {\MathsPIC}
therefore generates a message to this effect in the output-file
 if different units are selected for the two axes in the
\verb!units! command.

\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawCircle(C2,5)
var r2=3
drawCircle(C2,r2)
drawCircle(C2,(r2/tan(1.2)) )
drawCircle(C2,AB)
\end{verbatim}
\end{itemize}


%%-----------------------------
\subsection{DrawCircumcircle}

Draws  the circumcircle of a triangle defined
by three points
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawCircumcircle(} \ab{three-points} \syntax{)}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawCircumcircle(ABC)
\end{verbatim}
\end{itemize}



%-----------------------
\subsection{DrawCurve}

Draws  a smooth quadratic curve through three points
in the  order specified.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawCurve (} \ab{three-points} \syntax{)}

\item\textbf{Notes}

This command will be upgraded in the next version to apply to
more than three points.


Note that curves drawn using this command
 do  \textit{not} break to
avoid line-free zones associated with
 the points (the \verb!drawLine! command for straight lines
\textit{does} acknowledge line-free zones).

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawCurve(ABC)
\end{verbatim}
\end{itemize}



%%-----------------------------
\subsection{DrawExcircle}

Draws  the excircle touching a given side of a triangle.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawExcircle(} \textsc{triangle} , \textsc{side} \syntax{)}

\textsc{triangle} \syntax{::=} \ab{three-points}

\textsc{side} \syntax{::=} \ab{two-points}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawExcircle(ABC,BC)
\end{verbatim}
\end{itemize}



%%-----------------------------
\subsection{DrawIncircle}

Draws  the incircle of a triangle defined by three points
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawIncircle(} \ab{three-points} \syntax{)}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawIncircle(ABC)
\end{verbatim}
\end{itemize}



%------------------------
\subsection{DrawLine}

This command draws  a line(s) between sets of two or more points.
\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{drawLine (} \textsc{line}
  [ \syntax{,} \textsc{line} ] \syntax{\ldots\ )}

\textsc{line} \syntax{::=} \ab{two-points} [ \ab{point} ]\ \ldots\


\item\textbf{Notes}

Lines are drawn in the  point order specified.
Commands and parameters which control line-thickness
are described in Section~\ref{sec:linethickness}.

Note that the \verb!drawline! command uses the {\PiCTeX}
\verb!\putrule! command for horizontal and vertical lines, and the \verb!\plot! command for lines of all other orientations.

\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawLine(AB)
drawLine(FG, HJ)
var d = 3
\end{verbatim}
\end{itemize}


%%-----------------------------
\subsection{DrawPerpendicular}

Draws the perpendicular from a point to a line.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawPerpendicular(} \ab{point} \syntax{,} \textsc{line} \syntax{)}

\textsc{line} \syntax{::=} \ab{two-points}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawPerpendicular(P, AB)
\end{verbatim}
\end{itemize}




%%-----------------------------
\subsection{DrawPoint}

Draws a symbol at the  point-location.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawPoint(} \ab{point} [ \ab{point} ]\ \syntax{...)}

\item\textbf{Notes}
There must be no commas in the list of points (spaces are allowed).

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawpoint(T4)
drawpoint(ABCDEF)
drawpoint(P1 P2 P3 P4)
\end{verbatim}
\end{itemize}



%%-----------------------------
\subsection{DrawRightangle}

Draws  the standard right-angle symbol in the
internal (acute) angle specified.
If the angle is not exactly  $90^\circ$   then \mathsPIC\ draws  the required symbol in perspective (i.e.,~each arm is still drawn parallel to the respective lines).
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawRightangle(} \ab{three-points} \syntax{,} \ab{expr} \syntax{)}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawRightangle(ABC,3)
\end{verbatim}
\end{itemize}


%%-----------------------------
\subsection{DrawSquare}
Draws  a square at a given point with a given side-length.
\begin{itemize}
\item\textbf{Syntax}

\syntax{DrawSquare(} \ab{point} \syntax{,} \ab{expr} \syntax{)}

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawSquare(P,5)
drawSquare(P,s2)
drawSquare(P, s2*4/(3*j))
drawSquare(P,AB)
\end{verbatim}
\end{itemize}

%------------------------
\subsection{DrawThickArrow}
This command draws  a thickarrow(s)  joining
two points.
\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{drawThickArrow (} \ab{two-points} [ \syntax{,} \ab{two-points} ] \ldots\ \syntax{)}


\item\textbf{Notes}

The direction of the arrow is in the  point order specified.
The shape of the arrowhead is controlled by the
\verb!ArrowShape! command (see Section~\ref{sec:arrows}).
Commands and parameters which control line-thickness
are described in Section~\ref{sec:linethickness}.


\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawThickArrow(AB)
drawThickArrow(FG, HJ)
\end{verbatim}
\end{itemize}


%------------------------
\subsection{DrawThickLine}
This command draws  a thick line(s) between sets of two or more points.
\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{drawThickLine (} \textsc{line}
  [ \syntax{,} \textsc{line} ] \syntax{\ldots\ )}

\textsc{line} \syntax{::=} \ab{two-points} [ \ab{point} ] \ldots\


\item\textbf{Notes}

Lines are drawn in the  point order specified.
Commands and parameters which control line-thickness
are described in Section~\ref{sec:linethickness}.


Note that the \verb!drawThickLine! command uses the {\PiCTeX}
\verb!\putrule! command for horizontal and vertical lines, and the \verb!\plot! command for lines of all other orientations.

\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
drawThickLine(AB)
drawThickLine(FG, HJ)
var d = 3
\end{verbatim}
\end{itemize}



%%-----------------------------
\subsection{InputFile}
Inputs a plain text file containing {\mathsPIC} commands,
one or more times.
\begin{itemize}
\item\textbf{Syntax}

\syntax{InputFile(} \ab{file-name} \syntax{) [} \textsc{loop} \syntax{]}

\textsc{loop} \syntax{::=} \ab{expr}

\item\textbf{Notes}

 Optionally, the file can be input
[\textsc{loop}] times, in which case this command can be used  to implement something akin to a primitive \textsc{do--loop} if the file contains \mathsPIC\ commands.

See also the LOOP command (a beginLOOP...endLOOP environment).

If  \textsc{loop} is not an integer then {\mathsPIC} will round the value down to the nearest integer.
Note that the \verb!inputfile*! command has no
[\textsc{loop}] option.

\item\textbf{Example}

The following command inputs the file
\verb!newfile.dat! 4 times in succession.
\begin{verbatim}
inputFile(myfile.dat)[4]
\end{verbatim}
The \verb!inputfile*! command is used to input a file in
\textit{verbatim},
i.e.~a file with \textit{no} {\mathsPIC} commands. For example, a file
containing only \PiCTeX\ commands or data-points
for plotting etc. A typical example might be the following file
(curve-A.dat) which would be input verbatim
using the command \verb!inputfile*(curve-A.dat)!. (Note that \PiCTeX\ requires an \textsc{odd}  number of points).
\begin{verbatim}
%% curve-A.dat
\setquadratic
\plot
 0     0
 3.56  4.87
 8.45  9.45
 5     7
 2.34  3.23 /
\setlinear
\end{verbatim}
\end{itemize}




%------------------------
\subsection{LineThickness}
Sets a particular linethickness.
\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{Linethickness (} \ab{expr} \ab{units} \syntax{)}

\syntax{Linethickness (default)}

\item\textbf{Notes}

This command also sets the font to \verb!cmr! and plotsymbol to
\verb!{\CM .}!, and also sets the rule thickness for drawing horizontal and vertical lines.
For example the command \verb!linethickness(2pt)!
results in the following commands in the output \verb!.mt! file.
\begin{verbatim}
\linethickness=2.00000pt\Linethickness{2.00000pt}%
\font\CM=cmr10 at 9.94451pt%
\setplotsymbol  ({\CM .})%
\end{verbatim}
The command \verb!linethickness(default)! restores the working linethickness to the default value of $0.4$pt.

The current value of linethickness (in the current units as defined in the \texttt{paper} command) can be accessed  as the value \verb!_linethickness_! as follows.
\begin{verbatim}
var t = _linethickness_
\end{verbatim}
See also---the chapter on \PiCTeX\ commands as there is a similar \PiCTeX\  command  with the same name (but with a different syntax).


\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
linethickness(2pt)
linethickness(default)
var t = _linethickness_
\end{verbatim}
\end{itemize}


%-------------------------
\subsection{Loop environment}
This environment cycles a block of code  a number of times.
\begin{itemize}
\item\textbf{Syntax}

\syntax{beginLoop \ab{expr}...endLoop}

\item{\textbf{Notes}}
The block of code which lies within the environment is input \ab{expr} times.

\item\textbf{Example}
\begin{verbatim}
beginLoop 5
...
endLoop
\end{verbatim}

\end{itemize}


%=============================

%------------------------
\subsection{Paper}
Defines the plot area and scale, and  optional axes and tick marks.

\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{Paper\{} \textsc{units , xrange , yrange , axes , ticks} \syntax{\}}

\textsc{units} \syntax{::= units(} \ab{expr}  \ab{units} [ \syntax{,} \ab{y-expr} \ab{y-units} ] \syntax{)}

\textsc{xrange} \syntax{::= xrange(} \ab{low-expr} \syntax{,} \ab{high-expr} \syntax{)}

\textsc{yrange} \syntax{::= yrange(} \ab{low-expr} \syntax{,} \ab{high-expr} \syntax{)}

\textsc{axes} \syntax{::= axes(} [\ab{L}[\syntax{*}]]
[\ab{R}[\syntax{*}]]
[\ab{T}[\syntax{*}]]
[\ab{B}[\syntax{*}]]
[\ab{X}[\syntax{*}]]
[\ab{Y}[\syntax{*}]]
\syntax{)}

\textsc{ticks} \syntax{::= ticks(} \ab{x-expr} \syntax{,} \ab{y-expr} \syntax{)}


\item\textbf{Notes}

The following statement sets up a rectangular drawing area
5~cm $\times$ 5~cm with axes on the \verb!L!eft (y-axis) and \verb!B!ottom
(x-axis), and tick marks at 1 cm intervals. Note that the order of the options  \verb!units()...ticks()! \textsc{must} adhere to the order shown here (this will be made flexible in a later version).
\begin{verbatim}
paper{units(1cm),xrange(0,5),yrange(0,5),axes(LB),ticks(1,1)}
\end{verbatim}
All combinations of the axis-codes (XYLRTB) are allowed, and  a *
following an axis-code (e.g.\ L*) disables the drawing of ticks on
the specified axis.

If it is necessary to have \emph{different} unit scales
for the $x$ and $y$
axes, say 1 cm and 2 mm respectively, then this is implemented
by \verb!units(1cm,2mm)!.
If only a single unit is specified (e.g.\ \verb!units(3cm)!)
then {\mathsPIC} automatically makes this the unit scale for
\textit{both} axes.
If the \verb!unit! option is omitted  {\PiCTeX} will use
the last defined units (within the same picture environment),
the default units being \textit{xunit}=1pt and \textit{yunit}=1pt
(see the {\PiCTeX} Manual, page~3;  Wichura, 1992).

If different units or different sizes of the same unit are used for the $x$ and $y$ scales then \mathsPIC\ issues a warning message to this effect (since strange effects arise, e.g.,~with circles, ellipses \& angles, when the $x$ and $y$ axes are scaled unequally).
Note that the modern rectangular thin computer screens may also `stretch' circles sideways, depending on the setup, in a way not seen when the image is printed. 

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
paper{units(1cm),xrange(0,10),yrange(0,10),axes(XY)}
var j=5
paper{units(1cm),xrange(0,j),yrange(0,5),axes(LBT*R*),ticks(1,1)}
var u = 3
paper{units((u)mm),xrange(0,50),yrange(0,50),axes(LBTB)}
\end{verbatim}
\end{itemize}


%%======================


%------------------------
\subsection{Point}
Allocates coordinates to a point-name.
A  point name   \textit{must} begin
with a \textit{single} letter (either upper or lower case),
and may have up to a \textit{maximum} of four\footnote{From \mathsPIC\ version~1.11 onwards.} following digits, e.g.,~$P1326$.


\begin{itemize}
%-------------------------
\item\textbf{Syntax}

\syntax{Point \syntax{[*]} (} \ab{point} \syntax{) \{} \ab{point} \syntax{\}}
\syntax{[} \textsc{option} [\syntax{,} \textsc{option}] \syntax{]}


\syntax{Point \syntax{[*]} (} \ab{point} \syntax{) \{} \textsc{location} \syntax{\}}
\syntax{[} \textsc{option} [\syntax{,} \textsc{option}] \syntax{]}

\textsc{location} \syntax{::=} \ab{x-expr} \syntax{,} \ab{y-expr}

\textsc{location} \syntax{::=} \syntax{xcoord(} \ab{point} \syntax{) ,} \syntax{ycoord(} \ab{point} \syntax{)}

\textsc{location} \syntax{::=} \syntax{midpoint(} \ab{two-points} \syntax{)}


\textsc{location} \syntax{::=} \syntax{intersection(} \ab{two-points} \syntax{,} \ab{two-points} \syntax{)}

\textsc{location} \syntax{::=} \syntax{PointOnLine(} \ab{point} \syntax{,} \ab{expr} \syntax{)}

\textsc{location} \syntax{::=} \syntax{perpendicular(} \ab{point} \syntax{,} \ab{two-points} \syntax{)}

\textsc{location} \syntax{::=} \syntax{Circumcirclecenter(} \ab{three-points} \syntax{)}

\textsc{location} \syntax{::=} \syntax{Incirclecenter(} \ab{three-points} \syntax{)}


\textsc{location} \syntax{::=} \syntax{Excirclecenter(} \ab{three-points} \syntax{,} \ab{two-points} \syntax{)}



\textsc{location} \syntax{::=} \ab{point} \syntax{,} \textsc{point-function}

\textsc{point-function} \syntax{::=} \syntax{shift(} \ab{x-expr} \syntax{,} \ab{y-expr} \syntax{)}

\textsc{point-function} \syntax{::=} \syntax{polar(} \ab{r-expr} \syntax{,} $\langle\theta$\textit{-expr}$\rangle$ \syntax{)}


\textsc{point-function} \syntax{::=} \syntax{rotate(} \ab{point} \syntax{,} $\langle\theta$\textit{-expr}$\rangle$ \syntax{)}

\textsc{point-function} \syntax{::=} \syntax{vector(} \ab{two-points} \syntax{)}

\textsc{option} \syntax{::=}
     \syntax{symbol =} \textsc{chars}
     \syntax{|}
     \syntax{radius =} \ab{expr}

\textsc{chars} \syntax{::=} \ab{string} \syntax{| square(} \ab{expr} \syntax{) | circle(} \ab{expr} \syntax{)}



\item\textbf{Notes}

The default point-symbol is the \verb!$\bullet$!.
An optional alternative point-symbol (or string of characters)
can be specified within  square
brackets, as for example: \verb![symbol=$\triangle$]!

By  default lines drawn to a `point' are drawn to the point location. However, the
radius of an optional line-free zone (line-free radius)
 can be specified within an
optional square bracket e.g.~\verb![symbol=$\triangle$,radius=2]!.
A line-free radius option can be specified by itself, for example
\verb![radius=2]!.

The \verb!polar(r,theta)! defaults to radians for the angle theta. If degrees are required then need
to append $<deg>$; e.g.~\verb!polar(r,theta deg)!. Note that \verb!direction()! or \verb!directiondeg()! can be used instead of theta, as for example: \verb!point(D4){D2, polar(6,direction(AB))}! (see  also the \textit{Examples}  at the end on the following page).

An optional {\verb!symbol=circle()!} or {\verb!symbol=square()!}  can also be used
as the \textit{symbol}. In these cases a numeric expression is required as the argument, and is taken to be the side length (for \verb!square()!) or circle-radius (for \verb!circle()!).  If a radius  \ab{expr} is also included  then
the square will have associated with it a line-free radius of the specified value, e.g.,~\texttt{[symbol=square(2), radius=5]}; and similarly if the symbol is a circle.

Note (1) there must be a comma between the  options, and (2) the options are  not order specific.
If no line-free radius  value is specified,
the line-free radius used  is the current (default) value).


Points can also be defined  relative to \emph{previously defined}
points. For example,  as the intersection
of two existing lines, or as a $+$ve or $-$ve extension (in the
direction indicated by the letters) between two previously
defined points, (e.g.~the \verb!PointOnLine()! construction).

If the command \verb!point(){}! is used to reallocate new parameters to an existing point-name then \mathsPIC\  will generate a warning message indicating that an existing point-name is being reallocated.
For example, the following code
\begin{verbatim}
point(S){6,6}
point(S){7,7}
\end{verbatim}
will generate the following warning message in the output file, but still
reallocate the  point-name.
\begin{verbatim}
%% point(S){6,6} 	S = (6, 6)
%% *** Line 15: point(S
%% ***                 ){7,6}
%% ... Warning: Point S has been used already
%% point(S){7,6} 	S = (7, 6)
\end{verbatim}
The \verb!point*! command allocates parameters to a point-name
irrespective of whether that point-name has been previously defined or not.
Thus in the above example, the reallocation proceeds without any warning message at all, as follows
\begin{verbatim}
%% point(S){6,6} 	S = (6, 6)
%% point*(S){7,6} 	S = (7, 6)
\end{verbatim}


\item\textbf{Examples}
\vspace{-0.5\baselineskip}
\begin{verbatim}
point(A){5,5}
point(B2){22,46}[symbol=$\odot$]
point(B2){22,46}[symbol=circle(2),radius=5]
point(B2){22,46}[symbol=square(3),radius=5]
point(B2){22,46}[radius=5]
point(D2){B2, shift(5,5)}
point(D3){D2, polar(6,32 deg)}
point(D4){D2, polar(6,1.2 rad)}
point(D4){D2, polar(6,direction(AB))}
point(D4){D2, polar(6,directiondeg(AB)deg)}
point(G2){Q, rotate(P, 23 deg)}
point(J4){B2, vector(AB)}
point(D2){midpoint(AB)}
point(D2){intersection(AB,CD)}
point(F){PointOnLine(AB,5.3)}
point(G){perpendicular(P,AB)}
point(H){circumcirclecenter(ABC)}
point(J){incirclecenter(ABC)}
point(K){excirclecenter(ABC,BC)}
point*(A){6,3}
point*(B){B, shift(5,0)}
point*(P){J} %% make J have the same coords as P
point*(P){xcoord(J),ycoord(J)}  %% same as  Point*(P){J}
\end{verbatim}
\end{itemize}


%------------------------
\subsection{PointSymbol}
Sets a particular point-symbol and line-free radius.
\begin{itemize}
\item\textbf{Syntax}

\syntax{pointSymbol (} \ab{chars} \syntax{,} \ab{expr} \syntax{)}

\syntax{pointSymbol (square(}\ab{expr}\syntax{) ,} \ab{expr} \syntax{)}

\syntax{pointSymbol (circle(}\ab{expr}\syntax{) ,} \ab{expr} \syntax{)}

\item\textbf{Notes}

This command allows the default point-symbol (\verb!$\bullet$!,
line-free radius zero) to be changed.
The \texttt{square} option takes the side-length as argument.
The \texttt{circle} option takes the radius as argument.

The PointSymbol command is particularly useful where a set of
points uses the same point-symbol, and also
when drawing graphs.

For example, the following command changes the
point-symbol to $\odot$
having a line-free radius of $0.7$ units.
\begin{verbatim}
PointSymbol($\odot$, 0.7)
\end{verbatim}
Note that the \verb!PointSymbol! command only influences
subsequent \verb!point! commands, i.e.,~it should be placed before the defining \verb!point! command.
The optional square bracket of the \verb!point! command
overrides the PointSymbol command.
The point-symbol can be reset to the default
(\verb!$\bullet$!, zero  line-free radius) using the command \verb!PointSymbol(default)!.

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
PointSymbol($\odot$, 0.7)
PointSymbol(square(4), 5)
PointSymbol(circle(3), 3)
var r = 1.2
PointSymbol($\triangle$, 0.7)
PointSymbol(circle(r), r)
pointSymbol(default)
\end{verbatim}
\end{itemize}


%-------------------------
\subsection{Skip environment}
This is an environment within which commands are not actioned.
\begin{itemize}
\item\textbf{Syntax}

\syntax{beginSKIP...endSKIP}

\item{\textbf{Notes}}

It is useful in development for by-passing commands (i.e.~its function is equivalent to the \verb!\iffalse....\fi! commands  in a \TeX\ document).

\end{itemize}




%------------------------
\subsection{Show...}
This command  makes {\mathsPIC}
 return the value of a calculation or specified parameter.
\begin{itemize}
\item\textbf{Syntax}

\syntax{ShowLength (} \ab{two-points} \syntax{)}

\syntax{ShowAngle (} \ab{three-points} \syntax{)}

\syntax{ShowArea (} \ab{three-points} \syntax{)}

\syntax{ShowPoints}

\syntax{ShowVariables}

\item\textbf{Notes}

The \verb!showarea()! command is only for triangles.
The results of the \verb!Show...! commands are shown in the output-file as a commented line.

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
showLength(AB)
showAngle(ABC)
showArea(ABC)
showPoints
showVariables
\end{verbatim}
When the above examples are processed, the results appear
as commented lines in the output-file as follows.
\begin{verbatim}
%% Length(AB) =  25.35746
%% Angle(ABC) =  39.35746 deg (0.68691 rad)
%% Area(ABC)  =  54.54267
%%-------------------------------------------------
%%            L I S T  O F  P O I N T S
%%-------------------------------------------------
%%  q = (8.000, 9.000), LF-radius = 5.000, symbol = $\bigodot$
%%  s = (6.000, 6.000), LF-radius = 0.000, symbol = $\bullet$
%%  p = (5.000, 5.000), LF-radius = 3.000, symbol = $\circle$
%%  t = (5.000, 5.000), LF-radius = 7.000, symbol = $\square$
%%-------------------------------------------------
%%      E N D  O F  L I S T  O F  P O I N T S
%%-------------------------------------------------
%%-------------------------------------------------
%%       L I S T  O F  V A R I A B L E S
%%-------------------------------------------------
%%	a	=	4
%%	b	=	12
%%-------------------------------------------------
%%   E N D  O F  L I S T  O F  V A R I A B L E S
%%-------------------------------------------------
\end{verbatim}
\end{itemize}



%------------------------
\subsection{System}
This command allows the user to access the command line and execute system commands. Allows programs to be run from within \mathsPIC.
\begin{itemize}
\item\textbf{Syntax}

\syntax{system ( "} \ab{command} \syntax{" )}

\item\textbf{Notes}

 The whole command must be delimited by inverted commas.
For example, the following command will temporarily stop \mathsPIC\
processing, access the command-line and run \LaTeX\ on the
file \texttt{myfile.tex}, and then seamlessly return and continue
\mathsPIC\ processing.
\begin{verbatim}
system("latex2e myfile.tex")
\end{verbatim}
Alternatively, the \texttt{system()} command  may be used
 to create a small batch file
on-the-fly in order to facilitate some procedure.
In \mathsPIC\ a common use is for running a Perl program to
write \mathsPIC\ commands to a temporary file which is then input by \mathsPIC\
(see the examples at the end of the Examples chapter).


\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
system("dir > mydir-listing.txt")
system("perl drawbox.pl  5  5  temp.txt")
inputFile(temp.txt)
\end{verbatim}
\end{itemize}




%------------------------
\subsection{Text}
Places text at a given location.
\begin{itemize}
\item\textbf{Syntax}

\syntax{Text (} \ab{string} \syntax{) \{} \textsc{location} \syntax{\}}
\syntax{[} \textsc{possn} [\syntax{,} \textsc{possn}] \syntax{]}

\textsc{location} \syntax{::=} \ab{point}

\textsc{location} \syntax{::=} \ab{x-expr} \syntax{,} \ab{y-expr}


\textsc{location} \syntax{::=} \ab{point} \syntax{,} \textsc{point-function}

\textsc{point-function} \syntax{::=} \syntax{shift(} \ab{x-expr} \syntax{,} \ab{y-expr} \syntax{)}

\textsc{point-function} \syntax{::=} \syntax{polar(} \ab{r-expr} \syntax{,} $\langle\theta$\textit{-expr}$\rangle$ \syntax{)}


\textsc{possn} \syntax{::=}  \syntax{ l | t | r | R | b }


\item\textbf{Notes}

This command puts the given text-string either at the named
point, or with a displacement specified by the
optional \texttt{shift()} or
\texttt{polar()} or \texttt{rotate()} functions.
By default the text is centreed vertically and
horizontally at the specified location.

    Optionally, text can be placed relative to the specified location using appropriate combinations of the
 {\PiCTeX} \textit{position} options \verb! l t r B b! to
align the \textbf{l}eft edge, \textbf{r}ight edge, \textbf{t}op edge,
\textbf{B}aseline, \textbf{b}ottom edge
respectively of the text box  with the point-location
(see the {\PiCTeX} Manual, page~5; Wichura, 1992).
    For example,  the text box \framebox{\texttt{This is point P}}
    would be aligned such that the right edge of the text box would be
centreed vertically at the point $P$,
using \verb!text(This is point P){P}[r]! (see figure~\ref{fig:nicebox}).

Note that \TeX\ and \LaTeX\ macros are very useful for defining blocks of text in this setting, since the macro name can be used in the \texttt{text()} command for convenience, as shown in the examples below.

\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
text(A){5,6}
text($A_1$){A1, shift(2, 2)}
text($Z2$){Z2, shift(5, -5)}[tr]
text($Z3$){Z2, polar(5, 20 deg)}[Br]
text($Z4$){Z2, rotate(P, 45)}
text(\framebox{$Z5$}){Z3}
\newcommand{\mybox}{\framebox{$Z5$}}
text(\mybox){P421}
\end{verbatim}
\end{itemize}




%%-------------------
\subsection{Var}
The \verb!var! command is used to define  scalar  variables.
The variable name   \textit{must} begin
with a \textit{single} letter (either upper or lower case),
and may have up to a \textit{maximum} of four\footnote{From \mathsPIC\ version~1.11 onwards.} following digits.

\begin{itemize}
\item\textbf{Syntax}

\syntax{var} \ab{name} \syntax{=} \ab{expr}  [\syntax{,} \ab{name} \syntax{=} \ab{expr}] ...

\item\textbf{Notes}

The variable name  follows the same naming convention as points and variables (see Section~\ref{sec:name}).
The scalar argument can be  any numeric expression.

New values can  be re-allocated to existing variable-names; however, when this occurs then \mathsPIC\ does \fbox{not} issue a  warning message to hightlight this fact. If it is important to be warned if a potential  variable is accidentally reallocated then one should consider using the \verb!const! command instead  (since \mathsPIC\ does generate an error message if a constant is reallocated).

Note that in addition to all the mathematical functions, the following functions can also be used.

\syntax{angle(}\ab{three-points}\syntax{)}

\syntax{angledeg(}\ab{three-points}\syntax{)}

\syntax{direction(}\ab{two-points}\syntax{)}

\syntax{directiondeg(}\ab{two-points}\syntax{)}

\syntax{area(}\ab{three-points}\syntax{)}

\syntax{xcoord(}\ab{point}\syntax{)}

\syntax{ycoord(}\ab{point}\syntax{)}



\item\textbf{Example}
\vspace{-0.5\baselineskip}
\begin{verbatim}
var r = 20, r4 = r3*tan(0.3), j = (r*2e3)**2,  r5 = AB
var e = _e_, p1 = _Pi_
var t = _linethickness_
var L25 = AB             %% gives length of line AB
var g137 = angle(ABC)    %(default: returns in radians)
var g200 = angledeg(ABC)    % returns in degrees
var d = direction(PQ)       % angular direction of PQ in radians
var d = directiondeg(PQ)    % angular direction of PQ in degrees
var h = area(ABC)
var r = incircleradius(ABC)
var x2000 = xcoord(A), y2000 = ycoord(A)
var m5 = 12 rem 3   %% remainder after dividing by 3
var s1 = sgn(h)     % returns the sign (+1, -1, 0) of h
var i = int(k)      % returns the integer value of k
\end{verbatim}
\end{itemize}


%-------------------------------------
\section{Summary of \mathsPIC\ commands}

The following list shows the format and typical usage
of all {\mathsPIC} commands.
Although {\mathsPIC} commands are \textit{not} case sensitive,
in this summary of commands points are represented using upper case
letters, and variables and constants are represented using lower case
letters.  Note that  a leading
\texttt{$\backslash$}\gap\ is used for copying \TeX\ or \PiCTeX\
lines verbatim, for example with macros or coordinates of data
points etc.

\begin{verbatim}
\   4.5    6.3
%def loge(n)log(n)%
%def fancydashes() dasharray(1pt,2pt,3pt,4pt)%
%def plaindashes() dasharray(1pt,1pt)%
%def d2r()_pi_/180%
%def r2d()180/_pi_%
ArrowShape(4mm,30,50)
ArrowShape(default)  %% generates arrowshape(2mm,30,40)
beginLoop ... endLoop  5
beginLoop ... endLoop  n
beginNoOutput ... endNoOutput
beginSKIP ... endSKIP
const r40=40
drawAngleArc{angle(ABC), radius(3), internal, clockwise}
drawAngleArrow{angle(ABC), radius(3), internal, clockwise}
drawArrow(AB)          %from A to B
drawArrow(AB,CD)
drawCircle(J,12)
drawCircle(C,r2)
drawCircle(C,AB)       %% the radius is length of line AB
drawCircumcircle(ABC)
drawCurve(ABC)          %% three points only
drawExcircle(ABC)
drawIncircle(ABC)
drawLine(AB)
drawLine(ABCDE)
drawPerpendicular(P,AB)
drawPoint(B)
drawPoint(ABP1P2)
drawRightAngle(ABC, 4)
drawSquare(P,2)    %% side = 2
drawThickArrow(AB)
drawThickArrow(AB,CD)
drawThickLine(RS,TU)
inputFile(mathspic.dat)
inputFile(mathspic.dat)[4]
inputfile*(fig2.dat)      %% * disables mathsPIC processing of file
linethickness(2pt)
paper{units(1mm,3mm),xrange(-5,50),yrange(-5,50),axes(LR)}
paper{units(2cm),xrange(0,5),yrange(0,9),axes(X*Y),ticks(1,1)}
paper{units(k mm),xrange(0,5),yrange(0,9),axes(X*Y),ticks(1,1)}
point(D1){20,2}
point(D4){6.3,8.9}
point(P){x1,y1}
point(P){Q}   %% make P have same coords as Q
point(P){xcoord(Q),ycoord(Q)}  %% same as  point(P){Q}
point(P){AB,PQ}
point(P){3,4}[symbol=$\odot$,radius=2]
point(P){3,4}[radius=2]
point(D2){20,2}[symbol=square(2),radius=3]
point(D3){20,3}[symbol=circle(r),radius=5]
point(D4){20,4}[symbol=$\Box$]
point(E1){D1, shift(5,6)}
point(E5){D1, shift(r2,6)}
point(E2){D2, polar(8, 1.34)}           %% radians is the default
point(E2){D2, polar(8, 1.34 rad)}
point(E2){D2, polar(8,45 deg)}
point(E6){D2, polar(r4,45 deg)}
point(E2){D2, polar(8, direction(AB))}  %% radians is the default
point(E2){D2, polar(8, directiondeg(AB) deg)}
point(E5){D2, polar(AB,45 deg)}
point(G2){Q, rotate(P, 23 deg)}  %% rotate Q about P by 23 deg
point(P){J, vector(AB)}     %% from J with length and direction AB
point(D32){midpoint(AB)}
point(D2){intersection(AB,CD)}
point(F){PointOnLine(AB,5)}
point(F){PointOnLine(AB,-d)}
point(G){perpendicular(P,AB)}
point(H){circumcirclecenter(ABC)}
point(J){incirclecenter(ABC)}
point(K){excirclecenter(ABC,BC)}
point*(D1){20,3}
point*(E1){D1, shift(3,0)}
point*(E1){E1}[radius=3] %% change the line-free radius
PointSymbol(circle(r))
PointSymbol(square(1),2)
PointSymbol($\odot$,2)
PointSymbol(default)
PointSymbol(default,0.5)
showAngle()
showArea()
showLength()
showVariables
showPoints
system("dir > mydir-listing.txt")
system("perl myprogram.pl")
text(P){5,7}
text($A$){A}
text($K$){K}[r]
text($B$){B, shift(5,5)}
text($Z3$){Z2, polar(5, 20 deg)}[Br]
text(\framebox{$Z5$}){Z3}
\newcommand{\mybox}{\framebox{$Z5$}}
text(\mybox){P421}
text(\framebox{$C$}){C, polar(5,62 deg)}[Br]
var r3 = 20, r4 = r3 * tan(0.4), r5 = AB, e=_e_, p1 = _Pi_
var g = angle(ABC)% (returns in radians)
var g = angledeg(ABC)% (returns in degrees)
var a = area(ABC)
var d = direction(PQ)    % angular direction of PQ in radians
var d = directiondeg(PQ) % angular direction of PQ in degrees
var x2 = xcoord(A), y2 = ycoord(A)
var m5 = 12 rem 3   %% remainder after dividing by 3
var t = _linethickness_
\end{verbatim}


\end{document}
