% \iffalse meta-comment
%<*internal>
\begingroup
\input docstrip.tex
\keepsilent
\declarepreamble\packagepreamble
********************************************************************
The xpicture package
Copyright (C) 2010, 2011, 2012 by Robert Fuster <rfuster@mat.upv.es>
All rights reserved

This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3c
of this license or (at your option) any later version.
The latest version of this license is in

   http://www.latex-project.org/lppl.txt

and version 1.3c or later is part of all distributions of LaTeX
version 2005/12/01 or later.
********************************************************************
\endpreamble
\declarepreamble\cfgpreamble
************************************************************************
This is xpicture.cfgxmpl, part of the xpicture distribution
Copyright (C) 2010, 2011, 2012 by Robert Fuster <rfuster@mat.upv.es>
All rights reserved

        This is a model for the xpicture configuration file

You should not modify this file.
To costumize your xpicture installation, make a copy of this file,
save it as 'xpicture.cfg' and modify this new file at your convenience.
************************************************************************

\endpreamble
\postamble
\endpostamble

\askforoverwritefalse
\generate{\usepreamble\packagepreamble
             \file{xpicture.sty}{\from{xpicture.dtx}{xpicture,defaults}}
          \usepreamble\cfgpreamble
             \file{xpicture.cfgxmpl}{\from{xpicture.dtx}{defaults,cfg}}
   }

\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
\endgroup
%</internal>
%
% Copyright (C) 2010, 2011, 2012 by Robert Fuster <rfuster@mat.upv.es>
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
% \CheckSum{2978}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\ProvidesFile{xpicture.dtx}
   [2012/12/17 v.1.2a documented xpicture package]
\GetFileInfo{xpicture.dtx}
\usepackage[lmargin=5cm,rmargin=2cm]{geometry}

\usepackage{xpicture}

