Debian Codegraph @

texmf-dist/source/latex/xpicture/xpicture.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \begingroup
4 \input docstrip.tex
5 \keepsilent
6 \declarepreamble\packagepreamble
7 ********************************************************************
8 The xpicture package
9 Copyright (C) 2010, 2011, 2012 by Robert Fuster <[email protected]>
10 All rights reserved
11
12 This file may be distributed and/or modified under the
13 conditions of the LaTeX Project Public License, either version 1.3c
14 of this license or (at your option) any later version.
15 The latest version of this license is in
16
17 http://www.latex-project.org/lppl.txt
18
19 and version 1.3c or later is part of all distributions of LaTeX
20 version 2005/12/01 or later.
21 ********************************************************************
22 \endpreamble
23 \declarepreamble\cfgpreamble
24 ************************************************************************
25 This is xpicture.cfgxmpl, part of the xpicture distribution
26 Copyright (C) 2010, 2011, 2012 by Robert Fuster <[email protected]>
27 All rights reserved
28
29 This is a model for the xpicture configuration file
30
31 You should not modify this file.
32 To costumize your xpicture installation, make a copy of this file,
33 save it as 'xpicture.cfg' and modify this new file at your convenience.
34 ************************************************************************
35
36 \endpreamble
37 \postamble
38 \endpostamble
39
40 \askforoverwritefalse
41 \generate{\usepreamble\packagepreamble
42 \file{xpicture.sty}{\from{xpicture.dtx}{xpicture,defaults}}
43 \usepreamble\cfgpreamble
44 \file{xpicture.cfgxmpl}{\from{xpicture.dtx}{defaults,cfg}}
45 }
46
47 \def\tmpa{plain}
48 \ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
49 \endgroup
50 %</internal>
51 %
52 % Copyright (C) 2010, 2011, 2012 by Robert Fuster <[email protected]>
53 %
54 % This file may be distributed and/or modified under the
55 % conditions of the LaTeX Project Public License, either version 1.3c
56 % of this license or (at your option) any later version.
57 % The latest version of this license is in
58 %
59 % http://www.latex-project.org/lppl.txt
60 %
61 % and version 1.3c or later is part of all distributions of LaTeX
62 % version 2005/12/01 or later.
63 %
64 % \fi
65 % \CheckSum{2978}
66 %% \CharacterTable
67 %% {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
68 %% 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
69 %% Digits \0\1\2\3\4\5\6\7\8\9
70 %% Exclamation \! Double quote \" Hash (number) \#
71 %% Dollar \$ Percent \% Ampersand \&
72 %% Acute accent \' Left paren \( Right paren \)
73 %% Asterisk \* Plus \+ Comma \,
74 %% Minus \- Point \. Solidus \/
75 %% Colon \: Semicolon \; Less than \<
76 %% Equals \= Greater than \> Question mark \?
77 %% Commercial at \@ Left bracket \[ Backslash \\
78 %% Right bracket \] Circumflex \^ Underscore \_
79 %% Grave accent \` Left brace \{ Vertical bar \|
80 %% Right brace \} Tilde \~}
81 %
82 % \iffalse
83 %<*driver>
84 \documentclass{ltxdoc}
85 \ProvidesFile{xpicture.dtx}
86 [2012/12/17 v.1.2a documented xpicture package]
87 \GetFileInfo{xpicture.dtx}
88 \usepackage[lmargin=5cm,rmargin=2cm]{geometry}
89
90 \usepackage{xpicture}
91
92 \newcommand{\environ}[1]{\textnormal{\texttt{#1}}}
93 \newcommand{\package}[1]{\textnormal{\texttt{#1}}}
94 \newcommand{\option}[1]{\textnormal{\texttt{#1}}}
95 \newcommand{\optionindex}[1]{%
96 \index{#1=\texttt{#1} (package option)|usage}%
97 \index{options:>#1=\texttt{#1}|usage}}
98
99 \newcommand{\starred}{\textnormal{\texttt{*}}}
100 \newcommand{\Parg}[1]{\textnormal{\texttt(\textit{#1}\texttt)}}
101 \makeatletter
102 \newcommand{\myDescribeMacro}{\@ifstar
103 \xpct@myDescribeMacrostar
104 \xpct@myDescribeMacro
105 }
106 \newcommand{\xpct@myDescribeMacro}[1]{\smallskip\par\DescribeMacro{#1}}
107 \newcommand{\xpct@myDescribeMacrostar}[1]{\myDescribeMacro{#1}{ }}
108 \newcommand{\myDescribeEnv}[1]{\smallskip\par
109 \DescribeEnv{#1}{ }\cs{begin}\{\texttt{#1}\}}
110 \makeatother
111
112 \def\fileversion{1.2a}
113 \def\filedate{2012/12/17}
114 \title{The \textsf{xpicture} package\thanks{This document
115 corresponds to \textsf{xpicture}~\fileversion, dated \filedate.}\\
116 (\texttt{http://www.upv.es/\~{}rfuster/xpicture}) \\
117 Several extensions of the \textsf{picture} standard environment\\
118 Reference manual and documented source}
119 \author{Robert Fuster\\
120 Universitat Polit\`ecnica de Val\`encia \\
121 \texttt{[email protected]}}
122 \date{\filedate}
123 \EnableCrossrefs
124 \CodelineIndex
125
126 \begin{document}
127 \DocInput{xpicture.dtx}
128 \newpage
129
130 \PrintIndex
131 \end{document}
132 %</driver>
133 %
134 % \fi
135 %
136 %
137 % \DoNotIndex{\NeedsTeXFormat}
138 % \DoNotIndex{\RequirePackage,\ProcessOptions,\ProvidesPackage}
139 % \DoNotIndex{\CurrentOption,\DeclareOption}
140 % \DoNotIndex{\MessageBreak,\PackageError,\PackageInfo,\PackageWarning}
141 % \DoNotIndex{\PassOptionsToPackage,\InputIfFileExists}
142 % \DoNotIndex{\begingroup,\endgroup,\begin,\end}
143 % \DoNotIndex{\def,\let,\edef,\xdef,\newcommand,\newenvironment}
144 % \DoNotIndex{\if,\ifx,\ifnum,\ifdim,\else,\fi,\@whilenum,\@whiledim,\value}
145 % \DoNotIndex{\@ifnextchar,\@ifstar,\@ifundefined,\@killglue,\do,\newif}
146 % \DoNotIndex{\undefined,\newcounter,\newdimen,\stepcounter}
147 % \DoNotIndex{\setcounter,\setlength,\unitlength,\settoheight,\settowidth}
148 % \DoNotIndex{\p@,\z@}
149 % \DoNotIndex{\noexpand,\ignorespaces}
150 % \DoNotIndex{\normalfont,\normalsize,\small}
151 % \DoNotIndex{\circle,\line,\linethickness,\makebox,\put,\multiput,\qbezier}
152 % \DoNotIndex{\ensuremath,\mathrm,\mathversion}
153 % \DoNotIndex{\scshape}
154 % \DoNotIndex{\color,\textcolor,\colorlet}
155 % \DoNotIndex{\moveto,\lineto,\closepath,\fillpath}
156 % \DoNotIndex{\LINE,\VECTOR,\segment}
157 % \DoNotIndex{\x,\Dx,\y,\Dy,\t,\Dt}
158 % \DoNotIndex{\Picture,\endPicture}
159 % \DoNotIndex{\ADD,\COPY,\GLOBALCOPY}
160 % \DoNotIndex{\COS,\RADtoDEG,\COSH,\COTAN,\COTANH,\CUBE,\DIVIDE,\EXP,\LOG}
161 % \DoNotIndex{\MULTIPLY,\POWER,\SIN,\SINH,\SQRT,\SQUARE,\SUBTRACT,\TAN,\TANH}
162 % \DoNotIndex{\ABSVALUE,\DEGREESCOS,\DEGREESSIN,\DEGREESTAN,\DEGREESCOT}
163 % \DoNotIndex{\COS,\SIN,\TAN,\COT,\pi}
164 % \DoNotIndex{\DETERMINANT,\MATRIXVECTORPRODUCT,\SCALARVECTORPRODUCT}
165 % \DoNotIndex{\MAX,\MIN,\ROUND,\TRUNCATE}
166 % \DoNotIndex{\FLOOR,\FRACTIONSIMPLIFY,\LENGTHDIVIDE,\SQUAREROOT}
167 % \DoNotIndex{\numberTWOPI,\newvectorfunction}
168 % \DoNotIndex{\UNITVECTOR,\VECTORADD,\VECTORCOPY,\VECTORNORM,\VECTORSUB}
169
170 % \maketitle
171 % \begin{abstract}
172 % The \package{xpicture} package extends the graphic abilities
173 % of the \environ{picture} standard environment and packages \package{pict2e}
174 % and \package{curve2e}, adding the ability to work with arbitrary
175 % In addition to other utilities,
176 % the greater interest of \package{xpicture}
177 % lies in its capacity to draw function graphs,
178 % conic sections and arcs, and parametrically defined curves.
179
180 % This is the technical documentation and reference manual
181 % of package \package{xpicture}, but not its user manual.
182 % User manual is on file \texttt{xpicture-doc.pdf},
183 % distributed together with the package.
184 % \end{abstract}
185 % \tableofcontents
186 % \newpage
187 %
188 % \section{Introduction}
189 % The \package{xpicture} package introduces several new graphical
190 % instructions,
191 % and some enriched versions of standard
192 % instructions used inside the \environ{picture} environment.
193 % All these new instructions can be classified as follows:
194 % \begin{enumerate}
195 % \item Reference systems and coordinates:
196 % \begin{itemize}
197 % \item Declaration and use of different reference systems,
198 % with Cartesian or polar coordinates.
199 % \item Instructions to show Cartesian or polar reference systems.
200 % \end{itemize}
201 % \item An alternative to the \environ{picture} environment,
202 % compatible with the new reference systems.
203 % \item Alternative instructions or extensions of the standard
204 % \environ{picture} commands and those defined by the packages
205 % \package{pict2e} and \package{curve2e}:
206 % \begin{itemize}
207 % \item Enriched versions of marks \cs{put} and \cs{multiput},
208 % providing an adequate control of the precise position
209 % in which objects are composed
210 % (this functionality is especially useful in the composition
211 % of not strictly graphical objects, such as formulas or labels).
212 % \item Instructions for drawing straight segments, vectors
213 % (in any direction and using any reference system), polylines,
214 % polygons, regular and arbitrary polygons .
215 % \end{itemize}
216 % \item Regular curves:
217 % \begin{itemize}
218 % \item Instructions for drawing conic sections (circles, ellipses,
219 % hyperbolas and parabolas) and arcs of these curves.
220 % \item Instructions to graph functions and parametrically defined curves
221 % (this is the most interesting feature of this package).
222 % \end{itemize}
223 % \end{enumerate}
224 %
225 % To enjoy this package you need to have an adequate knowledge of the commands
226 % defined in packages \package{calculator} and \package{calculus},
227 % especially concerning to the definition of
228 % functions and operations with functions.
229 %
230 %
231 % \setlength{\marginparsep}{0pt}
232 % \setlength{\parindent}{0pt}
233 % \section{Usage}
234 % This package is loaded as usual, using the instruction
235 % \cs{usepackage}\oarg{list of options}|{xpicture}|.
236 % Then, packages \package{pict2e}, \package{curve2e}, \package{xcolor},
237 % \package{calculator}, and \package{calculus} are automatically loaded.
238 % This package is compatible with any system that supports
239 % \package{xcolor} and \package{pict2e} packages.\footnote{%
240 % Earlier versions supports \option{dvi} option,
241 % which was compatible with a pure \texttt{dvi} output,
242 % but this possibility has been eliminated in version 2.1a,
243 % because it was too expensive and probably unhelpful.}
244 %
245 % Options are passed directly to packages
246 % \package{pict2e}, \package{curve2e}, and \package{xcolor}, excerpt option
247 % \option{draft}\optionindex{draft},
248 % which disables all the instructions defined in this package,
249 % replacing each picture set in a \environ{Picture} environment
250 % by a blank rectangle.\footnote{If you use an instruction
251 % not directly defined by \package{xpicture},
252 % this instruction may take effect.}
253 % Using this option is very convenient throughout the production
254 % of the document,
255 % since the composition of the drawings slows considerably
256 % the compilation time.
257 % The |\draftPictures| declaration performs a similar work,
258 % allowing the user to locally disable |Picture| commands.
259 %
260 % An interesting option (from package \package{pict2e}) is
261 % \option{pstarrows};\optionindex{pstarrows}
262 % if used, arrowheads in vectors are drawn in PSTricks style (instead of the
263 % standard \LaTeX{} style).
264 %
265 % If exists, the local configuration file \texttt{xpicture.cfg} is loaded.
266 % This file allows the user to customize all configurable
267 % \package{xpicture} parameters;
268 % if you want to use it, copy the file \texttt{xpicture.cfgxmpl},
269 % which is distributed along with package \package{xpicture},
270 % call your copy as \texttt{xpicture.cfg}, put it in your local
271 % \texttt{texmf} tree
272 % and edit this file to modify everything agreed.
273 %
274 % \section{The user interface}
275 % \subsection{Color selection}
276 %
277 % \myDescribeMacro\pictcolor\marg{color}
278 % select a color without spurious spaces.
279 %
280 % Example: |\pictcolor{blue}|
281 %
282 % \subsection{Reference systems}
283 % \myDescribeMacro\referencesystem\parg{x0,y0}\parg{x1,y1}\parg{x2,y2}
284 % selects the affine reference system with origin in point
285 % (\textit{x0},\textit{y0}) and coordinate vectors (\textit{x1},\textit{y1})
286 % and (\textit{x2},\textit{y2}).
287 %
288 % Coordinates are refered to the standard reference system.
289 %
290 % Example: |\referencesystem(0,0)(1,-1)(1,1)|
291 %
292 % \myDescribeMacro\changereferencesystem\parg{x0,y0}\parg{x1,y1}\parg{x2,y2}
293 % selects the affine reference system with origin in point
294 % (\textit{x0},\textit{y0}) and coordinate vectors (\textit{x1},\textit{y1})
295 % and (\textit{x2},\textit{y2}).
296 %
297 % Coordinates are refered to the active reference system.
298 %
299 % Example: |\changereferencesystem(0,0)(1,-1)(1,1)|
300 %
301 % \myDescribeMacro\translateorigin\parg{x0,y0}
302 % translates origin to the given point.
303 %
304 % Coordinates are refered to the active reference system.
305 %
306 % Example: |\translateorigin(2,-3)|
307 %
308 % \myDescribeMacro\rotateaxes\marg{angle}
309 % rotates the axes.
310 % The angle parameter is interpreted as the rotation angle in radians
311 % (if the \cs{radiansangles} declaration is active)
312 % or in sexagesimal degrees (if the \cs{degreesangles} declaration is active).
313 %
314 % Coordinates are refered to the active reference system.
315 %
316 % Example: |\rotateaxes{\numberQUARTERPI}|
317 %
318 % \myDescribeMacro\symmetrize\marg{angle}
319 % performs a symmetry, being \textit{angle}
320 % the angle between the symmetry axis and the $x$ axis.
321 % The \cs{radiansangles} and \cs{degreesangles} declarations determine
322 % if angles are interpreted as radians or degrees.
323 %
324 % Coordinates are refered to the active reference system.
325 %
326 % Example: |\symmetrize{\numberPI}|
327 %
328 % \myDescribeMacro*\radiansangles
329 % declares that angles are measured in radians (default).
330 %
331 % \myDescribeMacro*\degreesangles
332 % declares that angles are measured in degrees.
333 %
334 % \myDescribeMacro*\cartesianreference
335 % declares Cartesian coordinates (default).
336 %
337 % \myDescribeMacro*\polarreference
338 % declares polar coordinates.
339 %
340 % \myDescribeMacro\polarcoor\parg{radius,angle}\parg{x,y}
341 % changes from polar to Cartesian coordinates.
342 %
343 % \subsection{The \environ{Picture} environment}
344 %
345 % \myDescribeEnv{Picture}\oarg{color}\parg{x0,y0}\parg{x1,y1}
346 % starts a picture, refered to rectangle
347 % $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$.
348 % If optional argument is present, background is colored with
349 % this \textit{color}. By default, background is not colored.
350 %
351 % Coordinates are refered to the active reference system and are always
352 % Cartesian coordinates.
353 %
354 % Example: |\begin{Picture}[black!10!white](-3.5,-4)(3.5,4)|
355 %
356 % \myDescribeEnv{xpicture}
357 % is an alias for \cs{begin\{Picture\}}.
358 %
359 % Example: |\begin{xpicture}[black!10!white](-3.5,-4)(3.5,4)|
360 %
361 % \myDescribeMacro*{\draftPictures}
362 % disables |Picture| commands, showing only the picture area.
363 %
364 % Example: |\begin{xpicture}[black!10!white](-3.5,-4)(3.5,4)|
365 %
366 % \subsection{Cartesian and polar coordinate axes and grids}
367 %
368 % \myDescribeMacro{\cartesianaxes}\parg{x0,y0}\parg{x1,y1}
369 % draws the coordinate axes corresponding to the
370 % $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$ rectangle.
371 %
372 % Example: |\cartesianaxes(-3.25,-4.5)(3.25,4.25)|
373 %
374 % \myDescribeMacro{\cartesiangrid}\parg{x0,y0}\parg{x1,y1}
375 % draws a coordinate grid corresponding to the
376 % $[\textit{x0},\textit{y0}]\times[\textit{x1},\textit{y1}]$ rectangle.
377 %
378 % Example: |\cartesiangrid(-3.25,-4.5)(3.25,4.25)|
379 %
380 % \myDescribeMacro{\polargrid}\marg{radius}\marg{circledivs}
381 % draws a polar grid. |radius| is the radius of the circle and |circledivs|
382 % (an integer) the number of angular divisions.
383 %
384 % Example: |\polargrid{3.5}{16}|
385 %
386 % \subsubsection{The style of the axes}
387 %
388 % \myDescribeMacro*{\axescolor} User can change the axes color
389 % by redefining the \cs{axescolor} declaration.
390 %
391 % Example: |\renewcommand{\axescolor}{orange}| (default is \texttt{black}).
392 %
393 % \myDescribeMacro*{\axesthickness} Length determining the thickness of axes
394 % (default \verb+1 pt+).
395 %
396 % Example: |\setlength{\axesthickness}{1mm}|
397 %
398 % \myDescribeMacro*{\xunitdivisions} Number of subdivisions of
399 % the unit in the $x$ axis (must a positive integer).
400 %
401 % Example:|\renewcommand{\xunitdivisions}{5}|
402 % (default is \texttt{1}).
403 %
404 % \myDescribeMacro*{\yunitdivisions} Number of subdivisions of
405 % the unit in the $y$ axis (must a positive integer).
406 %
407 % Example:|\renewcommand{\yunitdivisions}{3}|
408 % (default is \texttt{1}).
409 %
410 % \myDescribeMacro*{\runitdivisions} Number of subdivisions of
411 % the unit in the polar axis (must a positive integer).
412 %
413 % Example:|\renewcommand{\runitdivisions}{3}|
414 % (default is \texttt{1}).
415 %
416 % \subsubsection{Axes position}
417 %
418 % \myDescribeMacro*{\internalaxes}
419 % Cartesian axes lies on $y=0$ and $x=0$ (default).
420 %
421 % \myDescribeMacro*{\externalaxes}
422 % Cartesian axes lies on $y=\textit{y0}$ and $x=\textit{x0}$.
423 %
424 % \subsubsection{Style of numerical labels}
425 %
426 % \myDescribeMacro*{\axeslabelcolor}
427 % User can change the color of labels by redefining the
428 % \cs{axeslabelcolor} declaration.
429 %
430 % Example: |\renewcommand{\axeslabelcolor}{red}|
431 % (default is equal to the axes color).
432 %
433 % \myDescribeMacro*{\axeslabelsize}
434 % User can change the size of labels by redefining the
435 % \cs{axeslabelsize} declaration.
436 %
437 % Example: |\renewcommand{\axeslabelsize}{\tiny}|
438 % (default is |\small|).
439 %
440 % \myDescribeMacro*{\axeslabelmathversion}
441 % User can change the mathversion of labels by redefining the
442 % \cs{axeslabelmathversion} declaration.
443 %
444 % Example: |\renewcommand{\axeslabelmathversion}{bold}|
445 % (default is |normal|).
446 %
447 % \myDescribeMacro*{\axeslabelmathalphabet}
448 % User can change the math alphabet of labels by redefining the
449 % \cs{axeslabelmathalphabet} declaration.
450 %
451 % Example: |\renewcommand{\axeslabelmathalphabet}{\mathsf}|
452 % (default is |\mathrm|).
453 %
454 % \myDescribeMacro*{\radianspolarlabels}
455 % when this declaration is active, angular labels in polar grids are printed
456 % in radians (default).
457 %
458 % \myDescribeMacro*{\degreespolarlabels}
459 % when this declaration is active, angular labels in polar grids are printed
460 % in degrees.
461 %
462 % \myDescribeMacro*{\axislabelsep}
463 % Distance between tags and cut marks, measured in \cs{unitlength} units;
464 % the distance between axes and tags equals \cs{ticssize}$+$\cs{axislabelsep}.
465 % (see description of \cs{makenotics}).
466 %
467 % Example: |\renewcommand{\axislabelsep}{0.3}|
468 % (default is |0.1|).
469 %
470 % \subsubsection{Position of numerical labels}
471 %
472 % \myDescribeMacro{\xlabelpos}\marg{position}
473 % Relative position of labels in $x$ axis.
474 %
475 % Example: |\xlabelpos{t}|
476 % (default is |-90|).
477 %
478 % \myDescribeMacro{\ylabelpos}\marg{position}
479 % Relative position of labels in $y$ axis.
480 %
481 % Example: |\ylabelpos{tl}|
482 % (default is |180|).
483 %
484 % \subsubsection{Style of cut marks}
485 %
486 % \myDescribeMacro*{\ticssize}
487 % half the length of main axes cuts.
488 %
489 % Example: |\setlength{\ticssize}{3mm}|
490 % (default is |4pt|)
491 %
492 % \myDescribeMacro*{\secundaryticssize}
493 % half the length of secundary axes cuts.
494 %
495 % Example: |\setlength{\secunadryticssize}{1mm}|
496 % (default is |2pt|)
497 %
498 % \myDescribeMacro*{\ticsthickness}
499 % thickness of the marks on axes.
500 %
501 % Example: |\setlength{\ticsthickness}{0.5pt}|
502 % (default is |1pt|)
503 %
504 % \myDescribeMacro*{\ticscolor}
505 % User can change the color of tics by redefining the
506 % \cs{ticscolor} declaration.
507 %
508 % Example: |\renewcommand{\ticscolor}{lightgray}|
509 % (default is |black|)
510 %
511 % \subsubsection{Grid style}
512 %
513 % \myDescribeMacro*{\gridthickness}
514 % thickness of the main grid lines.
515 %
516 % Example: |\setlength{\gridthickness}{1pt}|
517 % (default is |0.4pt|)
518 %
519 % \myDescribeMacro*{\secundarygridthickness}
520 % thickness of the secundary grid lines.
521 %
522 % Example: |\setlength{\gridthickness}{0.25pt}|
523 % (default is |0.2pt|)
524 %
525 % \myDescribeMacro*{\gridcolor}
526 % User can change the color of main grid lines by redefining the
527 % \cs{ticscolor} declaration.
528 %
529 % Example: |\renewcommand{\gridcolor}{blue}|
530 % (default is |gray|)
531 %
532 % \myDescribeMacro*{\secundarygridcolor}
533 % User can change the color of secundary grid lines by redefining the
534 % \cs{ticscolor} declaration.
535 %
536 % Example: |\renewcommand{\secundarygridcolor}{blue}|
537 % (default is |lightgray|)
538 %
539 % \subsubsection{Removing cut marks, labels and grids}
540 % \myDescribeMacro*{\maketics}
541 % when this declaration is active, divisions of axes are marked (default).
542 %
543 % \myDescribeMacro*{\makenotics}
544 % when this declaration is active, divisions of axes are not marked.
545 %
546 % In this case, the distance between axes and tags equals \cs{axislabelsep}.
547 %
548 % \myDescribeMacro*{\makelabels}
549 % when this declaration is active, numerical labels are printed (default).
550 %
551 % \myDescribeMacro*{\makenolabels}
552 % when this declaration is active, numerical labels are not printed.
553 %
554 % \myDescribeMacro*{\makenogrid}
555 % If the \cs{makenogrid} declaration is active,
556 % then \cs{cartesianaxes} plots only the axes (default).
557 %
558 % \myDescribeMacro*{\makegrid}
559 % If the \cs{makegrid} declaration is active,
560 % then \cs{cartesianaxes} plots a Cartesian grid.
561 %
562 % In this case, \cs{cartesianaxes} is equivalent to \cs{cartesiangrid}.
563 %
564 % \subsection{Directly printing cuts and labels}
565 %
566 % \myDescribeMacro{\plotxtic}\marg{x-coor}
567 % plot a tic for the given $x$ coordinate.
568 %
569 % \myDescribeMacro{\plotytic}\marg{y-coor}
570 % plot a tic for the given $y$ coordinate.
571 %
572 % \myDescribeMacro{\printxlabel}\marg{x-coor}\marg{label}
573 % print the required label at the given $x$ coordinate.
574 %
575 % \myDescribeMacro{\printylabel}\marg{y-coor}\marg{label}
576 % print the required label at the given $y$ coordinate.
577 %
578 % \myDescribeMacro{\printxticlabel}\marg{x-coor}\marg{label}
579 % print a tic and the required label at the given $x$ coordinate.
580 %
581 % \myDescribeMacro{\printyticlabel}\marg{y-coor}\marg{label}
582 % print a tic and the required label at the given $y$ coordinate.
583 %
584 % \myDescribeMacro{\plotxtics}\marg{firstcoor}\marg{incr}\marg{bound}
585 % plot several $x$ tics, from the initial coordinate \textit{firstcoor};
586 % \textit{incr} is the distance between consecutive tics,
587 % and the last tic is not in a position greater than \textit{bound}.
588 %
589 % \myDescribeMacro{\plotytics}\marg{firstcoor}\marg{incr}\marg{bound}
590 % plot several $y$ tics, from the initial coordinate \textit{firstcoor};
591 % \textit{incr} is the distance between consecutive tics,
592 % and the last tic is not in a position greater than \textit{bound}.
593 %
594 % \myDescribeMacro{\printxlabels}%
595 % \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
596 % print several $x$ labels, from the initial coordinate \textit{firstcoor};
597 % \textit{incr} is the distance between consecutive label positions,
598 % and the last position is not greater than \textit{bound}.
599 % The optional argument \textit{digits} is the number of decimal
600 % digits to be printed
601 % (by default, numbers are printed with its natural number of decimals).
602 % \myDescribeMacro{\printylabels}%
603 % \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
604 % print several $x$ labels, from the initial coordinate \textit{firstcoor};
605 % \textit{incr} is the distance between consecutive label positions,
606 % and the last position is not greater than \textit{bound}.
607 % The optional argument \textit{digits} is the number of decimal
608 % digits to be printed
609 % (by default, numbers are printed with its natural number of decimals).
610 %
611 % \myDescribeMacro{\printxticslabels}%
612 % \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
613 % print $x$ tics and labels simultaneously.
614 %
615 % \myDescribeMacro{\printyticslabels}%
616 % \oarg{digits}\marg{firstcoor}\marg{incr}\marg{bound}
617 % print $y$ tics and labels simultaneously.
618 %
619 % \subsection{\cs{put} and \cs{multiput} extensions}
620 %
621 % \myDescribeMacro{\cPut}\marg{position}\parg{x,y}\marg{object}
622 % \myDescribeMacro{\rPut}\starred\marg{position}\parg{x,y}\marg{object}
623 % \myDescribeMacro{\Put}\starred\oarg{position}\parg{x,y}\marg{object}
624 %
625 % draw \textit{object} in point \Parg{x,y}.
626 % Argument \textit{position} fixes the precise position of \textit{object}
627 % with respect \Parg{x,y}.
628 %
629 % In starred versions objects positioned below the reference point
630 % are aligned at a fixed vertical distance (normally, by the baseline).
631 % User must decide which is that amount (normally the higher object
632 % to be positioned), and introduce it as an argument of
633 % the \cs{highestlabel} declaration.
634 %
635 % Example: |\Put*[SSE](1,2){\Ellipse{2}{3}}|
636 %
637 % \medskip
638 %
639 % Argument \textit{position} supports the following values:
640 % \begin{description}
641 % \item[An integer or decimal number,] determining the angle (in degrees)
642 % where \textit{object} is placed,
643 % (with respect to the reference point \Parg{x,y}).
644 % \item[Letter \texttt{c}]
645 % which places the center of \textit{object} at
646 % \Parg{x,y}).
647 % \item[Letter or letter combinations \texttt N, \texttt E, \texttt S,
648 % \texttt W,
649 % \texttt{NE}, \texttt{SE}, \texttt{SW}, \texttt{NW},
650 % \texttt{NNE}, \texttt{ENE}, \texttt{ESE}, \texttt{SSE}, \texttt{SSW},%
651 % \texttt{WSW}, \texttt{WNW},
652 % \texttt{NNW}]
653 % Abbreviation of \emph{North}, \emph{East}\ldots, \emph{North-East}\ldots,
654 % \emph{North-North-East}\ldots
655 % \item[Letter o letter combinations \texttt t, \texttt r, \texttt b,%
656 % \texttt l,
657 % \texttt{tr}, \texttt{br}, \texttt{bl}, \texttt{tl},
658 % \texttt{ttr}, \texttt{rtr}, \texttt{rbr}, \texttt{bbr}, \texttt{bbl},%
659 % \texttt{lbl}, \texttt{ltl},
660 % \texttt{ttl}]
661 % Abbreviation of \emph{top}, \emph{right}\ldots, \emph{top-right}\ldots,
662 % \emph{top-top-right}\ldots
663 %
664 % \end{description}
665 % Without optional argument \textit{position} (in command \cs{Put})
666 % the reference point of \textit{object} is placed at
667 % \Parg{x,y})
668 % (in a similar way to the \cs{put} command).
669 %
670 % \myDescribeMacro*{\Pictlabelsep}
671 % determines the distance between the graphical object and the given point.
672 % User can redefine this declaration by typing
673 % \cs{renewcommand}\cs{Pictlabelsep}\marg{number}.
674 % This number is interpreted as an amount of |\unitlength|.
675 %
676 % Example: |\renewcommand{\Pictlabelsep}{1}| (default is |0.1|).
677 %
678 % This distance is understood either as the Euclidean (circular) distance,
679 % derived from the $2$-norm,
680 % or as the distance derived from the $\infty$-norm (rectangular distance),
681 % following these rules:
682 % \begin{itemize}
683 % \item If argument \textit{position} is a \textit{compass} argument
684 % (like \texttt N or \texttt{SSW}), then circular distance is used.
685 % \item If argument \textit{position} is like \texttt t, \texttt{bbl},\ldots
686 % then rectangular distance is used.
687 % In all other cases, |\cPut| uses circular distance,
688 % |\rPut| uses rectangular distance and |\Put| uses distance established
689 % by \cs{defaultPut}.
690 % \end{itemize}
691 %
692 % \myDescribeMacro{\defaultPut}\marg{position}
693 % fixes the default position for \cs{Put}, \cs{multiPut} and \cs{multiPlot}
694 % commands. Argument \textit{position} can be \texttt c or \texttt r.
695 %
696 % Example: |\defaultPut{r}| (default is \texttt c).
697 %
698 % \myDescribeMacro{\highestlabel}\marg{text} declares the highest label to be
699 % equal to height of \textit{text}.
700 %
701 % Example: |\highestlabel{\Huge A}| (default is |\normalfont\normalsize$1$|)
702 %
703 % \myDescribeMacro{\multicPut}
704 % \marg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
705 % \myDescribeMacro{\multirPut}\starred
706 % \marg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
707 % \myDescribeMacro{\multiPut}\starred
708 % \oarg{position}\parg{x,y}\parg{$\Delta$x,$\Delta$y}\marg{n}\marg{object}
709 %
710 % put \textit{n} copies of \textit{object} in \textit{position}
711 % at points
712 % $(\textit{x0},\textit{y0})$, $(\textit{x0}+\Delta x,\textit{y0}+\Delta y)$,
713 % $(\textit{x0}+2\Delta x,\textit{y0}+2\Delta y)$, \ldots,
714 % $(\textit{x0}+(\textit n-1)\Delta x,\textit{y0}+(\textit n-1)\Delta y)$.
715 %
716 % Example: |\multicPut{c}(1,2)(1,-1){4}{\xVECTOR(0,0)(1,1)}|
717 %
718 % \myDescribeMacro{\multicPlot}
719 % \marg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
720 %
721 % \myDescribeMacro{\multirPlot}\starred
722 % \marg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
723 %
724 % \myDescribeMacro{\multiPlot}\starred
725 % \oarg{position}\marg{object}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
726 %
727 % put $\textit{n}+1$ copies of \textit{object} at points
728 % \Parg{x0,y0},
729 % \Parg{x1,y1},\ldots,
730 % \Parg{xn,yn}
731 %
732 % Example: |\multirPlot{c}{\xVECTOR(0,0)(1,1)}(1,2)(2,1)(3,0)(4,-1)|
733 %
734 % \subsection{Drawing lines, vectors and polylines}
735 %
736 % \subsubsection{Lines and vectors}
737 %
738 % \myDescribeMacro{\xLINE}\parg{x0,y0}\parg{x1,y1}
739 % draws a stright line between points \Parg{x0,y0}
740 % and \Parg{x1,y1}.
741 %
742 % Example: |\xLINE(1,-2)(0,3)|.
743 %
744 % \myDescribeMacro{\xVECTOR}\parg{x0,y0}\parg{x1,y1}
745 % draws an arrow from point \Parg{x0,y0}
746 % to point \Parg{x1,y1}.
747 %
748 % Example: |\xVECTOR(1,-2)(0,3)|.
749 %
750 % \myDescribeMacro{\xtrivVECTOR}\parg{x0,y0}\parg{x1,y1}
751 % draws an arrow from point \Parg{x0,y0}
752 % to point \Parg{x1,y1}.
753 % The arrowhead consists of two lines, controled by the |\arrowsize|
754 % declaration.
755 %
756 % Example: |\xtrivVECTOR(1,-2)(0,3)|.
757 %
758 % \myDescribeMacro{\xline}\parg{x,y}\marg{size}
759 % \myDescribeMacro{\xvector}\parg{x,y}\marg{size}
760 % \myDescribeMacro{\xtrivvector}\parg{x,y}\marg{size}
761 %
762 % draw lines, vectors and triv vectors with the standard \LaTeX{} syntax,
763 % but without any restriction.
764 %
765 % Example: |\Put(1,-2){\xline(-1,5){1}}|
766 %
767 % \myDescribeMacro{\zerovector}\parg{x,y}
768 % \myDescribeMacro{\zerotrivvector}\parg{x,y}
769 %
770 % draw a zero-length vector (an arrowhead) in direction
771 % \Parg{x,y}.
772 %
773 % Example: |\Put(0,3){\zerovector(-1,5)}|
774 %
775 % \myDescribeMacro\arrowsize\marg{xlen}\marg{ylen}
776 % declares dimensions of triv arrowhead: |xlen|\,pt is its length, and
777 % |ylen|\,pt is half of its aperture.
778 %
779 % Example: |\arrowsize{4}{2}| (default is |xlen=5|, |ylen=2|)
780 %
781 % \subsubsection{Polylines and polygons}
782 %
783 % \myDescribeMacro{\Polyline}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
784 % draws a polyline with vertices
785 % \Parg{x0,y0}\Parg{x1,y1}\ldots\Parg{xn,yn}.
786 %
787 % Example: |\Polyline(1,1)(2,0)(0,-1)|
788 %
789 % \myDescribeMacro{\Polygon}\parg{x0,y0}\parg{x1,y1}\ldots\parg{xn,yn}
790 % draws a polygon with vertices
791 % \Parg{x0,y0}\Parg{x1,y1}\ldots\Parg{xn,yn}.
792 %
793 % Example: |\Polygon(1,1)(2,0)(0,-1)|
794 %
795 % \myDescribeMacro{\regularPolygon}\oarg{angle}\marg{radius}\marg{sides}
796 % draws a regular polygon with the given \textit{radius} and \textit{sides}.
797 % The optional argument (zero, by default) determines the inclination angle
798 % of the first vertex, always measured in degrees.
799 %
800 % Example: |\regularPolygon[90]{4}{7}|
801 %
802 % \subsection{Drawing curves}
803 % \subsubsection{Conic sections and arcs}
804 %
805 % \myDescribeMacro{\Circle}\marg{r}
806 % draws the circle $x^2+y^2=\textit{r}^2$.
807 %
808 % Example: |\Circle{2.5}|
809 %
810 % \myDescribeMacro{\Ellipse}\marg{a}\marg{b}
811 % draws the ellipse
812 % $\displaystyle\frac{x^2}{\textit{a}^2}+\frac{y^2}{\textit{b}^2}=1$.
813 %
814 % Example: |\Ellipse{2}{3}|
815 %
816 % \myDescribeMacro{\Hyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
817 % draws the hyperbola
818 % $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
819 %
820 % Variables $x$ and $y$ are limited, respectively,
821 % to the $[-\textit{xmax},\textit{xmax}]$ and
822 % $[-\textit{ymax},\textit{ymax}]$ intervals.
823 % This curve is well defined if the parameter \textit{xmax}
824 % is greater than \textit{a}. Otherwise, \package{xpicture} returns an error
825 % message and does not draw any curve.
826 %
827 % Example: |\Hyperbola{2}{3}{5}{5}|
828 %
829 % \myDescribeMacro{\rHyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
830 % draws the \emph{right} branch of hyperbola
831 % $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
832 %
833 % (parameters are restricted as in |\Hyperbola|).
834 %
835 % Example: |\rHyperbola{2}{3}{5}{5}|
836 %
837 % \myDescribeMacro{\lHyperbola}\marg{a}\marg{b}\marg{xmax}\marg{ymax}
838 % draws the \emph{left} branch of hyperbola
839 % $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$.
840 %
841 % (parameters are restricted as in |\Hyperbola|).
842 %
843 % Example: |\rHyperbola{2}{3}{5}{5}|
844 %
845 % \myDescribeMacro{\Parabola}\marg{a}\marg{xmax}\marg{ymax}
846 % draws the parabola $x=ay^2$.
847 %
848 % Variable $x$ is limited, respectively,
849 % to the $[0,\textit{xmax}]$ (if \textit{a} is positive)
850 % or $[-\textit{xmax},0]$ (if negative) interval.
851 % $[-\textit{ymax},\textit{ymax}]$ intervals.
852 %
853 % Example: |\Parabola{2}{5}{5}|
854 %
855 % \myDescribeMacro{\circularArc}\marg{r}\marg{angle1}\marg{angle2}
856 % draws the arc of circle
857 % $x=r\cos t,y=r\sin t,\ t\in[\textit{angle1},\textit{angle2}]$
858 % (the arc of the circle centered at $(0,0)$ with radius $\textit{r}$
859 % and limited between $\textit{angle1}$ and $\textit{angle2}$).
860 %
861 % Example: |\circularArc{3}{0}{\numberSIXTHPI}|
862 %
863 % \myDescribeMacro*{\xArc} is an alias for \cs{circularArc}.
864 %
865 % Example: |\xArc{3}{0}{\numberSIXTHPI}|
866 %
867 % \myDescribeMacro{\ellipticArc}\marg{a}\marg{b}\marg{angle1}\marg{angle2}
868 % draws the arc of ellipse
869 % $x=a\cos t,y=b\sin t,\ t\in[\textit{angle1},\textit{angle2}]$
870 % (the arc of the ellipse centered at $(0,0)$ with semiaxes
871 % $\textit{a}$ and $\textit{b}$
872 % and limited between $\textit{angle1}$ and $\textit{angle2}$).
873 %
874 % Example: |\ellipticArc{2}{3}{-\numberSIXTHPI}{\numberSIXTHPI}|
875 %
876 % \myDescribeMacro{\rhyperbolicArc}\marg{a}\marg{b}\marg{y0}\marg{y1}
877 % draws the right arc of hyperbola
878 % $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$
879 % included between
880 % $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
881 %
882 % Example: |\rhyperbolicArc{2}{3}{-2}{2}|
883 %
884 % \myDescribeMacro{\lhyperbolicArc}\marg{a}\marg{b}\marg{y0}\marg{y1}
885 % draws the left arc of hyperbola
886 % $\displaystyle\frac{x^2}{\textit{a}^2}-\frac{y^2}{\textit{b}^2}=1$
887 % included between $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
888 %
889 % Example: |\lhyperbolicArc{2}{3}{-2}{2}|
890 %
891 % \myDescribeMacro{\parabolicArc}\marg{a}\marg{y0}\marg{y1}
892 % Draw the arc of the parabola $x=ay^2$ included between
893 % $\textit{y}=\textit{y0}$ and $\textit{y}=\textit{y1}$.
894 %
895 % Example: |\parabolicArc{2}{-2}{2}|
896 %
897 % \myDescribeMacro{\defaultplotdivs}\marg{divisions}
898 % declares the number of subintervals we divide the domain of curves
899 % when plotting conic arcs.
900 %
901 % Example: |\defaultplotdivs{16}| (default is |8|).
902 %
903 % \subsubsection{Real variable functions}
904 %
905 % \myDescribeMacro{\PlotFunction}
906 % \oarg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
907 % draws the graph of function \cs{functionname}$(t)$,
908 % $t\in[\textit{t0},\textit{t1}]$.
909 % This interval is partitioned in \textit{n} subintervals (default for
910 % \textit{n} is |2|).
911 %
912 % Example: |\PlotFunction[16]{\COSfunction}{-\numberTWOPI}{\numberTWOPI}|
913 %
914 % \myDescribeMacro{\PlotPointsOfFunction}
915 % \marg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
916 % draws $\textit{n}+1$ points of the graph of function \cs{functionname}$(t)$,
917 % $t\in[\textit{t0},\textit{t1}]$.
918 %
919 % Example: |\PlotPointsOfFunction{20}{\SQRTfunction}{0}{4}|
920 %
921 % \myDescribeMacro*{\pointmarkdiam}
922 % is the size of points printed by |\PlotPointsOfFunction|, measured in
923 % |\unitlength| units. It may be
924 % redefined with a |\renewcommand| declaration.
925 %
926 % Example: |\renewcommand{\pointmarkdiam}{0.3}|
927 %
928 % \myDescribeMacro*{\pointmark}
929 % is the symbol printed at every point by |\PlotPointsOfFunction|. It may be
930 % redefined with a |\renewcommand| declaration.
931 %
932 % Example: |\renewcommand{\pointmark}{$\diamond$}|
933 %
934 % \subsubsection{Parametrically defined curves}
935 %
936 % \myDescribeMacro{\PlotParametricFunction}
937 % \oarg{n}\marg{\textbackslash functionname}\marg{t0}\marg{t1}
938 % draws the graph of parametric curve \cs{functionname}$(t)$,
939 % $t\in[\textit{t0},\textit{t1}]$.
940 % This interval is partitioned in \textit{n} subintervals (default for
941 % \textit{n} is |2|).
942 %
943 % Example: |\ParametricFunction{\F}{\SQUAREfunction}{CUBEfunction}|
944 % \\
945 % \phantom{Example:} |\PlotParametricFunction[15]{\F}{-2}{2}|
946 %
947 % \subsubsection{Drawing curves from a table of values}
948 %
949 % \myDescribeMacro{\qCurve}\parg{x0,y0}\parg{u0,v0}\parg{x1,y1}\parg{u1,v1}
950 % draws the quadratic curve between points \textit{x0,y0} and \textit{x1,y1}
951 % with tangent vectors \textit{u0,v0} nd \textit{u1,v1}.
952 %
953 % Example: |\qCurve(1,2)(1,2)(4,3)(-1,1)|
954 %
955 % \myDescribeMacro{\PlotQuadraticCurve}
956 % \parg{x0,y0}\parg{u0,v0}\parg{x1,y1}\parg{u1,v1}\ldots%
957 % \parg{xn,yn}\parg{un,vn}
958 %
959 % draws a curve through the points
960 % \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn}
961 % with tangent vectors
962 % \parg{u0,v0}, \parg{u1,v1},\ldots, \parg{un,vn}.
963 %
964 % Example:
965 % |\PlotQuadraticCurve(1,0)(1,0)(0,1)(0,1)(-1,0)(-1,0)(0,-1)(0,-1)|
966 %
967 % \myDescribeMacro{\PlotQuadraticCurve}
968 % \parg{x0,y0}\marg{angle0}\parg{x1,y1}\marg{angle1}\ldots
969 % \parg{xn,yn}\marg{anglen}
970 %
971 % draws a curve through the points
972 % \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn}
973 % the inclination angles of which, with respect to the $x$ axis,
974 % are \textit{{angle0}, \textit{angle1}}\dots,
975 % \textit{anglen} (always measured in degrees).
976 %
977 % Example:
978 % |\PlotQuadraticCurve(1,0){0}(0,1){90}(-1,0){180}(0,-1){270}}|
979 % \StopEventually{}
980 %
981 % \myDescribeMacro{\PlotxyDyData}
982 % \parg{x0,y0,Dy0}\parg{x1,y1,Dy1}\ldots\parg{xn,yn,Dyn}
983 % draws a curve through the points
984 % \parg{x0,y0}, \parg{x1,y1},\ldots, \parg{xn,yn}
985 % with derivatives \textit{Dy0}, \textit{Dy1}, \ldots, \textit{Dyn}.
986 % \section{Implementation}
987 % \begin{macrocode}
988 %<*xpicture>
989 \NeedsTeXFormat{LaTeX2e}
990 \ProvidesPackage{xpicture}[2012/12/17 v.1.2a picture environment extensions]
991 % \end{macrocode}
992 % \subsection{Package options}
993 % If the |draft| option is selected,
994 % |Picture| environments are shown
995 % as a rectangular frame and |xpicture| commands are ignored
996 % (Boolean |draft| controls whether this option has been selected).
997 % \begin{macrocode}
998 \newif\ifdraft\draftfalse
999 \DeclareOption{draft}{\drafttrue}
1000 % \end{macrocode}
1001 % All other options are passed to packages |curve2e| and |xcolor|
1002 % (Old options |dvi|, |pict2e| and |curve2e| have been removed in
1003 % version 1.2a).
1004 % \begin{macrocode}
1005 \DeclareOption*{%
1006 \PassOptionsToPackage{\CurrentOption}{curve2e}
1007 \PassOptionsToPackage{\CurrentOption}{xcolor}}
1008 \ProcessOptions
1009 % \end{macrocode}
1010 % \subsection{Booleans for some command options}
1011 % Booleans used by several declarations
1012 % controlling the behavior of some |xpicture| commands.
1013 % \begin{macro}{\ifpolar}
1014 % True: polar coordinates. False: Cartesian coordinates.
1015 % \begin{macrocode}
1016 \newif\ifpolar\polarfalse
1017 % \end{macrocode}
1018 % \end{macro}
1019 % \begin{macro}{\ifrputstar}
1020 % True: |\rPut| starred.
1021 % \begin{macrocode}
1022 \newif\ifrputstar\rputstarfalse
1023 % \end{macrocode}
1024 % \end{macro}
1025 % \begin{macro}{\ifdegrees}
1026 % True: angles mesured in degrees. False: arcs mesured in radians.
1027 % \begin{macrocode}
1028 \newif\ifdegrees\degreesfalse
1029 % \end{macrocode}
1030 % \end{macro}
1031 % \begin{macro}{\iftics}
1032 % True: coordinate axes include tic marks.
1033 % \begin{macrocode}
1034 \newif\iftics\ticstrue
1035 % \end{macrocode}
1036 % \end{macro}
1037 % \begin{macro}{\iflabels}
1038 % True: coordinate axes include numeric labels.
1039 % \begin{macrocode}
1040 \newif\iflabels\labelstrue
1041 % \end{macrocode}
1042 % \end{macro}
1043 % \begin{macro}{\ifgrid}
1044 % True: Cartesian grids.
1045 % \begin{macrocode}
1046 \newif\ifgrid\gridfalse
1047 % \end{macrocode}
1048 % \end{macro}
1049 % \begin{macro}{\ifticslabelsgrid}
1050 % True: Tics, labels or grid must be printed.
1051 % \begin{macrocode}
1052 \newif\ifticslabelsgrid\ticslabelsgridfalse
1053 % \end{macrocode}
1054 % \end{macro}
1055 % \begin{macro}{\ifinzeroaxes}
1056 % True: Representation of axes passes through the origin (internal axes).
1057 % False: external axes.
1058 % \begin{macrocode}
1059 \newif\ifinzeroaxes\inzeroaxestrue
1060 % \end{macrocode}
1061 % \end{macro}
1062 % \begin{macro}{\ifbg}
1063 % True: Background will be colored.
1064 % \begin{macrocode}
1065 \newif\ifbg\bgfalse
1066 % \end{macrocode}
1067 % \end{macro}
1068 % \subsection{Required packages}
1069 % \begin{macrocode}
1070 \RequirePackage{curve2e}
1071 \RequirePackage{xcolor}
1072 \RequirePackage{calculus}
1073 % \end{macrocode}
1074 % \subsection{Error, Warning and Info messages}
1075 % \begin{macrocode}
1076 \def\xpct@Warnbadpos{%
1077 \PackageWarning{xpicture}%
1078 {Argument in \noexpand\defaultPut command must be either
1079 'c' or 'r'\MessageBreak
1080 I will no change the default position for
1081 \noexpand\Put commands}}
1082 \def\xpct@Infopos#1{%
1083 \PackageInfo{xpicture}%
1084 {Default position for \noexpand\Put commands changed to #1}}
1085 \def\xpct@WarnIncSys(#1,#2)(#3,#4){%
1086 \PackageWarning{xpicture}{%
1087 Incompatible linear system!\MessageBreak
1088 Tangent lines are parallel}}
1089 \def\xpct@ErrHypCons{%
1090 \PackageError{xpicture}{%
1091 Inconsistent parameters in \noexpand\Hyperbola command}{%
1092 The first and second parameters in a \noexpand\Hyperbola
1093 command\MessageBreak
1094 must be, respectively, lesser than the third and
1095 the fourth ones.}}
1096 \def\xpct@Infocfg{\PackageInfo{xpicture}{%
1097 Loading local configuration file xpicture.cfg}}
1098 \def\xpct@Infonocfg{\PackageInfo{xpicture}{%
1099 Local configuration file xpicture.cfg does not exists}}
1100 % \end{macrocode}
1101 % \subsection{Internal counters and lengths and a special number}
1102 % Counters |xpct@counta| and |xpct@countb| will be used by several
1103 % internal commands (mainly in |while| clauses).
1104 % |xpct@step| is used when iterating functions plots, and
1105 % |multiput| by commands extending the |\multiput| command.
1106 % \begin{macrocode}
1107 \newcounter{xpct@counta}
1108 \newcounter{xpct@countb}
1109 \newcounter{xpct@step}
1110 \newcounter{multiput}
1111 % \end{macrocode}
1112 % \begin{macro}{\xpct@bxw}
1113 % \begin{macro}{\xpct@bxh}
1114 % Width and height of certain boxes.
1115 % \begin{macrocode}
1116 \newdimen\xpct@bxw
1117 \newdimen\xpct@bxh
1118 % \end{macrocode}
1119 % \end{macro}
1120 % \end{macro}
1121 % \begin{macro}{\xpct@maxnum}
1122 % The largest \TeX{} number.
1123 % \begin{macrocode}
1124 \def\xpct@maxnum{16383.99998}
1125 % \end{macrocode}
1126 % \end{macro}
1127 % \subsection{Declarations and parameters controlling axes style}
1128 % \begin{macro}{\makenotics}
1129 % \begin{macro}{\maketics}
1130 % \begin{macro}{\makenolabels}
1131 % \begin{macro}{\makelabels}
1132 % \begin{macro}{\makegrid}
1133 % \begin{macro}{\makenogrid}
1134 % \begin{macro}{\externalaxes}
1135 % \begin{macro}{\internalaxes}
1136 % Four pairs of alternative declarations, switching booleans
1137 % |\iftics|, |\iflabels|, |\ifgrid|, and |\ifinzeroaxes|.
1138 % Defaults are |\maketics|, |\makelabels|, |\makenogrid|,
1139 % and |\internalaxes|.
1140 % \begin{macrocode}
1141 \def\makenotics{\ticsfalse}
1142 \def\maketics{\ticstrue}
1143 \def\makenolabels{\labelsfalse}
1144 \def\makelabels{\labelstrue}
1145 \def\makenogrid{\gridfalse}
1146 \def\makegrid{\gridtrue}
1147 \def\externalaxes{\inzeroaxesfalse}
1148 \def\internalaxes{\inzeroaxestrue}
1149 % \end{macrocode}
1150 % \end{macro}
1151 % \end{macro}
1152 % \end{macro}
1153 % \end{macro}
1154 % \end{macro}
1155 % \end{macro}
1156 % \end{macro}
1157 % \end{macro}
1158 % \begin{macro}{\axesthickness}
1159 % Thickness of axes (it is a length).
1160 % \begin{macrocode}
1161 \newdimen\axesthickness
1162 % \end{macrocode}
1163 % \end{macro}
1164 % \begin{macro}{\xpct@axeslabelattrib}
1165 % Attributes of labels. It is a private declaration, because you can select
1166 % attributes (size, color and mathversion) of labels independently.
1167 % \begin{macrocode}
1168 \def\xpct@axeslabelattrib{\axeslabelsize%
1169 \pictcolor{\axeslabelcolor}%
1170 \mathversion{\axeslabelmathversion}}
1171 % \end{macrocode}
1172 % \end{macro}
1173 % \begin{macro}{\ticsthickness}
1174 % \begin{macro}{\ticssize}
1175 % \begin{macro}{\secundaryticssize}
1176 % \begin{macro}{\gridthickness}
1177 % \begin{macro}{\secundarygridthickness}
1178 % Thickness and size of tics and grid lines.
1179 % \begin{macrocode}
1180 \newdimen\ticsthickness
1181 \newdimen\ticssize
1182 \newdimen\secundaryticssize
1183 \newdimen\gridthickness
1184 \newdimen\secundarygridthickness
1185 % \end{macrocode}
1186 % \end{macro}
1187 % \end{macro}
1188 % \end{macro}
1189 % \end{macro}
1190 % \end{macro}
1191 % \subsection{Color selection}
1192 % \begin{macro}{\pictcolor}
1193 % Declaration |\pictcolor| supresses spureus spaces when selecting color.
1194 % \begin{macrocode}
1195 \def\pictcolor{\@killglue\color}
1196 % \end{macrocode}
1197 % \end{macro}
1198 % \subsection{Reference systems}
1199 % \begin{macro}{\standardreferencesystem}
1200 % Declaration to select the standard reference system.
1201 % \begin{macrocode}
1202 \def\standardreferencesystem{\referencesystem(0,0)(1,0)(0,1)}
1203 % \end{macrocode}
1204 % \end{macro}
1205 % \begin{macro}{\referencesystem}
1206 % \begin{macro}{\changereferencesystem}
1207 % \begin{macro}{\xpct@xorigin}
1208 % \begin{macro}{\xpct@yorigin}
1209 % \begin{macro}{\xpct@xI}
1210 % \begin{macro}{\xpct@yI}
1211 % \begin{macro}{\xpct@xII}
1212 % \begin{macro}{\xpct@yII}
1213 % |\referencesystem| changes to the affine reference centered
1214 % in P|(#1,#2)| with directions |(#3,#4)| and |(#5,#6)|.
1215 % These six numbers are stored in
1216 % |\xpct@xorigin|, |\xpct@yorigin|,
1217 % |\xpct@xI|, |\xpct@yI|, |\xpct@xII|, and |\xpct@yII|.
1218 % \begin{macrocode}
1219 \def\referencesystem(#1,#2)(#3,#4)(#5,#6){%
1220 \COPY{#1}\xpct@xorigin
1221 \COPY{#2}\xpct@yorigin
1222 \COPY{#3}\xpct@xI
1223 \COPY{#4}\xpct@yI
1224 \COPY{#5}\xpct@xII
1225 \COPY{#6}\xpct@yII}
1226 % \end{macrocode}
1227 % The |\changereferencesystem| changes from the active reference system.
1228 % \begin{macrocode}
1229 \def\changereferencesystem(#1)(#2)(#3){%
1230 \refsysPoint(#1)(\xpct@newx,\xpct@newy)
1231 \refsysVector(#2)(\xpct@newux,\xpct@newuy)
1232 \refsysVector(#3)(\xpct@newvx,\xpct@newvy)
1233 \referencesystem(\xpct@newx,\xpct@newy)(\xpct@newux,\xpct@newuy)%
1234 (\xpct@newvx,\xpct@newvy)}
1235 % \end{macrocode}
1236 % \end{macro}
1237 % \end{macro}
1238 % \end{macro}
1239 % \end{macro}
1240 % \end{macro}
1241 % \end{macro}
1242 % \end{macro}
1243 % \end{macro}
1244 % \begin{macro}{\translateorigin}
1245 % \begin{macro}{\rotateaxes}
1246 % \begin{macro}{\symmetrize}
1247 % Translations and orthogonal changes (rotations and symmetries)
1248 % of reference system.
1249 % \begin{macrocode}
1250 \def\translateorigin(#1){\changereferencesystem(#1)(1,0)(0,1)}
1251 \def\rotateaxes#1{%
1252 \ifdegrees\DEGREESCOS{#1}\xpct@cosine\DEGREESSIN{#1}\xpct@sine
1253 \else\COS{#1}\xpct@cosine\SIN{#1}\xpct@sine\fi
1254 \changereferencesystem%
1255 (0,0)(\xpct@cosine,\xpct@sine)(-\xpct@sine,\xpct@cosine)}
1256 % \end{macrocode}
1257 % \begin{macrocode}
1258 \def\symmetrize#1{%
1259 \MULTIPLY{2}{#1}{\xpct@sym}
1260 \ifdegrees
1261 \DEGREESCOS{\xpct@sym}\xpct@cosine\DEGREESSIN{\xpct@sym}\xpct@sine
1262 \else
1263 \COS{\xpct@sym}\xpct@cosine\SIN{\xpct@sym}\xpct@sine\fi
1264 \changereferencesystem%
1265 (0,0)(\xpct@cosine,\xpct@sine)(\xpct@sine,-\xpct@cosine)}
1266 % \end{macrocode}
1267 % \end{macro}
1268 % \end{macro}
1269 % \end{macro}
1270 % \subsection{Coordinates}
1271 % \begin{macro}{\refsysxyVector}
1272 % \begin{macro}{\refsysxyPoint}
1273 % Canonical coordinates of a point or vector given in Cartesian coordinates
1274 % (change from the active r.s. to the standard one).
1275 % \begin{macrocode}
1276 \def\refsysxyVector(#1)(#2,#3){%
1277 \MATRIXVECTORPRODUCT%
1278 (\xpct@xI,\xpct@xII;\xpct@yI,\xpct@yII)(#1)(#2,#3)}
1279 \def\refsysxyPoint(#1)(#2,#3){%
1280 \MATRIXVECTORPRODUCT(\xpct@xI,\xpct@xII;\xpct@yI,\xpct@yII)(#1)(#2,#3)
1281 \VECTORADD(#2,#3)(\xpct@xorigin,\xpct@yorigin)(#2,#3)}
1282 % \end{macrocode}
1283 % \end{macro}
1284 % \end{macro}
1285 % \begin{macro}{\refsyspVector}
1286 % \begin{macro}{\refsyspPoint}
1287 % Canonical coordinates of a point or vector given in polar coordinates.
1288 % \begin{macrocode}
1289 \def\refsyspVector(#1,#2)(#3,#4){%
1290 \polarcoor(#1,#2)(\xpct@polarx,\xpct@polary)
1291 \refsysxyVector(\xpct@polarx,\xpct@polary)(#3,#4)}
1292 \def\refsyspPoint(#1,#2)(#3,#4){%
1293 \polarcoor(#1,#2)(\xpct@polarx,\xpct@polary)
1294 \refsysxyPoint(\xpct@polarx,\xpct@polary)(#3,#4)}
1295 % \end{macrocode}
1296 % \end{macro}
1297 % \end{macro}
1298 % \begin{macro}{\cartesianreference}
1299 % \begin{macro}{\polarreference}
1300 % Alternative declarations to switch between Cartesian or polar coordinates.
1301 %
1302 % \noindent In fact, they define |\refsysVector|/|\refsysPoint| to be
1303 % |\refsysxyVector|/|\refsysxyPoint| or |\refsyspVector|/|\refsyspPoint|.
1304 % \begin{macrocode}
1305 \def\cartesianreference{%
1306 \def\refsysVector{\refsysxyVector}%
1307 \def\refsysPoint{\refsysxyPoint}\polarfalse}
1308 \def\polarreference{%
1309 \def\refsysVector{\refsyspVector}%
1310 \def\refsysPoint{\refsyspPoint}\polartrue}
1311 % \end{macrocode}
1312 % \end{macro}
1313 % \end{macro}
1314 % \begin{macro}{\polarcoor}
1315 % |\polarcoor| changes from polar to rectangular coordinates.
1316 % \begin{macrocode}
1317 \def\polarcoor(#1,#2)(#3,#4){%
1318 \ifdegrees\DEGREESCOS{#2}{\xpct@Px}\DEGREESSIN{#2}{\xpct@Py}
1319 \else\COS{#2}{\xpct@Px}\SIN{#2}{\xpct@Py}\fi
1320 \MULTIPLY{\xpct@Px}{#1}{#3}
1321 \MULTIPLY{\xpct@Py}{#1}{#4}}
1322 % \end{macrocode}
1323 % \end{macro}
1324 % \begin{macro}{\degreesangles}
1325 % \begin{macro}{\radiansangles}
1326 % Switches to measure angles in degrees or radians.
1327 % \begin{macrocode}
1328 \def\degreesangles{\degreestrue}
1329 \def\radiansangles{\degreesfalse}
1330 % \end{macrocode}
1331 % \end{macro}
1332 % \end{macro}
1333 % \subsection{The \texttt{Picture} environment}
1334 % \begin{environment}{Picture}
1335 % |Picture| is an extension of |picture| to refer points to the
1336 % active reference system.
1337 % It can take an optional argument (background color).
1338 % \begin{macrocode}
1339 \def\Picture{\@ifnextchar[{\xpct@@Picture}{\xpct@Picture}}
1340 % \end{macrocode}
1341 % \end{environment}
1342 % \begin{macro}{\xpct@Picture}
1343 % Compute the surrounding box and call |picture| with the appropriate
1344 % parameters.
1345 % \begin{macrocode}
1346 \def\xpct@Picture(#1,#2)(#3,#4){%
1347 % \end{macrocode}
1348 % First, we determine the standard coordinates of the four vertices
1349 % \begin{macrocode}
1350 \refsysxyPoint(#1,#2)(\xpct@xzero,\xpct@yzero)
1351 \refsysxyPoint(#3,#4)(\xpct@xone,\xpct@yone)
1352 \refsysxyPoint(#1,#4)(\xpct@xtwo,\xpct@ytwo)
1353 \refsysxyPoint(#3,#2)(\xpct@xthree,\xpct@ythree)
1354 % \end{macrocode}
1355 % Now we calculate the maximum and minimum |x| and |y| coordinates.
1356 % \begin{macrocode}
1357 \MIN{\xpct@xzero}{\xpct@xone}{\xpct@xmin}
1358 \MIN{\xpct@xmin}{\xpct@xtwo}{\xpct@xmin}
1359 \MIN{\xpct@xmin}{\xpct@xthree}{\xpct@xmin}
1360 \MIN{\xpct@yzero}{\xpct@yone}{\xpct@ymin}
1361 \MIN{\xpct@ymin}{\xpct@ytwo}{\xpct@ymin}
1362 \MIN{\xpct@ymin}{\xpct@ythree}{\xpct@ymin}
1363 \MAX{\xpct@xzero}{\xpct@xone}{\xpct@xmax}
1364 \MAX{\xpct@xmax}{\xpct@xtwo}{\xpct@xmax}
1365 \MAX{\xpct@xmax}{\xpct@xthree}{\xpct@xmax}
1366 \MAX{\xpct@yzero}{\xpct@yone}{\xpct@ymax}
1367 \MAX{\xpct@ymax}{\xpct@ytwo}{\xpct@ymax}
1368 \MAX{\xpct@ymax}{\xpct@ythree}{\xpct@ymax}
1369 % \end{macrocode}
1370 % Width and height (|xmax-xmin| and |ymax-ymin|) of the sorrounding box.
1371 % \begin{macrocode}
1372 \SUBTRACT{\xpct@xmax}{\xpct@xmin}{\xpct@pictwidth}
1373 \SUBTRACT{\xpct@ymax}{\xpct@ymin}{\xpct@pictheight}
1374 % \end{macrocode}
1375 % Call |picture|.
1376 % \begin{macrocode}
1377 \begin{picture}(\xpct@pictwidth,\xpct@pictheight)(%
1378 \xpct@xmin,\xpct@ymin)
1379 % \end{macrocode}
1380 % Fix highest label to normal 1.
1381 % \begin{macrocode}
1382 \highestlabel{\normalfont\normalsize$1$}
1383 % \end{macrocode}
1384 % If option |draft| was selected, background is colored,
1385 % a surrounding rectangle is drawn and a centered label is printed.
1386 % \begin{macrocode}
1387 \ifdraft
1388 \colorlet{backgroundcolor}{lightgray}
1389 \xpct@backgrd
1390 \put(\xpct@xmin,\xpct@ymin){\line(1,0){\xpct@pictwidth}}
1391 \put(\xpct@xmin,\xpct@ymin){\line(0,1){\xpct@pictheight}}
1392 \put(\xpct@xmin,\xpct@ymax){\line(1,0){\xpct@pictwidth}}
1393 \put(\xpct@xmax,\xpct@ymin){\line(0,1){\xpct@pictheight}}
1394 \VECTORADD(\xpct@xmax,\xpct@ymax)(\xpct@xmin,\xpct@ymin)(%
1395 \xpct@xmed,\xpct@ymed)
1396 \SCALARVECTORPRODUCT{0.5}(\xpct@xmed,\xpct@ymed)(%
1397 \xpct@xmed,\xpct@ymed)
1398 \put(\xpct@xmed,\xpct@ymed){\makebox(0,0){\scshape xpicture}}
1399 \else
1400 % \end{macrocode}
1401 % Finally, if required, we color the background.
1402 % \begin{macrocode}
1403 \ifbg\xpct@backgrd\fi
1404 \fi}
1405 % \end{macrocode}
1406 % \end{macro}
1407 % \begin{macro}{\xpct@@Picture}
1408 % Set background color to |#1|, swich boolean |\ifbg|
1409 % to true and call |\xpct@Picture|.
1410 % \begin{macrocode}
1411 \def\xpct@@Picture[#1](#2,#3)(#4,#5){%
1412 \colorlet{backgroundcolor}{#1}%
1413 \bgtrue\xpct@Picture(#2,#3)(#4,#5)}
1414 % \end{macrocode}
1415 % \end{macro}
1416 % \begin{macro}{\xpct@backgrd}
1417 % Fill background with |backgroundcolor|. We use |pict2e| path commands.
1418 % \begin{macrocode}
1419 \def\xpct@backgrd{\begingroup
1420 \pictcolor{backgroundcolor}
1421 \moveto(\xpct@xzero,\xpct@yzero)
1422 \lineto(\xpct@xthree,\xpct@ythree)
1423 \lineto(\xpct@xone,\xpct@yone)
1424 \lineto(\xpct@xtwo,\xpct@ytwo)
1425 \closepath\fillpath
1426 \endgroup}
1427 % \end{macrocode}
1428 % \end{macro}
1429 % \begin{macro}{\endPicture}
1430 % Close |picture| environment.
1431 % \begin{macrocode}
1432 \def\endPicture{\end{picture}}
1433 % \end{macrocode}
1434 % \end{macro}
1435 % \begin{environment}{xpicture}
1436 % |xpicture| is an alias for |Picture|.
1437 % \begin{macrocode}
1438 \newenvironment{xpicture}{\begin{Picture}}{\end{Picture}}
1439 % \end{macrocode}
1440 % \end{environment}
1441 % \subsection{\cs{put} extensions}
1442 % User's commands are |\cPut|, |\rPut|, and |\Put|.
1443 % |\rPut| and |\Put| have starred versions. Related commands are
1444 % |\highestlabel| and |\defaultPut|.
1445 % \begin{macro}{\cPut}
1446 % |\cPut| puts the |#4| object in the |(#2,#3)| point at the |#1| position
1447 % (circular version).
1448 % \begin{macrocode}
1449 \def\cPut#1(#2,#3)#4{%
1450 % \end{macrocode}
1451 % Select circular trigonometry and call |\xpct@PUT|.
1452 % \begin{macrocode}
1453 \COPY{0}{\xpct@CorRput}
1454 \xpct@PUT{#1}(#2,#3){#4}}
1455 % \end{macrocode}
1456 % \end{macro}
1457 % \begin{macro}{\rPut}
1458 % \begin{macro}{\rPut*}
1459 % |\rPut| puts the |#4| object in the |(#2,#3)| point at the |#1| position
1460 % (rectangular version).
1461 % Call |\xpct@rPut| (ordinary) or |\xpct@rPutstar| (starred).
1462 % \begin{macrocode}
1463 \def\rPut{\@ifstar
1464 \xpct@rPutstar%
1465 \xpct@rPut%
1466 }
1467 % \end{macrocode}
1468 % \end{macro}
1469 % \end{macro}
1470 % \begin{macro}{\Put}
1471 % \begin{macro}{\Put*}
1472 % |\Put| is equivalent to |\cPut| or |\rPut|, and has a starred form.
1473 % Call |\xpct@Put| (ordinary) or |\xpct@Putstar| (starred).
1474 % \begin{macrocode}
1475 \def\Put{\@ifstar
1476 \xpct@Putstar%
1477 \xpct@Put%
1478 }
1479 % \end{macrocode}
1480 % \end{macro}
1481 % \end{macro}
1482 % \begin{macro}{\defaultPut}
1483 % \begin{macro}{\xpct@defaultPut}
1484 % |\defaultPut| is a declaration to fix default position (|c| or |r|)
1485 % for the |\Put| command. It defines |\xpct@defaultPut| to be
1486 % |\rPut| or |\cPut|.
1487 % \begin{macrocode}
1488 \def\defaultPut#1{\def\xpct@tempa{#1}\def\xpct@tempb{r}
1489 \ifx\xpct@tempa\xpct@tempb
1490 \xpct@Infopos#1
1491 \def\xpct@defaultPut{\rPut}
1492 \else
1493 \xpct@Infopos#1
1494 \def\xpct@tempc{c}
1495 \ifx\xpct@tempa\xpct@tempc
1496 \def\xpct@defaultPut{\cPut}
1497 \else
1498 \xpct@Warnbadpos
1499 \fi\fi}
1500 % \end{macrocode}
1501 % \end{macro}
1502 % \end{macro}
1503 % \begin{macro}{\highestlabel}
1504 % The highest label for the starred |\Put| and |\rPut| commands.
1505 % First we mesure the label, then we convert this length to |\unitlength|.
1506 % This number is stored in |\xpct@rputmxhg|.
1507 % \begin{macrocode}
1508 \def\highestlabel#1{\settoheight{\xpct@bxh}{#1}%
1509 \LENGTHDIVIDE{\xpct@bxh}{\unitlength}{\xpct@rputmxhg}}
1510 % \end{macrocode}
1511 % \end{macro}
1512 % Private commands. Main command is |\xpct@PUT|, all other commands are
1513 % intended to select appropiate geometry.
1514 % \begin{macro}{\xpct@rPut}
1515 % \begin{macro}{\xpct@rPutstar}
1516 % We give the appropriate value to boolean |\rputstar|, select rectangular
1517 % trigonometry and call |\xpct@PUT|.
1518 % \begin{macrocode}
1519 \def\xpct@rPutstar{\rputstartrue\COPY{1}{\xpct@CorRput}\xpct@PUT}
1520 \def\xpct@rPut{\rputstarfalse\COPY{1}{\xpct@CorRput}\xpct@PUT}
1521 % \end{macrocode}
1522 % \end{macro}
1523 % \end{macro}
1524 % \begin{macro}{\xpct@Putstar}
1525 % \begin{macro}{\xpct@Put}
1526 % |\Put| can take an optional argument.
1527 % \begin{macrocode}
1528 \def\xpct@Putstar{\@ifnextchar[{\xpct@@Putstar}{\xpct@@Put}}
1529 \def\xpct@Put{\@ifnextchar[{\xpct@@@Put}{\xpct@@Put}}
1530 % \end{macrocode}
1531 % \end{macro}
1532 % \end{macro}
1533 % \begin{macro}{\xpct@@Putstar}
1534 % \begin{macro}{\xpct@@Put}
1535 % \begin{macro}{\xpct@@@Put}
1536 % |\Put[pos]| is |\rPut*{pos}| (for ``bl'' like pos),
1537 % |\cPut{pos}| (for ``SW'' like pos) and
1538 % |\defaultPut| pos otherwise.
1539 %
1540 % |\Put*[pos]| is |\rPut*{pos}|
1541 % or |\cPut{pos}| (only for ``SW'' like pos).
1542 % \begin{macrocode}
1543 \def\xpct@@Put(#1){\refsysPoint(#1)(\xpct@abscoorx,\xpct@abscoory)
1544 \put(\xpct@abscoorx,\xpct@abscoory)}
1545 \def\xpct@@Putstar[#1](#2)#3{\xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
1546 \if\xpct@CorR c
1547 \cPut{#1}(#2){#3}
1548 \else
1549 \rPut*{#1}(#2){#3}
1550 \fi}
1551 \def\xpct@@@Put[#1](#2)#3{\xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
1552 \if\xpct@CorR c
1553 \cPut{#1}(#2){#3}
1554 \else
1555 \if\xpct@CorR r
1556 \rPut{#1}(#2){#3}
1557 \else
1558 \xpct@defaultPut{#1}(#2){#3}
1559 \fi\fi}
1560 % \end{macrocode}
1561 % \end{macro}
1562 % \end{macro}
1563 % \end{macro}
1564 % \begin{macro}{\xpct@PUT}
1565 % This command puts object |#4| in |(#2,#3)| (active reference),
1566 % according to |#1| position.
1567 % \begin{macrocode}
1568 \def\xpct@PUT#1(#2,#3)#4{%
1569 % \end{macrocode}
1570 % Call |\xpct@alphaput| to compute |(\xpct@xPictsep,\xpct@yPictsep)|,
1571 % displacement of |\Pictlabelsep| units in direction |#1|.
1572 % Then, apply |\refsysxyVector| to get |(\xpct@Posx,\xpct@Posy)|,
1573 % standard coordinates of vector |(\xpct@xPictsep,\xpct@yPictsep)|.
1574 % \begin{macrocode}
1575 \xpct@alphaput{#1}{\xpct@CorRput}
1576 \refsysxyVector(\xpct@xPictsep,\xpct@yPictsep)(\xpct@Posx,\xpct@Posy)
1577 % \end{macrocode}
1578 % Compute |(\xpct@posx,\xpct@posy)|, standard coordinates of point |(#2,#3)|.
1579 % \begin{macrocode}
1580 \refsysPoint(#2,#3)(\xpct@posx,\xpct@posy)
1581 % \end{macrocode}
1582 % Call |\xpct@alphamove| to adjust |(\xpct@Posx,\xpct@Posy)|
1583 % according to dimensions of |#4|.
1584 % Then add |(\xpct@posx,\xpct@posy)| to |(\xpct@Posx,\xpct@Posy)|.
1585 % \begin{macrocode}
1586 \xpct@alphamove{#4}{\xpct@CorRput}
1587 \VECTORADD(\xpct@posx,\xpct@posy)(\xpct@Posx,\xpct@Posy)(%
1588 \xpct@Posx,\xpct@Posy)
1589 % \end{macrocode}
1590 % Now |(\xpct@Posx,\xpct@Posy)| is the absolute position where |#4|
1591 % must go.
1592 % \begin{macrocode}
1593 \put(\xpct@Posx,\xpct@Posy){#4}}
1594 % \end{macrocode}
1595 % \end{macro}
1596 % \begin{macro}{\xpct@alphaput}
1597 % Computes displacement vector required by |#1| and stores it in
1598 % |(\xpct@xPictsep},\xpct@yPictsep)|.
1599 % \begin{macrocode}
1600 \def\xpct@alphaput#1#2{\def\xpct@tempa{#1}\def\xpct@tempb{c}%
1601 \ifx\xpct@tempa\xpct@tempb
1602 % \end{macrocode}
1603 % If |#1=c|, no displacement is required:
1604 %|(\xpct@xPictsep},\xpct@yPictsep)=(0,0)|.
1605 % \begin{macrocode}
1606 \COPY{0}{\xpct@xPictsep}\COPY{0}{\xpct@yPictsep}
1607 \else
1608 % \end{macrocode}
1609 % Else, call |\xpct@convtoang| to translate |#1| to a number (of degrees),
1610 % \begin{macrocode}
1611 \xpct@convtoang{#1}{\xpct@putpos}{\xpct@CorR}
1612 % \end{macrocode}
1613 % and compute |(\xpct@xPictsep},\xpct@yPictsep)|.
1614 % \begin{macrocode}
1615 \ifnum #2=0
1616 \DEGREESCOS{\xpct@putpos}{\xpct@cosine}
1617 \DEGREESSIN{\xpct@putpos}{\xpct@sine}
1618 \else
1619 \qCOS{\xpct@putpos}{\xpct@cosine}
1620 \qSIN{\xpct@putpos}{\xpct@sine}
1621 \fi
1622 \MULTIPLY{\Pictlabelsep}{\xpct@cosine}{\xpct@xPictsep}
1623 \MULTIPLY{\Pictlabelsep}{\xpct@sine}{\xpct@yPictsep}
1624 \fi}
1625 % \end{macrocode}
1626 % \end{macro}
1627 % \begin{macro}{\xpct@alphamove}
1628 % Adjust |(\xpct@Posx,\xpct@Posy)| to required position, according to
1629 % |#1| dimensions. If |#2| equals |0|, it uses circular trigonometry, else
1630 % it uses square trigonometry.
1631 % \begin{macrocode}
1632 \def\xpct@alphamove#1#2{%
1633 % \end{macrocode}
1634 % Computes half of dimensions of |#1|,
1635 % \begin{macrocode}
1636 \xpct@halfbox{#1}{\xpct@amplada}{\xpct@altura}
1637 \ifx\xpct@tempa\xpct@tempb
1638 \else
1639 % \end{macrocode}
1640 % If required position is not centered, move |(\xpct@Posx,\xpct@Posy)|
1641 % (circular or square cases). First, compute a unitary vector in
1642 % |(\xpct@Posx,\xpct@Posy)| direction.
1643 % \begin{macrocode}
1644 \ifnum #2=0
1645 \UNITVECTOR(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)
1646 \else
1647 \qUNITVECTOR(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)
1648 % \end{macrocode}
1649 % If starred, change height to half |\xpct@rputmxhg|.
1650 % \begin{macrocode}
1651 \ifrputstar
1652 \ifdim\xpct@ydir\p@=-1\p@
1653 \DIVIDE{\xpct@rputmxhg}{2}{\xpct@altura}
1654 \fi
1655 \fi
1656 \fi
1657 % \end{macrocode}
1658 % Adjust |(\xpct@xdir,\xpct@ydir)| to |#1| dimensions.
1659 % \begin{macrocode}
1660 \MULTIPLY{\xpct@ydir}{\xpct@altura}{\xpct@ydir}
1661 \MULTIPLY{\xpct@xdir}{\xpct@amplada}{\xpct@xdir}
1662 \VECTORADD(\xpct@Posx,\xpct@Posy)(\xpct@xdir,\xpct@ydir)%
1663 (\xpct@Posx,\xpct@Posy)
1664 \fi
1665 % \end{macrocode}
1666 % Move |(\xpct@Posx,\xpct@Posy)| according to |#1| dimensions.
1667 % \begin{macrocode}
1668 \VECTORSUB(\xpct@Posx,\xpct@Posy)(\xpct@amplada,\xpct@altura)(%
1669 \xpct@Posx,\xpct@Posy)}
1670 % \end{macrocode}
1671 % \end{macro}
1672 % \begin{macro}{\xpct@convtoang}
1673 % Literal specifiers in |\Put|-like commands must be converted to angles.
1674 % |c| or |r| (circular or rectangular) distance is also selected.
1675 % \begin{macrocode}
1676 \def\xpct@convtoang#1#2#3{%
1677 \def\xpct@tempc{#1}
1678 \def\xpct@tempd{r}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{r}\else
1679 \def\xpct@tempd{tr}\ifx\xpct@tempc\xpct@tempd\COPY{45}{#2}\def#3{r}\else
1680 \def\xpct@tempd{t}\ifx\xpct@tempc\xpct@tempd\COPY{90}{#2}\def#3{r}\else
1681 \def\xpct@tempd{tl}\ifx\xpct@tempc\xpct@tempd\COPY{135}{#2}\def#3{r}\else
1682 \def\xpct@tempd{l}\ifx\xpct@tempc\xpct@tempd\COPY{180}{#2}\def#3{r}
1683 \else
1684 \def\xpct@tempd{bl}\ifx\xpct@tempc\xpct@tempd\COPY{-135}{#2}
1685 \def#3{r}\else
1686 \def\xpct@tempd{b}\ifx\xpct@tempc\xpct@tempd\COPY{-90}{#2}
1687 \def#3{r}\else
1688 \def\xpct@tempd{br}\ifx\xpct@tempc\xpct@tempd\COPY{-45}{#2}
1689 \def#3{r}\else
1690 \def\xpct@tempd{rtr}\ifx\xpct@tempc\xpct@tempd\COPY{22.5}{#2}
1691 \def#3{r}\else
1692 \def\xpct@tempd{ttr}\ifx\xpct@tempc\xpct@tempd\COPY{67.5}{#2}
1693 \def#3{r}\else
1694 \def\xpct@tempd{ttl}\ifx\xpct@tempc\xpct@tempd\COPY{112.5}{#2}
1695 \def#3{r}\else
1696 \def\xpct@tempd{ltl}\ifx\xpct@tempc\xpct@tempd\COPY{157.5}{#2}
1697 \def#3{r}\else
1698 \def\xpct@tempd{lbl}\ifx\xpct@tempc\xpct@tempd\COPY{-157.5}{#2}
1699 \def#3{r}\else
1700 \def\xpct@tempd{bbl}\ifx\xpct@tempc\xpct@tempd\COPY{-112.5}{#2}
1701 \def#3{r}\else
1702 \def\xpct@tempd{bbr}\ifx\xpct@tempc\xpct@tempd\COPY{-67.5}{#2}
1703 \def#3{r}\else
1704 \def\xpct@tempd{rbr}\ifx\xpct@tempc\xpct@tempd\COPY{-22.5}{#2}
1705 \def#3{r}\else
1706 \def\xpct@tempd{E}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{c}\else
1707 \def\xpct@tempd{NE}\ifx\xpct@tempc\xpct@tempd\COPY{45}{#2}\def#3{c}\else
1708 \def\xpct@tempd{N}\ifx\xpct@tempc\xpct@tempd\COPY{90}{#2}\def#3{c}\else
1709 \def\xpct@tempd{NW}\ifx\xpct@tempc\xpct@tempd\COPY{135}{#2}\def#3{c}\else
1710 \def\xpct@tempd{W}\ifx\xpct@tempc\xpct@tempd\COPY{180}{#2}\def#3{c}\else
1711 \def\xpct@tempd{SW}\ifx\xpct@tempc\xpct@tempd\COPY{-135}{#2}
1712 \def#3{c}\else
1713 \def\xpct@tempd{S}\ifx\xpct@tempc\xpct@tempd\COPY{-90}{#2}\def#3{c}\else
1714 \def\xpct@tempd{SE}\ifx\xpct@tempc\xpct@tempd\COPY{-45}{#2}\def#3{c}\else
1715 \def\xpct@tempd{ENE}\ifx\xpct@tempc\xpct@tempd\COPY{22.5}{#2}
1716 \def#3{c}\else
1717 \def\xpct@tempd{NNE}\ifx\xpct@tempc\xpct@tempd\COPY{67.5}{#2}
1718 \def#3{c}\else
1719 \def\xpct@tempd{NNW}\ifx\xpct@tempc\xpct@tempd\COPY{112.5}{#2}
1720 \def#3{c}\else
1721 \def\xpct@tempd{WNW}\ifx\xpct@tempc\xpct@tempd\COPY{157.5}{#2}
1722 \def#3{c}\else
1723 \def\xpct@tempd{WSW}\ifx\xpct@tempc\xpct@tempd\COPY{-157.5}{#2}
1724 \def#3{c}\else
1725 \def\xpct@tempd{SSW}\ifx\xpct@tempc\xpct@tempd\COPY{-112.5}{#2}
1726 \def#3{c}\else
1727 \def\xpct@tempd{SSE}\ifx\xpct@tempc\xpct@tempd\COPY{-67.5}{#2}
1728 \def#3{c}\else
1729 \def\xpct@tempd{ESE}\ifx\xpct@tempc\xpct@tempd\COPY{-22.5}{#2}
1730 \def#3{c}\else
1731 \def\xpct@tempd{c}\ifx\xpct@tempc\xpct@tempd\COPY{0}{#2}\def#3{c}\else
1732 \COPY{#1}{#2}\def#3{a}
1733 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1734 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1735 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1736 }
1737 % \end{macrocode}
1738 % \end{macro}
1739 % \begin{macro}{\xpct@halfbox}
1740 % Half of dimensions of a box.
1741 % \begin{macrocode}
1742 \def\xpct@halfbox#1#2#3{%
1743 \settowidth\xpct@bxw{#1}%
1744 \settoheight\xpct@bxh{#1}%
1745 \LENGTHDIVIDE{\xpct@bxw}{\unitlength}{#2}
1746 \LENGTHDIVIDE{\xpct@bxh}{\unitlength}{#3}
1747 \MULTIPLY{0.5}{#2}{#2}
1748 \MULTIPLY{0.5}{#3}{#3}}
1749 % \end{macrocode}
1750 % \end{macro}
1751 % \begin{macro}{\qCOS}
1752 % \begin{macro}{\qSIN}
1753 % \begin{macro}{\qUNITVECTOR}
1754 % Square versions of |\DEGREESCOS|, |\DEGREESSIN| and |\UNITVECTOR|.
1755 % \begin{macrocode}
1756 \def\qCOS#1#2{%
1757 \ifdim #1\p@<-135\p@
1758 \ADD{360}{#1}{\xpct@angles}\qCOS{\xpct@angles}{#2}
1759 \else
1760 \ifdim #1\p@>225\p@ \SUBTRACT{#1}{360}{\xpct@angles}
1761 \qCOS{\xpct@angles}{#2}
1762 \else
1763 \ifdim #1\p@<-45\p@ \DEGREESCOT{#1}{#2}\MULTIPLY{-1}{#2}{#2}
1764 \else
1765 \ifdim #1\p@<45\p@ \COPY{1}{#2}
1766 \else
1767 \ifdim #1\p@<135\p@ \DEGREESCOT{#1}{#2}
1768 \else
1769 \COPY{-1}{#2}
1770 \fi
1771 \fi
1772 \fi
1773 \fi
1774 \fi
1775 }
1776 \def\qSIN#1#2{%
1777 \ifdim #1\p@<-135\p@
1778 \ADD{360}{#1}{\xpct@angles}\qSIN{\xpct@angles}{#2}
1779 \else
1780 \ifdim #1\p@>225\p@ \SUBTRACT{#1}{360}{\xpct@angles}
1781 \qSIN{\xpct@angles}{#2}
1782 \else
1783 \ifdim #1\p@<-45\p@ \COPY{-1}{#2}
1784 \else
1785 \ifdim #1\p@<45\p@ \DEGREESTAN{#1}{#2}
1786 \else
1787 \ifdim #1\p@<135\p@ \COPY{1}{#2}
1788 \else
1789 \DEGREESTAN{#1}{#2}\MULTIPLY{-1}{#2}{#2}
1790 \fi
1791 \fi
1792 \fi
1793 \fi
1794 \fi
1795 }
1796 \def\qUNITVECTOR(#1,#2)(#3,#4){%
1797 \VECTORCOPY(#1,#2)(#3,#4)
1798 \ABSVALUE{#4}{\xpct@Ydir}
1799 \ifdim \xpct@Ydir\p@ < 0.00005\p@
1800 \COPY{\xpct@maxnum}{\xpct@tan}
1801 \else
1802 \DIVIDE{#3}{#4}{\xpct@tan}
1803 \fi
1804 \ifdim #3\p@ > 0\p@
1805 \ifdim #4\p@ > 0\p@
1806 \ifdim #3\p@ > #4\p@
1807 \COPY{1}{#3}\DIVIDE{#4}{\xpct@tan}{#4}
1808 \else
1809 \COPY{1}{#4}\COPY{\xpct@tan}{#3}
1810 \fi
1811 \else
1812 \ifdim #3\p@ > -#4\p@
1813 \COPY{1}{#3}\DIVIDE{-#4}{\xpct@tan}{#4}
1814 \else
1815 \COPY{-1}{#4}\MULTIPLY{-1}{\xpct@tan}{#3}
1816 \fi
1817 \fi
1818 \else
1819 \ifdim #4\p@ > 0\p@
1820 \ifdim -#3\p@ > #4\p@
1821 \COPY{-1}{#3}\DIVIDE{-#4}{\xpct@tan}{#4}
1822 \else
1823 \COPY{1}{#4}\COPY{\xpct@tan}{#3}
1824 \fi
1825 \else
1826 \ifdim #3\p@ > #4\p@
1827 \COPY{-1}{#4}\COPY{-\xpct@tan}{#3}
1828 \else
1829 \COPY{-1}{#3}\DIVIDE{#4}{\xpct@tan}{#4}
1830 \fi
1831 \fi
1832 \fi
1833 }
1834 % \end{macrocode}
1835 % \end{macro}
1836 % \end{macro}
1837 % \end{macro}
1838 % \subsection{\cs{multiput} extensions}
1839 % User commands: |\multicPut|, |\multirPut|, |\multiPut|;
1840 % |\multicPlot|, |\multirPlot|, |\multiPlot|.
1841 % |\multirPut|, |\multiPut|, |\multirPlot|, and |\multiPlot|
1842 % have starred versions.
1843 % \begin{macro}{\multicPut}
1844 % Define |\xpct@mPut| as |\cPut{#1}| and call |\xpct@@mPut|.
1845 % \begin{macrocode}
1846 \def\multicPut#1{\def\xpct@mPut{\cPut{#1}}\xpct@@mPut}
1847 % \end{macrocode}
1848 % \end{macro}
1849 % \begin{macro}{\multirPut}
1850 % \begin{macro}{\multirPut*}
1851 % Call |\xpct@multirPut| or |\xpct@multirPutstar| (if starred).
1852 % \begin{macrocode}
1853 \def\multirPut{\@ifstar
1854 \xpct@multirPutstar%
1855 \xpct@multirPut%
1856 }
1857 % \end{macrocode}
1858 % \end{macro}
1859 % \end{macro}
1860 % \begin{macro}{\multiPut}
1861 % \begin{macro}{\multiPut*}
1862 % Call |\xpct@multiPut| or |\xpct@multiPutstar| (if starred).
1863 % \begin{macrocode}
1864 \def\multiPut{\@ifstar
1865 \xpct@multiPutstar%
1866 \xpct@multiPut%
1867 }
1868 % \end{macrocode}
1869 % \end{macro}
1870 % \end{macro}
1871 % \begin{macro}{\xpct@multirPutstar}
1872 % \begin{macro}{\xpct@multirPut}
1873 % Define |\xpct@mPut| as |\rPut*{#1}| or |\rPut{#1}| and call |\xpct@@mPut|.
1874 % \begin{macrocode}
1875 \def\xpct@multirPutstar#1{\def\xpct@mPut{\rPut*{#1}}\xpct@@mPut}
1876 \def\xpct@multirPut#1{\def\xpct@mPut{\rPut{#1}}\xpct@@mPut}
1877 % \end{macrocode}
1878 % \end{macro}
1879 % \end{macro}
1880 % \begin{macro}{\xpct@multiPut}
1881 % \begin{macro}{\xpct@multiPutstar}
1882 % |\multiPut| can take an optional argument.
1883 % \begin{macrocode}
1884 \def\xpct@multiPut{\@ifnextchar[{\xpct@@@multiPut}{\xpct@@multiPut}}
1885 \def\xpct@multiPutstar{\@ifnextchar[{\xpct@@@multiPutstar}{\xpct@@multiPutstar}}
1886 % \end{macrocode}
1887 % \end{macro}
1888 % \end{macro}
1889 % \begin{macro}{\xpct@@multiPut}
1890 % \begin{macro}{\xpct@@multiPutstar}
1891 % Define |\xpct@mPut| as |\Put| or |\Put*| and call |\xpct@@mPut|.
1892 % \begin{macrocode}
1893 \def\xpct@@multiPut{\def\xpct@mPut{\Put}\xpct@@mPut}
1894 \def\xpct@@multiPutstar{\def\xpct@mPut{\Put*}\xpct@@mPut}
1895 % \end{macrocode}
1896 % \end{macro}
1897 % \end{macro}
1898 % \begin{macro}{\xpct@@@multiPut}
1899 % \begin{macro}{\xpct@@@multiPutstar}
1900 % Define |\xpct@mPut| as |\Put[#1]| or |\Put*[#1]| and call |\xpct@@mPut|.
1901 % \begin{macrocode}
1902 \def\xpct@@@multiPut[#1]{\def\xpct@mPut{\Put[#1]}\xpct@@mPut}
1903 \def\xpct@@@multiPutstar[#1]{\def\xpct@mPut{\Put*[#1]}\xpct@@mPut}
1904 % \end{macrocode}
1905 % \end{macro}
1906 % \end{macro}
1907 % \begin{macro}{\xpct@@mPut}
1908 % \begin{macro}{\xpct@mPut}
1909 % |\xpct@@mPut| is the main macro about |\multiPut|-like commands.
1910 % |\xpct@mPut| is already defined as the appropiate |\Put| command.
1911 % \begin{macrocode}
1912 \def\xpct@@mPut(#1,#2)(#3,#4)#5#6{%
1913 % \end{macrocode}
1914 % Use counter |multiput| to count iterations.
1915 % |(\xpct@@abscoorx,\xpct@@abscoory)| is the point to be ploted in each
1916 % iteration.
1917 % \begin{macrocode}
1918 \COPY{#1}\xpct@@abscoorx\COPY{#2}\xpct@@abscoory
1919 \setcounter{multiput}{0}%
1920 \@whilenum\value{multiput}<#5 \do
1921 % \end{macrocode}
1922 % Plot the point, translate it, and update conter.
1923 % \begin{macrocode}
1924 {\xpct@mPut(\xpct@@abscoorx,\xpct@@abscoory){#6}
1925 \ADD{#3}\xpct@@abscoorx\xpct@@abscoorx
1926 \ADD{#4}\xpct@@abscoory\xpct@@abscoory
1927 \stepcounter{multiput}}}
1928 % \end{macrocode}
1929 % \end{macro}
1930 % \end{macro}
1931 % \begin{macro}{\multicPlot}
1932 % Execute |\cPut| and iterates itself while next character be |(|.
1933 % \begin{macrocode}
1934 \def\multicPlot#1#2(#3){\cPut{#1}(#3){#2}\@ifnextchar({\multicPlot{#1}{#2}}{}}
1935 % \end{macrocode}
1936 % \end{macro}
1937 % \begin{macro}{\multirPlot}
1938 % \begin{macro}{\multirPlot*}
1939 % |\multirPlot| can take a starred form. Call |\xpct@multirPlot| or,
1940 % if starred, |\xpct@multirPlotstar|.
1941 % \begin{macrocode}
1942 \def\multirPlot{\@ifstar
1943 \xpct@multirPlotstar%
1944 \xpct@multirPlot%
1945 }
1946 % \end{macrocode}
1947 % \end{macro}
1948 % \end{macro}
1949 % \begin{macro}{\multiPlot}
1950 % \begin{macro}{\multiPlot*}
1951 % |\multiPlot| can take a starred form. Call |\xpct@multiPlot| or,
1952 % if starred, |\xpct@multiPlotstar|.
1953 % \begin{macrocode}
1954 \def\multiPlot{\@ifstar
1955 \xpct@multiPlotstar%
1956 \xpct@multiPlot%
1957 }
1958 % \end{macrocode}
1959 % \end{macro}
1960 % \end{macro}
1961 % \begin{macro}{\xpct@multirPlotstar}
1962 % \begin{macro}{\xpct@multirPlot}
1963 % Execute |\rPut*| or |\rPut| and iterates itself while next character be |(|.
1964 % \begin{macrocode}
1965 \def\xpct@multirPlotstar#1#2(#3){\rPut*{#1}(#3){#2}
1966 \@ifnextchar({\xpct@multirPlotstar{#1}{#2}}{}}
1967 \def\xpct@multirPlot#1#2(#3){\rPut{#1}(#3){#2}
1968 \@ifnextchar({\xpct@multirPlot{#1}{#2}}{}}
1969 % \end{macrocode}
1970 % \end{macro}
1971 % \end{macro}
1972 % \begin{macro}{\xpct@multiPlotstar}
1973 % \begin{macro}{\xpct@multiPlot}
1974 % |\multiPlot| (and |\multiPlot*|) can take an optional argument.
1975 % We have four cases: (starred or not) and (optional argument or not).
1976 % \begin{macrocode}
1977 \def\xpct@multiPlotstar{%
1978 \@ifnextchar[{\xpct@@@multiPlotstar}{\xpct@@multiPlotstar}}
1979 \def\xpct@multiPlot{\@ifnextchar[{\xpct@@@multiPlot}{\xpct@@multiPlot}}
1980 % \end{macrocode}
1981 % \end{macro}
1982 % \end{macro}
1983 % \begin{macro}{\xpct@@multiPlot}
1984 % \begin{macro}{\xpct@@@multiPlot}
1985 % \begin{macro}{\xpct@@multiPlotstar}
1986 % \begin{macro}{\xpct@@@multiPlotstar}
1987 % Execute |\Put| (or |\Put*|) and iterates itself while next character be |(|.
1988 % \begin{macrocode}
1989 \def\xpct@@multiPlot#1(#2){\Put(#2){#1}\@ifnextchar({\xpct@@multiPlot{#1}}{}}
1990 \def\xpct@@@multiPlot[#1]#2(#3){\Put[#1](#3){#2}
1991 \@ifnextchar({\xpct@@@multiPlot[#1]{#2}}{}}
1992 \def\xpct@@multiPlotstar#1(#2){\Put*(#2){#1}
1993 \@ifnextchar({\xpct@@multiPlotstar{#1}}{}}
1994 \def\xpct@@@multiPlotstar[#1]#2(#3){\Put*[#1](#3){#2}
1995 \@ifnextchar({\xpct@@@multiPlotstar[#1]{#2}}{}}
1996 % \end{macrocode}
1997 % \end{macro}
1998 % \end{macro}
1999 % \end{macro}
2000 % \end{macro}
2001 % \subsection{Strigth lines and vectors}
2002 % \begin{macro}{\xLINE}
2003 % \begin{macro}{\strline}
2004 % Compute standard coordinates of two points and call |\xpct@strline|
2005 % to plot a line.
2006 % \begin{macrocode}
2007 \def\xLINE(#1)(#2){%
2008 \refsysPoint(#1)(\xpct@xzero,\xpct@yzero)
2009 \refsysPoint(#2)(\xpct@xone,\xpct@yone)
2010 \xpct@strline(\xpct@xzero,\xpct@yzero)(\xpct@xone,\xpct@yone)}
2011 \let\strline\xLINE
2012 % \end{macrocode}
2013 % \end{macro}
2014 % \end{macro}
2015 % \begin{macro}{\xpct@strline}
2016 % This command calls the |\segment| command from |curve2e|
2017 % (or |\LINE|, for old versions of |curve2e|).
2018 % \begin{macrocode}
2019 \def\xpct@strline{\@killglue\@ifundefined{segment}{\LINE}{\segment}}
2020 % \end{macrocode}
2021 % \end{macro}
2022 % \begin{macro}{\xVECTOR}
2023 % Compute standard coordinates of two points and call |\VECTOR|
2024 % to plot a vector.
2025 % \begin{macrocode}
2026 \def\xVECTOR(#1)(#2){%
2027 \refsysPoint(#1)(\xpct@xzero,\xpct@yzero)
2028 \refsysPoint(#2)(\xpct@xone,\xpct@yone)
2029 \VECTOR(\xpct@xzero,\xpct@yzero)(\xpct@xone,\xpct@yone)}
2030 % \end{macrocode}
2031 % \end{macro}
2032 % \begin{macro}{\xtrivVECTOR}
2033 % Compute standard coordinates of two points and call |\xpct@xtrivVECTOR|
2034 % to plot a `triv' vector.
2035 % \begin{macrocode}
2036 \def\xtrivVECTOR(#1)(#2){%
2037 \refsysPoint(#1)(\xpct@xzeropoint,\xpct@yzeropoint)
2038 \refsysPoint(#2)(\xpct@xonepoint,\xpct@yonepoint)
2039 \xpct@xtrivVECTOR(\xpct@xzeropoint,\xpct@yzeropoint)(%
2040 \xpct@xonepoint,\xpct@yonepoint)}
2041 % \end{macrocode}
2042 % \end{macro}
2043 % \begin{macro}{\arrowsize}
2044 % Store dimensions of triv arrows.
2045 % to plot a vector.
2046 % \begin{macrocode}
2047 \def\arrowsize#1#2{\COPY{#1}{\xpct@xarrowlen}
2048 \COPY{#2}{\xpct@yarrowlen}}
2049 % \end{macrocode}
2050 % \end{macro}
2051 % \begin{macro}{\xpct@xtrivVECTOR}
2052 % Plot a stright line, compute size of arrowhead and call |\xpct@arrow|
2053 % to plot it.
2054 % \begin{macrocode}
2055 \def\xpct@xtrivVECTOR(#1)(#2){%
2056 \xpct@strline(#1)(#2)
2057 \VECTORSUB(#2)(#1)(\xpct@xarrow,\xpct@yarrow)
2058 \VECTORNORM(\xpct@xarrow,\xpct@yarrow){\xpct@xarrowunit}
2059 \DIVIDE{\xpct@xarrow}{\xpct@xarrowunit}{\xpct@xarrow}
2060 \DIVIDE{\xpct@yarrow}{\xpct@xarrowunit}{\xpct@yarrow}
2061 \xpct@arrow(#2){\xpct@xarrow}{\xpct@yarrow}}
2062 % \end{macrocode}
2063 % \end{macro}
2064 % \begin{macro}{\xpct@arrow}
2065 % Make an arrowhead as a small picture.
2066 % \begin{macrocode}
2067 \def\xpct@arrow(#1)#2#3{\begingroup%
2068 \referencesystem(#1)(#2,#3)(-#3,#2)
2069 \Put(0,0){\setlength{\unitlength}{1pt}%
2070 \begin{Picture}(0,0)(0,0)\cartesianreference
2071 \xLINE(-\xpct@xarrowlen,\xpct@yarrowlen)(0,0)
2072 \xLINE(0,0)(-\xpct@xarrowlen,-\xpct@yarrowlen)
2073 \end{Picture}}\endgroup}
2074 % \end{macrocode}
2075 % \end{macro}
2076 % \begin{macro}{\zerovector}
2077 % \begin{macro}{\zerotrivvector}
2078 % To have an arrowhead, draw a very short vector (of |0.01\unitlength|).
2079 % \begin{macrocode}
2080 \def\zerovector(#1){%
2081 \UNITVECTOR(#1)(\xpct@dirx,\xpct@diry)
2082 \SCALARVECTORPRODUCT{0.01}(\xpct@dirx,\xpct@diry)(\xpct@dirx,\xpct@diry)
2083 \xVECTOR(0,0)(\xpct@dirx,\xpct@diry)}
2084 \def\zerotrivvector(#1){%
2085 \UNITVECTOR(#1)(\xpct@dirx,\xpct@diry)
2086 \SCALARVECTORPRODUCT{0.01}(\xpct@dirx,\xpct@diry)(\xpct@dirx,\xpct@diry)
2087 \xtrivVECTOR(0,0)(\xpct@dirx,\xpct@diry)}
2088 % \end{macrocode}
2089 % \end{macro}
2090 % \end{macro}
2091 % \begin{macro}{\xline}
2092 % \begin{macro}{\xvector}
2093 % \begin{macro}{\xtrivvector}
2094 % Standard syntax strigth lines and vectors.
2095 % Call |\xpct@xline| to compute adequate coordinates of line or vector ends.
2096 % Then call |\xLINE|, |\xVECTOR| or |\xtrivVECTOR| command.
2097 % \begin{macrocode}
2098 \def\xline(#1,#2)#3{%
2099 \xpct@xline(#1,#2){#3}
2100 \xLINE(0,0)(\xpct@@xdir,\xpct@@ydir)}
2101
2102 \def\xvector(#1,#2)#3{%
2103 \ifdim #3 pt = 0 pt \zerovector(#1,#2)
2104 \else
2105 \xpct@xline(#1,#2){#3}
2106 \xVECTOR(0,0)(\xpct@@xdir,\xpct@@ydir)
2107 \fi}
2108
2109 \def\xtrivvector(#1,#2)#3{%
2110 \ifdim #3 pt = 0 pt \zerotrivvector(#1,#2)
2111 \else
2112 \xpct@xline(#1,#2){#3}
2113 \xtrivVECTOR(0,0)(\xpct@@xdir,\xpct@@ydir)
2114 \fi}
2115 % \end{macrocode}
2116 % \end{macro}
2117 % \end{macro}
2118 % \end{macro}
2119 % \begin{macro}{\xpct@xline}
2120 % Calculate the coordinates of the endpoint of |\xline(#1,#2){#3}| and stores
2121 % them in |(\xpct@@xdir,\xpct@@ydir)|.
2122 % \begin{macrocode}
2123 \def\xpct@xline(#1,#2)#3{%
2124 \ABSVALUE{#1}{\xpct@modx}
2125 \ifdim \xpct@modx pt < 0.0001 pt
2126 \COPY{0}{\xpct@@xdir}
2127 \ifdim #2\p@>\z@ \COPY{#3}{\xpct@@ydir}
2128 \else \MULTIPLY{-1}{#3}{\xpct@@ydir}
2129 \fi
2130 \else
2131 \DIVIDE{#1}{\xpct@modx}{\xpct@@xdir}
2132 \DIVIDE{#2}{\xpct@modx}{\xpct@@ydir}
2133 \SCALARVECTORPRODUCT{#3}(\xpct@@xdir,\xpct@@ydir)(%
2134 \xpct@@xdir,\xpct@@ydir)
2135 \fi}
2136 % \end{macrocode}
2137 % \end{macro}
2138 % \subsection{Polygons and polylines}
2139 % \begin{macro}{\Polyline}
2140 % This command plots a line between the two first points and, if next
2141 % character is |(|, supresses first point and iterates itself.
2142 % \begin{macrocode}
2143 \def\Polyline(#1)(#2){%
2144 \xLINE(#1)(#2)\@ifnextchar({\Polyline(#2)}{}}
2145 % \end{macrocode}
2146 % \end{macro}
2147 % \begin{macro}{\Polygon}
2148 % Store the first point in |(\xpct@firstx,\xpct@firsty)| and call
2149 % |\xpct@Polygon|.
2150 % \begin{macrocode}
2151 \def\Polygon(#1,#2)(#3){%
2152 \COPY{#1}{\xpct@firstx}\COPY{#2}{\xpct@firsty}
2153 \xpct@Polygon(#1,#2)(#3)}
2154 % \end{macrocode}
2155 % \end{macro}
2156 % \begin{macro}{\xpct@Polygon}
2157 % This command plots a line between the two first points and, if next
2158 % character is |(|, supresses first point and iterates itself.
2159 % When finished, adds a closing line to the previously stored first point.
2160 % \begin{macrocode}
2161 \def\xpct@Polygon(#1)(#2){%
2162 \xLINE(#1)(#2)\@ifnextchar({\xpct@Polygon(#2)}{%
2163 \xLINE(#2)(\xpct@firstx,\xpct@firsty)}}
2164 % \end{macrocode}
2165 % \end{macro}
2166 % \begin{macro}{\regularPolygon}
2167 % |\regularPolygon| can take an optional argument.
2168 % \begin{macrocode}
2169 \def\regularPolygon{%
2170 \@ifnextchar[{\xpct@regPolygon}{\xpct@@regPolygon}}
2171 % \end{macrocode}
2172 % \end{macro}
2173 % \begin{macro}{\xpct@@regPolygon}
2174 % Default for optional argument is |0|.
2175 % \begin{macrocode}
2176 \def\xpct@@regPolygon#1#2{\xpct@regPolygon[0]{#1}{#2}}
2177 % \end{macrocode}
2178 % \end{macro}
2179 % \begin{macro}{\xpct@regPolygon}
2180 % |\xpct@regPolygon[#1]{#2}{#3}| uses the |xpct@counta| counter to
2181 % plot |#3| lines, in polar coordinates with |#2| radius,
2182 % startint with angle |#1| and using $360/|#3|$ to
2183 % incrementing angle in each step.
2184 % \begin{macrocode}
2185 \def\xpct@regPolygon[#1]#2#3{\begingroup%
2186 \polarreference\degreesangles
2187 \setcounter{xpct@counta}{0}%
2188 \setcounter{xpct@countb}{#3}%
2189 \DIVIDE{360}{#3}{\xpct@angles}
2190 \COPY{#1}{\xpct@anglea}
2191 \@whilenum\value{xpct@counta}<\value{xpct@countb} \do {%
2192 \ADD{\xpct@anglea}{\xpct@angles}{\xpct@angleb}
2193 \xLINE(#2,\xpct@anglea)(#2,\xpct@angleb)
2194 \COPY{\xpct@angleb}{\xpct@anglea}\stepcounter{xpct@counta}}
2195 \endgroup}
2196 % \end{macrocode}
2197 % \end{macro}
2198 % \subsection{Quadratic curves}
2199 % \begin{macro}{\xpct@ctrlpoint}
2200 % The main command in this section is |\xpct@ctrlpoint|.
2201 % It computes the control point in a quadratic Bezier curve
2202 % from the coordinates and direction vectors of ending points.
2203 % \begin{macrocode}
2204 \def\xpct@ctrlpoint(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
2205 \DETERMINANT(#3,#4;#7,#8)\xpct@detA
2206 \DETERMINANT(#1,#2;#3,#4)\xpct@detB
2207 \DETERMINANT(#5,#6;#7,#8)\xpct@detC
2208 \DETERMINANT(#3,#7;\xpct@detB,\xpct@detC)\xpct@detD
2209 \DETERMINANT(#4,#8;\xpct@detB,\xpct@detC)\xpct@detE
2210 \ABSVALUE{\xpct@detA}{\xpct@@detA}
2211 \ABSVALUE{\xpct@detD}{\xpct@@detD}
2212 \ABSVALUE{\xpct@detE}{\xpct@@detE}
2213 \ifdim \xpct@@detA pt<0.00005 pt
2214 % \end{macrocode}
2215 % If |\xpct@detA| approaches zero, matrix is singular or close to singular.
2216 % Then tangent lines may be parallel or coincide.
2217 % \begin{macrocode}
2218 \ifdim \xpct@@detD pt<0.00005 pt %\xpct@detD pt=0 pt
2219 \ifdim \xpct@@detE pt<0.00005 pt %\xpct@detE pt=0 pt
2220 % \end{macrocode}
2221 % Indeterminate system. The curve is a straight line.
2222 % We take (as reference point) middle point between end points.
2223 % \begin{macrocode}
2224 \ADD{#1}{#5}{\xpct@solx}\DIVIDE{\xpct@solx}{2}{\xpct@solx}
2225 \ADD{#2}{#6}{\xpct@soly}\DIVIDE{\xpct@soly}{2}{\xpct@soly}
2226 \fi\else
2227 % \end{macrocode}
2228 % Inconsistent case. Return a warning and undefine control point.
2229 % \begin{macrocode}
2230 \xpct@WarnIncSys(#1,#2)(#5,#6)
2231 \let\xpct@solx\undefined\let\xpct@soly\undefined
2232 \fi
2233 \else
2234 % \end{macrocode}
2235 % This is the regular case.
2236 % \begin{macrocode}
2237 \DIVIDE{\xpct@detD}{\xpct@detA}{\xpct@solx}
2238 \DIVIDE{\xpct@detE}{\xpct@detA}{\xpct@soly}
2239 \fi}
2240 % \end{macrocode}
2241 % \end{macro}
2242 % \begin{macro}{\qCurve}
2243 % This macro accepts two alternative syntax (directions given by a vector
2244 % or by an angle).
2245 % \begin{macrocode}
2246 \def\qCurve(#1){\@ifnextchar({\xpct@@qCurve(#1)}{\xpct@@@qCurve(#1)}}
2247 % \end{macrocode}
2248 % \end{macro}
2249 % \begin{macro}{\xpct@@qCurve}
2250 % Compute standard coordinates of points and vectors and call |\xpct@qCurve|.
2251 % \begin{macrocode}
2252 \def\xpct@@qCurve(#1)(#2)(#3)(#4){%
2253 \refsysPoint(#1)(\xpct@@xzero,\xpct@@yzero)
2254 \refsysPoint(#3)(\xpct@@xone,\xpct@@yone)
2255 \refsysVector(#2)(\xpct@@dxzero,\xpct@@dyzero)
2256 \refsysVector(#4)(\xpct@@dxone,\xpct@@dyone)
2257 \xpct@qCurve(\xpct@@xzero,\xpct@@yzero)(\xpct@@dxzero,\xpct@@dyzero)(%
2258 \xpct@@xone,\xpct@@yone)%
2259 (\xpct@@dxone,\xpct@@dyone)}
2260 % \end{macrocode}
2261 % \end{macro}
2262 % \begin{macro}{\xpct@@@qCurve}
2263 % Translate direction angles to vectors and call |\qCurve|.
2264 % \begin{macrocode}
2265 \def\xpct@@@qCurve(#1)#2(#3)#4{%
2266 \ifpolar
2267 \qCurve(#1)(1,#2)(#3)(1,#4)
2268 \else
2269 \DEGREESCOS{#2}{\xpct@angxz}
2270 \DEGREESSIN{#2}{\xpct@angyz}
2271 \DEGREESCOS{#4}{\xpct@angxo}
2272 \DEGREESSIN{#4}{\xpct@angyo}
2273 \qCurve(#1)(\xpct@angxz,\xpct@angyz)(#3)%
2274 (\xpct@angxo,\xpct@angyo)\fi}
2275 % \end{macrocode}
2276 % \end{macro}
2277 % \begin{macro}{\xpct@qCurve}
2278 % Call |\xpct@ctrlpoint| to compute control point; then, use |\qbezier|
2279 % to plot the curve. If the control point is undefined, nothing is drawn.
2280 % \begin{macrocode}
2281 \def\xpct@qCurve(#1)(#2)(#3)(#4){%
2282 \xpct@ctrlpoint(#1)(#2)(#3)(#4)
2283 \ifx\xpct@solx\undefined
2284 \else
2285 \qbezier(#1)(\xpct@solx,\xpct@soly)(#3)\fi\ignorespaces}
2286 % \end{macrocode}
2287 % \end{macro}
2288 % \begin{macro}{\PlotQuadraticCurve}
2289 % Try between the two alternative sintax.
2290 % \begin{macrocode}
2291 \def\PlotQuadraticCurve(#1){%
2292 \@ifnextchar({\xpct@PlotQuadraticCurve(#1)}{%
2293 \xpct@@PlotQuadraticCurve(#1)}}
2294 % \end{macrocode}
2295 % \end{macro}
2296 % \begin{macro}{\xpct@PlotQuadraticCurve}
2297 % \begin{macro}{\xpct@@PlotQuadraticCurve}
2298 % Call |\qCurve| and iterate |\PlotQuadraticCurve|.
2299 % \begin{macrocode}
2300 \def\xpct@PlotQuadraticCurve(#1)(#2)(#3)(#4){%
2301 \qCurve(#1)(#2)(#3)(#4)
2302 \@ifnextchar({\PlotQuadraticCurve(#3)(#4)}{}}
2303 \def\xpct@@PlotQuadraticCurve(#1)#2(#3)#4{%
2304 \qCurve(#1){#2}(#3){#4}
2305 \@ifnextchar({\PlotQuadraticCurve(#3){#4}}{}}
2306 % \end{macrocode}
2307 % \end{macro}
2308 % \end{macro}
2309 % \subsection{Conic sections and arcs}
2310 % \begin{macro}{\xpct@circulararc}
2311 % \begin{macro}{\xpct@hyperbolicarc}
2312 % \begin{macro}{\xpct@parabolicarc}
2313 % Parametric equations of circular, hyperbolic and parabolic arcs
2314 % defined as vector functions.
2315 % \begin{macrocode}
2316 \newvectorfunction{\xpct@circulararc}{%
2317 % \end{macrocode}
2318 % Unit circle equation $x^2+y^2=1$ can be parameterized as
2319 % $f(t)=(\cos t,\sin t)$.
2320 % If the angles are measured in degrees, the derivative is not correct.
2321 % Should be multiplied by $\pi/180$, but because what we want is the
2322 % direction of the derivative, we will not do.
2323 % \begin{macrocode}
2324 \ifdegrees
2325 \DEGREESCOS{\t}{\x}
2326 \DEGREESSIN{\t}{\y}
2327 \COPY{\x}{\Dy}
2328 \MULTIPLY{-1}{\y}{\Dx}
2329 \else
2330 \COS{\t}{\x}
2331 \SIN{\t}{\y}
2332 \COPY{\x}{\Dy}
2333 \MULTIPLY{-1}{\y}{\Dx}
2334 \fi}
2335 \newvectorfunction{\xpct@hyperbolicarc}{%
2336 % \end{macrocode}
2337 % Hyperbola $x^2-y^2=1$, parameterized as $f(t)=\frac12(t+1/t,t-1/t)$.
2338 % This derivative is not correct.
2339 % We should divide it by $t$, but that did not change direction.
2340 % \begin{macrocode}
2341 \DIVIDE{1}{\t}{\xpct@invt}
2342 \ADD{\t}{\xpct@invt}{\x}
2343 \SUBTRACT{\t}{\xpct@invt}{\y}
2344 \MULTIPLY{0.5}{\x}{\x}
2345 \MULTIPLY{0.5}{\y}{\y}
2346 \COPY{\x}{\Dy}
2347 \COPY{\y}{\Dx}}
2348 % \end{macrocode}
2349 % Parabola $x=y^2$ (or $f(t)=(t^2,t)$).
2350 % \begin{macrocode}
2351 \newvectorfunction{\xpct@parabolicarc}{%
2352 \COPY{\t}{\y}
2353 \COPY{1}{\Dy}
2354 \SQUARE{\t}{\x}
2355 \MULTIPLY{2}{\t}{\Dx}}
2356 % \end{macrocode}
2357 % \end{macro}
2358 % \end{macro}
2359 % \end{macro}
2360 % \begin{macro}{\circularArc}
2361 % \begin{macro}{\xArc}
2362 % A circular arc is an elliptic arc with equal semiaxes.
2363 % \begin{macrocode}
2364 \def\circularArc#1#2#3{\ellipticArc{#1}{#1}{#2}{#3}}
2365 \let\xArc\circularArc
2366 % \end{macrocode}
2367 % \end{macro}
2368 % \end{macro}
2369 % \begin{macro}{\ellipticArc}
2370 % To draw an arc of ellipse of semiaxes |#1| and |#2|,
2371 % scale the axes and draw a circular arc.
2372 % |\defaultplotdivs| is the number of subintervals we divide |[#3,#4]|.
2373 % \begin{macrocode}
2374 \def\ellipticArc#1#2#3#4{%
2375 \begingroup
2376 \cartesianreference
2377 \changereferencesystem(0,0)(#1,0)(0,#2)
2378 \PlotParametricFunction[\defaultplotdivs]{\xpct@circulararc}{#3}{#4}
2379 \endgroup\ignorespaces}
2380 % \end{macrocode}
2381 % \end{macro}
2382 % \begin{macro}{\Circle}
2383 % \begin{macro}{\Ellipse}
2384 % A circle (or ellipse) is a circular (elliptic) arc of amplitude $2\pi$.
2385 % \begin{macrocode}
2386 \def\Circle#1{\begingroup\radiansangles
2387 \circularArc{#1}{0}{\numberTWOPI}\endgroup\ignorespaces}
2388 \def\Ellipse#1#2{\begingroup\radiansangles
2389 \ellipticArc{#1}{#2}{0}{\numberTWOPI}
2390 \endgroup\ignorespaces}
2391 % \end{macrocode}
2392 % \end{macro}
2393 % \end{macro}
2394 % \begin{macro}{\lhyperbolicArc}
2395 % Change $x$-axis to $-x$, then draw a right hyperbolic arc.
2396 % \begin{macrocode}
2397 \def\lhyperbolicArc#1#2#3#4{%
2398 \begingroup
2399 \changereferencesystem(0,0)(-1,0)(0,1)
2400 \rhyperbolicArc{#1}{#2}{#3}{#4}
2401 \endgroup}
2402 % \end{macrocode}
2403 % \end{macro}
2404 % \begin{macro}{\rhyperbolicArc}
2405 % Call |\xpct@hypluy| to compute extreme variables, then draw a
2406 % normalized arc of hyperbola.
2407 % \begin{macrocode}
2408 \def\rhyperbolicArc#1#2#3#4{%
2409 \xpct@hypluy{#2}{#3}{\xpct@uone}
2410 \xpct@hypluy{#2}{#4}{\xpct@utwo}
2411 \xpct@hyperbolicArc{#1}{#2}{\xpct@uone}{\xpct@utwo}}
2412 % \end{macrocode}
2413 % \end{macro}
2414 % \begin{macro}{\xpct@hyperbolicArc}
2415 % To draw an arc of (right branch of) hyperbola of semiaxes |#1| and |#2|,
2416 % scale the axes and draw a normalized arc of hyperbola.
2417 % |\defaultplotdivs| is the number of subintervals we divide |[#3,#4]|.
2418 % \begin{macrocode}
2419 \def\xpct@hyperbolicArc#1#2#3#4{%
2420 \begingroup
2421 \cartesianreference
2422 \changereferencesystem(0,0)(#1,0)(0,#2)
2423 \PlotParametricFunction[\defaultplotdivs]{\xpct@hyperbolicarc}{#3}{#4}
2424 \endgroup}
2425 % \end{macrocode}
2426 % \end{macro}
2427 % \begin{macro}{\lHyperbola}
2428 % Change $x$-axis to $-x$, then draw a right hyperbola branch.
2429 % \begin{macrocode}
2430 \def\lHyperbola#1#2#3#4{%
2431 \begingroup
2432 \changereferencesystem(0,0)(-1,0)(0,1)
2433 \rHyperbola{#1}{#2}{#3}{#4}
2434 \endgroup}
2435 % \end{macrocode}
2436 % \end{macro}
2437 % \begin{macro}{\rHyperbola}
2438 % Use |\xpct@hypconsist| to ensure parameters consistency,
2439 % call |\xpct@hyperbolalastu| to compute extreme variable,
2440 % then plot the right hyperbola branch.
2441 % Divide the curve into two arcs to ensure that
2442 % it includes point |(#1,0)|.
2443 % \begin{macrocode}
2444 \def\rHyperbola#1#2#3#4{%
2445 \def\xpct@hycons{}\xpct@hypconsist{#1}{#3}%
2446 \ifx\xpct@hycons\undefined
2447 \else
2448 \xpct@hyperbolalastu{#1}{#2}{#3}{#4}
2449 \DIVIDE{1}{\xpct@umax}{\xpct@umin}
2450 \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
2451 \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
2452 \fi}
2453 % \end{macrocode}
2454 % \end{macro}
2455 % \begin{macro}{\Hyperbola}
2456 % Use |\xpct@hypconsist| to ensure parameters consistency,
2457 % call |\xpct@hyperbolalastu| to compute extreme variable,
2458 % then plot the two branches.
2459 % \begin{macrocode}
2460 \def\Hyperbola#1#2#3#4{%
2461 \begingroup
2462 \def\xpct@hycons{}\xpct@hypconsist{#1}{#3}%
2463 \ifx\xpct@hycons\undefined
2464 \else
2465 \xpct@hyperbolalastu{#1}{#2}{#3}{#4}
2466 \DIVIDE{1}{\xpct@umax}{\xpct@umin}
2467 \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
2468 \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
2469 \changereferencesystem(0,0)(-1,0)(0,1)
2470 \xpct@hyperbolicArc{#1}{#2}{\xpct@umin}{1}
2471 \xpct@hyperbolicArc{#1}{#2}{1}{\xpct@umax}
2472 \fi\endgroup}
2473 % \end{macrocode}
2474 % \end{macro}
2475 % \begin{macro}{\xpct@hypconsist}
2476 % Ensures consistency of parameters in |\Hyperbola|-like commands.
2477 % This curve is not defined for $x<a$ values.
2478 % \begin{macrocode}
2479 \def\xpct@hypconsist#1#2{%
2480 \ifnum #1<#2\else\xpct@ErrHypCons
2481 \let\xpct@hycons\undefined\fi}
2482 % \end{macrocode}
2483 % \end{macro}
2484 % \begin{macro}{\xpct@hyperbolalastu}
2485 % Compute the max value of parameter ensuring restrictions
2486 % |x<#3| and |y<#4|.
2487 % \begin{macrocode}
2488 \def\xpct@hyperbolalastu#1#2#3#4{%
2489 \xpct@hyplux{#1}{#3}{\xpct@umaxx}
2490 \xpct@hypluy{#2}{#4}{\xpct@umaxy}
2491 \MIN{\xpct@umaxx}{\xpct@umaxy}{\xpct@umax}}
2492 % \end{macrocode}
2493 % \end{macro}
2494 % \begin{macro}{\xpct@hyplux}
2495 % To compute the max value of parameter ensuring restriction
2496 % |x<=#2|, solve equation |#2=(1/2)#1(u+1/u)| (|u=#3|).
2497 % \begin{macrocode}
2498 \def \xpct@hyplux#1#2#3{%
2499 \DIVIDE{#2}{#1}{\xpct@xa}
2500 \SQUARE{\xpct@xa}{#3}
2501 \SUBTRACT{#3}{1}{#3}
2502 \SQUAREROOT{#3}{\xpct@@umaxx}
2503 \ADD{\xpct@xa}{\xpct@@umaxx}{#3}}
2504 % \end{macrocode}
2505 % \end{macro}
2506 % \begin{macro}{\xpct@hypluy}
2507 % To compute the max value of parameter ensuring restriction
2508 % |y<#2|, solve equation |#2=(1/2)#1(u-1/u)| (|u=#3|).
2509 % \begin{macrocode}
2510 \def \xpct@hypluy#1#2#3{%
2511 \DIVIDE{#2}{#1}{\xpct@xa}
2512 \SQUARE{\xpct@xa}{#3}
2513 \ADD{#3}{1}{#3}
2514 \SQUAREROOT{#3}{\xpct@@umaxx}
2515 \ADD{\xpct@xa}{\xpct@@umaxx}{#3}}
2516 % \end{macrocode}
2517 % \end{macro}
2518 % \begin{macro}{\parabolicArc}
2519 % To draw an arc of parabola
2520 % scale the $x$-axis and draw a normalized arc of parabola.
2521 % |\defaultplotdivs| is the number of subintervals we divide |[#2,#3]|.
2522 % \begin{macrocode}
2523 \def\parabolicArc#1#2#3{%
2524 \begingroup
2525 \changereferencesystem(0,0)(#1,0)(0,1)
2526 \PlotParametricFunction[\defaultplotdivs]{\xpct@parabolicarc}{#2}{#3}
2527 \endgroup}
2528 % \end{macrocode}
2529 % \end{macro}
2530 % \begin{macro}{\Parabola}
2531 % Call |\xpct@parabolalasty| to compute extreme variable, then plot
2532 % the parabola. Divide the curve into two arcs to
2533 % ensure that it includes point |(0,0)|.
2534 % \begin{macrocode}
2535 \def\Parabola#1#2#3{%
2536 \xpct@parabolalasty{#1}{#2}{#3}
2537 \parabolicArc{#1}{-\xpct@maxy}{0}
2538 \parabolicArc{#1}{0}{\xpct@maxy}}
2539 % \end{macrocode}
2540 % \end{macro}
2541 % \begin{macro}{\xpct@parabolalasty}
2542 % Ensure restrictions |x<=#2|, |y<=#3|: solve equation |#2=#1 y^2|.
2543 % Then, |\xpct@maxy=min(y,#3)|.
2544 % \begin{macrocode}
2545 \def\xpct@parabolalasty#1#2#3{%
2546 \ABSVALUE{#1}{\xpct@@maxy}
2547 \DIVIDE{#2}{\xpct@@maxy}{\xpct@@maxy}
2548 \SQUAREROOT{\xpct@@maxy}{\xpct@maxy}
2549 \MIN{\xpct@maxy}{#3}{\xpct@maxy}}
2550 % \end{macrocode}
2551 % \end{macro}
2552 % \subsection{Graphing functions}
2553 % \begin{macro}{\PlotFunction}
2554 % This command can take an optional argument.
2555 % \begin{macrocode}
2556 \def\PlotFunction{%
2557 \@ifnextchar[{\xpct@iterateplotfunction}{\xpct@plotfunction}}
2558 % \end{macrocode}
2559 % \end{macro}
2560 % \begin{macro}{\xpct@iterateplotfunction}
2561 % Compute |\xpct@step| as |(#4-#3)/#1| and iterate |\xpct@plotfunction|
2562 % |#1| times.
2563 % \begin{macrocode}
2564 \def\xpct@iterateplotfunction[#1]#2#3#4{%
2565 \setcounter{xpct@step}{0}%
2566 \COPY{#3}{\xpct@oldt}
2567 \SUBTRACT{#4}{#3}{\xpct@step}
2568 \DIVIDE{\xpct@step}{#1}{\xpct@step}
2569 \@whilenum \value{xpct@step}<#1 \do
2570 {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
2571 \xpct@plotfunction{#2}{\xpct@oldt}{\xpct@newt}
2572 \stepcounter{xpct@step}%
2573 \COPY\xpct@newt\xpct@oldt
2574 }}
2575 % \end{macrocode}
2576 % \end{macro}
2577 % \begin{macro}{\xpct@plotfunction}
2578 % Draw graph of |#1| function between |#2| and |#3|.
2579 % \begin{macrocode}
2580 \def\xpct@plotfunction#1#2#3{\@killglue%
2581 % \end{macrocode}
2582 % Compute $f$ and $f'$ in |#2| and |#3|, and apply |\PlotxyDyData|.
2583 % \begin{macrocode}
2584 #1{#2}{\yzero}{\Dyzero}%
2585 #1{#3}{\yone}{\Dyone}%
2586 \PlotxyDyData(#2,\yzero,\Dyzero)(#3,\yone,\Dyone)
2587 \ifx\xpct@solx\undefined
2588 % \end{macrocode}
2589 % If tangent vectors are parallel, divide the interval into two halves
2590 % and recall |\xpct@plotfunction|.
2591 % \begin{macrocode}
2592 \ADD{#2}{#3}{\xpct@middt}
2593 \MULTIPLY{0.5}{\xpct@middt}{\xpct@middt}
2594 \xpct@plotfunction{#1}{#2}{\xpct@middt}
2595 \xpct@plotfunction{#1}{\xpct@middt}{#3}
2596 \fi}
2597 % \end{macrocode}
2598 % \end{macro}
2599 % \begin{macro}{\PlotPointsOfFunction}
2600 % The |\PlotPointsOfFunction| command is essentialy equal to
2601 % |\xpct@iterateplotfunction|,
2602 % but instead of a curve between two adjacent points,
2603 % plots a |\pointmark| (user can redefine |\pointmark|).
2604 % \begin{macrocode}
2605 \def\PlotPointsOfFunction#1#2#3#4{%
2606 \setcounter{xpct@step}{0}%
2607 \COPY{#3}{\xpct@oldt}
2608 \SUBTRACT{#4}{#3}{\xpct@step}
2609 \DIVIDE{\xpct@step}{#1}{\xpct@step}
2610 \ADD{#1}{1}{\xpct@lastt}
2611 \@whilenum \value{xpct@step}<\xpct@lastt \do
2612 {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
2613 #2{\xpct@oldt}{\xpct@oldy}{\xpct@oldDy}
2614 \Put[c](\xpct@oldt,\xpct@oldy){\pointmark}
2615 \stepcounter{xpct@step}%
2616 \COPY\xpct@newt\xpct@oldt
2617 }}
2618 % \end{macrocode}
2619 % \end{macro}
2620 % \begin{macro}{\PlotxyDyData}
2621 % |\PlotxyDyData(x0,y0,y0')(x1,y1,y1')(x2,y2,y2')...|
2622 % uses |\qCurve| to draw a curve between |(x0,y0)| and |(x1,y1)|
2623 % with tangent vectors |(1,y0')| and |(1,y1')|, then iterates itself.
2624 % \begin{macrocode}
2625 \def\PlotxyDyData(#1,#2,#3)(#4,#5,#6){%
2626 \qCurve(#1,#2)(1,#3)(#4,#5)(1,#6)
2627 \@ifnextchar({\PlotxyDyData(#4,#5,#6)}{}}
2628 % \end{macrocode}
2629 % \end{macro}
2630 % \subsection{Graphing parametric curves}
2631 % \begin{macro}{\PlotParametricFunction}
2632 % Plot vectorial function |#2| between the parameter values |#3| and |#4|.
2633 % It can take an optional argument |#1|.
2634 % \begin{macrocode}
2635 \def\PlotParametricFunction{%
2636 \@ifnextchar[{\xpct@iterateplotpfunction}{\xpct@plotpfunction}}
2637 % \end{macrocode}
2638 % \end{macro}
2639 % \begin{macro}{\xpct@iterateplotpfunction}
2640 % Divide |[#3,#4]| in |#1| pieces, then iterate |\xpct@plotpfunction| |#1|
2641 % times.
2642 % \begin{macrocode}
2643 \def\xpct@iterateplotpfunction[#1]#2#3#4{%
2644 \setcounter{xpct@step}{0}%
2645 \COPY{#3}{\xpct@oldt}
2646 \SUBTRACT{#4}{#3}{\xpct@step}
2647 \DIVIDE{\xpct@step}{#1}{\xpct@step}
2648 \@whilenum \value{xpct@step}<#1 \do
2649 {\ADD{\xpct@oldt}{\xpct@step}{\xpct@newt}
2650 \xpct@plotpfunction{#2}{\xpct@oldt}{\xpct@newt}
2651 \stepcounter{xpct@step}%
2652 \COPY\xpct@newt\xpct@oldt}\ignorespaces}
2653 % \end{macrocode}
2654 % \end{macro}
2655 % \begin{macro}{\xpct@plotpfunction}
2656 % Compute function (and derivative of) |#1| in |#2| and |#3|, then
2657 % call |\qCurve|.
2658 % \begin{macrocode}
2659 \def\xpct@plotpfunction#1#2#3{%
2660 \begingroup
2661 #1{#2}\xzero\Dxzero\yzero\Dyzero
2662 #1{#3}\xone\Dxone\yone\Dyone
2663 \cartesianreference
2664 \qCurve(\xzero,\yzero)(\Dxzero,\Dyzero)(\xone,\yone)(\Dxone,\Dyone)
2665 \endgroup\ignorespaces}
2666 % \end{macrocode}
2667 % \end{macro}
2668 % \subsection{Cartesian axes and grids}
2669 % Main commands: |\cartesianaxes| and |\cartesiangrid|.
2670 % \begin{macro}{\cartesiangrid}
2671 % Put |\ifgrid| to true, then call |\cartesianaxes|.
2672 % \begin{macrocode}
2673 \def\cartesiangrid(#1,#2)(#3,#4){%
2674 \begingroup\gridtrue\cartesianaxes(#1,#2)(#3,#4)\endgroup}
2675 % \end{macrocode}
2676 % \end{macro}
2677 % \begin{macro}{\cartesianaxes}
2678 % \begin{macro}{\xpct@XZero}
2679 % \begin{macro}{\xpct@XOne}
2680 % \begin{macro}{\xpct@YZero}
2681 % \begin{macro}{\xpct@YOne}
2682 % |\cartesianaxes| makes axes and, optionally, grid, tics, and/or labels.
2683 % Cartesian rectangle limits are stored in
2684 % |\xpct@XZero|, |\xpct@XOne|, |\xpct@YZero|, and |\xpct@YOne|.
2685 % \begin{macrocode}
2686 \def\cartesianaxes(#1,#2)(#3,#4){%
2687 % \end{macrocode}
2688 % In this command, coordinates are Cartesian.
2689 % \begin{macrocode}
2690 \begingroup\cartesianreference
2691 \GLOBALCOPY{#1}{\xpct@XZero}\GLOBALCOPY{#2}{\xpct@YZero}
2692 \GLOBALCOPY{#3}{\xpct@XOne}\GLOBALCOPY{#4}{\xpct@YOne}
2693 % \end{macrocode}
2694 % There shall be cuts, labels or grid?
2695 % \begin{macrocode}
2696 \iftics
2697 \ticslabelsgridtrue
2698 \else
2699 \iflabels
2700 \ticslabelsgridtrue
2701 \else
2702 \ifgrid
2703 \ticslabelsgridtrue
2704 \fi\fi\fi
2705 \ifticslabelsgrid
2706 \xpct@plotticslabels
2707 \fi
2708 % \end{macrocode}
2709 % Call |\xpct@plotaxes| to plot axes.
2710 % \begin{macrocode}
2711 \xpct@plotaxes\endgroup}
2712 % \end{macrocode}
2713 % \end{macro}
2714 % \end{macro}
2715 % \end{macro}
2716 % \end{macro}
2717 % \end{macro}
2718 % \begin{macro}{\plotxtic}
2719 % \begin{macro}{\plotytic}
2720 % Put |\iftics| boolean to true, adjust tics lengths and position,
2721 % and call |\xpct@printtic|.
2722 % \begin{macrocode}
2723 \def\plotxtic#1{%
2724 \maketics
2725 \xpct@adjticssize
2726 \xpct@adjxorytics{#1}{0}
2727 \xpct@printtic}
2728 \def\plotytic#1{%
2729 \maketics
2730 \xpct@adjticssize
2731 \xpct@adjxorytics{#1}{1}
2732 \xpct@printtic}
2733 % \end{macrocode}
2734 % \end{macro}
2735 % \end{macro}
2736 % \begin{macro}{\printxlabel}
2737 % \begin{macro}{\printylabel}
2738 % Adjust tics lengths and position, and call |\xpct@printlabel|.
2739 % \begin{macrocode}
2740 \def\printxlabel#1#2{%
2741 \xpct@adjticssize
2742 \xpct@adjxorytics{#1}{0}
2743 \xpct@printlabel{0}{#2}}
2744 \def\printylabel#1#2{%
2745 \xpct@adjticssize
2746 \xpct@adjxorytics{#1}{1}
2747 \xpct@printlabel{1}{#2}}
2748 % \end{macrocode}
2749 % \end{macro}
2750 % \end{macro}
2751 % \begin{macro}{\printxticlabel}
2752 % \begin{macro}{\printyticlabel}
2753 % Print tic and label.
2754 % \begin{macrocode}
2755 \def\printxticlabel#1#2{\plotxtic{#1}\printxlabel{#1}{#2}}
2756 \def\printyticlabel#1#2{\plotytic{#1}\printylabel{#1}{#2}}
2757 % \end{macrocode}
2758 % \end{macro}
2759 % \end{macro}
2760 % \begin{macro}{\plotxtics}
2761 % \begin{macro}{\plotytics}
2762 % Call |\xpct@plottics{0}}| or |\xpct@plottics{1}|.
2763 % \begin{macrocode}
2764 \def\plotxtics{\xpct@plottics{0}}
2765 \def\plotytics{\xpct@plottics{1}}
2766 % \end{macrocode}
2767 % \end{macro}
2768 % \end{macro}
2769 % \begin{macro}{\printxlabels}
2770 % \begin{macro}{\printylabels}
2771 % Call |\xpct@printlabels{0}| or |\xpct@printlabels{1}|.
2772 % By default, optional argument must be |-1|.
2773 % \begin{macrocode}
2774 \def\printxlabels{%
2775 \@ifnextchar[{\xpct@printlabels{0}}{\xpct@printlabels{0}[-1]}}
2776 \def\printylabels{%
2777 \@ifnextchar[{\xpct@printlabels{1}}{\xpct@printlabels{1}[-1]}}
2778 % \end{macrocode}
2779 % \end{macro}
2780 % \end{macro}
2781 % \begin{macro}{\printxticslabels}
2782 % \begin{macro}{\printyticslabels}
2783 % Call |\xpct@printxticslabels| or |\xpct@printyticslabels|.
2784 % By default, optional argument must be |-1|.
2785 % \begin{macrocode}
2786 \def\printxticslabels{%
2787 \@ifnextchar[{\xpct@printxticslabels}{\xpct@printxticslabels[-1]}}
2788 \def\printyticslabels{%
2789 \@ifnextchar[{\xpct@printyticslabels}{\xpct@printyticslabels[-1]}}
2790 % \end{macrocode}
2791 % \end{macro}
2792 % \end{macro}
2793
2794
2795
2796 % \begin{macro}{\xpct@plotaxes}
2797 % Axes are simple lines, but its position depends on boolean |\inzeroaxes|.
2798 % \begin{macrocode}
2799 \def\xpct@plotaxes{\linethickness{\axesthickness}%
2800 \pictcolor{\axescolor}
2801 \ifinzeroaxes
2802 \xLINE(\xpct@XZero,0)(\xpct@XOne,0)
2803 \xLINE(0,\xpct@YZero)(0,\xpct@YOne)
2804 \else
2805 \xLINE(\xpct@XZero,\xpct@YZero)(\xpct@XOne,\xpct@YZero)
2806 \xLINE(\xpct@XZero,\xpct@YZero)(\xpct@XZero,\xpct@YOne)
2807 \fi}
2808 % \end{macrocode}
2809 % \end{macro}
2810 % \begin{macro}{\xpct@plotticslabels}
2811 % Adjust tics sizes to axes lengths
2812 % and call |\xpct@plotxticslabels| and |\xpct@plotyticslabels|.
2813 % \begin{macrocode}
2814 \def\xpct@plotticslabels{%
2815 \xpct@adjticssize
2816 \xpct@plotxticslabels\xpct@plotyticslabels}
2817 % \end{macrocode}
2818 % \end{macro}
2819 % \begin{macro}{\xpct@plotxticslabels}
2820 % Grid, tics and labels on the |x| axis.
2821 % If secundary divisions are required, this command iterates itself.
2822 % \begin{macrocode}
2823 \def\xpct@plotxticslabels{%
2824 % \end{macrocode}
2825 % If required, plot grid (in both directions, |x| and |y|).
2826 % \begin{macrocode}
2827 \ifgrid\xpct@plotgrid\fi
2828 \begingroup
2829 \ifnum\xunitdivisions=1
2830 % \end{macrocode}
2831 % Call |\xpct@ticsinterval| to compute integer interval extremes
2832 % and number of tics;
2833 % then plot |x| tics.
2834 % \begin{macrocode}
2835 \xpct@ticsinterval{\xpct@XZero}{\xpct@XOne}
2836 \xpct@plotxtics
2837 \else
2838 % \end{macrocode}
2839 % Secundary tics.
2840 % \begin{macrocode}
2841 \begingroup
2842 % \end{macrocode}
2843 % Secundary tics. Change the reference system to the small unities,
2844 % and ajust tics sizes, thickness and colors.
2845 % \begin{macrocode}
2846 \xpct@adjstics
2847 \MULTIPLY{\secundaryyticssize}{\yunitdivisions}{\yticssize}
2848 % \end{macrocode}
2849 % At secundary level one must not print labels.
2850 % \begin{macrocode}
2851 \makenolabels
2852 % \end{macrocode}
2853 % Print secundary tics.
2854 % \begin{macrocode}
2855 \def\xunitdivisions{1}
2856 \xpct@plotxticslabels
2857 \endgroup
2858 % \end{macrocode}
2859 % Print primary tics and (perhaps) labels.
2860 % \begin{macrocode}
2861 \def\xunitdivisions{1}
2862 \xpct@plotxticslabels
2863 \fi
2864 \endgroup}
2865 % \end{macrocode}
2866 % \end{macro}
2867 % \begin{macro}{\xpct@plotyticslabels}
2868 % Tics and labels on the |y| axis.
2869 % If secundary divisions are required, this command iterates itself.
2870 % \begin{macrocode}
2871 \def\xpct@plotyticslabels{%
2872 \begingroup
2873 \ifnum\yunitdivisions=1
2874 % \end{macrocode}
2875 % Call |\xpct@ticsinterval| to compute integer interval extremes
2876 % and number of tics;
2877 % then plot |y| tics.
2878 % \begin{macrocode}
2879 \xpct@ticsinterval{\xpct@YZero}{\xpct@YOne}
2880 \xpct@plotytics
2881 \else
2882 % \end{macrocode}
2883 % Secundary tics.
2884 % \begin{macrocode}
2885 \begingroup
2886 % \end{macrocode}
2887 % Secundary tics. Change the reference system to the small unities,
2888 % and ajust tics sizes, thickness and colors.
2889 % \begin{macrocode}
2890 \xpct@adjstics
2891 \MULTIPLY{\secundaryxticssize}{\xunitdivisions}{\xticssize}
2892 % \end{macrocode}
2893 % At secundary level one must not print labels.
2894 % \begin{macrocode}
2895 \makenolabels
2896 % \end{macrocode}
2897 % Print secundary tics.
2898 % \begin{macrocode}
2899 \def\yunitdivisions{1}
2900 \xpct@plotyticslabels
2901 \endgroup
2902 % \end{macrocode}
2903 % Print primary tics and (perhaps) labels.
2904 % \begin{macrocode}
2905 \def\yunitdivisions{1}
2906 \xpct@plotyticslabels
2907 \fi
2908 \endgroup}
2909 % \end{macrocode}
2910 % \end{macro}
2911 % \begin{macro}{\xpct@adjstics}
2912 % Adjust length, color and thickness for secundary tics.
2913 % \begin{macrocode}
2914 \def\xpct@adjstics{%
2915 \MULTIPLY{\xpct@XZero}{\xunitdivisions}{\xpct@XZero}
2916 \MULTIPLY{\xpct@YZero}{\yunitdivisions}{\xpct@YZero}
2917 \MULTIPLY{\xpct@XOne}{\xunitdivisions}{\xpct@XOne}
2918 \MULTIPLY{\xpct@YOne}{\yunitdivisions}{\xpct@YOne}
2919 \DIVIDE{1}{\xunitdivisions}{\xpct@xunit}
2920 \DIVIDE{1}{\yunitdivisions}{\xpct@yunit}
2921 \changereferencesystem(0,0)(\xpct@xunit,0)(0,\xpct@yunit)
2922 \def\gridthickness{\secundarygridthickness}
2923 \def\gridcolor{\secundarygridcolor}}
2924 % \end{macrocode}
2925 % \end{macro}
2926 % \begin{macro}{\xpct@plotxtics}
2927 % \begin{macro}{\xpct@plotytics}
2928 % Call |\xpct@maketics| to make tics and/or labels (on |x| and |y| axes).
2929 % \begin{macrocode}
2930 \def\xpct@plotxtics{\xpct@maketics{\xpct@firstint}{\xpct@numtics}{0}}
2931 \def\xpct@plotytics{\xpct@maketics{\xpct@firstint}{\xpct@numtics}{1}}
2932 % \end{macrocode}
2933 % \end{macro}
2934 % \end{macro}
2935 % \begin{macro}{\xpct@maketics}
2936 % Makes tics and/or labels (|#2| points, begining in |#1|;
2937 % |#3=0| means |x| axis, |#3=1| means |y| axis).
2938 % \begin{macrocode}
2939 \def\xpct@maketics#1#2#3{%
2940 % \end{macrocode}
2941 % Call |\xpct@adjxorytics| to compute coordinates of extreme points of first
2942 % tic and translation vector from one tic to the next one.
2943 % \begin{macrocode}
2944 \xpct@adjxorytics{#1}{#3}
2945 % \end{macrocode}
2946 % Use counter |xpct@counta| for tics and |xpct@countb| for labels
2947 % (number to print in each label).
2948 % \begin{macrocode}
2949 \setcounter{xpct@counta}{0}%
2950 \iflabels\setcounter{xpct@countb}{#1}\fi
2951 % \end{macrocode}
2952 % Main loop: |#2| steps, begining in |#1|.
2953 % \begin{macrocode}
2954 \@whilenum \value{xpct@counta}<#2 \do {%
2955 \iftics
2956 % \end{macrocode}
2957 % If required, print tic.
2958 % \begin{macrocode}
2959 \xpct@printtic
2960 \fi
2961 \iflabels
2962 % \end{macrocode}
2963 % If labels are to be printed, adjust |\Pictlabelsep|; then print label
2964 % and step label (|xpct@countb| counter).
2965 % \begin{macrocode}
2966 \highestlabel{\xpct@axeslabelattrib%
2967 $\axeslabelmathalphabet{1}$}%
2968 \xpct@printlabel{#3}{\thexpct@countb}
2969 \stepcounter{xpct@countb}%
2970 \fi
2971 % \end{macrocode}
2972 % Step tics counter and move coordinates to next point.
2973 % \begin{macrocode}
2974 \stepcounter{xpct@counta}%
2975 \VECTORADD(\xpct@@xzero,\xpct@@yzero)(\xpct@@xincr,\xpct@@yincr)%
2976 (\xpct@@xzero,\xpct@@yzero)
2977 \VECTORADD(\xpct@@xone,\xpct@@yone)(\xpct@@xincr,\xpct@@yincr)%
2978 (\xpct@@xone,\xpct@@yone)
2979 }}
2980 % \end{macrocode}
2981 % \end{macro}
2982 % \begin{macro}{\xpct@adjxorytics}
2983 % Compute coordinates of extreme points of first tic
2984 % and translation vector from one tic to the next one.
2985 % There are four cases: |x| or |y| axis, and external or internal axes.
2986 % \begin{macrocode}
2987 \def\xpct@adjxorytics#1#2{%
2988 \ifnum #2=0
2989 \COPY{#1}{\xpct@@xzero}
2990 \COPY{-\yticssize}{\xpct@@yzero}
2991 \COPY{#1}{\xpct@@xone}
2992 \COPY{\yticssize}{\xpct@@yone}
2993 \COPY{1}{\xpct@@xincr}
2994 \COPY{0}{\xpct@@yincr}
2995 \ifinzeroaxes\else
2996 \ADD{\xpct@YZero}{\xpct@@yzero}{\xpct@@yzero}
2997 \ADD{\xpct@YZero}{\xpct@@yone}{\xpct@@yone}
2998 \fi
2999 \else
3000 \COPY{#1}{\xpct@@yzero}
3001 \COPY{-\xticssize}{\xpct@@xzero}
3002 \COPY{#1}{\xpct@@yone}
3003 \COPY{\xticssize}{\xpct@@xone}
3004 \COPY{1}{\xpct@@yincr}
3005 \COPY{0}{\xpct@@xincr}
3006 \ifinzeroaxes\else
3007 \ADD{\xpct@XZero}{\xpct@@xzero}{\xpct@@xzero}
3008 \ADD{\xpct@XZero}{\xpct@@xone}{\xpct@@xone}
3009 \fi
3010 \fi}
3011 % \end{macrocode}
3012 % \end{macro}
3013 % \begin{macro}{\xpct@printtic}
3014 % Plot a tic.
3015 % \begin{macrocode}
3016 \def\xpct@printtic{\pictcolor{\ticscolor}
3017 \linethickness{\ticsthickness}
3018 \xLINE(\xpct@@xzero,\xpct@@yzero)(\xpct@@xone,\xpct@@yone)}
3019 % \end{macrocode}
3020 % \end{macro}
3021 % \begin{macro}{\xpct@adjticssize}
3022 % Adjust size of tics according to axes length.
3023 % \begin{macrocode}
3024 \def\xpct@adjticssize{%
3025 % \end{macrocode}
3026 % First, convert absolute lenghts |\ticssize| and |\secundaryticssize| to
3027 % the |\unitlength| unity.
3028 % \begin{macrocode}
3029 \LENGTHDIVIDE{\ticssize}{\unitlength}{\xpct@ticssize}
3030 \LENGTHDIVIDE{\secundaryticssize}{\unitlength}{\xpct@sticssize}
3031 % \end{macrocode}
3032 % Calculate the size of vector |(1,0)|, converting it to standard coordinates
3033 % and computing its norm.
3034 % Then we adjust |\xticssize| and |\secundaryxticssize|; this ensures
3035 % the desired sizes.
3036 % \begin{macrocode}
3037 \refsysxyVector(1,0)(\xpct@a,\xpct@b)
3038 \VECTORNORM(\xpct@a,\xpct@b){\xpct@norm}
3039 \DIVIDE{\xpct@ticssize}{\xpct@norm}{\xticssize}
3040 \DIVIDE{\xpct@sticssize}{\xpct@norm}{\secundaryxticssize}
3041 \DIVIDE{\axislabelsep}{\xpct@norm}{\xpct@xaxislabelsep}
3042 % \end{macrocode}
3043 % Repeat calculations for vector $(0,1)$,
3044 % adjusting |\yticssize| and |\secundaryyticssize|.
3045 % \begin{macrocode}
3046 \refsysxyVector(0,1)(\xpct@a,\xpct@b)
3047 \VECTORNORM(\xpct@a,\xpct@b){\xpct@norm}
3048 \DIVIDE{\xpct@ticssize}{\xpct@norm}{\yticssize}
3049 \DIVIDE{\xpct@sticssize}{\xpct@norm}{\secundaryyticssize}
3050 \DIVIDE{\axislabelsep}{\xpct@norm}{\xpct@yaxislabelsep}}
3051 % \end{macrocode}
3052 % \end{macro}
3053 % \begin{macro}{\xpct@printlabel}
3054 % Adjust highest label (for horizontal labels);
3055 % then print value of |#2|.
3056 % Four cases: |x| or |y|, external or internal.
3057 % \begin{macrocode}
3058 \def\xpct@printlabel#1#2{%
3059 \iftics
3060 \ifnum #1=0
3061 \ADD{\yticssize}{\xpct@yaxislabelsep}{\Pictlabelsep}
3062 \else
3063 \ADD{\xticssize}{\xpct@xaxislabelsep}{\Pictlabelsep}
3064 \fi
3065 \else
3066 \ifnum #1=0
3067 \COPY{\xpct@yaxislabelsep}{\Pictlabelsep}
3068 \else
3069 \COPY{\xpct@xaxislabelsep}{\Pictlabelsep}
3070 \fi
3071 \fi
3072 \ifinzeroaxes
3073 \ifnum\thexpct@countb=0
3074 \else
3075 \ifnum #1=0
3076 \rPut*{\xpct@xlblpos}(\xpct@@xzero,0){%
3077 \xpct@axeslabelattrib%
3078 \ensuremath{\axeslabelmathalphabet{#2}}}
3079 \else
3080 \rPut*{\xpct@ylblpos}(0,\xpct@@yzero){%
3081 \xpct@axeslabelattrib%
3082 \ensuremath{\axeslabelmathalphabet{#2}}}
3083 \fi
3084 \fi
3085 \else
3086 \ifnum #1=0
3087 \rPut*{\xpct@xlblpos}(\xpct@@xzero,\xpct@YZero){%
3088 \xpct@axeslabelattrib%
3089 \ensuremath{\axeslabelmathalphabet{#2}}}
3090 \else
3091 \rPut*{\xpct@ylblpos}(\xpct@XZero,\xpct@@yzero){%
3092 \xpct@axeslabelattrib%
3093 \ensuremath{\axeslabelmathalphabet{#2}}}
3094 \fi
3095 \fi}
3096 % \end{macrocode}
3097 % \end{macro}
3098 % \begin{macro}{\xlabelpos}
3099 % \begin{macro}{\ylabelpos}
3100 % Default position for labels on axes. Call |\xpct@convtoang| to define
3101 % |\xpct@xlblpos| or |\xpct@ylblpos|.
3102 % \begin{macrocode}
3103 \def\xlabelpos#1{\xpct@convtoang{#1}{\xpct@xlblpos}{\xpct@CorR}}
3104 \def\ylabelpos#1{\xpct@convtoang{#1}{\xpct@ylblpos}{\xpct@CorR}}
3105 % \end{macrocode}
3106 % \end{macro}
3107 % \end{macro}
3108 % \begin{macro}{\xpct@printxticslabels}
3109 % \begin{macro}{\xpct@printyticslabels}
3110 % Print tics and labels.
3111 % \begin{macrocode}
3112 \def\xpct@printxticslabels[#1]#2#3#4{%
3113 \plotxtics{#2}{#3}{#4}\printxlabels[#1]{#2}{#3}{#4}}
3114 \def\xpct@printyticslabels[#1]#2#3#4{%
3115 \plotytics{#2}{#3}{#4}\printylabels[#1]{#2}{#3}{#4}}
3116 % \end{macrocode}
3117 % \end{macro}
3118 % \end{macro}
3119 % \begin{macro}{\xpct@plottics}
3120 % Plot |x| or |y| tics (if |#1| equals |0| or |1|),
3121 % starting an |#2|. Distance between two consecutive tics is |#3|, and
3122 % position of last tic is not greather than |#4|.
3123 % \begin{macrocode}
3124 \def\xpct@plottics#1#2#3#4{%
3125 \COPY{#2}{\xpct@ticcoor}
3126 % \end{macrocode}
3127 % |\xpct@ticcoor| is the position of next tic.
3128 % \begin{macrocode}
3129 \@whiledim\xpct@ticcoor\p@<#4\p@ \do {%
3130 % \end{macrocode}
3131 % Make a tic while |\xpct@ticcoor<#4|
3132 % \begin{macrocode}
3133 \ifnum #1=0
3134 \plotxtic{\xpct@ticcoor}
3135 \else
3136 \plotytic{\xpct@ticcoor}
3137 \fi
3138 \ADD{#3}{\xpct@ticcoor}{\xpct@ticcoor}
3139 }
3140 % \end{macrocode}
3141 % If |\xpct@ticcoor=#4| then this is the last tic position.
3142 % \begin{macrocode}
3143 \ifdim\xpct@ticcoor\p@>#4\p@
3144 \else
3145 \ifnum #1=0
3146 \plotxtic{\xpct@ticcoor}
3147 \else
3148 \plotytic{\xpct@ticcoor}
3149 \fi
3150 \fi}
3151 % \end{macrocode}
3152 % \end{macro}
3153 % \begin{macro}{\xpct@printlabels}
3154 % Print |x| or |y| labels (if |#1| equals |0| or |1|),
3155 % starting an |#3|. Distance between two consecutive tics is |#4|, and
3156 % position of last tic is not greather than |#5|.
3157 % |#2| is the number of decimal digits to be printed
3158 % (default is |#2=-1|, meaning no control of digits in number printing).
3159 % \begin{macrocode}
3160 \def\xpct@printlabels#1[#2]#3#4#5{%
3161 \COPY{#3}{\xpct@ticcoor}
3162 % \end{macrocode}
3163 % |\xpct@ticcoor| is the position of next label.
3164 % \begin{macrocode}
3165 \@whiledim\xpct@ticcoor\p@<#5\p@ \do {%
3166 % \end{macrocode}
3167 % Print a label while |\xpct@ticcoor<#5|
3168 % |\xpct@Ticcoor| is the label with adjusted number of digits.
3169 % \begin{macrocode}
3170 \ifnum #2=-1
3171 \COPY{\xpct@ticcoor}{\xpct@Ticcoor}
3172 \else
3173 \ROUND[#2]{\xpct@ticcoor}{\xpct@Ticcoor}
3174 \fi
3175 \xpct@prtlbl{#1}
3176 \ADD{#4}{\xpct@ticcoor}{\xpct@ticcoor}}
3177 \ifdim\xpct@ticcoor\p@>#5\p@
3178 % \end{macrocode}
3179 % If |\xpct@ticcoor=#5| then this is the last label position.
3180 % \begin{macrocode}
3181 \else
3182 \ifnum #2=-1
3183 \COPY{\xpct@ticcoor}{\xpct@Ticcoor}
3184 \else
3185 \ROUND[#2]{\xpct@ticcoor}{\xpct@Ticcoor}
3186 \fi
3187 \xpct@prtlbl{#1}
3188 \fi}
3189 % \end{macrocode}
3190 % \end{macro}
3191 % \begin{macro}{\xpct@prtlbl}
3192 % Print the |x| or |y| label (for |#1=0| or |1|)
3193 % |\xpct@Ticcoor| at |\xpct@ticcoor|.
3194 % When |\ifinzeroaxes| is true label at |0| position is not printed.
3195 % \begin{macrocode}
3196 \def\xpct@prtlbl#1{%
3197 \ifinzeroaxes
3198 \ifdim \xpct@ticcoor\p@=\z@\else
3199 \xpct@adjticssize
3200 \xpct@adjxorytics{\xpct@ticcoor}{#1}
3201 \xpct@printlabel{#1}{\xpct@Ticcoor}
3202 \fi
3203 \else
3204 \xpct@adjticssize
3205 \xpct@adjxorytics{\xpct@ticcoor}{#1}
3206 \xpct@printlabel{#1}{\xpct@Ticcoor}\fi}
3207 % \end{macrocode}
3208 % \end{macro}
3209 % \begin{macro}{\xpct@plotgrid}
3210 % Plot a grid in a Cartesian rectangle.
3211 % \begin{macrocode}
3212 \def\xpct@plotgrid{%
3213 % \end{macrocode}
3214 % Call |\xpct@ticsinterval| to compute integer interval extremes
3215 % and number of tics;
3216 % then plot grid lines (for |x| axis).
3217 % \begin{macrocode}
3218 \xpct@ticsinterval{\xpct@XZero}{\xpct@XOne}
3219 \begingroup\setcounter{xpct@counta}{0}%
3220 \pictcolor{\gridcolor}\linethickness{\gridthickness}
3221 \COPY{\xpct@firstint}{\xpct@grid}
3222 \@whilenum\value{xpct@counta}<\xpct@numtics\do{
3223 \xLINE(\xpct@grid,\xpct@YZero)(\xpct@grid,\xpct@YOne)
3224 \ADD{1}{\xpct@grid}{\xpct@grid}
3225 \stepcounter{xpct@counta}}\endgroup
3226 % \end{macrocode}
3227 % Call |\xpct@ticsinterval| to compute integer interval extremes
3228 % and number of tics;
3229 % then plot grid lines (for |y| axis).
3230 % \begin{macrocode}
3231 \xpct@ticsinterval{\xpct@YZero}{\xpct@YOne}
3232 \begingroup\setcounter{xpct@counta}{0}%
3233 \pictcolor{\gridcolor}\linethickness{\gridthickness}
3234 \COPY{\xpct@firstint}{\xpct@grid}
3235 \@whilenum\value{xpct@counta}<\xpct@numtics\do{
3236 \xLINE(\xpct@XZero,\xpct@grid)(\xpct@XOne,\xpct@grid)
3237 \ADD{1}{\xpct@grid}{\xpct@grid}
3238 \stepcounter{xpct@counta}}\endgroup}
3239 % \end{macrocode}
3240 % \end{macro}
3241 % \begin{macro}{\xpct@ticsinterval}
3242 % Truncate extremes to integers, then compute the number of tics
3243 % (|\xpct@firstint-\xpct@lastint+1|).
3244 % \begin{macrocode}
3245 \def\xpct@ticsinterval#1#2{\TRUNCATE[0]{#1}{\xpct@firstint}
3246 \TRUNCATE[0]{#2}{\xpct@lastint}
3247 \SUBTRACT{\xpct@lastint}{\xpct@firstint}{\xpct@numtics}
3248 \ADD{\xpct@numtics}{1}{\xpct@numtics}}
3249 % \end{macrocode}
3250 % \end{macro}
3251 % \subsection{Polar grids}
3252 % \begin{macro}{\polargrid}
3253 % Plot a polar grid of radius |#1| and |#2| divisions of circle.
3254 % \begin{macrocode}
3255 \def\polargrid#1#2{%
3256 \begingroup
3257 \polarreference
3258 % \end{macrocode}
3259 % Compute integer part of radius, number of circles and distance
3260 % between circles.
3261 % \begin{macrocode}
3262 \FLOOR{#1}{\xpct@rint}
3263 \MULTIPLY{\xpct@rint}{\runitdivisions}{\xpct@rdivs}
3264 \DIVIDE{1}{\runitdivisions}{\rincr}
3265 % \end{macrocode}
3266 % Use counter |xpct@counta| to control the number of printed circles
3267 % and |\xpct@radius| as radius of the current circle.
3268 % \begin{macrocode}
3269 \COPY{0}{\xpct@radius}
3270 \setcounter{xpct@counta}{1}%
3271 % \end{macrocode}
3272 % Plot |\xpct@rdivs| circles.
3273 % \begin{macrocode}
3274 \begingroup
3275 \pictcolor{\gridcolor}
3276 \linethickness{\gridthickness}
3277 \@whilenum \value{xpct@counta}<\xpct@rdivs\do {%
3278 \ADD{\rincr}{\xpct@radius}{\xpct@radius}
3279 \Ellipse{\xpct@radius}{\xpct@radius}
3280 \stepcounter{xpct@counta}}%
3281 % \end{macrocode}
3282 % Plot external circle.
3283 % \begin{macrocode}
3284 \pictcolor{\axescolor}
3285 \linethickness{\axesthickness}
3286 \Ellipse{\xpct@rint}{\xpct@rint}
3287 \endgroup
3288 % \end{macrocode}
3289 % Use counter |xpct@counta| to control the number of printed lines and
3290 % |\xpct@angle| as arc (in radians) of the current line.
3291 % |\xpct@angincr| is the gap between two adjacent lines.
3292 % \begin{macrocode}
3293 \COPY{0}{\xpct@angle}
3294 \DIVIDE{\numberTWOPI}{#2}{\xpct@angincr}
3295 \setcounter{xpct@counta}{0}%
3296 % \end{macrocode}
3297 % Plot |#2| lines.
3298 % \begin{macrocode}
3299 \pictcolor{\gridcolor}
3300 \linethickness{\gridthickness}
3301 \@whilenum \value{xpct@counta}<#2 \do {%
3302 \xLINE(0,0)(#1,\xpct@angle)
3303 % \end{macrocode}
3304 % If required, print angular label: evaluate the number |\xpct@arc|
3305 % such that angle is |(\xpct@arc/#2) pi| and call |\xpct@polarlabel|.
3306 % \begin{macrocode}
3307 \iflabels
3308 \COPY{\axislabelsep}{\Pictlabelsep}
3309 \MULTIPLY{2}{\thexpct@counta}{\xpct@arc}
3310 \xpct@polarlabel{#1}{\xpct@arc}{#2}\fi
3311 \ADD{\xpct@angincr}{\xpct@angle}{\xpct@angle}
3312 \stepcounter{xpct@counta}}%
3313 % \end{macrocode}
3314 % Plot the polar line.
3315 % \begin{macrocode}
3316 \pictcolor{\axescolor}
3317 \linethickness{\axesthickness}
3318 \xLINE(0,0)(#1,0)
3319 % \end{macrocode}
3320 % If required, print radial labels.
3321 % \begin{macrocode}
3322 \iflabels
3323 \highestlabel{\xpct@axeslabelattrib$\axeslabelmathalphabet{1}$}
3324 \multiPut*[\xpct@rlblpos](1,0)(1,0){\xpct@rint}{%
3325 \ADD{\value{multiput}}{1}{\xpct@lbl}
3326 \xpct@axeslabelattrib%
3327 \ensuremath{\axeslabelmathalphabet{\xpct@lbl}}}%
3328 \fi
3329 \endgroup}
3330 % \end{macrocode}
3331 % \end{macro}
3332
3333 % \begin{macro}{\rlabelpos}
3334 % Default position for labels on polar axis. Call |\xpct@convtoang| to define
3335 % |\xpct@rlblpos|.
3336 % \begin{macrocode}
3337 \def\rlabelpos#1{\xpct@convtoang{#1}{\xpct@rlblpos}{\xpct@CorR}}
3338 % \end{macrocode}
3339 % \end{macro}
3340 % \begin{macro}{\degreespolarlabels}
3341 % \begin{macro}{\radianspolarlabels}
3342 % Define |\xpct@polarlabel| to be |\xpct@degreeslabel| or |\xpct@radianslabel|
3343 % (print polar label as degrees or radians).
3344 % \begin{macrocode}
3345 \def\degreespolarlabels{\def\xpct@polarlabel{\xpct@degreeslabel}}
3346 \def\radianspolarlabels{\def\xpct@polarlabel{\xpct@radianslabel}}
3347 % \end{macrocode}
3348 % \end{macro}
3349 % \end{macro}
3350 % \begin{macro}{\xpct@degreeslabel}
3351 % Print the angle label |(#2/#3) pi| converted to degrees.
3352 % \begin{macrocode}
3353 \def\xpct@degreeslabel#1#2#3{%
3354 % \end{macrocode}
3355 % Adjust label position.
3356 % \begin{macrocode}
3357 % \end{macrocode}
3358 % Simplify |#2/#3|. Then convert |(#2/#3) pi| to degrees
3359 % (evaluate |(#2 180)/#3|).
3360 % \begin{macrocode}
3361 \FRACTIONSIMPLIFY{#2}{#3}\xpct@num\xpct@den
3362 \MULTIPLY{\xpct@num}{180}{\xpct@degangle}
3363 \DIVIDE{\xpct@degangle}{\xpct@den}{\xpct@degangle}
3364 % \end{macrocode}
3365 % Print label.
3366 % \begin{macrocode}
3367 \cPut{\xpct@degangle}(#1,\xpct@angle){%
3368 \xpct@axeslabelattrib%
3369 \ensuremath{\axeslabelmathalphabet{\xpct@degangle^\mathrm{o}}}}}
3370 % \end{macrocode}
3371 % \end{macro}
3372 % \begin{macro}{\xpct@radianslabel}
3373 % Print the angle label |(#2/#3) pi|.
3374 % \begin{macrocode}
3375 \def\xpct@radianslabel#1#2#3{%
3376 % \end{macrocode}
3377 % Adjust label position and call |\xpct@prtfracrad|.
3378 % \begin{macrocode}
3379 \RADtoDEG{\xpct@angle}{\xpct@angles}
3380 \cPut{\xpct@angles}(#1,\xpct@angle){%
3381 \xpct@axeslabelattrib%
3382 \ensuremath{\axeslabelmathalphabet
3383 {\xpct@prtfracrad{#2}{#3}}}}}
3384 % \end{macrocode}
3385 % \end{macro}
3386 % \begin{macro}{\xpct@prtfracrad}
3387 % Pretty print |(#1/#2)pi|
3388 % \begin{macrocode}
3389 \def\xpct@prtfracrad#1#2{%
3390 \FRACTIONSIMPLIFY{#1}{#2}\xpct@num\xpct@den
3391 \ifnum \xpct@num = 0 0
3392 \else
3393 \ifnum \xpct@num = 1
3394 \ifnum \xpct@den = 1 \pi
3395 \else \pi/\xpct@den
3396 \fi
3397 \else \xpct@num\pi/\xpct@den
3398 \fi
3399 \fi}
3400 % \end{macrocode}
3401 % \end{macro}
3402 % \subsection{Configurable parameters}
3403 % These are the parameters the user can customize.
3404 % Default values ​​are written to |xpicture.sty| and |xpicture.cfgxmpl|.
3405 % \begin{macrocode}
3406 %</xpicture>
3407 %<*defaults>
3408 %<+cfg>%%
3409 %<+cfg>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3410 %<+cfg>% xpicture configurable parameters %
3411 %<+cfg>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3412 %<+cfg>%%
3413 %<+cfg>%%%%% Cartesian and polar axes
3414 %<+cfg> % Thickness and color of axes
3415 \axesthickness=1pt
3416 \def\axescolor{black}
3417 %<+cfg> % Color, size, mathversion and mathalphabet of numeric labels
3418 \def\axeslabelcolor{\axescolor}
3419 \def\axeslabelsize{\small}
3420 \def\axeslabelmathversion{normal}
3421 \def\axeslabelmathalphabet{\mathrm}
3422 %<+cfg> % Relative position of numeric labels on x- y- and r- axes
3423 \xlabelpos{-90}
3424 \ylabelpos{180}
3425 \rlabelpos{bbr}
3426 %<+cfg> % Distance between tags and cut marks,
3427 %<+cfg> % is is a number (not a lenght) of \unitlength units
3428 \def\axislabelsep{0.1}
3429 %<+cfg> % Color, thickness and size of tics
3430 \def\ticscolor{\axescolor}
3431 \ticsthickness=1pt
3432 \ticssize=4pt
3433 %<+cfg> % Size of secundary tics
3434 \secundaryticssize=2pt
3435 %<+cfg> % Thickness and color of Cartesian or polar grid
3436 \gridthickness=0.4pt
3437 \def\gridcolor{gray}
3438 %<+cfg> % Thickness and color of Cartesian or polar secundary grid
3439 \secundarygridthickness=0.2pt
3440 \def\secundarygridcolor{lightgray}
3441 %<+cfg> % Number of divisions of unity in x- y- and r-axis
3442 \def\xunitdivisions{1}
3443 \def\yunitdivisions{1}
3444 \def\runitdivisions{1}
3445 %<+cfg> % Arc labels in radians (\xpct@radianslabel)
3446 %<+cfg> % or degrees (\xpct@degreeslabel)
3447 \def\xpct@polarlabel{\xpct@radianslabel}
3448 %<+cfg>%%%%% \put and \multiput extensions
3449 %<+cfg> % Distance from label to reference point,
3450 %<+cfg> % is is a number (not a lenght) of \unitlength units
3451 \def\Pictlabelsep{0.1}
3452 %<+cfg> % Default layout for distance (\defaultPut{c} or \defaultPut{r})
3453 \defaultPut{c}
3454 %<+cfg>%%%%% Reference systems
3455 %<+cfg> % Default reference system
3456 \referencesystem(0,0)(1,0)(0,1)
3457 %<+cfg> % Cartesian or polar reference
3458 \cartesianreference
3459 %<+cfg>%%%%% Arrow size in \xtrivVECTOR
3460 \arrowsize{5}{2}
3461 %<+cfg>%%%%% Default interval divisions
3462 %<+cfg> % (used when plotting conic sections and arcs)
3463 \def\defaultplotdivs{8}
3464 %<+cfg>%%%%% Size to be used by \pointmark
3465 \def\pointmarkdiam{0.1}
3466 %<+cfg>%%%%% Point mark used by \PlotPointsOfFunction
3467 \def\pointmark{\circle*{\pointmarkdiam}}
3468 %</defaults>
3469 %<*xpicture>
3470 % \end{macrocode}
3471 % \subsection{Commands to be ignored if draft option or \cs{draftPicture}
3472 % declaration is active}
3473 % \begin{macro}{\draftPictures}
3474 % This declaration allow user to locally disable |Picture| drawns.
3475 % \begin{macrocode}
3476 \def\draftPictures{%
3477 \drafttrue
3478 \def\cPut##1(##2,##3)##4{}
3479 \def\xpct@@Put(##1)##2{}
3480 \def\xpct@@Putstar[##1](##2)##3{}
3481 \def\xpct@@@Put[##1](##2)##3{}
3482 \def\defaultPut##1{\def\xpct@defaultPut{\cPut}}
3483 \def\xpct@@mPut(##1,##2)(##3,##4)##5##6{}
3484 \def\xpct@PUT##1(##2,##3)##4{}
3485 \def\xLINE(##1)(##2){}
3486 \def\xtrivVECTOR(##1)(##2){}
3487 \def\xVECTOR(##1)(##2){}
3488 \def\zerovector(##1){}
3489 \def\zerotrivvector(##1){}
3490 \def\xline(##1,##2)##3{}
3491 \def\xvector(##1,##2)##3{}
3492 \def\xtrivvector(##1,##2)##3{}
3493 \def\xpct@regPolygon[##1]##2##3{}
3494 \def\xpct@@qCurve(##1)(##2)(##3)(##4){}
3495 \def\xpct@PlotQuadraticCurve(##1)(##2)(##3)(##4){%
3496 \@ifnextchar({\PlotQuadraticCurve(##3)(##4)}{}}
3497 \def\xpct@@PlotQuadraticCurve(##1)##2(##3)##4{%
3498 \@ifnextchar({\PlotQuadraticCurve(##3){##4}}{}}
3499 \def\circularArc##1##2##3{}
3500 \def\ellipticArc##1##2##3##4{}
3501 \def\Ellipse##1##2{}
3502 \def\Circle##1{}
3503 \def\xpct@hyperbolicArc##1##2##3##4{}
3504 \def\lHyperbola##1##2##3##4{}
3505 \def\rHyperbola##1##2##3##4{}
3506 \def\Hyperbola##1##2##3##4{}
3507 \def\rhyperbolicArc##1##2##3##4{}
3508 \def\lhyperbolicArc##1##2##3##4{}
3509 \def\parabolicArc##1##2##3{}
3510 \def\Parabola##1##2##3{}
3511 \def\PlotPointsOfFunction##1##2##3##4{}
3512 \def\xpct@iterateplotfunction[##1]##2##3##4{}
3513 \def\xpct@plotfunction##1##2##3{}
3514 \def\xpct@iterateplotpfunction[##1]##2##3##4{}
3515 \def\xpct@plotpfunction##1##2##3{}
3516 \def\cartesianaxes(##1,##2)(##3,##4){}
3517 \def\cartesiangrid(##1,##2)(##3,##4){}
3518 \def\plotxtic##1{}
3519 \def\plotytic##1{}
3520 \def\printxlabel##1##2{}
3521 \def\printylabel##1##2{}
3522 \def\printxticlabel##1##2{}
3523 \def\printyticlabel##1##2{}
3524 \def\plotxtics##1##2##3{}
3525 \def\plotytics##1##2##3{}
3526 \def\xpct@printlabels##1[##2]##3##4##5{}
3527 \def\polargrid##1##2{}
3528 }
3529 % \end{macrocode}
3530 % \end{macro}
3531 % \begin{macro}{\ifdraft}
3532 % If |draft| option is active |\draftPictures| is executed.
3533 % Then all |Picture| commands are disabled.
3534 % \begin{macrocode}
3535 \ifdraft
3536 \draftPictures
3537 \fi
3538 % \end{macrocode}
3539 % \end{macro}
3540 % Input local defaults (file |xpicture.cfg|).
3541 % \begin{macrocode}
3542 \InputIfFileExists{xpicture.cfg}{\xpct@Infocfg}{\xpct@Infonocfg}
3543 %</xpicture>
3544 % \end{macrocode}
3545 % \section{Change history}
3546 % \begin{description}
3547 % \item[v1.2a] (2012/11/17)
3548 %
3549 % Documented source.\par
3550 % Many internal c.s. renamed and/or rewrited.\par
3551 % dvi/pict2e/curve2e options supressed.\par
3552 % draft option added.\par
3553 % Background color added to Picture environment.\par
3554 % \cs{Pictlabelsep} is set to \verb+\normalfont\normalsize$1$+
3555 % when a \verb+Picture+ environment starts.\par
3556 % New commands: \cs{draftPictures},\cs{symmetrize},
3557 % \cs{xlabelpos}, \cs{ylabelpos},
3558 % \cs{plotxtic}, \cs{plotytic}, \cs{plotxtics}, \cs{plotytics},
3559 % \cs{printxlabel}, \cs{printylabel}, \cs{printxlabels}, \cs{printylabels},
3560 % \cs{printxticlabel}, \cs{printyticlabel},
3561 % \cs{printxticslabels}, \cs{printyticslabels},
3562 % \cs{makegrid}, \cs{makenogrid},
3563 % \cs{PlotPointsOfFunction}, \cs{pointmark}, \cs{pointmarkdiam}.
3564 %
3565 % \item[v1.2] (2012/04/25)
3566 %
3567 % First public version.
3568 % \end{description}
3569 % \Finale
3570 %