\newcommand{\environ}[1]{\textnormal{\texttt{#1}}}
\newcommand{\package}[1]{\textnormal{\texttt{#1}}}
\newcommand{\option}[1]{\textnormal{\texttt{#1}}}
\newcommand{\optionindex}[1]{%
    \index{#1=\texttt{#1} (package option)|usage}%
    \index{options:>#1=\texttt{#1}|usage}}

\newcommand{\starred}{\textnormal{\texttt{*}}}
\newcommand{\Parg}[1]{\textnormal{\texttt(\textit{#1}\texttt)}}
\makeatletter
\newcommand{\myDescribeMacro}{\@ifstar
      \xpct@myDescribeMacrostar
      \xpct@myDescribeMacro
      }
\newcommand{\xpct@myDescribeMacro}[1]{\smallskip\par\DescribeMacro{#1}}
\newcommand{\xpct@myDescribeMacrostar}[1]{\myDescribeMacro{#1}{ }}
\newcommand{\myDescribeEnv}[1]{\smallskip\par
   \DescribeEnv{#1}{ }\cs{begin}\{\texttt{#1}\}}
\makeatother

\def\fileversion{1.2a}
\def\filedate{2012/12/17}
\title{The \textsf{xpicture} package\thanks{This document
       corresponds to \textsf{xpicture}~\fileversion, dated \filedate.}\\
       (\texttt{http://www.upv.es/\~{}rfuster/xpicture}) \\
       Several extensions of the \textsf{picture} standard environment\\
       Reference manual and documented source}
\author{Robert Fuster\\
        Universitat Polit\`ecnica de Val\`encia \\
        \texttt{rfuster@mat.upv.es}}
\date{\filedate}
\EnableCrossrefs         
\CodelineIndex

\begin{document}
  \DocInput{xpicture.dtx}
  \newpage
  
  \PrintIndex
\end{document}
%</driver>
%
% \fi
%
%
% \DoNotIndex{\NeedsTeXFormat}
% \DoNotIndex{\RequirePackage,\ProcessOptions,\ProvidesPackage}
% \DoNotIndex{\CurrentOption,\DeclareOption}
% \DoNotIndex{\MessageBreak,\PackageError,\PackageInfo,\PackageWarning}
% \DoNotIndex{\PassOptionsToPackage,\InputIfFileExists}
% \DoNotIndex{\begingroup,\endgroup,\begin,\end}
% \DoNotIndex{\def,\let,\edef,\xdef,\newcommand,\newenvironment}
% \DoNotIndex{\if,\ifx,\ifnum,\ifdim,\else,\fi,\@whilenum,\@whiledim,\value}
% \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@killglue,\do,\newif}
% \DoNotIndex{\undefined,\newcounter,\newdimen,\stepcounter}
% \DoNotIndex{\setcounter,\setlength,\unitlength,\settoheight,\settowidth}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\noexpand,\ignorespaces}
% \DoNotIndex{\normalfont,\normalsize,\small}
% \DoNotIndex{\circle,\line,\linethickness,\makebox,\put,\multiput,\qbezier}
% \DoNotIndex{\ensuremath,\mathrm,\mathversion}
% \DoNotIndex{\scshape}
% \DoNotIndex{\color,\textcolor,\colorlet}
% \DoNotIndex{\moveto,\lineto,\closepath,\fillpath}
% \DoNotIndex{\LINE,\VECTOR,\segment}
% \DoNotIndex{\x,\Dx,\y,\Dy,\t,\Dt}
% \DoNotIndex{\Picture,\endPicture}
% \DoNotIndex{\ADD,\COPY,\GLOBALCOPY}
% \DoNotIndex{\COS,\RADtoDEG,\COSH,\COTAN,\COTANH,\CUBE,\DIVIDE,\EXP,\LOG}
% \DoNotIndex{\MULTIPLY,\POWER,\SIN,\SINH,\SQRT,\SQUARE,\SUBTRACT,\TAN,\TANH}
% \DoNotIndex{\ABSVALUE,\DEGREESCOS,\DEGREESSIN,\DEGREESTAN,\DEGREESCOT}
% \DoNotIndex{\COS,\SIN,\TAN,\COT,\pi}
% \DoNotIndex{\DETERMINANT,\MATRIXVECTORPRODUCT,\SCALARVECTORPRODUCT}
% \DoNotIndex{\MAX,\MIN,\ROUND,\TRUNCATE}
% \DoNotIndex{\FLOOR,\FRACTIONSIMPLIFY,\LENGTHDIVIDE,\SQUAREROOT}
% \DoNotIndex{\numberTWOPI,\newvectorfunction}
% \DoNotIndex{\UNITVECTOR,\VECTORADD,\VECTORCOPY,\VECTORNORM,\VECTORSUB}

% \maketitle
% \begin{abstract}
% The \package{xpicture} package extends the graphic abilities 
% of the \environ{picture} standard environment and packages \package{pict2e}
% and \package{curve2e}, adding the ability to work with arbitrary 
% In addition to other utilities,
% the greater interest of \package{xpicture} 
% lies in its capacity to draw function graphs,
% conic sections and arcs, and parametrically defined curves.

% This is the technical documentation and reference manual 
% of package \package{xpicture}, but not its user manual.
% User manual is on file \texttt{xpicture-doc.pdf}, 
% distributed together with the package.
% \end{abstract}
% \tableofcontents
% \newpage
%
% \section{Introduction}
% The \package{xpicture} package introduces several new graphical 
% instructions,
% and some enriched versions of standard
% instructions used inside the \environ{picture} environment.
% All these new instructions can be classified as follows:
% \begin{enumerate}
%  \item Reference systems and coordinates:
% \begin{itemize}
% \item Declaration and use of different reference systems,
% with Cartesian or polar coordinates.
% \item Instructions to show Cartesian or polar reference systems.
% \end{itemize}
%  \item  An alternative to the \environ{picture} environment,
% compatible with the new reference systems.
%  \item Alternative instructions or extensions of the standard
%  \environ{picture} commands and those defined by the packages
%  \package{pict2e} and \package{curve2e}:
% \begin{itemize}
%  \item Enriched versions of marks \cs{put} and \cs{multiput},
%  providing an adequate control of the precise position 
% in which objects are composed
% (this functionality is especially useful in the composition
% of not strictly graphical objects, such as formulas or labels).
% \item Instructions for drawing straight segments, vectors
% (in any direction and using any reference system), polylines,
% polygons, regular and arbitrary polygons .
% \end{itemize}
% \item Regular curves:
% \begin{itemize}
% \item Instructions for drawing conic sections (circles, ellipses,
% hyperbolas and parabolas) and arcs of these curves.
% \item Instructions to graph functions and parametrically defined curves
% (this is the most interesting feature of this package).
% \end{itemize}
% \end{enumerate}
%
% To enjoy this package you need to have an adequate knowledge of the commands
% defined in packages \package{calculator} and \package{calculus}, 
% especially concerning to the definition of 
% functions and operations with functions.
% 
% 
% \setlength{\marginparsep}{0pt}
% \setlength{\parindent}{0pt}
% \section{Usage}
% This package is loaded as usual, using the instruction
% \cs{usepackage}\oarg{list of options}|{xpicture}|.
% Then, packages \package{pict2e}, \package{curve2e}, \package{xcolor},
% \package{calculator}, and \package{calculus} are automatically loaded.
% This package is compatible with any system that supports 
% \package{xcolor} and \package{pict2e} packages.\footnote{%
% Earlier versions supports \option{dvi} option, 
% which was compatible with a pure \texttt{dvi} output, 
% but this possibility has been eliminated in version 2.1a, 
% because it was too expensive and probably unhelpful.}
%
% Options are passed directly to packages 
% \package{pict2e}, \package{curve2e}, and \package{xcolor}, excerpt option
% \option{draft}\optionindex{draft},
% which disables all the instructions defined in this package, 
% replacing each picture set in a \environ{Picture} environment
% by a blank rectangle.\footnote{If you use an instruction 
% not directly defined by \package{xpicture}, 
% this instruction may take effect.} 
% Using this option is very convenient throughout the production 
% of the document, 
% since the composition of the drawings slows considerably
% the compilation time.
% The |\draftPictures| declaration performs a similar work,
% allowing the user to locally disable |Picture| commands.
% 
% An interesting option (from package \package{pict2e}) is 
% \option{pstarrows};\optionindex{pstarrows} 
% if used, arrowheads in vectors are drawn in PSTricks style (instead of the
% standard \LaTeX{} style).
% 
% If exists, the local configuration file \texttt{xpicture.cfg} is loaded.
% This file allows the user to customize all configurable
% \package{xpicture} parameters;
% if you want to use it, copy the file \texttt{xpicture.cfgxmpl}, 
% which is distributed along with package \package{xpicture},
% call your copy as \texttt{xpicture.cfg}, put it in your local
% \texttt{texmf} tree
% and edit this file to modify everything agreed. 
% 
% \section{The user interface}
% \subsection{Color selection}
%
% \myDescribeMacro\pictcolor\marg{color}
% select a color without spurious spaces.
%
% Example: |\pictcolor{blue}|
%
% \subsection{Reference systems}
% \myDescribeMacro\referencesystem\parg{x0,y0}\parg{x1,y1}\parg{x2,y2}
% selects the affine reference system with origin in point
% (\textit{x0},\textit{y0}) and coordinate vectors (\textit{x1},\textit{y1})
% and (\textit{x2},\textit{y2}). 
%
% Coordinates are refered to the standard reference system. 
%
% Example: |\referencesystem(0,0)(1,-1)(1,1)|
%
% \myDescribeMacro\changereferencesystem\parg{x0,y0}\parg{x1,y1}\parg{x2,y2}
% selects the affine reference system with origin in point
% (\textit{x0},\textit{y0}) and coordinate vectors (\textit{x1},\textit{y1})
% and (\textit{x2},\textit{y2}).
%
% Coordinates are refered to the active reference system.
%
% Example: |\changereferencesystem(0,0)(1,-1)(1,1)|
%
% \myDescribeMacro\translateorigin\parg{x0,y0}
% translates origin to the given point.
%
% Coordinates are refered to the active reference system.
%
% Example: |\translateorigin(2,-3)|
%
% \myDescribeMacro\rotateaxes\marg{angle}
% rotates the axes. 
% The angle parameter is interpreted as the rotation angle in radians 
% (if the \cs{radiansangles} declaration is active) 
% or in sexagesimal degrees (if the \cs{degreesangles} declaration is active).
%
% Coordinates are refered to the active reference system.
%
% Example: |\rotateaxes{\numberQUARTERPI}|
%
% \myDescribeMacro\symmetrize\marg{angle}
% performs a symmetry, being \textit{angle}
% the angle between the symmetry axis and the $x$ axis.
% The \cs{radiansangles} and \cs{degreesangles} declarations determine 
% if angles are interpreted as radians or degrees.
%
% Coordinates are refered to the active reference system.
%
% Example: |\symmetrize{\numberPI}|
%
% \myDescribeMacro*\radiansangles
% declares that angles are measured in radians (default).
%
% \myDescribeMacro*\degreesangles
% declares that angles are measured in degrees.
% 
% \myDescribeMacro*\cartesianreference
% declares Cartesian coordinates (default).
% 
% \myDescribeMacro*\polarreference
% declares polar coordinates.
%
% \myDescribeMacro\polarcoor\parg{radius,angle}\parg{x,y}
% changes from polar to Cartesian coordinates.
%
% \subsection{The \environ{Picture} environment}
%
% \myDescribeEnv{Picture}\oarg{color}\parg{x0,y0}\parg{x1,y1}
% starts a picture, refered to rectangle 
% $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$.
% If optional argument is present, background is colored with 
% this \textit{color}. By default, background is not colored.
% 
% Coordinates are refered to the active reference system and are always 
% Cartesian coordinates.
%
% Example: |\begin{Picture}[black!10!white](-3.5,-4)(3.5,4)|
%
% \myDescribeEnv{xpicture}
% is an alias for \cs{begin\{Picture\}}.
%
% Example: |\begin{xpicture}[black!10!white](-3.5,-4)(3.5,4)|
%
% \myDescribeMacro*{\draftPictures}
% disables |Picture| commands, showing only the picture area.
%
% Example: |\begin{xpicture}[black!10!white](-3.5,-4)(3.5,4)|
%
% \subsection{Cartesian and polar coordinate axes and grids}
%
% \myDescribeMacro{\cartesianaxes}\parg{x0,y0}\parg{x1,y1}
% draws the coordinate axes corresponding to the
% $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$ rectangle.
%
% Example: |\cartesianaxes(-3.25,-4.5)(3.25,4.25)|
%
% \myDescribeMacro{\cartesiangrid}\parg{x0,y0}\parg{x1,y1}
% draws a coordinate grid corresponding to the
% $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$ rectangle.
%
% Example: |\cartesiangrid(-3.25,-4.5)(3.25,4.25)|
%
% \myDescribeMacro{\polargrid}\marg{radius}\marg{circledivs}
% draws a polar grid. |radius| is the radius of the circle and |circledivs|
% (an integer) the number of angular divisions.
%
% Example: |\polargrid{3.5}{16}|
%
% \subsubsection{The style of the axes}
%
% \myDescribeMacro*{\axescolor} User can change the axes color
% by redefining the \cs{axescolor} declaration.
% 
% Example: |\renewcommand{\axescolor}{orange}| (default is \texttt{black}).
%
% \myDescribeMacro*{\axesthickness} Length determining the thickness of axes 
% (default \verb+1 pt+).
% 
% Example: |\setlength{\axesthickness}{1mm}|
%
% \myDescribeMacro*{\xunitdivisions} Number of subdivisions of
% the unit in the $x$ axis (must a  positive integer).
% 
% Example:|\renewcommand{\xunitdivisions}{5}|
% (default is \texttt{1}).
%
% \myDescribeMacro*{\yunitdivisions} Number of subdivisions of
% the unit in the $y$ axis (must a  positive integer).
% 
% Example:|\renewcommand{\yunitdivisions}{3}|
% (default is \texttt{1}).
% 
% \myDescribeMacro*{\runitdivisions} Number of subdivisions of
% the unit in the polar axis (must a  positive integer).
% 
% Example:|\renewcommand{\runitdivisions}{3}|
% (default is \texttt{1}).
% 
% \subsubsection{Axes position}
% 
% \myDescribeMacro*{\internalaxes}
% Cartesian axes lies on $y=0$ and $x=0$ (default).
%
% \myDescribeMacro*{\externalaxes}
% Cartesian axes lies on $y=\textit{y0}$ and $x=\textit{x0}$.
% 
% \subsubsection{Style of numerical labels}
%
% \myDescribeMacro*{\axeslabelcolor} 
% User can change the color of labels by redefining the 
% \cs{axeslabelcolor} declaration.
% 
% Example: |\renewcommand{\axeslabelcolor}{red}| 
% (default is equal to the axes color).
%
% \myDescribeMacro*{\axeslabelsize} 
% User can change the size of labels by redefining the 
% \cs{axeslabelsize} declaration.
% 
% Example: |\renewcommand{\axeslabelsize}{\tiny}| 
% (default is |\small|).
%
% \myDescribeMacro*{\axeslabelmathversion} 
% User can change the mathversion of labels by redefining the 
% \cs{axeslabelmathversion} declaration.
% 
% Example: |\renewcommand{\axeslabelmathversion}{bold}| 
% (default is |normal|).
%
% \myDescribeMacro*{\axeslabelmathalphabet} 
% User can change the math alphabet of labels by redefining the 
% \cs{axeslabelmathalphabet} declaration.
% 
% Example: |\renewcommand{\axeslabelmathalphabet}{\mathsf}| 
% (default is |\mathrm|).
%
% \myDescribeMacro*{\radianspolarlabels}
% when this declaration is active, angular labels in polar grids are printed
% in radians (default).
%
% \myDescribeMacro*{\degreespolarlabels}
% when this declaration is active, angular labels in polar grids are printed
% in degrees.
% 
% \myDescribeMacro*{\axislabelsep}
% Distance between tags and cut marks, measured in \cs{unitlength} units;
% the distance between axes and tags equals \cs{ticssize}$+$\cs{axislabelsep}.
% (see description of \cs{makenotics}).
% 
% Example: |\renewcommand{\axislabelsep}{0.3}| 
% (default is |0.1|).
%
% \subsubsection{Position of numerical labels}
%
% \myDescribeMacro{\xlabelpos}\marg{position}
% Relative position of labels in $x$ axis.
% 
% Example: |\xlabelpos{t}| 
% (default is |-90|).
%
% \myDescribeMacro{\ylabelpos}\marg{position}
% Relative position of labels in $y$ axis.
% 
% Example: |\ylabelpos{tl}| 
% (default is |180|).
%
% \subsubsection{Style of cut marks}
%
% \myDescribeMacro*{\ticssize}
% half the length of main axes cuts.
% 
% Example: |\setlength{\ticssize}{3mm}|
% (default is |4pt|)
%
% \myDescribeMacro*{\secundaryticssize}
% half the length of secundary axes cuts.
% 
% Example: |\setlength{\secunadryticssize}{1mm}|
% (default is |2pt|)
%
% \myDescribeMacro*{\ticsthickness}
% thickness of the marks on axes.
% 
% Example: |\setlength{\ticsthickness}{0.5pt}|
% (default is |1pt|)
%
% \myDescribeMacro*{\ticscolor}
% User can change the color of tics by redefining the 
% \cs{ticscolor} declaration.
% 
% Example: |\renewcommand{\ticscolor}{lightgray}|
% (default is |black|)
%
% \subsubsection{Grid style}
%
% \myDescribeMacro*{\gridthickness}
% thickness of the main grid lines.
% 
% Example: |\setlength{\gridthickness}{1pt}|
% (default is |0.4pt|)
%
% \myDescribeMacro*{\secundarygridthickness}
% thickness of the secundary grid lines.
% 
% Example: |\setlength{\gridthickness}{0.25pt}|
% (default is |0.2pt|)
%
% \myDescribeMacro*{\gridcolor}
% User can change the color of main grid lines by redefining the 
% \cs{ticscolor} declaration.
% 
% Example: |\renewcommand{\gridcolor}{blue}|
% (default is |gray|)
%
% \myDescribeMacro*{\secundarygridcolor}
% User can change the color of secundary grid lines by redefining the 
% \cs{ticscolor} declaration.
% 
% Example: |\renewcommand{\secundarygridcolor}{blue}|
% (default is |lightgray|)
%
% \subsubsection{Removing cut marks, labels and grids}
% \myDescribeMacro*{\maketics}
% when this declaration is active, divisions of axes are marked (default).
% 
% \myDescribeMacro*{\makenotics}
% when this declaration is active, divisions of axes are not marked.
%
% In this case, the distance between axes and tags equals \cs{axislabelsep}.
%
% \myDescribeMacro*{\makelabels}
% when this declaration is active, numerical labels are printed (default).
%
% \myDescribeMacro*{\makenolabels}
% when this declaration is active, numerical labels are not printed.
%
% \myDescribeMacro*{\makenogrid}
% If the \cs{makenogrid} declaration is active,
% then \cs{cartesianaxes} plots only the axes (default).
%
% \myDescribeMacro*{\makegrid}
% If the \cs{makegrid} declaration is active,
% then \cs{cartesianaxes} plots a Cartesian grid.
% 
% In this case, \cs{cartesianaxes} is equivalent to \cs{cartesiangrid}.
% 
% \subsection{Directly printing cuts and labels}
%
% \myDescribeMacro{\plotxtic}\marg{x-coor} 
% plot a tic for the given $x$ coordinate.
%
% \myDescribeMacro{\plotytic}\marg{y-coor} 
% plot a tic for the given $y$ coordinate.
%
% \myDescribeMacro{\printxlabel}\marg{x-coor}\marg{label} 
% print the required label at the given $x$ coordinate.
%
% \myDescribeMacro{\printylabel}\marg{y-coor}\marg{label} 
% print the required label at the given $y$ coordinate.
%
% \myDescribeMacro{\printxticlabel}\marg{x-coor}\marg{label} 
% print a tic and the required label at the given $x$ coordinate.
%
% \myDescribeMacro{\printyticlabel}\marg{y-coor}\marg{label} 
% print a tic and  the required label at the given $y$ coordinate.
%
% \myDescribeMacro{\plotxtics}\marg{firstcoor}\marg{incr}\marg{bound} 
% plot several $x$ tics, from the initial coordinate \textit{firstcoor}; 
% \textit{incr} is the distance between consecutive tics, 
% and the last tic is not in a position greater than \textit{bound}.
%
% \myDescribeMacro{\plotytics}\marg{firstcoor}\marg{incr}\marg{bound} 
% plot several $y$ tics, from the initial coordinate \textit{firstcoor}; 
% \textit{incr} is the distance between consecutive tics, 
% and the last tic is not in a position greater than \textit{bound}.
%
% \myDescribeMacro{\printxlabels}%
% \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound} 
% print several $x$ labels, from the initial coordinate \textit{firstcoor}; 
% \textit{incr} is the distance between consecutive label positions, 
% and the last position is not greater than \textit{bound}. 
% The optional argument \textit{digits} is the number of decimal 
% digits to be printed 
% (by default, numbers are printed with its natural number of decimals).
% \myDescribeMacro{\printylabels}%
% \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
% print several $x$ labels, from the initial coordinate \textit{firstcoor}; 
% \textit{incr} is the distance between consecutive label positions, 
% and the last position is not greater than \textit{bound}. 
% The optional argument \textit{digits} is the number of decimal 
% digits to be printed 
% (by default, numbers are printed with its natural number of decimals).
%
% \myDescribeMacro{\printxticslabels}%
% \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
% print $x$ tics and labels simultaneously.
%
% \myDescribeMacro{\printyticslabels}%
% \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound} 
% print $y$ tics and labels simultaneously.
%
% \subsection{\cs{put} and \cs{multiput} extensions}
% 
% \myDescribeMacro{\cPut}\marg{position}\parg{x,y}\marg{object}
% \myDescribeMacro{\rPut}\starred\marg{position}\parg{x,y}\marg{object}
% \myDescribeMacro{\Put}\starred\oarg{position}\parg{x,y}\marg{object}
%
% draw \textit{object} in point \Parg{x,y}.
% Argument \textit{position} fixes the precise position of \textit{object}
% with respect \Parg{x,y}.
%
% In starred versions objects positioned below the reference point
% are aligned at a fixed vertical distance (normally, by the baseline).
% User must decide which is that amount (normally the higher object 
% to be positioned), and introduce it as an argument of
% the \cs{highestlabel} declaration.
%
% Example: |\Put*[SSE](1,2){\Ellipse{2}{3}}|
% 
% \medskip
%
% Argument \textit{position} supports the following values:
% \begin{description}
% \item[An integer or decimal number,] determining the angle (in degrees)
% where \textit{object} is placed,
% (with respect to the reference point \Parg{x,y}).
% \item[Letter \texttt{c}]
% which places the center of \textit{object} at
% \Parg{x,y}).
% \item[Letter or letter combinations \texttt N, \texttt E, \texttt S, 
% \texttt W,
% \texttt{NE}, \texttt{SE}, \texttt{SW}, \texttt{NW},
% \texttt{NNE}, \texttt{ENE}, \texttt{ESE}, \texttt{SSE}, \texttt{SSW},%
% \texttt{WSW}, \texttt{WNW}, 
% \texttt{NNW}]
% Abbreviation of \emph{North}, \emph{East}\ldots,  \emph{North-East}\ldots,  
% \emph{North-North-East}\ldots
% \item[Letter o letter combinations  \texttt t, \texttt  r, \texttt  b,%
% \texttt  l,
% \texttt{tr}, \texttt{br}, \texttt{bl}, \texttt{tl},
% \texttt{ttr}, \texttt{rtr}, \texttt{rbr}, \texttt{bbr}, \texttt{bbl},% 
% \texttt{lbl}, \texttt{ltl}, 
% \texttt{ttl}]
% Abbreviation of \emph{top}, \emph{right}\ldots,  \emph{top-right}\ldots,  
% \emph{top-top-right}\ldots 
% 
% \end{description}
% Without optional argument \textit{position} (in command \cs{Put})
% the reference point of \textit{object} is placed at 
% \Parg{x,y})
% (in a similar way to the \cs{put} command).
%
% \myDescribeMacro*{\Pictlabelsep} 
% determines the distance between the graphical object and the given point.
% User can redefine this declaration by typing
% \cs{renewcommand}\cs{Pictlabelsep}\marg{number}.
% This number is interpreted as an amount of |\unitlength|.
%
% Example: |\renewcommand{\Pictlabelsep}{1}| (default is |0.1|).
%
% This distance is understood either as the Euclidean (circular) distance, 
% derived from the $2$-norm,
% or as the distance derived from the $\infty$-norm (rectangular distance),
% following these rules:
% \begin{itemize}
% \item If argument \textit{position} is a \textit{compass} argument 
% (like \texttt N or \texttt{SSW}), then circular distance is used.
% \item If argument \textit{position} is like \texttt t, \texttt{bbl},\ldots
% then rectangular distance is used.
% In all other cases, |\cPut| uses circular distance, 
% |\rPut| uses rectangular distance and |\Put| uses distance established
% by \cs{defaultPut}.
% \end{itemize}
%
% \myDescribeMacro{\defaultPut}\marg{position}
% fixes the default position for \cs{Put}, \cs{multiPut} and \cs{multiPlot}
% commands. Argument \textit{position} can be \texttt c or \texttt r.
%
% Example: |\defaultPut{r}| (default is \texttt c).
%
% \myDescribeMacro{\highestlabel}\marg{text} declares the highest label to be
% equal to height of \textit{text}.
%
% Example: |\highestlabel{\Huge A}| (default is |\normalfont\normalsize$1$|)
% 
% \myDescribeMacro{\multicPut}
% \marg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
% \myDescribeMacro{\multirPut}\starred
% \marg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
% \myDescribeMacro{\multiPut}\starred
% \oarg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
%
% put \textit{n} copies of \textit{object} in \textit{position}
% at points 
% $(\textit{x0},\textit{y0})$, $(\textit{x0}+\Delta x,\textit{y0}+\Delta y)$,
% $(\textit{x0}+2\Delta x,\textit{y0}+2\Delta y)$, \ldots, 
% $(\textit{x0}+(\textit n-1)\Delta x,\textit{y0}+(\textit n-1)\Delta y)$.
%  
% Example: |\multicPut{c}(1,2)(1,-1){4}{\xVECTOR(0,0)(1,1)}|
% 
% \myDescribeMacro{\multicPlot}
% \marg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
% 
% \myDescribeMacro{\multirPlot}\starred
% \marg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
% 
% \myDescribeMacro{\multiPlot}\starred
% \oarg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
% 
% put $\textit{n}+1$ copies of \textit{object} at points 
% \Parg{x0,y0},
% \Parg{x1,y1},\ldots,
% \Parg{xn,yn}
%  
% Example: |\multirPlot{c}{\xVECTOR(0,0)(1,1)}(1,2)(2,1)(3,0)(4,-1)|
% 
% \subsection{Drawing lines, vectors and polylines}
% 
% \subsubsection{Lines and vectors}
% 
% \myDescribeMacro{\xLINE}\parg{x0,y0}\parg{x1,y1}
% draws a stright line between points \Parg{x0,y0}
% and  \Parg{x1,y1}.
%
% Example: |\xLINE(1,-2)(0,3)|.
% 
% \myDescribeMacro{\xVECTOR}\parg{x0,y0}\parg{x1,y1}
% draws an arrow from point \Parg{x0,y0}
% to point \Parg{x1,y1}.
%
% Example: |\xVECTOR(1,-2)(0,3)|.
% 
% \myDescribeMacro{\xtrivVECTOR}\parg{x0,y0}\parg{x1,y1}
% draws an arrow from point \Parg{x0,y0}
% to point \Parg{x1,y1}.
% The arrowhead consists of two lines, controled by the |\arrowsize| 
% declaration.
%
% Example: |\xtrivVECTOR(1,-2)(0,3)|.
% 
% \myDescribeMacro{\xline}\parg{x,y}\marg{size}
% \myDescribeMacro{\xvector}\parg{x,y}\marg{size}
% \myDescribeMacro{\xtrivvector}\parg{x,y}\marg{size}
%
% draw lines, vectors and triv vectors with the standard \LaTeX{} syntax,
% but without any restriction.
% 
% Example: |\Put(1,-2){\xline(-1,5){1}}|
% 
% \myDescribeMacro{\zerovector}\parg{x,y}
% \myDescribeMacro{\zerotrivvector}\parg{x,y}
% 
% draw a zero-length vector (an arrowhead) in direction 
% \Parg{x,y}.
% 
% Example: |\Put(0,3){\zerovector(-1,5)}|
%
% \myDescribeMacro\arrowsize\marg{xlen}\marg{ylen}
% declares dimensions of triv arrowhead: |xlen|\,pt is its length, and
%  |ylen|\,pt is half of its aperture.
% 
% Example: |\arrowsize{4}{2}| (default is |xlen=5|, |ylen=2|)
% 
% \subsubsection{Polylines and polygons}
% 
% \myDescribeMacro{\Polyline}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
% draws a polyline with vertices 
% \Parg{x0,y0}\Parg{x1,y1}\ldots\Parg{xn,yn}.
% 
% Example: |\Polyline(1,1)(2,0)(0,-1)|
% 
% \myDescribeMacro{\Polygon}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
% draws a polygon with vertices 
% \Parg{x0,y0}\Parg{x1,y1}\ldots\Parg{xn,yn}.
% 
% Example: |\Polygon(1,1)(2,0)(0,-1)|
% 
% \myDescribeMacro{\regularPolygon}\oarg{angle}\marg{radius}\marg{sides}
% draws a regular polygon with the given \textit{radius} and \textit{sides}.
% The optional argument (zero, by default) determines the inclination angle 
% of the first vertex, always measured in degrees.
% 
% Example: |\regularPolygon[90]{4}{7}|
% 
% \subsection{Drawing curves}
% \subsubsection{Conic sections and arcs}
% 
% \myDescribeMacro{\Circle}\marg{r}
% draws the circle $x^2+y^2=\textit{r}^2$.
% 
% Example: |\Circle{2.5}|
% 
% \myDescribeMacro{\Ellipse}\marg{a}\marg{b}
% draws the ellipse 
% $\displaystyle\frac{x^2}{\textit{a}^2}+\frac{y^2}{\textit{b}^2}=1$.
% 
% Example: |\Ellipse{2}{3}|
% 
% \myDescribeMacro{\Hyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
% draws the hyperbola 
% $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
% 
% Variables $x$ and $y$ are limited, respectively,
% to the $[-\textit{xmax},\textit{xmax}]$ and 
% $[-\textit{ymax},\textit{ymax}]$  intervals.
% This curve is well defined if the parameter \textit{xmax}
% is greater than \textit{a}. Otherwise, \package{xpicture} returns an error 
% message and does not draw any curve.
%
% Example: |\Hyperbola{2}{3}{5}{5}|
% 
% \myDescribeMacro{\rHyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
% draws the \emph{right} branch of hyperbola 
% $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
%
% (parameters are restricted as in |\Hyperbola|). 
%
% Example: |\rHyperbola{2}{3}{5}{5}|
% 
% \myDescribeMacro{\lHyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
% draws the \emph{left} branch of hyperbola 
% $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
%
% (parameters are restricted as in |\Hyperbola|). 
%
% Example: |\rHyperbola{2}{3}{5}{5}|
% 
% \myDescribeMacro{\Parabola}\marg{a}\marg{xmax}\marg{ymax}
% draws the parabola $x=ay^2$.
% 
% Variable $x$ is limited, respectively,
% to the $[0,\textit{xmax}]$ (if \textit{a} is positive) 
% or $[-\textit{xmax},0]$ (if negative) interval.
% $[-\textit{ymax},\textit{ymax}]$  intervals.
%
% Example: |\Parabola{2}{5}{5}|
% 
% \myDescribeMacro{\circularArc}\marg{r}\marg{angle1}\marg{angle2}
% draws the arc of circle 
% $x=r\cos t,y=r\sin t,\ t\in[\textit{angle1},\textit{angle2}]$
% (the arc of the circle centered at $(0,0)$ with radius $\textit{r}$
% and limited between $\textit{angle1}$ and $\textit{angle2}$).
%
% Example: |\circularArc{3}{0}{\numberSIXTHPI}|
% 
% \myDescribeMacro*{\xArc} is an alias for \cs{circularArc}.
%
% Example: |\xArc{3}{0}{\numberSIXTHPI}|
%  
% \myDescribeMacro{\ellipticArc}\marg{a}\marg{b}\marg{angle1}\marg{angle2}
% draws the arc of ellipse 
% $x=a\cos t,y=b\sin t,\ t\in[\textit{angle1},\textit{angle2}]$
% (the arc of the ellipse centered at $(0,0)$ with semiaxes 
% $\textit{a}$ and $\textit{b}$
% and limited between $\textit{angle1}$ and $\textit{angle2}$).
%
% Example: |\ellipticArc{2}{3}{-\numberSIXTHPI}{\numberSIXTHPI}|
%  
% \myDescribeMacro{\rhyperbolicArc}\marg{a}\marg{b}\marg{y0}\marg{y1}
% draws the right arc of hyperbola
% $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$
% included between
% $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
%
% Example: |\rhyperbolicArc{2}{3}{-2}{2}|
%   
% \myDescribeMacro{\lhyperbolicArc}\marg{a}\marg{b}\marg{y0}\marg{y1}
% draws the left arc of hyperbola
% $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$
% included between $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
%
% Example: |\lhyperbolicArc{2}{3}{-2}{2}|
%   
% \myDescribeMacro{\parabolicArc}\marg{a}\marg{y0}\marg{y1}
% Draw the arc of the parabola $x=ay^2$ included between 
% $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
%
% Example: |\parabolicArc{2}{-2}{2}|
%
% \myDescribeMacro{\defaultplotdivs}\marg{divisions} 
% declares the number of subintervals we divide the domain of curves 
% when plotting conic arcs.
% 
% Example: |\defaultplotdivs{16}| (default is |8|).
% 
% \subsubsection{Real variable functions}
% 
% \myDescribeMacro{\PlotFunction}
% \oarg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
% draws the graph of function \cs{functionname}$(t)$, 
% $t\in[\textit{t0},\textit{t1}]$.
% This interval is partitioned in \textit{n} subintervals (default for
% \textit{n} is |2|).
% 
% Example: |\PlotFunction[16]{\COSfunction}{-\numberTWOPI}{\numberTWOPI}|
% 
% \myDescribeMacro{\PlotPointsOfFunction}
% \marg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
% draws $\textit{n}+1$ points of the graph of function \cs{functionname}$(t)$,
% $t\in[\textit{t0},\textit{t1}]$.
% 
% Example: |\PlotPointsOfFunction{20}{\SQRTfunction}{0}{4}|
% 
% \myDescribeMacro*{\pointmarkdiam}
% is the size of points printed by |\PlotPointsOfFunction|, measured in
% |\unitlength| units. It may be
% redefined with a |\renewcommand| declaration.
% 
% Example: |\renewcommand{\pointmarkdiam}{0.3}|
% 
% \myDescribeMacro*{\pointmark}
% is the symbol printed at every point by |\PlotPointsOfFunction|. It may be
% redefined with a |\renewcommand| declaration.
% 
% Example: |\renewcommand{\pointmark}{$\diamond$}|
% 
% \subsubsection{Parametrically defined curves}
% 
% \myDescribeMacro{\PlotParametricFunction}
% \oarg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
% draws the graph of parametric curve \cs{functionname}$(t)$, 
% $t\in[\textit{t0},\textit{t1}]$.
% This interval is partitioned in \textit{n} subintervals (default for
% \textit{n} is |2|).
% 
% Example: |\ParametricFunction{\F}{\SQUAREfunction}{CUBEfunction}|
% \\
% \phantom{Example:} |\PlotParametricFunction[15]{\F}{-2}{2}|
% 
% \subsubsection{Drawing curves from a table of values}
% 
% \myDescribeMacro{\qCurve}\parg{x0,y0}\parg{u0,v0}\parg{x1,y1}\parg{u1,v1}
% draws the quadratic curve between points \textit{x0,y0} and \textit{x1,y1}
% with tangent vectors \textit{u0,v0} nd \textit{u1,v1}. 
% 
% Example: |\qCurve(1,2)(1,2)(4,3)(-1,1)|
%
% \myDescribeMacro{\PlotQuadraticCurve}
% \parg{x0,y0}\parg{u0,v0}\parg{x1,y1}\parg{u1,v1}\ldots%
% \parg{xn,yn}\parg{un,vn}
%
% draws a curve through the points
% \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn}
% with tangent vectors
% \parg{u0,v0}, \parg{u1,v1},\ldots, \parg{un,vn}.
% 
% Example:
% |\PlotQuadraticCurve(1,0)(1,0)(0,1)(0,1)(-1,0)(-1,0)(0,-1)(0,-1)|
% 
% \myDescribeMacro{\PlotQuadraticCurve}
% \parg{x0,y0}\marg{angle0}\parg{x1,y1}\marg{angle1}\ldots
% \parg{xn,yn}\marg{anglen}
% 
% draws a curve through the points
% \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn}
% the inclination angles of which, with respect to the $x$ axis,
% are \textit{{angle0}, \textit{angle1}}\dots,
% \textit{anglen} (always measured in degrees).
%
% Example:
% |\PlotQuadraticCurve(1,0){0}(0,1){90}(-1,0){180}(0,-1){270}}|
% \StopEventually{} 
%
% \myDescribeMacro{\PlotxyDyData}
% \parg{x0,y0,Dy0}\parg{x1,y1,Dy1}\ldots\parg{xn,yn,Dyn}
% draws a curve through the points
% \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn} 
% with derivatives \textit{Dy0}, \textit{Dy1}, \ldots, \textit{Dyn}.
% \section{Implementation}
%    \begin{macrocode}
%<*xpicture>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xpicture}[2012/12/17 v.1.2a picture environment extensions]
%    \end{macrocode}
% \subsection{Package options}
% If the |draft| option is selected, 
% |Picture| environments are shown
% as a rectangular frame and |xpicture| commands are ignored
% (Boolean |draft| controls whether this option has been selected).
%    \begin{macrocode}
\newif\ifdraft\draftfalse
\DeclareOption{draft}{\drafttrue}
%    \end{macrocode}
% All other options are passed to packages |curve2e| and |xcolor|
% (Old options |dvi|, |pict2e| and |curve2e| have been removed in 
% version 1.2a).
%    \begin{macrocode}
\DeclareOption*{%
   \PassOptionsToPackage{\CurrentOption}{curve2e}
    \PassOptionsToPackage{\CurrentOption}{xcolor}}
\ProcessOptions
%    \end{macrocode}
% \subsection{Booleans for some command options}
% Booleans used by several declarations  
% controlling the behavior of some |xpicture| commands.
% \begin{macro}{\ifpolar}
% True: polar coordinates. False: Cartesian coordinates.
%    \begin{macrocode}
\newif\ifpolar\polarfalse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifrputstar}
% True: |\rPut| starred.
%    \begin{macrocode}
\newif\ifrputstar\rputstarfalse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifdegrees}
%  True: angles mesured in degrees. False: arcs mesured in radians.
%    \begin{macrocode}
\newif\ifdegrees\degreesfalse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\iftics}
% True: coordinate axes include tic marks.
%    \begin{macrocode}
\newif\iftics\ticstrue
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\iflabels}
% True: coordinate axes include numeric labels.
%    \begin{macrocode}
\newif\iflabels\labelstrue
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifgrid}
%  True: Cartesian grids.
%    \begin{macrocode}
\newif\ifgrid\gridfalse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifticslabelsgrid}
% True: Tics, labels or grid must be printed.
%    \begin{macrocode}
\newif\ifticslabelsgrid\ticslabelsgridfalse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifinzeroaxes}
% True: Representation of axes passes through the origin (internal axes). 
% False: external axes.
%    \begin{macrocode}
\newif\ifinzeroaxes\inzeroaxestrue
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifbg}
% True: Background will be colored. 
%    \begin{macrocode}
\newif\ifbg\bgfalse
%    \end{macrocode}
% \end{macro}
% \subsection{Required packages}
%    \begin{macrocode}
\RequirePackage{curve2e}
\RequirePackage{xcolor}
\RequirePackage{calculus}
%    \end{macrocode}
% \subsection{Error, Warning and Info messages}
%    \begin{macrocode}
\def\xpct@Warnbadpos{%
      \PackageWarning{xpicture}%
        {Argument in \noexpand\defaultPut command must be either
        'c' or 'r'\MessageBreak
         I will no change the default position for 
         \noexpand\Put commands}}
\def\xpct@Infopos#1{%
      \PackageInfo{xpicture}%
        {Default position for \noexpand\Put commands changed to #1}}                  
\def\xpct@WarnIncSys(#1,#2)(#3,#4){%
      \PackageWarning{xpicture}{%
           Incompatible linear system!\MessageBreak
           Tangent lines are parallel}}                                            
\def\xpct@ErrHypCons{%
       \PackageError{xpicture}{%
        Inconsistent parameters in \noexpand\Hyperbola command}{%
        The first and second parameters in a \noexpand\Hyperbola 
        command\MessageBreak
        must be, respectively, lesser than the third and 
        the fourth ones.}}                          
\def\xpct@Infocfg{\PackageInfo{xpicture}{%
          Loading local configuration file xpicture.cfg}}
\def\xpct@Infonocfg{\PackageInfo{xpicture}{%
          Local configuration file xpicture.cfg does not exists}}
%    \end{macrocode}
% \subsection{Internal counters and lengths and a special number}
% Counters |xpct@counta| and |xpct@countb| will be used by several
% internal commands (mainly in |while| clauses).
% |xpct@step| is used when iterating functions plots, and
% |multiput| by commands extending the |\multiput| command.
%    \begin{macrocode}
\newcounter{xpct@counta}
\newcounter{xpct@countb}
\newcounter{xpct@step}
\newcounter{multiput}
%    \end{macrocode}
% \begin{macro}{\xpct@bxw}
% \begin{macro}{\xpct@bxh}
% Width and height of certain boxes. 
%    \begin{macrocode}
\newdimen\xpct@bxw
\newdimen\xpct@bxh
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@maxnum}
% The largest \TeX{} number. 
%    \begin{macrocode}
\def\xpct@maxnum{16383.99998}
%    \end{macrocode}
% \end{macro}
% \subsection{Declarations and parameters controlling axes style}
% \begin{macro}{\makenotics}
% \begin{macro}{\maketics}
% \begin{macro}{\makenolabels}
% \begin{macro}{\makelabels}
% \begin{macro}{\makegrid}
% \begin{macro}{\makenogrid}
% \begin{macro}{\externalaxes}
% \begin{macro}{\internalaxes}
% Four pairs of alternative declarations, switching booleans
% |\iftics|, |\iflabels|, |\ifgrid|, and |\ifinzeroaxes|.
% Defaults are |\maketics|,  |\makelabels|, |\makenogrid|,
% and  |\internalaxes|.
%    \begin{macrocode}
\def\makenotics{\ticsfalse}
\def\maketics{\ticstrue}
\def\makenolabels{\labelsfalse}
\def\makelabels{\labelstrue}
\def\makenogrid{\gridfalse}
\def\makegrid{\gridtrue}
\def\externalaxes{\inzeroaxesfalse}
\def\internalaxes{\inzeroaxestrue}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\axesthickness}
% Thickness of axes (it is a length).
%    \begin{macrocode}
\newdimen\axesthickness
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@axeslabelattrib}
% Attributes of labels. It is a private declaration, because you can select
% attributes (size, color and mathversion) of labels independently.
%    \begin{macrocode}
\def\xpct@axeslabelattrib{\axeslabelsize%
       \pictcolor{\axeslabelcolor}%
       \mathversion{\axeslabelmathversion}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ticsthickness}
% \begin{macro}{\ticssize}
% \begin{macro}{\secundaryticssize}
% \begin{macro}{\gridthickness}
% \begin{macro}{\secundarygridthickness}
% Thickness and size of tics and grid lines.
%    \begin{macrocode}
\newdimen\ticsthickness
\newdimen\ticssize
\newdimen\secundaryticssize
\newdimen\gridthickness
\newdimen\secundarygridthickness
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsection{Color selection}
% \begin{macro}{\pictcolor}
% Declaration |\pictcolor| supresses  spureus spaces when selecting color.
%    \begin{macrocode}    
\def\pictcolor{\@killglue\color}
%    \end{macrocode}
% \end{macro}
% \subsection{Reference systems}
% \begin{macro}{\standardreferencesystem}
% Declaration to select the standard reference system.
%    \begin{macrocode}
\def\standardreferencesystem{\referencesystem(0,0)(1,0)(0,1)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\referencesystem}
% \begin{macro}{\changereferencesystem}
% \begin{macro}{\xpct@xorigin}
% \begin{macro}{\xpct@yorigin}
% \begin{macro}{\xpct@xI}
% \begin{macro}{\xpct@yI}
% \begin{macro}{\xpct@xII}
% \begin{macro}{\xpct@yII}
% |\referencesystem| changes to the affine reference centered
% in P|(#1,#2)| with directions |(#3,#4)| and |(#5,#6)|.
% These six numbers are stored in 
% |\xpct@xorigin|, |\xpct@yorigin|, 
% |\xpct@xI|, |\xpct@yI|, |\xpct@xII|, and |\xpct@yII|.
%    \begin{macrocode}
\def\referencesystem(#1,#2)(#3,#4)(#5,#6){%
       \COPY{#1}\xpct@xorigin
       \COPY{#2}\xpct@yorigin
       \COPY{#3}\xpct@xI
       \COPY{#4}\xpct@yI
       \COPY{#5}\xpct@xII
       \COPY{#6}\xpct@yII}
%    \end{macrocode}
% The |\changereferencesystem| changes from the active reference system.
%    \begin{macrocode} 
\def\changereferencesystem(#1)(#2)(#3){%
       \refsysPoint(#1)(\xpct@newx,\xpct@newy)
       \refsysVector(#2)(\xpct@newux,\xpct@newuy)
       \refsysVector(#3)(\xpct@newvx,\xpct@newvy)
       \referencesystem(\xpct@newx,\xpct@newy)(\xpct@newux,\xpct@newuy)%
       (\xpct@newvx,\xpct@newvy)}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\translateorigin}
% \begin{macro}{\rotateaxes}
% \begin{macro}{\symmetrize}
% Translations and orthogonal changes (rotations and symmetries)
% of reference system.
%    \begin{macrocode}
\def\translateorigin(#1){\changereferencesystem(#1)(1,0)(0,1)}
\def\rotateaxes#1{%
       \ifdegrees\DEGREESCOS{#1}\xpct@cosine\DEGREESSIN{#1}\xpct@sine
       \else\COS{#1}\xpct@cosine\SIN{#1}\xpct@sine\fi
       \changereferencesystem%
          (0,0)(\xpct@cosine,\xpct@sine)(-\xpct@sine,\xpct@cosine)}
%    \end{macrocode}
%    \begin{macrocode}
\def\symmetrize#1{%
       \MULTIPLY{2}{#1}{\xpct@sym}
       \ifdegrees
          \DEGREESCOS{\xpct@sym}\xpct@cosine\DEGREESSIN{\xpct@sym}\xpct@sine
       \else
          \COS{\xpct@sym}\xpct@cosine\SIN{\xpct@sym}\xpct@sine\fi
       \changereferencesystem%
          (0,0)(\xpct@cosine,\xpct@sine)(\xpct@sine,-\xpct@cosine)}
%    \end{macrocode}
% \end{macro} 
% \end{macro} 
% \end{macro} 
% \subsection{Coordinates}
% \begin{macro}{\refsysxyVector}
% \begin{macro}{\refsysxyPoint}
% Canonical coordinates of a point or vector given in Cartesian coordinates
% (change from the active r.s. to the standard one).
%    \begin{macrocode}    
\def\refsysxyVector(#1)(#2,#3){%
       \MATRIXVECTORPRODUCT%
          (\xpct@xI,\xpct@xII;\xpct@yI,\xpct@yII)(#1)(#2,#3)}
\def\refsysxyPoint(#1)(#2,#3){%
       \MATRIXVECTORPRODUCT(\xpct@xI,\xpct@xII;\xpct@yI,\xpct@yII)(#1)(#2,#3)
       \VECTORADD(#2,#3)(\xpct@xorigin,\xpct@yorigin)(#2,#3)} 
%    \end{macrocode}
% \end{macro} 
% \end{macro}
% \begin{macro}{\refsyspVector}
% \begin{macro}{\refsyspPoint}
% Canonical coordinates of a point or vector given in polar coordinates.
%    \begin{macrocode}
\def\refsyspVector(#1,#2)(#3,#4){%
      \polarcoor(#1,#2)(\xpct@polarx,\xpct@polary)
      \refsysxyVector(\xpct@polarx,\xpct@polary)(#3,#4)}
\def\refsyspPoint(#1,#2)(#3,#4){%
      \polarcoor(#1,#2)(\xpct@polarx,\xpct@polary)
      \refsysxyPoint(\xpct@polarx,\xpct@polary)(#3,#4)}
%    \end{macrocode}
% \end{macro} 
% \end{macro}
% \begin{macro}{\cartesianreference}
% \begin{macro}{\polarreference}
% Alternative declarations to switch between Cartesian or polar coordinates.
% 
% \noindent In fact, they define |\refsysVector|/|\refsysPoint| to be
%  |\refsysxyVector|/|\refsysxyPoint| or  |\refsyspVector|/|\refsyspPoint|.
%    \begin{macrocode}
\def\cartesianreference{%
       \def\refsysVector{\refsysxyVector}%
       \def\refsysPoint{\refsysxyPoint}\polarfalse}
\def\polarreference{%
       \def\refsysVector{\refsyspVector}%
       \def\refsysPoint{\refsyspPoint}\polartrue}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\polarcoor}
% |\polarcoor| changes from polar to rectangular coordinates.
%    \begin{macrocode}
\def\polarcoor(#1,#2)(#3,#4){%
       \ifdegrees\DEGREESCOS{#2}{\xpct@Px}\DEGREESSIN{#2}{\xpct@Py}
       \else\COS{#2}{\xpct@Px}\SIN{#2}{\xpct@Py}\fi
       \MULTIPLY{\xpct@Px}{#1}{#3}
       \MULTIPLY{\xpct@Py}{#1}{#4}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\degreesangles}
% \begin{macro}{\radiansangles}
% Switches to measure angles in degrees or radians.
%    \begin{macrocode}
\def\degreesangles{\degreestrue}
\def\radiansangles{\degreesfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \subsection{The \texttt{Picture} environment}
% \begin{environment}{Picture}
% |Picture| is an extension of |picture| to refer points to the
% active reference system. 
% It can take an optional argument (background color).
%    \begin{macrocode}
\def\Picture{\@ifnextchar[{\xpct@@Picture}{\xpct@Picture}}
%    \end{macrocode}
% \end{environment}
% \begin{macro}{\xpct@Picture}
% Compute the surrounding box and call |picture| with the appropriate 
% parameters. 
%    \begin{macrocode}
\def\xpct@Picture(#1,#2)(#3,#4){%
%    \end{macrocode}
% First, we determine the standard coordinates of the four vertices
%    \begin{macrocode}
       \refsysxyPoint(#1,#2)(\xpct@xzero,\xpct@yzero)
       \refsysxyPoint(#3,#4)(\xpct@xone,\xpct@yone)
       \refsysxyPoint(#1,#4)(\xpct@xtwo,\xpct@ytwo)
       \refsysxyPoint(#3,#2)(\xpct@xthree,\xpct@ythree)
%    \end{macrocode}
% Now we calculate the maximum and minimum |x| and |y| coordinates.
%    \begin{macrocode}       
       \MIN{\xpct@xzero}{\xpct@xone}{\xpct@xmin}
       \MIN{\xpct@xmin}{\xpct@xtwo}{\xpct@xmin}
       \MIN{\xpct@xmin}{\xpct@xthree}{\xpct@xmin}
       \MIN{\xpct@yzero}{\xpct@yone}{\xpct@ymin}
       \MIN{\xpct@ymin}{\xpct@ytwo}{\xpct@ymin}
       \MIN{\xpct@ymin}{\xpct@ythree}{\xpct@ymin}
       \MAX{\xpct@xzero}{\xpct@xone}{\xpct@xmax}
       \MAX{\xpct@xmax}{\xpct@xtwo}{\xpct@xmax}
       \MAX{\xpct@xmax}{\xpct@xthree}{\xpct@xmax}
       \MAX{\xpct@yzero}{\xpct@yone}{\xpct@ymax}
       \MAX{\xpct@ymax}{\xpct@ytwo}{\xpct@ymax}
       \MAX{\xpct@ymax}{\xpct@ythree}{\xpct@ymax}
%    \end{macrocode}
% Width and height (|xmax-xmin| and |ymax-ymin|) of the sorrounding box.
%    \begin{macrocode}
       \SUBTRACT{\xpct@xmax}{\xpct@xmin}{\xpct@pictwidth}
       \SUBTRACT{\xpct@ymax}{\xpct@ymin}{\xpct@pictheight}
%    \end{macrocode}
% Call |picture|.
%    \begin{macrocode}
          \begin{picture}(\xpct@pictwidth,\xpct@pictheight)(%
             \xpct@xmin,\xpct@ymin)
%    \end{macrocode}
% Fix highest label to normal 1.
%    \begin{macrocode}
          \highestlabel{\normalfont\normalsize$1$}
%    \end{macrocode}
% If option |draft| was selected, background is colored, 
% a surrounding rectangle is drawn and a centered label is printed.
%    \begin{macrocode}
          \ifdraft
            \colorlet{backgroundcolor}{lightgray}
            \xpct@backgrd
            \put(\xpct@xmin,\xpct@ymin){\line(1,0){\xpct@pictwidth}}
            \put(\xpct@xmin,\xpct@ymin){\line(0,1){\xpct@pictheight}}
            \put(\xpct@xmin,\xpct@ymax){\line(1,0){\xpct@pictwidth}}
            \put(\xpct@xmax,\xpct@ymin){\line(0,1){\xpct@pictheight}}
            \VECTORADD(\xpct@xmax,\xpct@ymax)(\xpct@xmin,\xpct@ymin)(%
            \xpct@xmed,\xpct@ymed)
            \SCALARVECTORPRODUCT{0.5}(\xpct@xmed,\xpct@ymed)(%
            \xpct@xmed,\xpct@ymed)
            \put(\xpct@xmed,\xpct@ymed){\makebox(0,0){\scshape xpicture}}
         \else
%    \end{macrocode}
% Finally, if required, we color the background.
%    \begin{macrocode}
            \ifbg\xpct@backgrd\fi
         \fi}
%    \end{macrocode}
% \end{macro}     
% \begin{macro}{\xpct@@Picture}
% Set background color to |#1|, swich boolean |\ifbg| 
% to true and call |\xpct@Picture|.
%    \begin{macrocode}
\def\xpct@@Picture[#1](#2,#3)(#4,#5){%
         \colorlet{backgroundcolor}{#1}%
         \bgtrue\xpct@Picture(#2,#3)(#4,#5)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@backgrd}
% Fill background with |backgroundcolor|. We use |pict2e| path commands.
%    \begin{macrocode}
\def\xpct@backgrd{\begingroup
                \pictcolor{backgroundcolor}
                \moveto(\xpct@xzero,\xpct@yzero)
                \lineto(\xpct@xthree,\xpct@ythree)
                \lineto(\xpct@xone,\xpct@yone)
                \lineto(\xpct@xtwo,\xpct@ytwo)
                \closepath\fillpath
            \endgroup}         
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\endPicture}
% Close |picture| environment.
%    \begin{macrocode}         
\def\endPicture{\end{picture}}
%    \end{macrocode}
% \end{macro}
% \begin{environment}{xpicture}
% |xpicture| is an alias for |Picture|.
%    \begin{macrocode}
\newenvironment{xpicture}{\begin{Picture}}{\end{Picture}}
%    \end{macrocode}
% \end{environment}
% \subsection{\cs{put} extensions}
% User's commands are |\cPut|, |\rPut|, and |\Put|. 
% |\rPut| and |\Put| have starred versions. Related commands are
% |\highestlabel| and |\defaultPut|.
% \begin{macro}{\cPut}
% |\cPut| puts the |#4| object in the |(#2,#3)| point at the |#1| position
% (circular version).
%    \begin{macrocode}
\def\cPut#1(#2,#3)#4{%
%    \end{macrocode}
% Select circular trigonometry and call |\xpct@PUT|.
%    \begin{macrocode}
       \COPY{0}{\xpct@CorRput}
       \xpct@PUT{#1}(#2,#3){#4}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\rPut} 
% \begin{macro}{\rPut*}
% |\rPut| puts the |#4| object in the |(#2,#3)| point at the |#1| position
% (rectangular version). 
% Call |\xpct@rPut| (ordinary) or |\xpct@rPutstar| (starred).
%    \begin{macrocode}
\def\rPut{\@ifstar
             \xpct@rPutstar%
             \xpct@rPut%
             }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\Put}
% \begin{macro}{\Put*}
% |\Put| is equivalent to |\cPut| or |\rPut|, and has a starred form.
% Call |\xpct@Put| (ordinary) or |\xpct@Putstar| (starred).
%    \begin{macrocode} 
\def\Put{\@ifstar
            \xpct@Putstar%
            \xpct@Put%
        }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\defaultPut} 
% \begin{macro}{\xpct@defaultPut}
% |\defaultPut| is a declaration to fix default position (|c| or |r|) 
% for the |\Put| command. It defines |\xpct@defaultPut| to be
% |\rPut| or |\cPut|.
%    \begin{macrocode}
\def\defaultPut#1{\def\xpct@tempa{#1}\def\xpct@tempb{r}
       \ifx\xpct@tempa\xpct@tempb
          \xpct@Infopos#1
          \def\xpct@defaultPut{\rPut}
       \else
          \xpct@Infopos#1
          \def\xpct@tempc{c}
          \ifx\xpct@tempa\xpct@tempc
             \def\xpct@defaultPut{\cPut}
          \else
             \xpct@Warnbadpos
       \fi\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\highestlabel}
% The highest label for the starred |\Put| and |\rPut| commands.
% First we mesure the label, then we convert this length to |\unitlength|.
% This number is stored in |\xpct@rputmxhg|.
%    \begin{macrocode}
\def\highestlabel#1{\settoheight{\xpct@bxh}{#1}%
       \LENGTHDIVIDE{\xpct@bxh}{\unitlength}{\xpct@rputmxhg}}
%    \end{macrocode}
% \end{macro}
% Private commands. Main command is |\xpct@PUT|, all other commands are 
% intended to select appropiate geometry.
% \begin{macro}{\xpct@rPut}
% \begin{macro}{\xpct@rPutstar}
% We give the appropriate value to boolean |\rputstar|, select rectangular
% trigonometry and call |\xpct@PUT|.
%    \begin{macrocode}
\def\xpct@rPutstar{\rputstartrue\COPY{1}{\xpct@CorRput}\xpct@PUT}
\def\xpct@rPut{\rputstarfalse\COPY{1}{\xpct@CorRput}\xpct@PUT}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@Putstar}
% \begin{macro}{\xpct@Put}
% |\Put| can take an optional argument.
%    \begin{macrocode}
\def\xpct@Putstar{\@ifnextchar[{\xpct@@Putstar}{\xpct@@Put}}
\def\xpct@Put{\@ifnextchar[{\xpct@@@Put}{\xpct@@Put}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@@Putstar}
% \begin{macro}{\xpct@@Put}
% \begin{macro}{\xpct@@@Put}
% |\Put[pos]| is |\rPut*{pos}|  (for ``bl'' like pos),
%                   |\cPut{pos}| (for ``SW'' like pos) and
%                   |\defaultPut| pos otherwise.
% 
% |\Put*[pos]| is |\rPut*{pos}|  
%                   or |\cPut{pos}| (only for ``SW'' like pos).
%    \begin{macrocode}
\def\xpct@@Put(#1){\refsysPoint(#1)(\xpct@abscoorx,\xpct@abscoory)
       \put(\xpct@abscoorx,\xpct@abscoory)}
\def\xpct@@Putstar[#1](#2)#3{\xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
       \if\xpct@CorR c
          \cPut{#1}(#2){#3}
       \else
          \rPut*{#1}(#2){#3}
       \fi}
\def\xpct@@@Put[#1](#2)#3{\xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
       \if\xpct@CorR c
          \cPut{#1}(#2){#3}
       \else
          \if\xpct@CorR r
             \rPut{#1}(#2){#3}
          \else
             \xpct@defaultPut{#1}(#2){#3}
       \fi\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@PUT}
% This command puts object |#4| in |(#2,#3)| (active reference),
% according to |#1| position.
%    \begin{macrocode}
\def\xpct@PUT#1(#2,#3)#4{%
%    \end{macrocode}
% Call |\xpct@alphaput| to compute |(\xpct@xPictsep,\xpct@yPictsep)|,
% displacement of |\Pictlabelsep| units in direction |#1|.
% Then, apply |\refsysxyVector| to get |(\xpct@Posx,\xpct@Posy)|,
% standard coordinates of vector |(\xpct@xPictsep,\xpct@yPictsep)|.
%    \begin{macrocode}
       \xpct@alphaput{#1}{\xpct@CorRput}
       \refsysxyVector(\xpct@xPictsep,\xpct@yPictsep)(\xpct@Posx,\xpct@Posy)
%    \end{macrocode}
% Compute |(\xpct@posx,\xpct@posy)|, standard coordinates of point |(#2,#3)|.
%    \begin{macrocode}
       \refsysPoint(#2,#3)(\xpct@posx,\xpct@posy)
%    \end{macrocode}
% Call |\xpct@alphamove| to adjust |(\xpct@Posx,\xpct@Posy)|
% according to dimensions of |#4|.
% Then add |(\xpct@posx,\xpct@posy)| to |(\xpct@Posx,\xpct@Posy)|.
%    \begin{macrocode}
       \xpct@alphamove{#4}{\xpct@CorRput}
       \VECTORADD(\xpct@posx,\xpct@posy)(\xpct@Posx,\xpct@Posy)(%
          \xpct@Posx,\xpct@Posy)
%    \end{macrocode}
% Now |(\xpct@Posx,\xpct@Posy)| is the absolute position where |#4|
% must go.
%    \begin{macrocode}
       \put(\xpct@Posx,\xpct@Posy){#4}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@alphaput}
% Computes displacement vector required by |#1| and stores it in
%  |(\xpct@xPictsep},\xpct@yPictsep)|.
%    \begin{macrocode}
\def\xpct@alphaput#1#2{\def\xpct@tempa{#1}\def\xpct@tempb{c}%
       \ifx\xpct@tempa\xpct@tempb
%    \end{macrocode}
% If |#1=c|, no displacement is required: 
%|(\xpct@xPictsep},\xpct@yPictsep)=(0,0)|.
%    \begin{macrocode}
          \COPY{0}{\xpct@xPictsep}\COPY{0}{\xpct@yPictsep}
       \else
%    \end{macrocode}
% Else, call |\xpct@convtoang| to translate |#1| to a number (of degrees),
%    \begin{macrocode}
          \xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
%    \end{macrocode}
% and compute |(\xpct@xPictsep},\xpct@yPictsep)|.
%    \begin{macrocode}
          \ifnum #2=0
             \DEGREESCOS{\xpct@putpos}{\xpct@cosine}
             \DEGREESSIN{\xpct@putpos}{\xpct@sine}
          \else
             \qCOS{\xpct@putpos}{\xpct@cosine}
             \qSIN{\xpct@putpos}{\xpct@sine}
          \fi          
          \MULTIPLY{\Pictlabelsep}{\xpct@cosine}{\xpct@xPictsep}
          \MULTIPLY{\Pictlabelsep}{\xpct@sine}{\xpct@yPictsep}
       \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@alphamove}
% Adjust |(\xpct@Posx,\xpct@Posy)| to required position, according to
% |#1| dimensions. If |#2| equals |0|, it uses circular trigonometry, else
% it uses square trigonometry. 
%    \begin{macrocode}
\def\xpct@alphamove#1#2{%
%    \end{macrocode}
% Computes half of dimensions of |#1|,
%    \begin{macrocode}
       \xpct@halfbox{#1}{\xpct@amplada}{\xpct@altura}
       \ifx\xpct@tempa\xpct@tempb
       \else
%    \end{macrocode}
% If required position is not centered, move |(\xpct@Posx,\xpct@Posy)|
% (circular or square cases). First, compute a unitary vector in
% |(\xpct@Posx,\xpct@Posy)| direction.
%    \begin{macrocode}
          \ifnum #2=0
             \UNITVECTOR(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)
          \else
             \qUNITVECTOR(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)
%    \end{macrocode}
% If starred, change height to half |\xpct@rputmxhg|.
%    \begin{macrocode}
             \ifrputstar
                \ifdim\xpct@ydir\p@=-1\p@
                   \DIVIDE{\xpct@rputmxhg}{2}{\xpct@altura}
                \fi
             \fi
             \fi
%    \end{macrocode}
% Adjust |(\xpct@xdir,\xpct@ydir)| to |#1| dimensions.
%    \begin{macrocode}            
             \MULTIPLY{\xpct@ydir}{\xpct@altura}{\xpct@ydir}
             \MULTIPLY{\xpct@xdir}{\xpct@amplada}{\xpct@xdir}
             \VECTORADD(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)%
                       (\xpct@Posx,\xpct@Posy)
       \fi
%    \end{macrocode}
% Move |(\xpct@Posx,\xpct@Posy)| according to |#1| dimensions.
%    \begin{macrocode}        
       \VECTORSUB(\xpct@Posx,\xpct@Posy)(\xpct@amplada,\xpct@altura)(%
          \xpct@Posx,\xpct@Posy)}
%    \end{macrocode}
% \end{macro}     
% \begin{macro}{\xpct@convtoang}
% Literal specifiers in |\Put|-like commands must be converted to angles.
% |c| or |r| (circular or rectangular) distance is also selected.
%    \begin{macrocode}    
\def\xpct@convtoang#1#2#3{%
     \def\xpct@tempc{#1}
     \def\xpct@tempd{r}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{r}\else
     \def\xpct@tempd{tr}\ifx\xpct@tempc\xpct@tempd\COPY{45}{#2}\def#3{r}\else
     \def\xpct@tempd{t}\ifx\xpct@tempc\xpct@tempd\COPY{90}{#2}\def#3{r}\else
     \def\xpct@tempd{tl}\ifx\xpct@tempc\xpct@tempd\COPY{135}{#2}\def#3{r}\else
     \def\xpct@tempd{l}\ifx\xpct@tempc\xpct@tempd\COPY{180}{#2}\def#3{r}
     \else
     \def\xpct@tempd{bl}\ifx\xpct@tempc\xpct@tempd\COPY{-135}{#2}
     \def#3{r}\else
     \def\xpct@tempd{b}\ifx\xpct@tempc\xpct@tempd\COPY{-90}{#2}
     \def#3{r}\else
     \def\xpct@tempd{br}\ifx\xpct@tempc\xpct@tempd\COPY{-45}{#2}
     \def#3{r}\else
     \def\xpct@tempd{rtr}\ifx\xpct@tempc\xpct@tempd\COPY{22.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{ttr}\ifx\xpct@tempc\xpct@tempd\COPY{67.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{ttl}\ifx\xpct@tempc\xpct@tempd\COPY{112.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{ltl}\ifx\xpct@tempc\xpct@tempd\COPY{157.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{lbl}\ifx\xpct@tempc\xpct@tempd\COPY{-157.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{bbl}\ifx\xpct@tempc\xpct@tempd\COPY{-112.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{bbr}\ifx\xpct@tempc\xpct@tempd\COPY{-67.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{rbr}\ifx\xpct@tempc\xpct@tempd\COPY{-22.5}{#2}
     \def#3{r}\else
     \def\xpct@tempd{E}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{c}\else
     \def\xpct@tempd{NE}\ifx\xpct@tempc\xpct@tempd\COPY{45}{#2}\def#3{c}\else
     \def\xpct@tempd{N}\ifx\xpct@tempc\xpct@tempd\COPY{90}{#2}\def#3{c}\else
     \def\xpct@tempd{NW}\ifx\xpct@tempc\xpct@tempd\COPY{135}{#2}\def#3{c}\else
     \def\xpct@tempd{W}\ifx\xpct@tempc\xpct@tempd\COPY{180}{#2}\def#3{c}\else
     \def\xpct@tempd{SW}\ifx\xpct@tempc\xpct@tempd\COPY{-135}{#2}
     \def#3{c}\else
     \def\xpct@tempd{S}\ifx\xpct@tempc\xpct@tempd\COPY{-90}{#2}\def#3{c}\else
     \def\xpct@tempd{SE}\ifx\xpct@tempc\xpct@tempd\COPY{-45}{#2}\def#3{c}\else
     \def\xpct@tempd{ENE}\ifx\xpct@tempc\xpct@tempd\COPY{22.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{NNE}\ifx\xpct@tempc\xpct@tempd\COPY{67.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{NNW}\ifx\xpct@tempc\xpct@tempd\COPY{112.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{WNW}\ifx\xpct@tempc\xpct@tempd\COPY{157.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{WSW}\ifx\xpct@tempc\xpct@tempd\COPY{-157.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{SSW}\ifx\xpct@tempc\xpct@tempd\COPY{-112.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{SSE}\ifx\xpct@tempc\xpct@tempd\COPY{-67.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{ESE}\ifx\xpct@tempc\xpct@tempd\COPY{-22.5}{#2}
     \def#3{c}\else
     \def\xpct@tempd{c}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{c}\else
     \COPY{#1}{#2}\def#3{a}
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@halfbox}
% Half of dimensions of a box.
%    \begin{macrocode}
\def\xpct@halfbox#1#2#3{%
        \settowidth\xpct@bxw{#1}%
        \settoheight\xpct@bxh{#1}%
        \LENGTHDIVIDE{\xpct@bxw}{\unitlength}{#2}
        \LENGTHDIVIDE{\xpct@bxh}{\unitlength}{#3}
        \MULTIPLY{0.5}{#2}{#2}
        \MULTIPLY{0.5}{#3}{#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\qCOS}
% \begin{macro}{\qSIN}
% \begin{macro}{\qUNITVECTOR}
% Square versions of |\DEGREESCOS|, |\DEGREESSIN| and |\UNITVECTOR|.
%    \begin{macrocode}
\def\qCOS#1#2{%
    \ifdim #1\p@<-135\p@ 
         \ADD{360}{#1}{\xpct@angles}\qCOS{\xpct@angles}{#2}
    \else
       \ifdim #1\p@>225\p@ \SUBTRACT{#1}{360}{\xpct@angles}
                           \qCOS{\xpct@angles}{#2}
       \else
          \ifdim #1\p@<-45\p@ \DEGREESCOT{#1}{#2}\MULTIPLY{-1}{#2}{#2}
          \else
             \ifdim #1\p@<45\p@ \COPY{1}{#2}
             \else
                \ifdim #1\p@<135\p@ \DEGREESCOT{#1}{#2}
                \else
                   \COPY{-1}{#2}
                \fi           
             \fi             
          \fi
       \fi
    \fi
}
\def\qSIN#1#2{%
    \ifdim #1\p@<-135\p@ 
         \ADD{360}{#1}{\xpct@angles}\qSIN{\xpct@angles}{#2}
    \else
       \ifdim #1\p@>225\p@ \SUBTRACT{#1}{360}{\xpct@angles}
                           \qSIN{\xpct@angles}{#2}
       \else
          \ifdim #1\p@<-45\p@ \COPY{-1}{#2}
          \else
             \ifdim #1\p@<45\p@ \DEGREESTAN{#1}{#2}
             \else
                \ifdim #1\p@<135\p@ \COPY{1}{#2}
                \else
                   \DEGREESTAN{#1}{#2}\MULTIPLY{-1}{#2}{#2}
                \fi           
             \fi             
          \fi
       \fi
    \fi
}
\def\qUNITVECTOR(#1,#2)(#3,#4){%
          \VECTORCOPY(#1,#2)(#3,#4)
          \ABSVALUE{#4}{\xpct@Ydir}
          \ifdim \xpct@Ydir\p@ < 0.00005\p@
          \COPY{\xpct@maxnum}{\xpct@tan} 
          \else
             \DIVIDE{#3}{#4}{\xpct@tan}
          \fi
          \ifdim #3\p@ > 0\p@
             \ifdim #4\p@ > 0\p@ 
                \ifdim #3\p@ > #4\p@
                   \COPY{1}{#3}\DIVIDE{#4}{\xpct@tan}{#4}
                \else    
                   \COPY{1}{#4}\COPY{\xpct@tan}{#3}
                \fi
                \else
                   \ifdim #3\p@ > -#4\p@
                      \COPY{1}{#3}\DIVIDE{-#4}{\xpct@tan}{#4}
                   \else
                      \COPY{-1}{#4}\MULTIPLY{-1}{\xpct@tan}{#3}
                   \fi
                \fi
             \else
                \ifdim #4\p@ > 0\p@ 
                   \ifdim -#3\p@ > #4\p@
                      \COPY{-1}{#3}\DIVIDE{-#4}{\xpct@tan}{#4}
                   \else    
                      \COPY{1}{#4}\COPY{\xpct@tan}{#3} 
                   \fi
                \else
                   \ifdim #3\p@ > #4\p@
                      \COPY{-1}{#4}\COPY{-\xpct@tan}{#3}
                   \else
                      \COPY{-1}{#3}\DIVIDE{#4}{\xpct@tan}{#4}
                   \fi
                \fi
             \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsection{\cs{multiput} extensions}
% User commands: |\multicPut|, |\multirPut|, |\multiPut|; 
% |\multicPlot|, |\multirPlot|, |\multiPlot|. 
% |\multirPut|, |\multiPut|, |\multirPlot|, and |\multiPlot|
% have starred versions.
% \begin{macro}{\multicPut}
% Define |\xpct@mPut| as |\cPut{#1}| and call |\xpct@@mPut|.
%    \begin{macrocode}
\def\multicPut#1{\def\xpct@mPut{\cPut{#1}}\xpct@@mPut}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\multirPut}
% \begin{macro}{\multirPut*}
% Call |\xpct@multirPut| or |\xpct@multirPutstar| (if starred).
%    \begin{macrocode}
\def\multirPut{\@ifstar
       \xpct@multirPutstar%
       \xpct@multirPut%
       }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\multiPut}
% \begin{macro}{\multiPut*}
% Call |\xpct@multiPut| or |\xpct@multiPutstar| (if starred).
%    \begin{macrocode}
\def\multiPut{\@ifstar
       \xpct@multiPutstar%
       \xpct@multiPut%
       }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@multirPutstar}
% \begin{macro}{\xpct@multirPut}
% Define |\xpct@mPut| as |\rPut*{#1}| or |\rPut{#1}| and call |\xpct@@mPut|.
%    \begin{macrocode}
\def\xpct@multirPutstar#1{\def\xpct@mPut{\rPut*{#1}}\xpct@@mPut}
\def\xpct@multirPut#1{\def\xpct@mPut{\rPut{#1}}\xpct@@mPut}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@multiPut}
% \begin{macro}{\xpct@multiPutstar}
% |\multiPut| can take an optional argument.
%    \begin{macrocode}
\def\xpct@multiPut{\@ifnextchar[{\xpct@@@multiPut}{\xpct@@multiPut}}
\def\xpct@multiPutstar{\@ifnextchar[{\xpct@@@multiPutstar}{\xpct@@multiPutstar}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@@multiPut}
% \begin{macro}{\xpct@@multiPutstar}
% Define |\xpct@mPut| as |\Put| or |\Put*| and call |\xpct@@mPut|.
%    \begin{macrocode}
\def\xpct@@multiPut{\def\xpct@mPut{\Put}\xpct@@mPut}     
\def\xpct@@multiPutstar{\def\xpct@mPut{\Put*}\xpct@@mPut}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@@@multiPut}
% \begin{macro}{\xpct@@@multiPutstar}
% Define |\xpct@mPut| as |\Put[#1]| or |\Put*[#1]| and call |\xpct@@mPut|.
%    \begin{macrocode}
\def\xpct@@@multiPut[#1]{\def\xpct@mPut{\Put[#1]}\xpct@@mPut}
\def\xpct@@@multiPutstar[#1]{\def\xpct@mPut{\Put*[#1]}\xpct@@mPut}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@@mPut}
% \begin{macro}{\xpct@mPut}
% |\xpct@@mPut| is the main macro about |\multiPut|-like commands.
% |\xpct@mPut| is already defined as the appropiate |\Put| command.
%    \begin{macrocode}
\def\xpct@@mPut(#1,#2)(#3,#4)#5#6{%
%    \end{macrocode}
% Use counter |multiput| to count iterations.
% |(\xpct@@abscoorx,\xpct@@abscoory)| is the point to be ploted in each 
% iteration.
%    \begin{macrocode}
       \COPY{#1}\xpct@@abscoorx\COPY{#2}\xpct@@abscoory
       \setcounter{multiput}{0}%
       \@whilenum\value{multiput}<#5 \do
%    \end{macrocode}
% Plot the point, translate it, and update conter.
%    \begin{macrocode}
          {\xpct@mPut(\xpct@@abscoorx,\xpct@@abscoory){#6}
           \ADD{#3}\xpct@@abscoorx\xpct@@abscoorx
           \ADD{#4}\xpct@@abscoory\xpct@@abscoory
           \stepcounter{multiput}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\multicPlot}
% Execute |\cPut| and iterates itself while next character be |(|.
%    \begin{macrocode}
\def\multicPlot#1#2(#3){\cPut{#1}(#3){#2}\@ifnextchar({\multicPlot{#1}{#2}}{}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\multirPlot}
% \begin{macro}{\multirPlot*}
% |\multirPlot| can take a starred form. Call |\xpct@multirPlot| or,
% if starred, |\xpct@multirPlotstar|.
%    \begin{macrocode}
\def\multirPlot{\@ifstar
       \xpct@multirPlotstar%
       \xpct@multirPlot%
       }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\multiPlot}
% \begin{macro}{\multiPlot*}
% |\multiPlot| can take a starred form. Call |\xpct@multiPlot| or,
% if starred, |\xpct@multiPlotstar|.
%    \begin{macrocode}
\def\multiPlot{\@ifstar
             \xpct@multiPlotstar%
             \xpct@multiPlot%
             }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@multirPlotstar}
% \begin{macro}{\xpct@multirPlot}
% Execute |\rPut*| or |\rPut| and iterates itself while next character be |(|.
%    \begin{macrocode}
\def\xpct@multirPlotstar#1#2(#3){\rPut*{#1}(#3){#2}
       \@ifnextchar({\xpct@multirPlotstar{#1}{#2}}{}}
\def\xpct@multirPlot#1#2(#3){\rPut{#1}(#3){#2}
       \@ifnextchar({\xpct@multirPlot{#1}{#2}}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@multiPlotstar}
% \begin{macro}{\xpct@multiPlot}
% |\multiPlot| (and |\multiPlot*|) can take an optional argument. 
% We have four cases: (starred or not) and (optional argument or not).
%    \begin{macrocode}
\def\xpct@multiPlotstar{%
   \@ifnextchar[{\xpct@@@multiPlotstar}{\xpct@@multiPlotstar}}
\def\xpct@multiPlot{\@ifnextchar[{\xpct@@@multiPlot}{\xpct@@multiPlot}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@@multiPlot}
% \begin{macro}{\xpct@@@multiPlot}
% \begin{macro}{\xpct@@multiPlotstar}
% \begin{macro}{\xpct@@@multiPlotstar}
% Execute |\Put| (or |\Put*|) and iterates itself while next character be |(|.
%    \begin{macrocode}
\def\xpct@@multiPlot#1(#2){\Put(#2){#1}\@ifnextchar({\xpct@@multiPlot{#1}}{}}
\def\xpct@@@multiPlot[#1]#2(#3){\Put[#1](#3){#2}
       \@ifnextchar({\xpct@@@multiPlot[#1]{#2}}{}}
\def\xpct@@multiPlotstar#1(#2){\Put*(#2){#1}
       \@ifnextchar({\xpct@@multiPlotstar{#1}}{}}
\def\xpct@@@multiPlotstar[#1]#2(#3){\Put*[#1](#3){#2}
       \@ifnextchar({\xpct@@@multiPlotstar[#1]{#2}}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsection{Strigth lines and vectors}
% \begin{macro}{\xLINE}
% \begin{macro}{\strline}
% Compute standard coordinates of two points and call |\xpct@strline|
% to plot a line.
%    \begin{macrocode}
\def\xLINE(#1)(#2){%        
         \refsysPoint(#1)(\xpct@xzero,\xpct@yzero)
         \refsysPoint(#2)(\xpct@xone,\xpct@yone)
         \xpct@strline(\xpct@xzero,\xpct@yzero)(\xpct@xone,\xpct@yone)}
\let\strline\xLINE
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@strline}
% This command calls the |\segment| command from |curve2e|
% (or |\LINE|, for old versions of |curve2e|).
%    \begin{macrocode}
\def\xpct@strline{\@killglue\@ifundefined{segment}{\LINE}{\segment}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xVECTOR}
% Compute standard coordinates of two points and call |\VECTOR|
% to plot a vector.
%    \begin{macrocode}
\def\xVECTOR(#1)(#2){%
       \refsysPoint(#1)(\xpct@xzero,\xpct@yzero)
       \refsysPoint(#2)(\xpct@xone,\xpct@yone)
       \VECTOR(\xpct@xzero,\xpct@yzero)(\xpct@xone,\xpct@yone)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xtrivVECTOR}
% Compute standard coordinates of two points and call |\xpct@xtrivVECTOR|
% to plot a  `triv' vector.
%    \begin{macrocode}
\def\xtrivVECTOR(#1)(#2){%
       \refsysPoint(#1)(\xpct@xzeropoint,\xpct@yzeropoint)
       \refsysPoint(#2)(\xpct@xonepoint,\xpct@yonepoint)
       \xpct@xtrivVECTOR(\xpct@xzeropoint,\xpct@yzeropoint)(%
                         \xpct@xonepoint,\xpct@yonepoint)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\arrowsize}
% Store dimensions of triv arrows. 
% to plot a vector.
%    \begin{macrocode}
\def\arrowsize#1#2{\COPY{#1}{\xpct@xarrowlen}
                   \COPY{#2}{\xpct@yarrowlen}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@xtrivVECTOR}
% Plot a stright line, compute size of arrowhead and call |\xpct@arrow|
% to plot it.
%    \begin{macrocode}        
\def\xpct@xtrivVECTOR(#1)(#2){%
         \xpct@strline(#1)(#2)
         \VECTORSUB(#2)(#1)(\xpct@xarrow,\xpct@yarrow)
         \VECTORNORM(\xpct@xarrow,\xpct@yarrow){\xpct@xarrowunit}
         \DIVIDE{\xpct@xarrow}{\xpct@xarrowunit}{\xpct@xarrow}
         \DIVIDE{\xpct@yarrow}{\xpct@xarrowunit}{\xpct@yarrow}
         \xpct@arrow(#2){\xpct@xarrow}{\xpct@yarrow}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@arrow}
% Make an arrowhead as a small picture.
%    \begin{macrocode} 
\def\xpct@arrow(#1)#2#3{\begingroup%
             \referencesystem(#1)(#2,#3)(-#3,#2)
             \Put(0,0){\setlength{\unitlength}{1pt}%
                \begin{Picture}(0,0)(0,0)\cartesianreference
                         \xLINE(-\xpct@xarrowlen,\xpct@yarrowlen)(0,0)
                         \xLINE(0,0)(-\xpct@xarrowlen,-\xpct@yarrowlen)
                \end{Picture}}\endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\zerovector}
% \begin{macro}{\zerotrivvector}
% To have an arrowhead, draw a very short vector (of |0.01\unitlength|).
%    \begin{macrocode}
\def\zerovector(#1){%
   \UNITVECTOR(#1)(\xpct@dirx,\xpct@diry)
   \SCALARVECTORPRODUCT{0.01}(\xpct@dirx,\xpct@diry)(\xpct@dirx,\xpct@diry)
    \xVECTOR(0,0)(\xpct@dirx,\xpct@diry)}
\def\zerotrivvector(#1){%
   \UNITVECTOR(#1)(\xpct@dirx,\xpct@diry)
   \SCALARVECTORPRODUCT{0.01}(\xpct@dirx,\xpct@diry)(\xpct@dirx,\xpct@diry)
    \xtrivVECTOR(0,0)(\xpct@dirx,\xpct@diry)}    
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xline}
% \begin{macro}{\xvector}
% \begin{macro}{\xtrivvector}
% Standard syntax strigth lines and vectors.
% Call |\xpct@xline| to compute adequate coordinates of line or vector ends.
% Then call |\xLINE|, |\xVECTOR| or |\xtrivVECTOR| command.
%    \begin{macrocode}
\def\xline(#1,#2)#3{%
       \xpct@xline(#1,#2){#3}
   \xLINE(0,0)(\xpct@@xdir,\xpct@@ydir)}

\def\xvector(#1,#2)#3{%
   \ifdim #3 pt = 0 pt \zerovector(#1,#2)
   \else 
       \xpct@xline(#1,#2){#3}
   \xVECTOR(0,0)(\xpct@@xdir,\xpct@@ydir)
   \fi}

\def\xtrivvector(#1,#2)#3{%
   \ifdim #3 pt = 0 pt \zerotrivvector(#1,#2)
   \else 
       \xpct@xline(#1,#2){#3}
   \xtrivVECTOR(0,0)(\xpct@@xdir,\xpct@@ydir)
   \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@xline}
% Calculate the coordinates of the endpoint of |\xline(#1,#2){#3}| and stores
% them in |(\xpct@@xdir,\xpct@@ydir)|.
%    \begin{macrocode}
\def\xpct@xline(#1,#2)#3{%
         \ABSVALUE{#1}{\xpct@modx}
         \ifdim \xpct@modx pt < 0.0001 pt  
              \COPY{0}{\xpct@@xdir}
              \ifdim #2\p@>\z@ \COPY{#3}{\xpct@@ydir}
              \else \MULTIPLY{-1}{#3}{\xpct@@ydir}
              \fi
         \else 
              \DIVIDE{#1}{\xpct@modx}{\xpct@@xdir}
              \DIVIDE{#2}{\xpct@modx}{\xpct@@ydir}
              \SCALARVECTORPRODUCT{#3}(\xpct@@xdir,\xpct@@ydir)(%
                                       \xpct@@xdir,\xpct@@ydir)
        \fi}
%    \end{macrocode}
% \end{macro}
% \subsection{Polygons and polylines}
% \begin{macro}{\Polyline}
% This command plots a line between the two first points and, if next
% character is |(|, supresses first point and iterates itself.
%    \begin{macrocode}
\def\Polyline(#1)(#2){%
         \xLINE(#1)(#2)\@ifnextchar({\Polyline(#2)}{}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Polygon}
% Store the first point in |(\xpct@firstx,\xpct@firsty)| and call
% |\xpct@Polygon|.
%    \begin{macrocode}
\def\Polygon(#1,#2)(#3){% 
       \COPY{#1}{\xpct@firstx}\COPY{#2}{\xpct@firsty}
                  \xpct@Polygon(#1,#2)(#3)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@Polygon}
% This command plots a line between the two first points and, if next
% character is |(|, supresses first point and iterates itself. 
% When finished, adds a closing line to the previously stored first point.
%    \begin{macrocode}
\def\xpct@Polygon(#1)(#2){%
       \xLINE(#1)(#2)\@ifnextchar({\xpct@Polygon(#2)}{%
       \xLINE(#2)(\xpct@firstx,\xpct@firsty)}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\regularPolygon}
% |\regularPolygon| can take an optional argument.
%    \begin{macrocode}
\def\regularPolygon{%
       \@ifnextchar[{\xpct@regPolygon}{\xpct@@regPolygon}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@@regPolygon}
% Default for optional argument is |0|.
%    \begin{macrocode}
\def\xpct@@regPolygon#1#2{\xpct@regPolygon[0]{#1}{#2}}                                               
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@regPolygon}
% |\xpct@regPolygon[#1]{#2}{#3}| uses the |xpct@counta| counter to
% plot |#3| lines, in polar coordinates with |#2| radius, 
% startint with angle |#1| and using $360/|#3|$ to
% incrementing angle in each step. 
%    \begin{macrocode}
\def\xpct@regPolygon[#1]#2#3{\begingroup%
       \polarreference\degreesangles
       \setcounter{xpct@counta}{0}%
       \setcounter{xpct@countb}{#3}%
       \DIVIDE{360}{#3}{\xpct@angles}
       \COPY{#1}{\xpct@anglea}
       \@whilenum\value{xpct@counta}<\value{xpct@countb} \do {% 
          \ADD{\xpct@anglea}{\xpct@angles}{\xpct@angleb}
          \xLINE(#2,\xpct@anglea)(#2,\xpct@angleb)
          \COPY{\xpct@angleb}{\xpct@anglea}\stepcounter{xpct@counta}}
       \endgroup}
%    \end{macrocode}
% \end{macro}
% \subsection{Quadratic curves}
% \begin{macro}{\xpct@ctrlpoint}
% The main command in this section is |\xpct@ctrlpoint|.
% It computes the control point in a quadratic Bezier curve
% from the coordinates and direction vectors of ending points.
%    \begin{macrocode}
\def\xpct@ctrlpoint(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
       \DETERMINANT(#3,#4;#7,#8)\xpct@detA
       \DETERMINANT(#1,#2;#3,#4)\xpct@detB
       \DETERMINANT(#5,#6;#7,#8)\xpct@detC
       \DETERMINANT(#3,#7;\xpct@detB,\xpct@detC)\xpct@detD
       \DETERMINANT(#4,#8;\xpct@detB,\xpct@detC)\xpct@detE
       \ABSVALUE{\xpct@detA}{\xpct@@detA}
       \ABSVALUE{\xpct@detD}{\xpct@@detD}
       \ABSVALUE{\xpct@detE}{\xpct@@detE}
       \ifdim \xpct@@detA pt<0.00005 pt 
%    \end{macrocode}       
% If |\xpct@detA| approaches zero, matrix is singular or close to singular.
% Then tangent lines may be parallel or coincide.
%    \begin{macrocode}       
          \ifdim \xpct@@detD pt<0.00005 pt %\xpct@detD pt=0 pt
             \ifdim \xpct@@detE pt<0.00005 pt %\xpct@detE pt=0 pt 
%    \end{macrocode}       
% Indeterminate system. The curve is a straight line.
% We take (as reference point) middle point between end points.
%    \begin{macrocode} 
                \ADD{#1}{#5}{\xpct@solx}\DIVIDE{\xpct@solx}{2}{\xpct@solx}
                \ADD{#2}{#6}{\xpct@soly}\DIVIDE{\xpct@soly}{2}{\xpct@soly}
             \fi\else
%    \end{macrocode}       
% Inconsistent case. Return a warning and undefine control point.
%    \begin{macrocode} 
             \xpct@WarnIncSys(#1,#2)(#5,#6)
             \let\xpct@solx\undefined\let\xpct@soly\undefined
          \fi
       \else 
%    \end{macrocode}       
% This is the regular case.
%    \begin{macrocode} 
          \DIVIDE{\xpct@detD}{\xpct@detA}{\xpct@solx}
          \DIVIDE{\xpct@detE}{\xpct@detA}{\xpct@soly}
       \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\qCurve}
% This macro accepts two alternative syntax (directions given by a vector
% or by an angle).
%    \begin{macrocode}
\def\qCurve(#1){\@ifnextchar({\xpct@@qCurve(#1)}{\xpct@@@qCurve(#1)}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@@qCurve}
% Compute standard coordinates of points and vectors and call |\xpct@qCurve|.
%    \begin{macrocode}                     
\def\xpct@@qCurve(#1)(#2)(#3)(#4){%
       \refsysPoint(#1)(\xpct@@xzero,\xpct@@yzero)
       \refsysPoint(#3)(\xpct@@xone,\xpct@@yone)
       \refsysVector(#2)(\xpct@@dxzero,\xpct@@dyzero)
       \refsysVector(#4)(\xpct@@dxone,\xpct@@dyone)
       \xpct@qCurve(\xpct@@xzero,\xpct@@yzero)(\xpct@@dxzero,\xpct@@dyzero)(%
                    \xpct@@xone,\xpct@@yone)%
          (\xpct@@dxone,\xpct@@dyone)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@@@qCurve}
% Translate direction angles to vectors and call |\qCurve|.
%    \begin{macrocode}       
\def\xpct@@@qCurve(#1)#2(#3)#4{%
             \ifpolar
                 \qCurve(#1)(1,#2)(#3)(1,#4)
             \else
             \DEGREESCOS{#2}{\xpct@angxz}
             \DEGREESSIN{#2}{\xpct@angyz}
             \DEGREESCOS{#4}{\xpct@angxo}
             \DEGREESSIN{#4}{\xpct@angyo}
             \qCurve(#1)(\xpct@angxz,\xpct@angyz)(#3)%
                (\xpct@angxo,\xpct@angyo)\fi}      
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@qCurve}
% Call |\xpct@ctrlpoint| to compute control point; then, use |\qbezier|
% to plot the curve. If the control point is undefined, nothing is drawn.
%    \begin{macrocode} 
\def\xpct@qCurve(#1)(#2)(#3)(#4){%
       \xpct@ctrlpoint(#1)(#2)(#3)(#4)
       \ifx\xpct@solx\undefined
       \else   
          \qbezier(#1)(\xpct@solx,\xpct@soly)(#3)\fi\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PlotQuadraticCurve}
% Try between the two alternative sintax.
%    \begin{macrocode}
\def\PlotQuadraticCurve(#1){%
       \@ifnextchar({\xpct@PlotQuadraticCurve(#1)}{%
                     \xpct@@PlotQuadraticCurve(#1)}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@PlotQuadraticCurve}
% \begin{macro}{\xpct@@PlotQuadraticCurve}
% Call |\qCurve| and iterate |\PlotQuadraticCurve|.
%    \begin{macrocode}
\def\xpct@PlotQuadraticCurve(#1)(#2)(#3)(#4){%
       \qCurve(#1)(#2)(#3)(#4)
       \@ifnextchar({\PlotQuadraticCurve(#3)(#4)}{}}
\def\xpct@@PlotQuadraticCurve(#1)#2(#3)#4{%
       \qCurve(#1){#2}(#3){#4}
       \@ifnextchar({\PlotQuadraticCurve(#3){#4}}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \subsection{Conic sections and arcs}
% \begin{macro}{\xpct@circulararc}
% \begin{macro}{\xpct@hyperbolicarc}
% \begin{macro}{\xpct@parabolicarc}
% Parametric equations of circular, hyperbolic and parabolic arcs
% defined as vector functions. 
%    \begin{macrocode}        
\newvectorfunction{\xpct@circulararc}{%
%    \end{macrocode}
% Unit circle equation $x^2+y^2=1$ can be parameterized as
% $f(t)=(\cos t,\sin t)$.
% If the angles are measured in degrees, the derivative is not correct.
% Should be multiplied by  $\pi/180$, but because what we want is the
% direction of the derivative, we will not do.
%    \begin{macrocode} 
    \ifdegrees
       \DEGREESCOS{\t}{\x}
       \DEGREESSIN{\t}{\y}
       \COPY{\x}{\Dy}
       \MULTIPLY{-1}{\y}{\Dx}
    \else
       \COS{\t}{\x}
       \SIN{\t}{\y}
       \COPY{\x}{\Dy}
       \MULTIPLY{-1}{\y}{\Dx}
    \fi}
\newvectorfunction{\xpct@hyperbolicarc}{%
%    \end{macrocode}
% Hyperbola $x^2-y^2=1$, parameterized as $f(t)=\frac12(t+1/t,t-1/t)$.
% This derivative is not correct. 
% We should divide it by $t$, but that did not change direction.
%    \begin{macrocode} 
       \DIVIDE{1}{\t}{\xpct@invt}
       \ADD{\t}{\xpct@invt}{\x}
       \SUBTRACT{\t}{\xpct@invt}{\y}
       \MULTIPLY{0.5}{\x}{\x}
       \MULTIPLY{0.5}{\y}{\y}
       \COPY{\x}{\Dy}
       \COPY{\y}{\Dx}}
%    \end{macrocode}
% Parabola $x=y^2$ (or $f(t)=(t^2,t)$).
%    \begin{macrocode} 
\newvectorfunction{\xpct@parabolicarc}{%
        \COPY{\t}{\y}
        \COPY{1}{\Dy}
        \SQUARE{\t}{\x}
        \MULTIPLY{2}{\t}{\Dx}}
%    \end{macrocode}         
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\circularArc}
% \begin{macro}{\xArc}
% A circular arc is an elliptic arc with equal semiaxes.
%    \begin{macrocode} 
\def\circularArc#1#2#3{\ellipticArc{#1}{#1}{#2}{#3}}
\let\xArc\circularArc
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\ellipticArc}
% To draw an arc of ellipse of semiaxes |#1| and |#2|, 
% scale the axes and draw a circular arc.
% |\defaultplotdivs| is the number of subintervals we divide  |[#3,#4]|.
%    \begin{macrocode}
\def\ellipticArc#1#2#3#4{%
    \begingroup
      \cartesianreference
       \changereferencesystem(0,0)(#1,0)(0,#2)
       \PlotParametricFunction[\defaultplotdivs]{\xpct@circulararc}{#3}{#4}
    \endgroup\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Circle}
% \begin{macro}{\Ellipse}
% A circle (or ellipse) is a circular (elliptic) arc of amplitude $2\pi$.
%    \begin{macrocode}
\def\Circle#1{\begingroup\radiansangles
                     \circularArc{#1}{0}{\numberTWOPI}\endgroup\ignorespaces}
\def\Ellipse#1#2{\begingroup\radiansangles
                         \ellipticArc{#1}{#2}{0}{\numberTWOPI}
                         \endgroup\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\lhyperbolicArc}
% Change $x$-axis to $-x$, then draw a right hyperbolic arc.
%    \begin{macrocode}
\def\lhyperbolicArc#1#2#3#4{%
            \begingroup
               \changereferencesystem(0,0)(-1,0)(0,1)  
               \rhyperbolicArc{#1}{#2}{#3}{#4}        
           \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\rhyperbolicArc}
% Call |\xpct@hypluy| to compute extreme variables, then draw a
% normalized arc of hyperbola.
%    \begin{macrocode}
\def\rhyperbolicArc#1#2#3#4{%
              \xpct@hypluy{#2}{#3}{\xpct@uone}
              \xpct@hypluy{#2}{#4}{\xpct@utwo}
              \xpct@hyperbolicArc{#1}{#2}{\xpct@uone}{\xpct@utwo}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@hyperbolicArc}
% To draw an arc of (right branch of) hyperbola of semiaxes |#1| and |#2|, 
% scale the axes and draw a normalized arc of hyperbola.
% |\defaultplotdivs| is the number of subintervals we divide  |[#3,#4]|.
%    \begin{macrocode}
\def\xpct@hyperbolicArc#1#2#3#4{%
    \begingroup
      \cartesianreference
      \changereferencesystem(0,0)(#1,0)(0,#2)
       \PlotParametricFunction[\defaultplotdivs]{\xpct@hyperbolicarc}{#3}{#4}
    \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\lHyperbola}
% Change $x$-axis to $-x$, then draw a right hyperbola branch.
%    \begin{macrocode}
\def\lHyperbola#1#2#3#4{%
          \begingroup
          \changereferencesystem(0,0)(-1,0)(0,1)
          \rHyperbola{#1}{#2}{#3}{#4}
          \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\rHyperbola}
% Use |\xpct@hypconsist| to ensure parameters consistency,
% call |\xpct@hyperbolalastu| to compute extreme variable,
% then plot the right hyperbola branch. 
% Divide the curve into two arcs to ensure that 
% it includes point |(#1,0)|.
%    \begin{macrocode}
\def\rHyperbola#1#2#3#4{%
       \def\xpct@hycons{}\xpct@hypconsist{#1}{#3}%
          \ifx\xpct@hycons\undefined
          \else
              \xpct@hyperbolalastu{#1}{#2}{#3}{#4}
              \DIVIDE{1}{\xpct@umax}{\xpct@umin}
              \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
               \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
          \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Hyperbola}
% Use |\xpct@hypconsist| to ensure parameters consistency,
% call |\xpct@hyperbolalastu| to compute extreme variable,
% then plot the two branches.
%    \begin{macrocode}
\def\Hyperbola#1#2#3#4{%
       \begingroup
       \def\xpct@hycons{}\xpct@hypconsist{#1}{#3}%
          \ifx\xpct@hycons\undefined
          \else
              \xpct@hyperbolalastu{#1}{#2}{#3}{#4}
              \DIVIDE{1}{\xpct@umax}{\xpct@umin}
               \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
               \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
             \changereferencesystem(0,0)(-1,0)(0,1)
              \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
               \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
          \fi\endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@hypconsist}
% Ensures consistency of parameters in |\Hyperbola|-like commands.
% This curve is not defined for $x<a$ values. 
%    \begin{macrocode}
\def\xpct@hypconsist#1#2{% 
       \ifnum #1<#2\else\xpct@ErrHypCons
                            \let\xpct@hycons\undefined\fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@hyperbolalastu}
% Compute the max value of parameter ensuring restrictions
% |x<#3| and |y<#4|. 
%    \begin{macrocode}
\def\xpct@hyperbolalastu#1#2#3#4{%
      \xpct@hyplux{#1}{#3}{\xpct@umaxx}
      \xpct@hypluy{#2}{#4}{\xpct@umaxy}
       \MIN{\xpct@umaxx}{\xpct@umaxy}{\xpct@umax}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@hyplux}
% To compute the max value of parameter ensuring restriction
% |x<=#2|, solve equation |#2=(1/2)#1(u+1/u)| (|u=#3|).
%    \begin{macrocode}
\def \xpct@hyplux#1#2#3{%
       \DIVIDE{#2}{#1}{\xpct@xa}
       \SQUARE{\xpct@xa}{#3}
       \SUBTRACT{#3}{1}{#3}
       \SQUAREROOT{#3}{\xpct@@umaxx}
       \ADD{\xpct@xa}{\xpct@@umaxx}{#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@hypluy}
% To compute the max value of parameter ensuring restriction
% |y<#2|, solve equation |#2=(1/2)#1(u-1/u)| (|u=#3|).
%    \begin{macrocode}
\def \xpct@hypluy#1#2#3{%
       \DIVIDE{#2}{#1}{\xpct@xa}
       \SQUARE{\xpct@xa}{#3}
       \ADD{#3}{1}{#3}
       \SQUAREROOT{#3}{\xpct@@umaxx}
       \ADD{\xpct@xa}{\xpct@@umaxx}{#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\parabolicArc}
% To draw an arc of parabola
%  scale the $x$-axis and draw a normalized arc of parabola. 
% |\defaultplotdivs| is the number of subintervals we divide |[#2,#3]|.
%    \begin{macrocode}
\def\parabolicArc#1#2#3{%
    \begingroup
       \changereferencesystem(0,0)(#1,0)(0,1)
       \PlotParametricFunction[\defaultplotdivs]{\xpct@parabolicarc}{#2}{#3}
    \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Parabola}
% Call |\xpct@parabolalasty| to compute extreme variable, then plot 
% the parabola. Divide the curve into two arcs to
% ensure that it includes point |(0,0)|.
%    \begin{macrocode}
\def\Parabola#1#2#3{%
              \xpct@parabolalasty{#1}{#2}{#3} 
              \parabolicArc{#1}{-\xpct@maxy}{0}
              \parabolicArc{#1}{0}{\xpct@maxy}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@parabolalasty}
% Ensure restrictions |x<=#2|, |y<=#3|: solve equation |#2=#1 y^2|.
% Then, |\xpct@maxy=min(y,#3)|.
%    \begin{macrocode}
\def\xpct@parabolalasty#1#2#3{%
       \ABSVALUE{#1}{\xpct@@maxy}
       \DIVIDE{#2}{\xpct@@maxy}{\xpct@@maxy}
       \SQUAREROOT{\xpct@@maxy}{\xpct@maxy}
       \MIN{\xpct@maxy}{#3}{\xpct@maxy}}
%    \end{macrocode}
% \end{macro}
% \subsection{Graphing functions}
% \begin{macro}{\PlotFunction}
% This command can take an optional argument.
%    \begin{macrocode} 
\def\PlotFunction{%
       \@ifnextchar[{\xpct@iterateplotfunction}{\xpct@plotfunction}}
%    \end{macrocode}
% \end{macro} 
% \begin{macro}{\xpct@iterateplotfunction}
% Compute |\xpct@step| as |(#4-#3)/#1| and iterate |\xpct@plotfunction|
% |#1| times.
%    \begin{macrocode} 
\def\xpct@iterateplotfunction[#1]#2#3#4{%
\setcounter{xpct@step}{0}%
\COPY{#3}{\xpct@oldt}
\SUBTRACT{#4}{#3}{\xpct@step}
\DIVIDE{\xpct@step}{#1}{\xpct@step}
\@whilenum \value{xpct@step}<#1 \do
   {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
   \xpct@plotfunction{#2}{\xpct@oldt}{\xpct@newt}
   \stepcounter{xpct@step}%
   \COPY\xpct@newt\xpct@oldt
}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotfunction}
% Draw graph of |#1| function between |#2| and |#3|.
%    \begin{macrocode} 
\def\xpct@plotfunction#1#2#3{\@killglue%
%    \end{macrocode}
% Compute $f$ and $f'$ in |#2| and |#3|, and apply |\PlotxyDyData|.
%    \begin{macrocode}
       #1{#2}{\yzero}{\Dyzero}%
       #1{#3}{\yone}{\Dyone}%
       \PlotxyDyData(#2,\yzero,\Dyzero)(#3,\yone,\Dyone)
       \ifx\xpct@solx\undefined
%    \end{macrocode}
% If tangent vectors are parallel, divide the interval into two halves
% and recall |\xpct@plotfunction|.
%    \begin{macrocode}       
       \ADD{#2}{#3}{\xpct@middt}
       \MULTIPLY{0.5}{\xpct@middt}{\xpct@middt}
       \xpct@plotfunction{#1}{#2}{\xpct@middt}
       \xpct@plotfunction{#1}{\xpct@middt}{#3}
       \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PlotPointsOfFunction}
% The |\PlotPointsOfFunction| command is essentialy equal to 
% |\xpct@iterateplotfunction|,
% but instead of a curve between two adjacent points,
% plots a |\pointmark| (user can redefine |\pointmark|).
%    \begin{macrocode}
\def\PlotPointsOfFunction#1#2#3#4{%
   \setcounter{xpct@step}{0}%
\COPY{#3}{\xpct@oldt}
\SUBTRACT{#4}{#3}{\xpct@step}
\DIVIDE{\xpct@step}{#1}{\xpct@step}
\ADD{#1}{1}{\xpct@lastt}
\@whilenum \value{xpct@step}<\xpct@lastt \do 
   {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
   #2{\xpct@oldt}{\xpct@oldy}{\xpct@oldDy}
   \Put[c](\xpct@oldt,\xpct@oldy){\pointmark}
   \stepcounter{xpct@step}%
   \COPY\xpct@newt\xpct@oldt
}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\PlotxyDyData}
% |\PlotxyDyData(x0,y0,y0')(x1,y1,y1')(x2,y2,y2')...|
% uses |\qCurve| to draw a curve between |(x0,y0)| and |(x1,y1)|
% with tangent vectors |(1,y0')| and |(1,y1')|, then iterates itself.
%    \begin{macrocode}  
\def\PlotxyDyData(#1,#2,#3)(#4,#5,#6){%
       \qCurve(#1,#2)(1,#3)(#4,#5)(1,#6)
       \@ifnextchar({\PlotxyDyData(#4,#5,#6)}{}}
%    \end{macrocode}
% \end{macro}
% \subsection{Graphing parametric curves}
% \begin{macro}{\PlotParametricFunction}
% Plot vectorial function |#2| between the parameter values |#3| and |#4|.
% It can take an optional argument |#1|.
%    \begin{macrocode}  
\def\PlotParametricFunction{%
    \@ifnextchar[{\xpct@iterateplotpfunction}{\xpct@plotpfunction}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@iterateplotpfunction}
% Divide |[#3,#4]| in |#1| pieces, then iterate |\xpct@plotpfunction| |#1|
% times.
%    \begin{macrocode}
\def\xpct@iterateplotpfunction[#1]#2#3#4{%
\setcounter{xpct@step}{0}%
\COPY{#3}{\xpct@oldt}
\SUBTRACT{#4}{#3}{\xpct@step}
\DIVIDE{\xpct@step}{#1}{\xpct@step}
\@whilenum \value{xpct@step}<#1 \do
   {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
   \xpct@plotpfunction{#2}{\xpct@oldt}{\xpct@newt}
   \stepcounter{xpct@step}%
   \COPY\xpct@newt\xpct@oldt}\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotpfunction}
% Compute function (and derivative of) |#1| in |#2| and |#3|, then
% call |\qCurve|.
%    \begin{macrocode}
\def\xpct@plotpfunction#1#2#3{%
    \begingroup
       #1{#2}\xzero\Dxzero\yzero\Dyzero
       #1{#3}\xone\Dxone\yone\Dyone
       \cartesianreference
       \qCurve(\xzero,\yzero)(\Dxzero,\Dyzero)(\xone,\yone)(\Dxone,\Dyone)
    \endgroup\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \subsection{Cartesian axes and grids}
% Main commands: |\cartesianaxes| and |\cartesiangrid|. 
% \begin{macro}{\cartesiangrid}
% Put |\ifgrid| to true, then call |\cartesianaxes|.
%    \begin{macrocode} 
\def\cartesiangrid(#1,#2)(#3,#4){%
       \begingroup\gridtrue\cartesianaxes(#1,#2)(#3,#4)\endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cartesianaxes}
% \begin{macro}{\xpct@XZero}
% \begin{macro}{\xpct@XOne}
% \begin{macro}{\xpct@YZero}
% \begin{macro}{\xpct@YOne}
% |\cartesianaxes| makes axes and, optionally, grid, tics, and/or labels.
% Cartesian rectangle limits are stored in 
% |\xpct@XZero|, |\xpct@XOne|, |\xpct@YZero|, and |\xpct@YOne|.
%    \begin{macrocode}
\def\cartesianaxes(#1,#2)(#3,#4){%
%    \end{macrocode}
% In this command, coordinates are Cartesian.
%    \begin{macrocode}
       \begingroup\cartesianreference
          \GLOBALCOPY{#1}{\xpct@XZero}\GLOBALCOPY{#2}{\xpct@YZero}
          \GLOBALCOPY{#3}{\xpct@XOne}\GLOBALCOPY{#4}{\xpct@YOne}
%    \end{macrocode}
% There shall be cuts, labels or grid?
%    \begin{macrocode}
          \iftics
             \ticslabelsgridtrue
          \else
             \iflabels
                \ticslabelsgridtrue
             \else
                \ifgrid
                   \ticslabelsgridtrue
          \fi\fi\fi
          \ifticslabelsgrid
             \xpct@plotticslabels
          \fi
%    \end{macrocode}
% Call |\xpct@plotaxes| to plot axes.
%    \begin{macrocode}          
          \xpct@plotaxes\endgroup}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\plotxtic}
% \begin{macro}{\plotytic}
% Put |\iftics| boolean to true, adjust tics lengths and position,
% and call |\xpct@printtic|.
%    \begin{macrocode}   
\def\plotxtic#1{%
          \maketics
          \xpct@adjticssize
          \xpct@adjxorytics{#1}{0}
          \xpct@printtic}
\def\plotytic#1{%
          \maketics
          \xpct@adjticssize
          \xpct@adjxorytics{#1}{1}
          \xpct@printtic}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printxlabel}
% \begin{macro}{\printylabel}
% Adjust tics lengths and position, and call |\xpct@printlabel|.
%    \begin{macrocode}  
\def\printxlabel#1#2{%
          \xpct@adjticssize
          \xpct@adjxorytics{#1}{0}
          \xpct@printlabel{0}{#2}}
\def\printylabel#1#2{%
          \xpct@adjticssize
          \xpct@adjxorytics{#1}{1}
          \xpct@printlabel{1}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printxticlabel}
% \begin{macro}{\printyticlabel}
% Print tic and label.
%    \begin{macrocode} 
\def\printxticlabel#1#2{\plotxtic{#1}\printxlabel{#1}{#2}}       
\def\printyticlabel#1#2{\plotytic{#1}\printylabel{#1}{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\plotxtics}
% \begin{macro}{\plotytics}
% Call |\xpct@plottics{0}}| or |\xpct@plottics{1}|.
%    \begin{macrocode} 
\def\plotxtics{\xpct@plottics{0}}
\def\plotytics{\xpct@plottics{1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printxlabels}
% \begin{macro}{\printylabels}
% Call |\xpct@printlabels{0}| or |\xpct@printlabels{1}|.
% By default, optional argument must be |-1|.
%    \begin{macrocode}
\def\printxlabels{%
   \@ifnextchar[{\xpct@printlabels{0}}{\xpct@printlabels{0}[-1]}}
\def\printylabels{%
   \@ifnextchar[{\xpct@printlabels{1}}{\xpct@printlabels{1}[-1]}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printxticslabels}
% \begin{macro}{\printyticslabels}
% Call |\xpct@printxticslabels| or |\xpct@printyticslabels|.
% By default, optional argument must be |-1|.
%    \begin{macrocode}
\def\printxticslabels{%
   \@ifnextchar[{\xpct@printxticslabels}{\xpct@printxticslabels[-1]}}
\def\printyticslabels{%
   \@ifnextchar[{\xpct@printyticslabels}{\xpct@printyticslabels[-1]}}
%    \end{macrocode}
% \end{macro}
% \end{macro}



% \begin{macro}{\xpct@plotaxes}
% Axes are simple lines, but its position depends on boolean |\inzeroaxes|.
%    \begin{macrocode}
\def\xpct@plotaxes{\linethickness{\axesthickness}%
               \pictcolor{\axescolor}
               \ifinzeroaxes
                  \xLINE(\xpct@XZero,0)(\xpct@XOne,0)
                  \xLINE(0,\xpct@YZero)(0,\xpct@YOne)
               \else   
                   \xLINE(\xpct@XZero,\xpct@YZero)(\xpct@XOne,\xpct@YZero)
                   \xLINE(\xpct@XZero,\xpct@YZero)(\xpct@XZero,\xpct@YOne)
               \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotticslabels}
% Adjust tics sizes to axes lengths
% and call |\xpct@plotxticslabels| and |\xpct@plotyticslabels|.
%    \begin{macrocode}
\def\xpct@plotticslabels{%
       \xpct@adjticssize
       \xpct@plotxticslabels\xpct@plotyticslabels}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotxticslabels}
% Grid, tics and labels on the |x| axis.
% If secundary divisions are required, this command iterates itself.
%    \begin{macrocode}
\def\xpct@plotxticslabels{%
%    \end{macrocode}
% If required, plot grid (in both directions, |x| and |y|). 
%    \begin{macrocode}
       \ifgrid\xpct@plotgrid\fi
       \begingroup
          \ifnum\xunitdivisions=1
%    \end{macrocode}
% Call |\xpct@ticsinterval| to compute integer interval extremes
% and number of tics;
% then plot |x| tics. 
%    \begin{macrocode}        
             \xpct@ticsinterval{\xpct@XZero}{\xpct@XOne}
             \xpct@plotxtics
          \else
%    \end{macrocode}
% Secundary tics.
%    \begin{macrocode}
             \begingroup
%    \end{macrocode}
% Secundary tics. Change the reference system to the small unities,
% and ajust tics sizes, thickness and colors.
%    \begin{macrocode}
                \xpct@adjstics
                \MULTIPLY{\secundaryyticssize}{\yunitdivisions}{\yticssize}
%    \end{macrocode}
% At secundary level one must not print labels. 
%    \begin{macrocode}
                \makenolabels
%    \end{macrocode}
% Print secundary tics. 
%    \begin{macrocode}
                \def\xunitdivisions{1}
                \xpct@plotxticslabels
             \endgroup
%    \end{macrocode}
% Print primary tics and (perhaps) labels. 
%    \begin{macrocode}                                   
             \def\xunitdivisions{1}
             \xpct@plotxticslabels
          \fi
       \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotyticslabels}
% Tics and labels on the |y| axis.
% If secundary divisions are required, this command iterates itself.
%    \begin{macrocode}
\def\xpct@plotyticslabels{%
       \begingroup
          \ifnum\yunitdivisions=1
%    \end{macrocode}
% Call |\xpct@ticsinterval| to compute integer interval extremes
% and number of tics;
% then plot |y| tics. 
%    \begin{macrocode} 
             \xpct@ticsinterval{\xpct@YZero}{\xpct@YOne}
             \xpct@plotytics
          \else
%    \end{macrocode}
% Secundary tics.
%    \begin{macrocode}
             \begingroup
%    \end{macrocode}
% Secundary tics. Change the reference system to the small unities,
% and ajust tics sizes, thickness and colors.
%    \begin{macrocode}
                \xpct@adjstics
                \MULTIPLY{\secundaryxticssize}{\xunitdivisions}{\xticssize}
%    \end{macrocode}
% At secundary level one must not print labels. 
%    \begin{macrocode}
                \makenolabels
%    \end{macrocode}
% Print secundary tics. 
%    \begin{macrocode}
                \def\yunitdivisions{1}
                \xpct@plotyticslabels
             \endgroup
%    \end{macrocode}
% Print primary tics and (perhaps) labels. 
%    \begin{macrocode} 
             \def\yunitdivisions{1}
             \xpct@plotyticslabels
          \fi
       \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@adjstics}
% Adjust length, color and thickness for secundary tics.
%    \begin{macrocode}
\def\xpct@adjstics{%
                \MULTIPLY{\xpct@XZero}{\xunitdivisions}{\xpct@XZero}
                \MULTIPLY{\xpct@YZero}{\yunitdivisions}{\xpct@YZero}
                \MULTIPLY{\xpct@XOne}{\xunitdivisions}{\xpct@XOne}
                \MULTIPLY{\xpct@YOne}{\yunitdivisions}{\xpct@YOne}
                \DIVIDE{1}{\xunitdivisions}{\xpct@xunit}
                \DIVIDE{1}{\yunitdivisions}{\xpct@yunit}
                \changereferencesystem(0,0)(\xpct@xunit,0)(0,\xpct@yunit)
                \def\gridthickness{\secundarygridthickness}
                \def\gridcolor{\secundarygridcolor}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotxtics}
% \begin{macro}{\xpct@plotytics}
% Call |\xpct@maketics| to make tics and/or labels (on |x| and |y| axes). 
%    \begin{macrocode}
\def\xpct@plotxtics{\xpct@maketics{\xpct@firstint}{\xpct@numtics}{0}}
\def\xpct@plotytics{\xpct@maketics{\xpct@firstint}{\xpct@numtics}{1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@maketics}
% Makes tics and/or labels (|#2| points, begining in |#1|;
% |#3=0| means |x| axis, |#3=1| means |y| axis).
%    \begin{macrocode}
\def\xpct@maketics#1#2#3{%
%    \end{macrocode}
% Call |\xpct@adjxorytics| to compute coordinates of extreme points of first 
% tic and translation vector from one tic to the next one.
%    \begin{macrocode}
   \xpct@adjxorytics{#1}{#3}
%    \end{macrocode}
% Use counter |xpct@counta| for tics and |xpct@countb| for labels
% (number to print in each label).
%    \begin{macrocode}
       \setcounter{xpct@counta}{0}%
       \iflabels\setcounter{xpct@countb}{#1}\fi
%    \end{macrocode}
% Main loop: |#2| steps, begining in |#1|.
%    \begin{macrocode}
       \@whilenum \value{xpct@counta}<#2 \do {%
          \iftics
%    \end{macrocode}
% If required, print tic.
%    \begin{macrocode}
           \xpct@printtic
           \fi
           \iflabels
%    \end{macrocode}
% If labels are to be printed, adjust |\Pictlabelsep|; then print label
% and step label (|xpct@countb| counter).
%    \begin{macrocode}
              \highestlabel{\xpct@axeslabelattrib%
                            $\axeslabelmathalphabet{1}$}%
              \xpct@printlabel{#3}{\thexpct@countb}
              \stepcounter{xpct@countb}%
           \fi
%    \end{macrocode}
% Step tics counter and move coordinates to next point.
%    \begin{macrocode}
           \stepcounter{xpct@counta}%
           \VECTORADD(\xpct@@xzero,\xpct@@yzero)(\xpct@@xincr,\xpct@@yincr)%
           (\xpct@@xzero,\xpct@@yzero)
           \VECTORADD(\xpct@@xone,\xpct@@yone)(\xpct@@xincr,\xpct@@yincr)%
           (\xpct@@xone,\xpct@@yone)
       }}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@adjxorytics}
% Compute coordinates of extreme points of first tic 
% and translation vector from one tic to the next one.
% There are four cases: |x| or |y| axis, and external or internal axes.  
%    \begin{macrocode}     
\def\xpct@adjxorytics#1#2{%
      \ifnum #2=0 
                \COPY{#1}{\xpct@@xzero}
                \COPY{-\yticssize}{\xpct@@yzero}
                \COPY{#1}{\xpct@@xone}
                \COPY{\yticssize}{\xpct@@yone}
                \COPY{1}{\xpct@@xincr}
                \COPY{0}{\xpct@@yincr}
                \ifinzeroaxes\else
                   \ADD{\xpct@YZero}{\xpct@@yzero}{\xpct@@yzero}
                   \ADD{\xpct@YZero}{\xpct@@yone}{\xpct@@yone}
                \fi  
           \else 
                \COPY{#1}{\xpct@@yzero}
                \COPY{-\xticssize}{\xpct@@xzero}
                \COPY{#1}{\xpct@@yone}
                \COPY{\xticssize}{\xpct@@xone}
                \COPY{1}{\xpct@@yincr}
                \COPY{0}{\xpct@@xincr}
                \ifinzeroaxes\else
                   \ADD{\xpct@XZero}{\xpct@@xzero}{\xpct@@xzero}
                   \ADD{\xpct@XZero}{\xpct@@xone}{\xpct@@xone}
                \fi  
       \fi}       
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@printtic}
% Plot a tic.
%    \begin{macrocode}
\def\xpct@printtic{\pictcolor{\ticscolor}
             \linethickness{\ticsthickness}
             \xLINE(\xpct@@xzero,\xpct@@yzero)(\xpct@@xone,\xpct@@yone)}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@adjticssize}
% Adjust size of tics according to axes length.
%    \begin{macrocode}
\def\xpct@adjticssize{%
%    \end{macrocode}
% First, convert absolute lenghts |\ticssize| and |\secundaryticssize| to 
% the |\unitlength| unity.
%    \begin{macrocode}
       \LENGTHDIVIDE{\ticssize}{\unitlength}{\xpct@ticssize}
       \LENGTHDIVIDE{\secundaryticssize}{\unitlength}{\xpct@sticssize}
%    \end{macrocode}
% Calculate the size of vector |(1,0)|, converting it to standard coordinates 
% and computing its norm. 
% Then we adjust |\xticssize| and |\secundaryxticssize|; this ensures 
% the desired sizes.
%    \begin{macrocode}
       \refsysxyVector(1,0)(\xpct@a,\xpct@b)
          \VECTORNORM(\xpct@a,\xpct@b){\xpct@norm}
          \DIVIDE{\xpct@ticssize}{\xpct@norm}{\xticssize}
          \DIVIDE{\xpct@sticssize}{\xpct@norm}{\secundaryxticssize}
          \DIVIDE{\axislabelsep}{\xpct@norm}{\xpct@xaxislabelsep}
%    \end{macrocode}
% Repeat calculations for vector $(0,1)$, 
% adjusting |\yticssize| and |\secundaryyticssize|.
%    \begin{macrocode}
       \refsysxyVector(0,1)(\xpct@a,\xpct@b)
          \VECTORNORM(\xpct@a,\xpct@b){\xpct@norm}
          \DIVIDE{\xpct@ticssize}{\xpct@norm}{\yticssize}
          \DIVIDE{\xpct@sticssize}{\xpct@norm}{\secundaryyticssize}
          \DIVIDE{\axislabelsep}{\xpct@norm}{\xpct@yaxislabelsep}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@printlabel}
% Adjust highest label (for horizontal labels); 
% then print value of |#2|.
% Four cases: |x| or |y|, external or internal.
%    \begin{macrocode}
\def\xpct@printlabel#1#2{%
       \iftics
          \ifnum #1=0
             \ADD{\yticssize}{\xpct@yaxislabelsep}{\Pictlabelsep}
          \else
             \ADD{\xticssize}{\xpct@xaxislabelsep}{\Pictlabelsep}
          \fi
       \else
          \ifnum #1=0
             \COPY{\xpct@yaxislabelsep}{\Pictlabelsep}
          \else
             \COPY{\xpct@xaxislabelsep}{\Pictlabelsep}
          \fi          
       \fi
    \ifinzeroaxes
       \ifnum\thexpct@countb=0
       \else
          \ifnum #1=0
             \rPut*{\xpct@xlblpos}(\xpct@@xzero,0){%
                \xpct@axeslabelattrib%
                \ensuremath{\axeslabelmathalphabet{#2}}}
          \else                         
             \rPut*{\xpct@ylblpos}(0,\xpct@@yzero){%
                \xpct@axeslabelattrib%
                \ensuremath{\axeslabelmathalphabet{#2}}}
          \fi
       \fi
    \else
       \ifnum #1=0
          \rPut*{\xpct@xlblpos}(\xpct@@xzero,\xpct@YZero){%
             \xpct@axeslabelattrib%
             \ensuremath{\axeslabelmathalphabet{#2}}}
       \else                         
          \rPut*{\xpct@ylblpos}(\xpct@XZero,\xpct@@yzero){%
             \xpct@axeslabelattrib%
             \ensuremath{\axeslabelmathalphabet{#2}}}
       \fi
    \fi}
%    \end{macrocode}
% \end{macro}   
% \begin{macro}{\xlabelpos}
% \begin{macro}{\ylabelpos}
% Default position for labels on axes. Call |\xpct@convtoang| to define
% |\xpct@xlblpos| or |\xpct@ylblpos|.
%    \begin{macrocode}
\def\xlabelpos#1{\xpct@convtoang{#1}{\xpct@xlblpos}{\xpct@CorR}}
\def\ylabelpos#1{\xpct@convtoang{#1}{\xpct@ylblpos}{\xpct@CorR}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@printxticslabels}
% \begin{macro}{\xpct@printyticslabels}
% Print tics and labels.
%    \begin{macrocode}
\def\xpct@printxticslabels[#1]#2#3#4{%
       \plotxtics{#2}{#3}{#4}\printxlabels[#1]{#2}{#3}{#4}}
\def\xpct@printyticslabels[#1]#2#3#4{%
       \plotytics{#2}{#3}{#4}\printylabels[#1]{#2}{#3}{#4}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@plottics}
% Plot |x| or |y| tics (if |#1| equals |0| or |1|),
% starting an |#2|. Distance between two consecutive tics is |#3|, and 
% position of last tic is not greather than |#4|. 
%    \begin{macrocode}
\def\xpct@plottics#1#2#3#4{%
      \COPY{#2}{\xpct@ticcoor}
%    \end{macrocode}
% |\xpct@ticcoor| is the position of next tic.
%    \begin{macrocode}
      \@whiledim\xpct@ticcoor\p@<#4\p@ \do {%
%    \end{macrocode}
% Make a tic while |\xpct@ticcoor<#4|
%    \begin{macrocode}
      \ifnum #1=0 
         \plotxtic{\xpct@ticcoor} 
      \else 
         \plotytic{\xpct@ticcoor}
      \fi
      \ADD{#3}{\xpct@ticcoor}{\xpct@ticcoor}
      }
%    \end{macrocode}
% If |\xpct@ticcoor=#4| then this is the last tic position.
%    \begin{macrocode}
      \ifdim\xpct@ticcoor\p@>#4\p@
      \else
         \ifnum #1=0 
            \plotxtic{\xpct@ticcoor} 
         \else 
            \plotytic{\xpct@ticcoor}
         \fi
      \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@printlabels}
% Print |x| or |y| labels (if |#1| equals |0| or |1|),
% starting an |#3|. Distance between two consecutive tics is |#4|, and 
% position of last tic is not greather than |#5|. 
% |#2| is the number of decimal digits to be printed
% (default is |#2=-1|, meaning no control of digits in number printing).
%    \begin{macrocode}
\def\xpct@printlabels#1[#2]#3#4#5{%
      \COPY{#3}{\xpct@ticcoor}
%    \end{macrocode}
% |\xpct@ticcoor| is the position of next label.
%    \begin{macrocode}
      \@whiledim\xpct@ticcoor\p@<#5\p@ \do {%
%    \end{macrocode}
%  Print a label while |\xpct@ticcoor<#5|
% |\xpct@Ticcoor| is the label with adjusted number of digits.
%    \begin{macrocode}
         \ifnum #2=-1 
            \COPY{\xpct@ticcoor}{\xpct@Ticcoor}
         \else
            \ROUND[#2]{\xpct@ticcoor}{\xpct@Ticcoor}
         \fi
         \xpct@prtlbl{#1}
         \ADD{#4}{\xpct@ticcoor}{\xpct@ticcoor}}
      \ifdim\xpct@ticcoor\p@>#5\p@
%    \end{macrocode}
% If |\xpct@ticcoor=#5| then this is the last label position.
%    \begin{macrocode}
      \else
         \ifnum #2=-1 
            \COPY{\xpct@ticcoor}{\xpct@Ticcoor}
         \else
            \ROUND[#2]{\xpct@ticcoor}{\xpct@Ticcoor}
         \fi
         \xpct@prtlbl{#1}
      \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@prtlbl}
% Print the |x| or |y| label (for |#1=0| or |1|)
% |\xpct@Ticcoor| at |\xpct@ticcoor|. 
% When |\ifinzeroaxes| is true label at |0| position is not printed. 
%    \begin{macrocode}
\def\xpct@prtlbl#1{%
        \ifinzeroaxes
        \ifdim \xpct@ticcoor\p@=\z@\else
            \xpct@adjticssize
            \xpct@adjxorytics{\xpct@ticcoor}{#1}
            \xpct@printlabel{#1}{\xpct@Ticcoor}
         \fi
         \else
            \xpct@adjticssize
            \xpct@adjxorytics{\xpct@ticcoor}{#1}
            \xpct@printlabel{#1}{\xpct@Ticcoor}\fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@plotgrid}
% Plot a grid in a Cartesian rectangle.
%    \begin{macrocode}
\def\xpct@plotgrid{%
%    \end{macrocode}
% Call |\xpct@ticsinterval| to compute integer interval extremes
% and number of tics;
% then plot grid lines (for |x| axis). 
%    \begin{macrocode}
       \xpct@ticsinterval{\xpct@XZero}{\xpct@XOne}
       \begingroup\setcounter{xpct@counta}{0}%
          \pictcolor{\gridcolor}\linethickness{\gridthickness}
          \COPY{\xpct@firstint}{\xpct@grid}
          \@whilenum\value{xpct@counta}<\xpct@numtics\do{
             \xLINE(\xpct@grid,\xpct@YZero)(\xpct@grid,\xpct@YOne)
             \ADD{1}{\xpct@grid}{\xpct@grid}
             \stepcounter{xpct@counta}}\endgroup
%    \end{macrocode}
% Call |\xpct@ticsinterval| to compute integer interval extremes
% and number of tics;
% then plot grid lines (for |y| axis).
%    \begin{macrocode}
       \xpct@ticsinterval{\xpct@YZero}{\xpct@YOne}
       \begingroup\setcounter{xpct@counta}{0}%
          \pictcolor{\gridcolor}\linethickness{\gridthickness}
          \COPY{\xpct@firstint}{\xpct@grid}
          \@whilenum\value{xpct@counta}<\xpct@numtics\do{
             \xLINE(\xpct@XZero,\xpct@grid)(\xpct@XOne,\xpct@grid)
             \ADD{1}{\xpct@grid}{\xpct@grid}
             \stepcounter{xpct@counta}}\endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@ticsinterval}
% Truncate extremes to integers, then compute the number of tics
% (|\xpct@firstint-\xpct@lastint+1|).
%    \begin{macrocode}
\def\xpct@ticsinterval#1#2{\TRUNCATE[0]{#1}{\xpct@firstint}
                       \TRUNCATE[0]{#2}{\xpct@lastint}
                       \SUBTRACT{\xpct@lastint}{\xpct@firstint}{\xpct@numtics}
                       \ADD{\xpct@numtics}{1}{\xpct@numtics}}
%    \end{macrocode}
% \end{macro}
% \subsection{Polar grids}
% \begin{macro}{\polargrid}
% Plot a polar grid of radius |#1| and |#2| divisions of circle. 
%    \begin{macrocode}
\def\polargrid#1#2{%
       \begingroup
       \polarreference
%    \end{macrocode}
% Compute integer part of radius, number of circles and distance
% between circles.
%    \begin{macrocode}
       \FLOOR{#1}{\xpct@rint}
       \MULTIPLY{\xpct@rint}{\runitdivisions}{\xpct@rdivs}
       \DIVIDE{1}{\runitdivisions}{\rincr}
%    \end{macrocode}
% Use counter |xpct@counta| to control the number of printed circles
% and |\xpct@radius| as radius of the current circle.
%    \begin{macrocode}       
       \COPY{0}{\xpct@radius}
       \setcounter{xpct@counta}{1}%
%    \end{macrocode}
% Plot |\xpct@rdivs| circles.
%    \begin{macrocode}   
       \begingroup
          \pictcolor{\gridcolor}
          \linethickness{\gridthickness}
          \@whilenum \value{xpct@counta}<\xpct@rdivs\do {%
             \ADD{\rincr}{\xpct@radius}{\xpct@radius}
             \Ellipse{\xpct@radius}{\xpct@radius}
             \stepcounter{xpct@counta}}%
%    \end{macrocode}
% Plot external circle.
%    \begin{macrocode} 
          \pictcolor{\axescolor}
          \linethickness{\axesthickness}
          \Ellipse{\xpct@rint}{\xpct@rint}
       \endgroup
%    \end{macrocode}
% Use counter |xpct@counta| to control the number of printed lines and
% |\xpct@angle| as arc (in radians) of the current line.
% |\xpct@angincr| is the gap between two adjacent lines.
%    \begin{macrocode}
       \COPY{0}{\xpct@angle}
       \DIVIDE{\numberTWOPI}{#2}{\xpct@angincr}
       \setcounter{xpct@counta}{0}%
%    \end{macrocode}
% Plot |#2| lines.
%    \begin{macrocode}
       \pictcolor{\gridcolor}
       \linethickness{\gridthickness}
       \@whilenum \value{xpct@counta}<#2 \do {%
          \xLINE(0,0)(#1,\xpct@angle)
%    \end{macrocode}
% If required, print angular label: evaluate the number |\xpct@arc|
% such that angle is |(\xpct@arc/#2) pi| and call |\xpct@polarlabel|.
%    \begin{macrocode}
          \iflabels
             \COPY{\axislabelsep}{\Pictlabelsep}
             \MULTIPLY{2}{\thexpct@counta}{\xpct@arc}
             \xpct@polarlabel{#1}{\xpct@arc}{#2}\fi
          \ADD{\xpct@angincr}{\xpct@angle}{\xpct@angle}
          \stepcounter{xpct@counta}}%
%    \end{macrocode}
% Plot the polar line.
%    \begin{macrocode}
        \pictcolor{\axescolor}
        \linethickness{\axesthickness}
        \xLINE(0,0)(#1,0)
%    \end{macrocode}
% If required, print radial labels.
%    \begin{macrocode}
       \iflabels
          \highestlabel{\xpct@axeslabelattrib$\axeslabelmathalphabet{1}$}  
          \multiPut*[\xpct@rlblpos](1,0)(1,0){\xpct@rint}{%
             \ADD{\value{multiput}}{1}{\xpct@lbl}
             \xpct@axeslabelattrib%
             \ensuremath{\axeslabelmathalphabet{\xpct@lbl}}}%
       \fi
       \endgroup}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\rlabelpos}
% Default position for labels on polar axis. Call |\xpct@convtoang| to define
% |\xpct@rlblpos|.
%    \begin{macrocode}
\def\rlabelpos#1{\xpct@convtoang{#1}{\xpct@rlblpos}{\xpct@CorR}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\degreespolarlabels}
% \begin{macro}{\radianspolarlabels}
% Define |\xpct@polarlabel| to be |\xpct@degreeslabel| or |\xpct@radianslabel|
% (print polar label as degrees or radians).
%    \begin{macrocode}
\def\degreespolarlabels{\def\xpct@polarlabel{\xpct@degreeslabel}}
\def\radianspolarlabels{\def\xpct@polarlabel{\xpct@radianslabel}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xpct@degreeslabel}
% Print the angle label |(#2/#3) pi| converted to degrees.
%    \begin{macrocode}
\def\xpct@degreeslabel#1#2#3{%
%    \end{macrocode}
% Adjust label position.
%    \begin{macrocode}
%    \end{macrocode}
% Simplify |#2/#3|. Then convert |(#2/#3) pi| to degrees
% (evaluate |(#2 180)/#3|).
%    \begin{macrocode}
       \FRACTIONSIMPLIFY{#2}{#3}\xpct@num\xpct@den
       \MULTIPLY{\xpct@num}{180}{\xpct@degangle}
       \DIVIDE{\xpct@degangle}{\xpct@den}{\xpct@degangle}
%    \end{macrocode}
% Print label.
%    \begin{macrocode}
       \cPut{\xpct@degangle}(#1,\xpct@angle){%
          \xpct@axeslabelattrib%
          \ensuremath{\axeslabelmathalphabet{\xpct@degangle^\mathrm{o}}}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@radianslabel}
% Print the angle label |(#2/#3) pi|.
%    \begin{macrocode}
\def\xpct@radianslabel#1#2#3{%
%    \end{macrocode}
% Adjust label position and call |\xpct@prtfracrad|.
%    \begin{macrocode}
          \RADtoDEG{\xpct@angle}{\xpct@angles}
          \cPut{\xpct@angles}(#1,\xpct@angle){%
             \xpct@axeslabelattrib%
             \ensuremath{\axeslabelmathalphabet
                 {\xpct@prtfracrad{#2}{#3}}}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xpct@prtfracrad}
% Pretty print |(#1/#2)pi|
%    \begin{macrocode}
\def\xpct@prtfracrad#1#2{%
       \FRACTIONSIMPLIFY{#1}{#2}\xpct@num\xpct@den
          \ifnum \xpct@num = 0 0
          \else
             \ifnum \xpct@num = 1 
                \ifnum \xpct@den = 1 \pi
                \else \pi/\xpct@den
                \fi
             \else \xpct@num\pi/\xpct@den
             \fi
          \fi}
%    \end{macrocode}
% \end{macro}
% \subsection{Configurable parameters}
% These are the parameters the user can customize.
% Default values ​​are written to |xpicture.sty| and |xpicture.cfgxmpl|.
%    \begin{macrocode}
%</xpicture>
%<*defaults>
%<+cfg>%%
%<+cfg>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<+cfg>% xpicture configurable parameters %
%<+cfg>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<+cfg>%%
%<+cfg>%%%%% Cartesian and polar axes
%<+cfg>    % Thickness and color of axes
\axesthickness=1pt
\def\axescolor{black}
%<+cfg>    % Color, size, mathversion and mathalphabet of numeric labels
\def\axeslabelcolor{\axescolor}
\def\axeslabelsize{\small}
\def\axeslabelmathversion{normal}
\def\axeslabelmathalphabet{\mathrm}
%<+cfg>    % Relative position of numeric labels on x- y- and r- axes
\xlabelpos{-90}
\ylabelpos{180}
\rlabelpos{bbr}
%<+cfg>    % Distance between tags and cut marks,
%<+cfg>    % is is a number (not a lenght) of \unitlength units
\def\axislabelsep{0.1}
%<+cfg>    % Color, thickness and size of tics
\def\ticscolor{\axescolor}
\ticsthickness=1pt
\ticssize=4pt
%<+cfg>    % Size of secundary tics
\secundaryticssize=2pt
%<+cfg>    % Thickness and color of Cartesian or polar grid
\gridthickness=0.4pt
\def\gridcolor{gray}
%<+cfg>    % Thickness and color of Cartesian or polar secundary grid
\secundarygridthickness=0.2pt
\def\secundarygridcolor{lightgray}
%<+cfg>    % Number of divisions of unity in x- y- and r-axis
\def\xunitdivisions{1}
\def\yunitdivisions{1}
\def\runitdivisions{1}
%<+cfg>    % Arc labels in radians (\xpct@radianslabel)
%<+cfg>    %            or degrees (\xpct@degreeslabel)
\def\xpct@polarlabel{\xpct@radianslabel}
%<+cfg>%%%%% \put and \multiput extensions
%<+cfg>    % Distance from label to reference point,
%<+cfg>    % is is a number (not a lenght) of \unitlength units
\def\Pictlabelsep{0.1}
%<+cfg>    % Default layout for distance (\defaultPut{c} or \defaultPut{r})
\defaultPut{c}
%<+cfg>%%%%% Reference systems
%<+cfg>    % Default reference system
\referencesystem(0,0)(1,0)(0,1)
%<+cfg>    % Cartesian or polar reference
\cartesianreference
%<+cfg>%%%%% Arrow size in \xtrivVECTOR
\arrowsize{5}{2}
%<+cfg>%%%%% Default interval divisions
%<+cfg>    % (used when plotting conic sections and arcs)
\def\defaultplotdivs{8}
%<+cfg>%%%%% Size to be used by \pointmark
\def\pointmarkdiam{0.1}
%<+cfg>%%%%% Point mark used by \PlotPointsOfFunction
\def\pointmark{\circle*{\pointmarkdiam}}
%</defaults>
%<*xpicture>
%    \end{macrocode}
% \subsection{Commands to be ignored if draft option or \cs{draftPicture} 
%             declaration is active}
% \begin{macro}{\draftPictures}
% This declaration allow user to locally disable |Picture| drawns.
%    \begin{macrocode}
\def\draftPictures{%
       \drafttrue
       \def\cPut##1(##2,##3)##4{}
       \def\xpct@@Put(##1)##2{}
       \def\xpct@@Putstar[##1](##2)##3{}
       \def\xpct@@@Put[##1](##2)##3{}
       \def\defaultPut##1{\def\xpct@defaultPut{\cPut}}
       \def\xpct@@mPut(##1,##2)(##3,##4)##5##6{}
       \def\xpct@PUT##1(##2,##3)##4{}
       \def\xLINE(##1)(##2){}
       \def\xtrivVECTOR(##1)(##2){}
       \def\xVECTOR(##1)(##2){}
       \def\zerovector(##1){}
       \def\zerotrivvector(##1){}
       \def\xline(##1,##2)##3{}
       \def\xvector(##1,##2)##3{}
       \def\xtrivvector(##1,##2)##3{}
       \def\xpct@regPolygon[##1]##2##3{}
       \def\xpct@@qCurve(##1)(##2)(##3)(##4){}
       \def\xpct@PlotQuadraticCurve(##1)(##2)(##3)(##4){%
           \@ifnextchar({\PlotQuadraticCurve(##3)(##4)}{}}
       \def\xpct@@PlotQuadraticCurve(##1)##2(##3)##4{%
           \@ifnextchar({\PlotQuadraticCurve(##3){##4}}{}}
       \def\circularArc##1##2##3{}
       \def\ellipticArc##1##2##3##4{}
       \def\Ellipse##1##2{}
       \def\Circle##1{}
       \def\xpct@hyperbolicArc##1##2##3##4{}
       \def\lHyperbola##1##2##3##4{}
       \def\rHyperbola##1##2##3##4{}
       \def\Hyperbola##1##2##3##4{}
       \def\rhyperbolicArc##1##2##3##4{}
       \def\lhyperbolicArc##1##2##3##4{}
       \def\parabolicArc##1##2##3{}
       \def\Parabola##1##2##3{}
       \def\PlotPointsOfFunction##1##2##3##4{}
       \def\xpct@iterateplotfunction[##1]##2##3##4{}
       \def\xpct@plotfunction##1##2##3{}
       \def\xpct@iterateplotpfunction[##1]##2##3##4{}
       \def\xpct@plotpfunction##1##2##3{}
       \def\cartesianaxes(##1,##2)(##3,##4){}
       \def\cartesiangrid(##1,##2)(##3,##4){}
       \def\plotxtic##1{}
       \def\plotytic##1{}
       \def\printxlabel##1##2{}
       \def\printylabel##1##2{}
       \def\printxticlabel##1##2{}
       \def\printyticlabel##1##2{}
       \def\plotxtics##1##2##3{}
       \def\plotytics##1##2##3{}
       \def\xpct@printlabels##1[##2]##3##4##5{}
       \def\polargrid##1##2{}
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifdraft}
% If |draft| option is active |\draftPictures| is executed. 
% Then all |Picture| commands are disabled.
%    \begin{macrocode}
\ifdraft
   \draftPictures
\fi
%    \end{macrocode}
% \end{macro}
% Input local defaults (file |xpicture.cfg|).
%    \begin{macrocode}
\InputIfFileExists{xpicture.cfg}{\xpct@Infocfg}{\xpct@Infonocfg}
%</xpicture>
%    \end{macrocode}
% \section{Change history}
% \begin{description}
% \item[v1.2a] (2012/11/17)
% 
% Documented source.\par
% Many internal c.s. renamed and/or rewrited.\par
% dvi/pict2e/curve2e options supressed.\par
% draft option added.\par
% Background color added to Picture environment.\par
% \cs{Pictlabelsep} is set to \verb+\normalfont\normalsize$1$+
% when a \verb+Picture+ environment starts.\par
% New commands: \cs{draftPictures},\cs{symmetrize}, 
% \cs{xlabelpos}, \cs{ylabelpos},
% \cs{plotxtic}, \cs{plotytic}, \cs{plotxtics}, \cs{plotytics},
% \cs{printxlabel}, \cs{printylabel}, \cs{printxlabels}, \cs{printylabels},
% \cs{printxticlabel}, \cs{printyticlabel},
% \cs{printxticslabels}, \cs{printyticslabels},
% \cs{makegrid}, \cs{makenogrid}, 
% \cs{PlotPointsOfFunction}, \cs{pointmark}, \cs{pointmarkdiam}.
% 
% \item[v1.2] (2012/04/25) 
% 
% First public version. 
% \end{description}
% \Finale
%