summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-11-13 00:23:45 +0000
committerKarl Berry <karl@freefriends.org>2010-11-13 00:23:45 +0000
commitb2520c4eee7eb7032ace566b4514f2ff2215f242 (patch)
treed867b56c0d9f394456024be0bff8e71c32421562 /Master/texmf-dist
parentfb507b895f0d286f263cb8e9f26f1245896a4b66 (diff)
curve2e (12nov10)
git-svn-id: svn://tug.org/texlive/trunk@20420 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/curve2e/README12
-rw-r--r--Master/texmf-dist/doc/latex/curve2e/curve2e.pdfbin220825 -> 402519 bytes
-rw-r--r--Master/texmf-dist/doc/latex/curve2e/manifest.txt38
-rw-r--r--Master/texmf-dist/source/latex/curve2e/curve2e.dtx947
-rw-r--r--Master/texmf-dist/source/latex/curve2e/curve2e.ins42
-rw-r--r--Master/texmf-dist/tex/latex/curve2e/curve2e.sty239
6 files changed, 881 insertions, 397 deletions
diff --git a/Master/texmf-dist/doc/latex/curve2e/README b/Master/texmf-dist/doc/latex/curve2e/README
index 74b730b7c9f..0286ee4883e 100644
--- a/Master/texmf-dist/doc/latex/curve2e/README
+++ b/Master/texmf-dist/doc/latex/curve2e/README
@@ -1,10 +1,14 @@
Curve2e.sty
-version 1.0
-filedate 27 nov. 2006
+version 1.30
+filedate 10 nov. 2010
-This file is an extension of the package pict2e.sty which extends the standard picture LaTeX environment accordine to what Leslie Lamport specified in the second edition of the LaTeX manual.
+This file is an extension of the package pict2e.sty which extends the standard picture LaTeX environment according to what Leslie Lamport specified in the second edition of the LaTeX manual.
-This further extension allows to draw lines and vectors with any non integer slope parameters, to draw arcs and curved vectors, to draw curves where just the interpolating nodes are specified together with the slopes at the nodes.
+This further extension allows to draw lines and vectors with any non integer slope parameters, to draw dashed lined of any slope, to draw arcs and curved vectors, to draw curves where just the interpolating nodes are specified together with the slopes at the nodes. Some of these features, implemented in this package previous version, have been incorporated in
+the 2009 version of pict2e; therefore this package has provisions for
+avoiding the original commands redefinition.
+
+This version id fully compatible with pict2e version 0.2x dated 2009/08/05.
I you specify
diff --git a/Master/texmf-dist/doc/latex/curve2e/curve2e.pdf b/Master/texmf-dist/doc/latex/curve2e/curve2e.pdf
index 9f7256b76d6..f6918e2cc16 100644
--- a/Master/texmf-dist/doc/latex/curve2e/curve2e.pdf
+++ b/Master/texmf-dist/doc/latex/curve2e/curve2e.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/curve2e/manifest.txt b/Master/texmf-dist/doc/latex/curve2e/manifest.txt
deleted file mode 100644
index ae78b2cf784..00000000000
--- a/Master/texmf-dist/doc/latex/curve2e/manifest.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-The package bundle curve2e is composed of the following files
-
-curve2e.ins
-curve2e.dtx
-curve2e.pdf
-mainfest.txt
-README
-
-Maninfest.txt is this file.
-
-curve2e.dtx is the documented source file of package curve2e.sty; you get
-curve2e.sty by running tex or latex on curve2e.ins.
-You get the documentation by running latex on curve2e.dtx; curve2e.pdf already
-contains the documentation in pdf format.
-
-README (or Readme or readme depending on the operating system) contains general
-information
-
-The package has the lppl status of author maintained.
-
-Nevertheless this package is an extension to the standard LaTeX package pict2e,
-so that this file is first of all submitted to the authors of pict2e, in case
-they wanted to incorporate part or all of its contents in the official package
-they maintain. Therefore any change must be controlled against the parent
-package pict2e so as to avoid redefining what has already been incorporated in
-the official package. Their e-mails are
-
-Rolf Niepraschk, Rolf.Niepraschk@ptb.de
-Hubert Gaesslein, HubertJG@open.mind.de
-
-
-If you prefer sending me your modifications, as long as I will maintain this
-package, I will forward every (documented) suggestion or modification to the
-authors of pict2e.
-
-Claudio Beccari
-
-claudio.beccari@gmail.it \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/curve2e/curve2e.dtx b/Master/texmf-dist/source/latex/curve2e/curve2e.dtx
index d1dd0a41b16..91d53920373 100644
--- a/Master/texmf-dist/source/latex/curve2e/curve2e.dtx
+++ b/Master/texmf-dist/source/latex/curve2e/curve2e.dtx
@@ -1,38 +1,75 @@
% \iffalse
+%<*internal>
+\begingroup
+\input docstrip.tex
+\keepsilent
+\preamble
+ ______________________________________________________
+ The curve2e package for LaTeX and XeLATeX
+ Copyright (C) 2010 Claudio Beccari
+ All rights reserved
+
+ License information appended
+
+\endpreamble
+\postamble
+
+Copyright 2005-2010 Claudio Beccari
+
+Distributable under the LaTeX Project Public License,
+version 1.3c or higher (your choice). The latest version of
+this license is at: http://www.latex-project.org/lppl.txt
+
+This work is "author-maintained"
+
+This work consists of this file curve2e.dtx, a README file
+and the derived files curve2e.sty and curve2e.pdf.
+
+\endpostamble
+\askforoverwritefalse
+
+\generate{\file{curve2e.sty}{\from{curve2e.dtx}{package}}}
+
+\def\tmpa{plain}
+\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
+\endgroup
+%</internal>
+%
%%
%% File `curve2e.dtx'.
-%% Copyright (C) 2005--2006 Claudio Beccari all rights reserved.
+%% Copyright (C) 2005--2010 Claudio Beccari all rights reserved.
%%
% What follows is the usual trick that is not typeset in the documentation
% dvi file that is produced by LaTeX. It is used to define the date, the version
% and the short description that characterizes both this file and the package;
% the point is that |\ProvidesFile| is being read only by the driver, while
-% |\ProvidePackage| goes to the stripped package file; It must be done before
+% |\ProvidePackage| goes to the stripped package file; it must be done before
% starting the documentation otherwise |\GetFileInfo| can't get the necessary
% information.
% \fi
+%
+% \iffalse
%<*package>
-% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
+%<package>\NeedsTeXFormat{LaTeX2e}
%</package>
%<*driver>
\ProvidesFile{curve2e.dtx}%
%</driver>
%<+package>\ProvidesPackage{curve2e}%
- [2008/05/04 v.1.01 Extension package for pict2e]
%<*package>
-% \end{macrocode}
+ [2010/11/08 v.1.30 Extension package for pict2e]
%</package>
-% \iffalse
%<*driver>
\documentclass{ltxdoc}
\hfuzz 10pt
\usepackage{multicol}
\usepackage[ansinew]{inputenc}
+\usepackage{curve2e}
\GetFileInfo{curve2e.dtx}
\title{The extension package \textsf{curve2e}\thanks{Version number
\fileversion; last revised \filedate.}}
\author{Claudio Beccari}
+\date{}
\begin{document}
\maketitle
\begin{multicols}{2}
@@ -43,12 +80,17 @@
%</driver>
% \fi
%
-% \CheckSum{2222}
+% \CheckSum{2304}
% \begin{abstract}
% This file documents the |curve2e| extension package to the recent
% implementation of the |pict2e| bundle that has been described by Lamport
% himself in the second edition of his \LaTeX\ handbook.
%
+% Please take notice that in August 2009 a new updated version of the package
+% |pict2e| has been released that incorporates some of the commands defined in
+% this package; apparently there are no conflicts, but only the advanced features
+% of |curve2e| remain available for extending the above package.
+%
% This extension redefines a couple of commands and introduces some more drawing
% facilities that allow to draw circular arcs and arbitrary curves with the
% minimum of user intervention. This beta version is open to the contribution of
@@ -70,27 +112,30 @@
% environment; specifically:
% \begin{enumerate}
% \item the line and vector slopes were limited to the ratios of relatively
-% prime one digit integers of magnitude not exceeding 6 for lines and 4 for
+% prime one-digit integers of magnitude not exceeding 6 for lines and 4 for
% vectors;
% \item filled and unfilled full circles were limited by the necessarily
-% bounded number of specific glyphs contained in the special \LaTeX\
+% limited number of specific glyphs contained in the special \LaTeX\
% \texttt{picture} fonts;
% \item quarter circles were also limited in their radii for the same reason;
% \item ovals (rectangles with rounded corners) could not be too small because
% of the unavailability of small radius quarter circles, nor could be too
% large, in the sense that after a certain radius the rounded corners remained
% the same and would not increase proportionally to the oval size.
-% \item vector arrows had only one possible shape besides matching the limited
+% \item vector arrows had only one possible shape and matched the limited
% number of vector slopes;
-% \item for circles and inclined lines and vectors there were available just
-% two possible thicknesses.
+% \item for circles and inclined lines and vectors just two possible thicknesses
+% were available.
% \end{enumerate}
%
% The package \texttt{pict2e} removes most if not all the above limitations:
% \begin{enumerate}
% \item line and vector slopes are virtually unlimited; the only remaining
% limitation is that the direction coefficients must be three-digit integer
-% numbers; they need not be relatively prime;
+% numbers; they need not be relatively prime; with the 2009 upgrade even this
+% limitation was removed and now slope coefficients can be any fractional number
+% whose magnitude does not exceed 16\,384, the maximum dimension in points that
+% \TeX\ can handle;
% \item filled and unfilled circles can be of any size;
% \item ovals can be designed with any specified corner curvature and there is
% virtually no limitation to such curvatures; of course corner radii should not
@@ -104,26 +149,44 @@
% This specific extension adds the following features
% \begin{enumerate}
% \item commands for setting the line terminations are introduced; the user can
-% chose between square or rounded caps; the default is set to rounded caps;
+% chose between square or rounded caps; the default is set to rounded caps (now
+% available also with |pict2e|);
+% \item commands for specifying the way two lines or curves join to one nanother;
+% ^^A
% \item the |\line| macro is redefined so as to allow integer and fractional
% direction coefficients, but maintaining the same syntax as in the original
-% \texttt{picture} environment;
-% \item a new macro |\Line| is defined so as to avoid the need to specify the
-% horizontal projection of inclined lines;
-% \item a new macro |\LINE| joins two points specified with their coordinates;
-% of course there is no need to use the |\put| command with this line
-% specification;
+% \texttt{picture} environment (now available also with |pict2e|);
+% ^^A
+% \item a new macro |\Line| was defined so as to avoid the need to specify the
+% horizontal projection of inclined lines (now available also with |pict2e|);
+% this conflicts with |pict2e| 2009 version; therefore its name is changed to
+% |\LIne| and supposedly it will not be used very often, if ever used;
+% ^^A
+% \item a new macro |\LINE| was defined in order to join two points specified with
+% their coordinates; this is now the normal behavior of the |\Line| macro of
+% |pict2e| so that |\LINE| is now renamed |\segment|; of course there is no need
+% to use the |\put| command with this line specification;
+% ^^A
+% \item a new macro |\DLine| is defined in order to draw dashed lines joining any
+% two given points; the dash length and gap (equal to one another) must be
+% specified;
+% ^^A
% \item similar macros are redefined for vectors; |\vector| redefines the
-% original macro but with the vector slope limitation removed; |\Vector| gets
+% original macro but with the vector slope limitations removed; |\Vector| gets
% specified with its two horizontal and vertical components; |\VECTOR|
% joins two specified points (without using the |\put| command) with the arrow
% pointing to the second point;
% \item a new macro |\polyline| for drawing polygonal lines is defined that
% accepts from two vertices up to an arbitrary (reasonably limited) number of
-% them;
+% them (available now also in |pict2e|);
% \item a new macro |\Arc| is defined in order to draw an arc with arbitrary
% radius and arbitrary angle amplitude; this amplitude is specified in
-% sexagesimal degrees, not in radians;
+% sexagesimal degrees, not in radians; the same functionality is now achieved with
+% the |\arc| macro of |pict2e|, which provides also the strar version |\arc*| that
+% fills up the interior of the generated circular arc. It must be noticed that
+% the syntax is slighltly different, so that it's reasonable that both commands,
+% in spite of producing identical arcs, might be more comfortable with this or that
+% syntax.
% \item two new macros are defined in order to draw circular arcs with one
% arrow at one or both ends;
% \item a new macro |\Curve| is defined so as to draw arbitrary curved lines
@@ -132,10 +195,10 @@
% \end{enumerate}
%
% In order to make the necessary calculations many macros have been defined so
-% as to use complex number to manipulate point coordinates, directions,
+% as to use complex number arithmetics to manipulate point coordinates, directions,
% rotations and the like. The trigonometric functions have also been defined in
-% a way that the author believes to be more efficient that that implied by the
-% \texttt{trig} package; in any case the macro names are sufficiently
+% a way that the author believes to be more efficient than that implied by the
+% \texttt{trig} package; in any case the macro names are sufficiently
% different to accommodate both definitions in the same \LaTeX\ run.
%
% Many aspects of this extension could be fine tuned for better performance;
@@ -148,14 +211,347 @@
% Gäßlein and Niepraschk who are the prime maintainers of \texttt{pict2e};
% they only can decide whether or not to incorporate new macros in their package.
%
+% \section{Summary of modifications and new commands}
+% This package \texttt{curve2e} extends the power of \texttt{pict2e} with the
+% following modifications and the following new commands.
+% \begin{enumerate}
+% \item This package |curve2e| calls directly the \LaTeX\ packages |color| and
+% |pict2e| to whom it passes any possible option that the latter can receive;
+% actually the only options that make sense are those concerning the arrow tips,
+% either \LaTeX\ or PostScript styled, because it is assumed that if you use this
+% package you are not interested in using the original \LaTeX\ commands. See the
+% |pict2e| documentation in order to use the correct options |pict2e| can receive.
+% \item New commands are offered the user in order to control the line terminators
+% and the line joins; specifically:
+% \begin{itemize}
+% \item |\roundcap|: the line is terminated with a semicircle;
+% \item |\squarecap|: the line is terminated with a half square;
+% \item |\roundjoin|: two lines are joined with a rounded join;
+% \item |\beveljoin|: two lines are joined with a bevel join;
+% \item |\miterjoin|: two lines are terminated with a miter join.
+% \end{itemize}
+% All the above commands should respect the intended range; but since they act at
+% the PostScript or PDF level, not at \TeX\ level, it might be necessary to issue
+% the necessary command in order to restore the previous terminator or join.
+% \item The commands |\linethickness|, |\thicklines|, |\thinlines| together with
+% |\defaultlinethickness| always redefine the internal |\@wholewidth| and
+% |\@halfwidth|
+% so that the latter always refer to a full width and to a half of it in this
+% way: if you issue the command |\defaultlinewidth{2pt}| all thin lines will be
+% drawn with a thickenes of 1\,pt while if a drawing command directly refers to the
+% internal value |\@wholewidth|, its line will be drawn with a thickness of 2\,pt.
+% If one issues the declaration |\thinlines| all lines will be drawn with a 1\,pt
+% width, but if a command refers to the internal value |\@halfwidth| the line will
+% be drawn with a thickness of 0.5\,pt. The command |\linethickness| redefines the
+% above internals but does not change the default width value; all these width
+% specifications apply to all lines, straight ones, curved ones, circles, ovals,
+% vectors, dashed, et cetera. It's better to recall that |thinlines| and
+% |thicklines| are declarations that do not take arguments; on the opposite the
+% other two commands follow the standard syntax:
+% \begin{flushleft}
+% |\linethickness|\marg{dimensioned value}\\
+% |\defaultlinewidth|\marg{dimensioned value}
+% \end{flushleft}
+% where \meta{dimensioned value} means a length specification complete of its units
+% or a dimensional expression.
+% \item Straight lines and vectors are redefined in such a way that fractional slope
+% coefficients may be specified; the zero length line does not produce errors and is
+% ignored; the zero length vectors draw only the arrow tips.
+% \item New line and vector macros are defined that avoid the necessity of
+% specifying the horizontal component |\put(3,4){\LIne(25,15)}| specifies a segment
+% that starts at point $(3,4)$ and goes to point $(3+25,4+15)$; the command
+% |\segment(3,4)(28,19)| achieves the same result without the need of the using
+% command |\put|.
+% The same applies to the vector commands |\Vector| and |\VECTOR|. Experience has
+% shown that the commands intended to joint two specified coordinates are
+% particularly useful.
+% \item The |\polyline| command has been introduced: it accepts an unlimited list of
+% point coordinates enclosed within round parentheses; the command draws a sequence
+% of connected segments that joins in sequence the specified points; the syntax is:
+% \begin{flushleft}
+% \cs{polyline[}\marg{optional join style}\texttt{](}\meta{$P_1$}\texttt{)(}%
+% \meta{$P_2$}\texttt{)...(}\meta{$P_n$}\texttt{)}
+% \end{flushleft}
+% See figure~\ref{fig:polyline} where a pentagon is designed..
+%
+% \begin{figure}[!ht]
+% \begin{minipage}{.48\linewidth}
+% \begin{verbatim}
+% \unitlength=.5mm
+% \begin{picture}(40,32)(-20,0)
+% \polyline(0,0)(19.0211,13,8197)(11.7557,36.1803)%
+% (-11.7557,36.1803)(-19.0211,13,8197)(0,0)
+% \end{picture}
+% \end{verbatim}
+% \end{minipage}
+% \hfill
+% \begin{minipage}{.48\linewidth}\raggedleft
+% \unitlength=.5mm
+% \begin{picture}(40,32)(-20,0)
+% \polyline(0,0)(19.0211,13,8197)(11.7557,36.1803)%
+% (-11.7557,36.1803)(-19.0211,13,8197)(0,0)
+% \end{picture}\hspace*{2em}
+% \end{minipage}
+% \caption{Polygonal line obtained by means of the \texttt{\string\polyline}
+% command} \label{fig:polyline}
+% \end{figure}
+%
+% Although you can draw polygons with |\polyline|, as it was done in
+% figure~\ref{fig:polyline}, do not confuse this command with the command |\polygon|
+% defined in |pict2e| 2009; the latter automatically joins the last specified
+% coordinate to the first one, therefore closing the path. |pict2e| defines also the
+% starred command that fills up the inside of the generated polygon.
+% \item The new command
+% \begin{flushleft}
+% |\Dline(|\textit{first point}|)(|\textit{second point}|)(|\textit{dash length}|)|
+% \end{flushleft}
+% draws a dashed line containing as many dashes as possible, long as specified, and
+% separated by a gap exactly the same size; actually, in order to make an even
+% gap-dash sequence, the desired dash length is used to do some computations in
+% order to find a suitable length, close to the one specified, such that the
+% distance of the end points is evenly divided in equally sized dashes and gaps.
+% The end points may be anywhere in
+% the drawing area, without any constraint on the slope of the joining segment. The
+% desired dash length is specified as a fractional multiple of |\unitlength|; see
+% figure~\ref{fig:dashline}.
+% \begin{figure}[!ht]
+% \begin{minipage}{.48\textwidth}
+% \begin{verbatim}
+% \unitlength.5mm
+% \begin{picture}(40,40)
+% \put(0,0){\GraphGrid(40,40)}
+% \Dline(0,0)(40,10){4}
+% \put(0,0){\circle*{2}}
+% \Dline(40,10)(0,25){4}
+% \put(40,10){\circle*{2}}
+% \Dline(0,25)(20,40){4}
+% \put(0,25){\circle*{2}}
+% \put(20,40){\circle*{2}}
+% \end{picture}
+% \end{verbatim}
+% \end{minipage}
+% \hfill
+% \begin{minipage}{.48\textwidth}\centering
+% \unitlength.5mm
+% \begin{picture}(40,40)
+% \put(0,0){\GraphGrid(40,40)}
+% \Dline(0,0)(40,10){4}
+% \put(0,0){\circle*{2}}
+% \Dline(40,10)(0,25){4}
+% \put(40,10){\circle*{2}}
+% \Dline(0,25)(20,40){4}
+% \put(0,25){\circle*{2}}
+% \put(20,40){\circle*{2}}
+% \end{picture}
+% \end{minipage}
+% \caption{Dashed lines and graph grid}\label{fig:dashline}
+% \end{figure}
+% \item |\GraphGrid| is a command that draws a red grid over the drawing area with
+% lines separated |10\unitlength|s; it is described only with a comma separated
+% couple of numbers, representing the base and the height of the grid, see
+% figure~\ref{fig;dashline}; it's better to specify multiples of ten and the grid
+% can be placed anywhere in the drawing plane by means of |\put|, whose coordinates
+% are multiples of 10; nevertheless the grid line distance is rounded to the
+% nearest multiple of 10, while the point coordinates specified to |\put| are not
+% rounded at all; therefore some care should be used to place the working grid in
+% the drawing plane. This grid is intended as an aid in drawing; even if you sketch
+% your drawing on millimeter paper, the drawing grid turns out to be very useful;
+% one must only delete or comment out the command when the drawing is finished.
+% \item New trigonometric function macros have been implemented; possibly they are
+% not better than the corresponding macros of the |trig| package, but they are
+% supposed to be more accurate at least they were intended to be so. The other
+% difference is that angles are specified in sexagesimal degrees ($360^\circ$ to one
+% revolution), so that reduction to the fundamental quadrant is supposed to be more
+% accurate; the tangent of odd multiples of $90^\circ$ are approximated with a
+% ``\TeX\ infinity'', that is the signed value 16383.99999. This will possibly
+% produce computational errors in the subsequent calculations, but at least it does
+% not stop the tangent computation. In order to avoid overflows or underflows in the
+% computation of small angles (reduced to the first quadrant), the sine and the
+% tangent of angles smaller than $1^\circ$ are approximated by the first term of the
+% McLaurin series, while for the cosine the approximation is given by the first two
+% terms of the McLaurin series. In both cases theoretical errors are smaller
+% than what \TeX\ arithmetics can handle.
+%
+% These trigonometric functions are used within the complex number macros; but if
+% the user wants to use them the syntax is the following:
+%\begin{flushleft}
+% \texttt{\char92SinOf}\meta{angle}\texttt{to}\meta{control sequence}
+%\\
+% \texttt{\char92CosOf}\meta{angle}\texttt{to}\meta{control sequence}
+%\\
+% \texttt{\char92TanOf}\meta{angle}\texttt{to}\meta{control sequence}
+%\end{flushleft}
+% The \meta{control sequence} may then be used as a multiplying factor of a length.
+% \item Arcs can be drawn as simple circular arcs, or with one or two arrows at
+% their ends (curved vectors); the syntax is:
+%\begin{flushleft}
+% \texttt{\char92Arc(}\meta{center}\texttt{)(}\meta{starting point}\texttt{)}\marg{angle}\\
+% \texttt{\char92VectorArc(}\meta{center}\texttt{)(}\meta{starting point}\texttt{)}\marg{angle}\\
+% \texttt{\char92VectorARC(}\meta{center}\texttt{)(}\meta{starting point}\texttt{)}\marg{angle}\\
+%\end{flushleft}
+% If the angle is specified numerically it must be enclosed in braces, while if it
+% is specified with a control sequence the braces (curly brackets) are not
+% necessary. The above macro |\Arc| draws a simple circular arc without arrows;
+% |\VectorArc| draws an arc with an arrow tip at the ending point; |\VectorARC|
+% draws an arc with arrow tips at both ends; see figure~\ref{fig:arcs}.
+% \begin{figure}
+% \begin{minipage}{.48\textwidth}
+% \begin{verbatim}
+% \unitlength=0.5mm
+% \begin{picture}(60,40)
+% \put(0,0){\GraphGrid(60,40)}
+% \Arc(0,20)(30,0){60}
+% \VECTOR(0,20)(30,0)\VECTOR(0,20)(32.5,36)
+% \VectorArc(0,20)(15,10){60}
+% \put(20,20){\makebox(0,0)[l]{$60^\circ$}}
+% \VectorARC(60,20)(60,0){-180}
+% \end{picture}
+% \end{verbatim}
+% \end{minipage}
+% \hfill
+% \begin{minipage}{.48\textwidth}\centering
+% \unitlength=0.5mm
+% \begin{picture}(60,40)
+% \put(0,0){\GraphGrid(60,40)}
+% \Arc(0,20)(30,0){60}
+% \VECTOR(0,20)(30,0)\VECTOR(0,20)(32.5,36)
+% \VectorArc(0,20)(15,10){60}
+% \put(20,20){\makebox(0,0)[l]{$60^\circ$}}
+% \VectorARC(60,20)(60,0){-180}
+% \end{picture}
+% \end{minipage}
+% \caption{Arcs and curved vectors}\label{fig:arcs}
+% \end{figure}
+% \item A multitude of commands have been defined in order to manage complex
+% numbers; actually complex numbers are represented as a comma separated pair of
+% fractional numbers. They are used to point to specific points in the drawing
+% plane, but also as operators so as to scale and rotate other objects. In the
+% following \meta{vector} means a comma separated pair of fractional numbers,
+% possibly stored in macros; \meta{argument} means a brace delimiteded numeric
+% value, possibly a macro; \textit{macro} is a valid macro name, a backslash
+% followed by letters, or anything else that can receive a definition.
+%
+% {\footnotesize\begin{itemize}
+% \item |\MakeVectorFrom|\meta{two arguments}|to|\meta{vector}
+% \item |\CopyVect|\meta{first vector}|to|\meta{second vector}
+% \item |\ModOfVect|\meta{vector}|to|\meta{macro}
+% \item |\DirOfvect|\meta{vector}|to|\meta{macro}
+% \item |\DmodAndDirOfVect|\meta{vector}|to|\meta{first macro}|and|\meta{second macro}
+% \item |\DistanceAndDirOfVect|\meta{first vector}|minus|\meta{second vector}|to|\meta{first macro}|and|\meta{second macro}
+% \item |\XpartOfVect|\meta{vector}|to|\meta{macro}
+% \item |\YpartOfVect|\meta{vector}|to|\meta{macro}
+% \item |\DirFromAngle|\meta{angle}|to|\meta{macro}
+% \item |\ScaleVect|\meta{vector}|by|\meta{scaling factor}|to|\meta{macro}
+% \item |\ConjVect|\meta{vector}|to|\meta{conjugate vector}
+% \item |\SubVect|\meta{first vector}|from|\meta{second vector}|to|\meta{vector}
+% \item |\AddVect|\meta{first vector}|and|\meta{second vector}|to|\meta{vector}
+% \item |\MultVect|\meta{first vector}|by|\meta{second vector}|to|\meta{vector}
+% \item |\MultVect|\meta{first vector}|by*|\meta{second vector}|to|\meta{vector}
+% \item |\DivVect|\meta{first vector}|by|\meta{second vector}|to|\meta{vector}
+% \end{itemize}}
+%
+% \item General curves can be drawn with the |pict2e| macro |\curve| but it requires
+% the specification of the Bézier third order spline control points; sometimes it's
+% better to be very specific with the control points and there is no other means to
+% do a decent graph; sometimes the curves to be drawn are not so tricky and a
+% general set of macros can be defined so as to compute the control points, while
+% letting the user specify only the nodes through which the curve must pass, and the
+% tangent direction of the curve in such nodes. This macro is |\Curve| and must be
+% followed by an ``unlimited" sequence of node-direction coordinates as a quadruple
+% defined as
+%\[
+% \texttt{(}\meta{node coordinates}\texttt{)<}\meta{direction vector}\texttt{>}
+%\]
+% Possibly if a sudden change of direction has to be performed (cusp) another item
+% can be inserted after one of those quadruples in the form
+%\[
+% \texttt{...(...)<...>[}\meta{new direction vector}\texttt{](...)<...>...}
+%\]
+% The |\Curve| macro does not (still) have facilities for cycling the path, that is
+% to close the path from the last specified node-direction to the first specified
+% node-direction.
+% The tangent direction need not be specified with a unit vector, although only its
+% direction is relevant; the scaling of the specified direction vector to a unit
+% vector is performed by the macro itself. Therefore one cannot specify the fine
+% tuning of the curve convexity as it can be done with other programs, as for
+% example with METAFONT or the |pgf/tikz| package and environment.
+% See figure~\ref{fig:curve} for an example.
+% \end{enumerate}
+% \begin{figure}
+% \begin{minipage}{.48\textwidth}
+% \begin{verbatim}
+% \unitlength=8mm
+% \begin{picture}(5,5)
+% \put(0,0){\framebox(5,5){}}\thicklines\roundcap
+% \Curve(2.5,0)<1,1>(5,3.5)<0,1>%
+% (2.5,3.5)<-.5,-1.2>[-.5,1.2]%
+% (0,3.5)<0,-1>(2.5,0)<1,-1>
+% \end{picture}
+% \end{verbatim}
+% \end{minipage}
+% \hfill
+% \begin{minipage}{.48\textwidth}\raggedleft
+% \unitlength=8mm
+% \begin{picture}(5,5)
+% \put(0,0){\framebox(5,5){}}\thicklines\roundcap
+% \Curve(2.5,0)<1,1>(5,3.5)<0,1>(2.5,3.5)<-0.5,-1.2>[-0.5,1.2](0,3.5)<0,-1>(2.5,0)<1,-1>
+% \end{picture}
+% \end{minipage}
+% \caption{A heart shaped curve with cusps drawn with \texttt{\string\Curve}}
+% \label{fig:curve}
+% \end{figure}
+%
+% In spite of the relative simplicity of the macros contained in this package, the
+% described macros, as well as the original macros included in the |pict2e| package,
+% allow to produce fine drawings that were inconceivable of with the original \LaTeX\
+% picture environment. Leslie Lamport himself announced an extension to his
+% environment when \LaTeXe\ was first issued in 1994; in the |latexnews| news letter
+% of December 2003; the first implementation appeared; the first version of this
+% package was issued in 2006. It was time to have a better drawing environment; this
+% package is a simple attempt to follow the initial path while extending the drawing
+% facilities; but Till Tantau's |pgf| package has gone much farther.
+%
+% \section{Notice}
+% There are other packages in the \textsc{ctan} archives that deal with tracing
+% curves of various kinds. |PSTricks| and |tikz/pgf| are the most powerful ones. But
+% there are also the package |curves| that is intended to draw almost anything by
+% using little dots or other symbols partially superimposed to one another. It used
+% only quadratic Bézier curves and the curve tracing is eased by specifying only the
+% curve nodes, without specifying the control nodes; with a suitable option to the
+% package call it is possible to reduce the memory usage by using short straight
+% segments drawn with the PostScript facilities offered by the |dvips| driver.
+%
+% Another package |ebezier| performs about the same as |curve2e| but draws its
+% Bézier curves by using little dots partially superimposed to one another. The
+% documentation is quite interesting but since it explains very clearly what exactly
+% are the Bézier splines, it appears that |ebezier| should be used only for dvi
+% output without recourse to PostScript machinery.
+%
% \section{Acknowledgements}
% I wish to express my deepest thanks to Michel Goosens who spotted some errors
% and very kindly submitted them to me so that I was able to correct them.
%
+% Josef Tkadlec and the author collaborated extensively in order to make a better
+% real long division so as to get the fractional part and to avoid as much as
+% possible any numeric overflow; many Josef's ideas are incorporated in the macro
+% that is implemented in this package, although the macro used by Josef is slightly
+% different from this one. Both versions aim at a better accuracy and at widening
+% the operand ranges.
+%
+% Daniele Degiorgi spotted a fault in the kernel definition of |\linethickness|
+% that heavily influenced also |curve2e|; see below.
+%
+% Thanks also to Jin-Hwan Cho and Juho Lee who suggested a small but crucial modification
+% in order to have \texttt{curve2e} work smoothly also with XeTeX (XeLaTeX).
+% Actually if version 0.2x or later, dated 2009/08/05 or later, of |pict2e| is being used,
+% such modification is not necessary, but it's true that it becomes imperative if older
+% versions are used.
+%
% \StopEventually{%
% \begin{thebibliography}{9}
-% \bibitem{pict2e} Gäßlein H.\ and Niepraschk R., \emph{The \texttt{pict2e}
-% package}, PDF document attached to the ``new'' \texttt{pict2e} bundle; the
+% \bibitem{pict2e} Gäßlein H., Niepraschk R., and Tkadlec J.
+% \emph{The \texttt{pict2e}
+% package}, 2009, PDF document attached to the ``new'' \texttt{pict2e} bundle; the
% bundle may be downloaded from any CTAN archive or one of their mirrors.
% \end{thebibliography}
% }
@@ -171,20 +567,25 @@
% \end{macrocode}
% Next we define the line terminators and joins; the following definitions work
% correctly if the \texttt{dvips} or the \texttt{pdftex} driver are specified;
-% probably other modes should be added so as to be consistent with
-% \texttt{pict2e}.
+% probably other modes should be added so as to be consistent with \texttt{pict2e}:
+% |\providecommand| is used instead of the low level command |\def| in order to
+% avoid redefinitions of |pict2e| macros.
% \begin{macrocode}
\ifcase\pIIe@mode\relax
\or %Postscript
- \def\roundcap{\special{ps:: 1 setlinecap}}%
- \def\squarecap{\special{ps:: 0 setlinecap}}%
- \def\roundjoin{\special{ps:: 1 setlinejoin}}%
- \def\beveljoin{\special{ps:: 2 setlinejoin}}%
+ \providecommand\roundcap{\special{ps:: 1 setlinecap}}%
+ \providecommand\squarecap{\special{ps:: 0 setlinecap}}%
+ \newcommand\roundjoin{\special{ps:: 1 setlinejoin}}%
+ \providecommand\beveljoin{\special{ps:: 2 setlinejoin}}%
+ \providecommand\miterjoin{\special{ps:: 0 setlinejoin}}%
\or %pdf
- \def\roundcap{\pdfliteral{1 J}}%
- \def\squarecap{\pdfliteral{0 J}}%
- \def\roundjoin{\pdfliteral{1 j}}%
- \def\beveljoin{\pdfliteral{2 j}}%
+ \@ifundefined{XeTeXrevision}{}
+ {\def\pdfliteral#1{\special{pdf: literal #1}}}%
+ \providecommand\roundcap{\pdfliteral{1 J}}%
+ \providecommand\squarecap{\pdfliteral{0 J}}%
+ \providecommand\roundjoin{\pdfliteral{1 j}}%
+ \providecommand\beveljoin{\pdfliteral{2 j}}%
+ \providecommand\miterjoin{\pdfliteral{0 j}}%
\fi
% \end{macrocode}
%
@@ -217,10 +618,10 @@
% 1pt, thick lines will be 1pt thick and thin lines will be 0.5pt thick. The
% default whole width of thick lines is 0,8pt, but this is specified in the
% kernel of \LaTeX\ and\slash or in \texttt{pict2e}. On the opposite it is
-% necessary to redefine |\linethickness| because the \LaTeX\ kernel global definition
-% does not hide the space after the closed brace when you enter something such as
-% |\linethickness{1mm}| followed by a space or a new line.\footnote{Thanks to
-% Daniele Degiorgi (\texttt{degiorgi@inf.ethz.ch}).}
+% necessary to redefine |\linethickness| because the \LaTeX\ kernel global
+% definition does not hide the space after the closed brace when you enter something
+% such as |\linethickness{1mm}| followed by a space or a new line.\footnote{Thanks
+% to Daniele Degiorgi (\texttt{degiorgi@inf.ethz.ch}).}
% \begin{macrocode}
\gdef\linethickness#1{\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}%
\newcommand\defaultlinethickness[1]{\defaultlinewidth=#1\relax
@@ -234,27 +635,36 @@
% eliminate.
%
% \subsubsection{Improved line and vector macros}
-% The new macro |\Line| allows to draw an arbitrary inclination line as if it
-% was a polygon with just two vertices. This line should be set by means of a
+% The new macro |\LIne| allows to draw an arbitrary inclination line as if it
+% was a polygonal with just two vertices. This line should be set by means of a
% |\put| command so that its starting point is always at a relative 0,0
% coordinate point. The two arguments define the horizontal and the
% vertical component respectively.
% \begin{macrocode}
-\def\Line(#1,#2){\pIIe@moveto\z@\z@
+\def\LIne(#1,#2){\pIIe@moveto\z@\z@
\pIIe@lineto{#1\unitlength}{#2\unitlength}\pIIe@strokeGraph}%
% \end{macrocode}
%
-% A similar macro |\LINE| operates between two explicit points with absolute
+% A similar macro |\segment| operates between two explicit points with absolute
% coordinates, instead of relative to the position specified by a |\put|
% command; it resorts to the |\polyline| macro that is to be defined in a while.
-% The |\@killglue|command might be unnecessary, but it does not harm; it eliminates any
-% explicit or implicit spacing that might precede this command.
-% \begin{macrocode}
-\def\LINE(#1)(#2){\@killglue\polyline(#1)(#2)}%
-% \end{macrocode}
-%
-% The |\line| macro is redefined by making use of a new division routine that
-% receives in input two dimensions and yields on output their fractional ratio.
+% The |\@killglue|command might be unnecessary, but it does not harm; it eliminates
+% any explicit or implicit spacing that might precede this command.
+% \begin{macrocode}
+\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}%
+% \end{macrocode}
+% By passing its ending points coordinates to the |\polyline| macro, both macro
+% arguments are a pair of coordinates, not their components; in other words, if
+% $P_1=(x_1, y_2)$ and $P_2=(x_2, y_2)$, then the first argument is the couple
+% $x_1, y_1$ and likewise the second argument is $x_2, y_2$. Please remember that
+% the decimal separator is the decimal \emph{point}, while the \emph{comma} acts
+% as coordinate separator. This recommendation is particularly important for
+% non-English speaking users, since the ISO regulations allow the decimal point
+% only for English speaking countries, while in all other countries the comma
+% must be used as the decimal separator.
+%
+% The |\line| macro is redefined by making use of a new division routine that
+% receives in input two dimensions and yields on output their fractional ratio.
% The beginning of the macro definition is the same as that of \texttt{pict2e}:
% \begin{macrocode}
\def\line(#1)#2{\begingroup
@@ -262,7 +672,8 @@
\ifdim\@linelen<\z@\@badlinearg\else
% \end{macrocode}
% but as soon as it is verified that the line length is not negative, things
-% change remarkably; in facts the machinery for complex numbers is invoked:
+% change remarkably; in facts the machinery for complex numbers is invoked.
+% This makes the code muche simpler, not necessarily more efficient; nevertheless
% |\DirOfVect| takes the only macro argument (that actually contains a comma
% separated pair of fractional numbers) and copies it to |\Dir@line| (an
% arbitrarily named control sequence) after re-normalizing to unit magnitude;
@@ -285,7 +696,8 @@
\@linelen=\sc@lelen\@linelen
\fi
% \end{macrocode}
-% Finally the \texttt{moveto}, \texttt{lineto} and \texttt{stroke} language
+% Of course, it the line is vertical this division must not take place.
+% Finally the \texttt{moveto}, \texttt{lineto} and \texttt{stroke} language
% keywords are invoked by means of the internal \texttt{pict2e} commands in
% order to draw the line. Notice that even vertical lines are drawn with the
% ``PostScript'' commands instead of resorting to the dvi low level language
@@ -297,9 +709,50 @@
\pIIe@moveto\z@\z@
\pIIe@lineto{\d@mX\@linelen}{\d@mY\@linelen}%
\pIIe@strokeGraph
-\fi
+ \fi
\endgroup\ignorespaces}%
% \end{macrocode}
+% The new definition of the command |\line|, besides tha ease with which is
+% readable, does not do different things from the definition of |pict2e| 2009, but
+% it did preform in a better way whith the 2004 version that was limited to integer
+% direction coefficients up to 999 in magnitude.
+%
+% Another usefull line-type macro creates a dashed line between two given points
+% with a dash length that must be specified; actually the specified dash length is a
+% desired dash length; the actual length is computed by integer division between
+% the distance of the given points and the desired dash length; this integer is
+% tested in order to see if it's odd; if it's not, it is increased by one. Then the
+% actual dash length is obtained by dividing the above distance by this odd number.
+% Another vector is created from $P_1-P_0$ by dividing it by the magic odd number;
+% then it is multiplied by two in order to have the increment from one dash to the
+% next, and finally the number of patterns is obtained by integer dividing the magic
+% odd number by 2 and increasing it by 1. A simple |\multiput| completes the job,
+% but in order to use the various vectors and numbers within a group and to throw the result outside the group while restoring all the intermediate counters and registers, a service macro is
+% created with an expanded definition and then this service macro is executed.
+% \begin{macrocode}
+\ifx\Dline\undefined
+\def\Dline(#1,#2)(#3,#4)#5{%
+\begingroup
+ \countdef\NumA254\countdef\NumB252\relax
+ \MakeVectorFrom{#1}{#2}to\V@ttA
+ \MakeVectorFrom{#3}{#4}to\V@ttB
+ \SubVect\V@ttA from\V@ttB to\V@ttC
+ \ModOfVect\V@ttC to\DlineMod
+ \DividE\DlineMod\p@ by#5\p@ to\NumD
+ \NumA\expandafter\Integer\NumD??
+ \ifodd\NumA\else\advance\NumA\@ne\fi
+ \NumB=\NumA \divide\NumB\tw@
+ \DividE\DlineMod\p@ by\NumA\p@ to\D@shMod
+ \DividE\p@ by\NumA\p@ to \@tempa
+ \MultVect\V@ttC by\@tempa,0 to\V@ttB
+ \MultVect\V@ttB by 2,0 to\V@ttC
+ \advance\NumB\@ne
+ \edef\@mpt{\noexpand\endgroup
+ \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}{\noexpand\LIne(\V@ttB)}}%
+ \@mpt\ignorespaces}%
+\fi
+% \end{macrocode}
+%
% The new macro |\GetCoord| splits a vector (or complex number) specification
% into its components:
% \begin{macrocode}
@@ -313,11 +766,13 @@
%
% The redefinitions and the new definitions for vectors are a little more
% complicated than with segments, because each vector is drawn as a filled
-% contour; the original \texttt{pict2e} macro checks if the slopes are
+% contour; the original \texttt{pict2e} 2004 macro checks if the slopes are
% corresponding to the limitations specified by Lamport (integer three digit
% signed numbers) and sets up a transformation in order to make it possible to
% draw each vector as an horizontal left-to-right arrow and then to rotate it by
-% its angle about its tail point; actually there are two macros for tracing the
+% its angle about its tail point; with |pict2e| 2009, possibly this redefinition
+% of |\vector| is not necessary, but we do it as well and for the same reasons
+% we had for redefining |\line|; actually there are two macros for tracing the
% contours that are eventually filled by the principal macro; each contour
% macro draws the vector with a \LaTeX\ or a PostScript arrow whose parameters
% are specified by default or may be taken from the parameters taken from the
@@ -349,14 +804,14 @@
% \begin{macrocode}
\ifdim\@linelen<\z@ \@linelen=-\@linelen\fi
% \end{macrocode}
-% We now make a vector with the slope direction even if one or the other is
+% We now make a vector with the slope coefficients even if one or the other is
% zero and we determine its direction; the real and imaginary parts of the
% direction vector are also the values we need for the subsequent rotation.
% \begin{macrocode}
\MakeVectorFrom\d@mX\d@mY to\@Vect
\DirOfVect\@Vect to\Dir@Vect
% \end{macrocode}
-% In order to be compatible with the original \texttt{pict2e} I need to
+% In order to be compatible with the original \texttt{pict2e} we need to
% transform the components of the vector direction in lengths with the specific
% names |\@xdim| and |\@ydim|
% \begin{macrocode}
@@ -425,7 +880,7 @@
%
% On the opposite the next macro specifies a vector by means of the coordinates
% of its end points; the first point is where the vector starts, and the second
-% point is the arrow tip side. We need the difference as these two coordinates,because % it represents the actual vector.
+% point is the arrow tip side. We need the difference of these two coordinates, because % it represents the actual vector.
% \begin{macrocode}
\def\VECTOR(#1)(#2){\begingroup
\SubVect#1from#2to\@tempa
@@ -436,13 +891,39 @@
% The \texttt{pict2e} documentation says that if the vector length is zero the
% macro designs only the arrow tip; this may work with macro |\vector|,
% certainly not with |\Vector| and |\VECTOR|. This might be useful for adding
-% an arrow tip to a circular arc
+% an arrow tip to a circular arc. See examples in figure~\ref{fig:vectors}.
+%
+% \begin{figure}
+% \begin{minipage}{.48\textwidth}
+% \begin{verbatim}
+% \unitlength=.5mm
+% \begin{picture}(60,20)
+% \put(0,0){\GraphGrid(60,20)}
+% \put(0,0){\vector(1.5,2.3){10}}
+% \put(20,0){\Vector(10,15.33333)}
+% \VECTOR(40,0)(50,15.33333)
+% \end{picture}
+% \end{verbatim}
+% \end{minipage}
+% \hfill
+% \begin{minipage}{.48\textwidth}\centering
+% \unitlength=.5mm
+% \begin{picture}(60,20)
+% \put(0,0){\GraphGrid(60,20)}
+% \put(0,0){\vector(1.5,2.3){10}}
+% \put(20,0){\Vector(10,15.33333)}
+% \VECTOR(40,0)(50,15.33333)
+% \end{picture}
+% \end{minipage}
+% \caption{Three (displaced) identical vectors obtained with the three vector
+% macros.}\label{fig:vectors}
+% \end{figure}
%
% \subsubsection{Polygonal lines}
% We now define the polygonal line macro; its syntax is very simple
-% \begin{flushleft}\ttfamily
-% \cs{polygonal}(\rmfamily{P}$_0$)(\rmfamily{P}$_1$)\rmfamily{P}$_2$)\dots
-% (\rmfamily{P}$_n$)
+% \begin{flushleft}
+% \cs{polygonal}\texttt{(}$P_0$\texttt{)(}$P_1$\texttt{)(}$P_2$)%
+% \texttt{\dots(}$P_n$\texttt{)}
% \end{flushleft}
% In order to write a recursive macro we need aliases for the parentheses;
% actually we need only the left parenthesis, but some editors complain about
@@ -457,18 +938,27 @@
% preceded by spaces that are ignored by the |\@ifnextchar| macro) then a
% warning message is output together with the line number where the missing
% parenthesis causes the warning: beware, this line number might point to
-% several lines further on along the source file! In any case it's necessary to insert
-% a |\@killglue| command, because |\polyline| refers to absolute coordinates
+% several lines further on along the source file! In any case it's necessary to
+% insert a |\@killglue| command, because |\polyline| refers to absolute coordinates
% not necessarily is put in position through a |\put| command that provides to
% eliminate any spurious spaces preceding this command.
+%
+% Remember: |\polyline| has been incorporated into |pict2e| 2009, but we redefine it so as to allow an optional argument to allow the line join specification.
+%
+% In order to allow a specification for the joints of the various segements of
+% a polygonal line it is necessary to allow for an optional parameter; the default
+% join is the bevel join.
% \begin{macrocode}
-\def\polyline(#1){\@killglue\beveljoin\GetCoord(#1)\d@mX\d@mY
+\providecommand*\polyline[1][\beveljoin]{\p@lylin@[#1]}
+
+\def\p@lylin@[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY
\pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}%
\@ifnextchar\lp@r{\p@lyline}{%
\PackageWarning{curve2e}%
{Polygonal lines require at least two vertices!\MessageBreak
Control your polygonal line specification\MessageBreak}%
\ignorespaces}}
+
% \end{macrocode}
% But if there is a second or further point coordinate the recursive macro
% |\p@lyline| is called; it works on the next point and checks for a further
@@ -487,7 +977,7 @@
% aid and the user should know what he/she is doing; nevertheless it is
% advisable to displace the grid by means of a |\put| command so that its grid
% lines coincide with the graph coordinates multiples of 10. Missing to do so
-% the readings become cumbersome. The |\RoundUp| macros provide to increase the
+% the readings become cumbersome. The |\RoundUp| macro provides to increase the
% grid dimensions to integer multiples of ten.
% \begin{macrocode}
\def\GraphGrid(#1,#2){\begingroup\textcolor{red}{\linethickness{.1\p@}%
@@ -523,74 +1013,97 @@
%
% \subsection{The new division macro}
% Now comes one of the most important macros in the whole package: the division
-% macro; it takes two lengths as input values ant computes their fractional
-% ratio.
+% macro; it takes two lengths as input values and computes their fractional
+% ratio into a control sequence.
% It must take care of the signs, so that it examines the operand signs and
% determines the result sign separately conserving this computed sign in the
% macro |\segno|; this done, we are sure that both operands are or are
% made positive; should the
% numerator be zero it directly issues the zero quotient; should the
-% denominator be zero it outputs a signed ``infinity'', that is the maximum
-% allowable length measured in points that \TeX\ can deal with.
+% denominator be zero it outputs ``infinity'' (|\maxdimen| in points), that is
+% the maximum allowable length measured in points that \TeX\ can deal with.
% Since the result is assigned a value, the calling statement must pass as the
% third argument either a control sequence or an active character. Of course the
% first operand is the dividend, the second the divisor and the third the
% quotient.
+%
+% Since |curve2e| is supposed to be an extension of |pic2e| and this macro package
+% already contains a division maro, we do not define any other division macro;
+% nevetheless, since the macro in |pic2e| may not be so efficient as it might be
+% if the |e-tex| extensions of the interpreter program were available, here we
+% check and eventually provide a more efficient macro. The latter exploits the
+% scaling mechanism embedded in |pdftex| since 2007, if the extended mode is
+% enabled, that is used to scale a dimension by a fraction: $L\times N/D$, where
+% $L$ is a dimension, and $N$ and $D$ are the numerator an denominator of the
+% scaling factor; these might be integers, but it's better they represent the
+% numbers of scaled points another two dimensions correspond to, in the philosophy
+% that floating point numbers are represented by the measures of lengths in points.
+%
+% Therefore first we test if the macro is already defined:
% \begin{macrocode}
\ifx\DividE\undefined
- \def\DividE#1by#2to#3{%
- \begingroup
- \dimendef\Numer=254\relax \dimendef\Denom=252\relax
- \countdef\Num 254\relax
- \countdef\Den 252\relax
- \countdef\I=250\relax
- \Numer #1\relax \Denom #2\relax
- \ifdim\Denom<\z@ \Denom -\Denom \Numer -\Numer\fi
- \def\segno{}\ifdim\Numer<\z@ \def\segno{-}\Numer -\Numer\fi
- \ifdim\Denom=\z@
- \ifdim\Numer>\z@\def\Q{16383.99999}\else\def\Q{-16383.99999}\fi
- \else
- \Num=\Numer \Den=\Denom \divide\Num\Den
- \edef\Q{\number\Num.}%
- \advance\Numer -\Q\Denom \I=6\relax
- \@whilenum \I>\z@ \do{\DividEDec\advance\I\m@ne}%
- \fi
- \xdef#3{\segno\Q}\endgroup
- }%
-% \end{macrocode}
-% The |\DividEDec| macro takes the remainder of the previous division,
-% multiplies it by 10, computes a one digit quotient that postfixes to the
-% previous overall quotient, and computes the next remainder; all operations
-% are done on integer registers to whom the dimensional operands are assigned
-% so that the mentioned registers acquire the measures of the dimensions in
-% scaled points; \TeX\ is called to perform integer arithmetics, but the long
-% division takes care of the decimal separator and of the suitable number of
-% fractional digits.
-% \begin{macrocode}
- \def\DividEDec{\Numer=10\Numer \Num=\Numer \divide\Num\Den
- \edef\q{\number\Num}\edef\Q{\Q\q}\advance\Numer -\q\Denom}%
-\fi
% \end{macrocode}
-% In the above code the |\begingroup|\dots|\endgroup| maintain all registers
-% local so that only the result must be globally defined. The |\ifx|\dots|\fi|
-% construct assures the division machinery is not redefined; I use it in so
-% many packages that its better not to mix up things even with slightly
-% different definitions.
+%then we test if the extended mode exists and/or is enabled:
+% \begin{macrocode}
+\ifx\dimexpr\undefined\else
+% \end{macrocode}
+% Notice that |\dimexpr| is the specific extended mode control sequence we are going
+% to use in order to perform our task; if the interpeter program is too old and/or
+% it is a recent version, but it was compiled without activating the extended mode,
+% the macro |\dimexpr| is undefined.
+%
+% The macro, creates a group where the names of two counters and a
+% dimensional register are defined; the numbers of these integer and dimension
+% registers are expressly above the value 255, because one of the extensions is
+% the possibility of using a virtually unlimited number of registers; moreover
+% even if these registers were used within other macros, their use within a group
+% does not damage the other macros; we just have to use a dirty trick to throw
+% the result beyond the end-group command.
+%
+% The efficiency of this macro is contained in the extended command |\dimexpr|; both
+% the |\@DimA| and |\Num| registers are program words of 32\,bits; the result is
+% stored into an internal register of 64\,bits; the final division by a factor
+% stored into a register of 32 bits, so that in terms of scaled points a division by
+% 1\,pt = $1\times 2^{16}$, scales down the result by 16 bits, and if the total
+% length of the result is smaller than $2^{30}$, the result can be correctly
+% assigned to a dimension register. In any other case the extended features imply
+% suitable error messages end the termination of the program. During the division a
+% scaling down by 16 bits, the result is not simply truncated, but it is rounded to
+% the nearest integer (in scaled points)
+%
+% \begin{macrocode}
+ \def\DividE#1by#2to#3{%
+ \begingroup
+ \countdef\Num2254\relax \countdef\Den2252\relax
+ \dimendef\@DimA 2254
+ \Num=\p@ \@DimA=#2\relax \Den=\@DimA
+ \ifnum\Den=\z@
+ \edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\maxdimen}}%
+ \else
+ \@DimA=#1\relax
+ \@DimA=\dimexpr\@DimA*\Num/\Den\relax
+ \edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\@DimA}}%
+ \fi
+ \x}
+% \end{macrocode}
+% \begin{macrocode}
+\fi\fi
+% \end{macrocode}
%
% The next two macros are one of the myriad variants of the dirty trick used by
% Knuth for separating a measure from its units that \textit{must} be points,
-% ``\texttt{pt}''; One has to call |\Numero| with a control sequence and a
+% ``\texttt{pt}''. One has to call |\Numero| with a control sequence and a
% dimension; the dimension value in points is assigned to the control sequence.
% \begin{macrocode}
-\ifx\undefined\@Numero% s
+\ifx\undefined\@Numero%
{\let\cc\catcode \cc`p=12\cc`t=12\gdef\@Numero#1pt{#1}}%
\fi
\ifx\undefined\Numero
- \def\Numero#1#2{\dimen254
-#2\edef#1{\expandafter\@Numero\the\dimen254}\ignorespaces}%
+ \def\Numero#1#2{\dimen254#2\relax
+ \edef#1{\expandafter\@Numero\the\dimen254}\ignorespaces}%
\fi
% \end{macrocode}
-% For both macros the |\ifx|\dots|\fi| constructs avoids messing up the
+% For both macros the |\ifx|\dots|\fi| constructs avoid messing up the
% definitions I have in several packages.
%
% \subsection{Trigonometric functions}
@@ -599,7 +1112,7 @@
% not appear so essential) by means of the parametric formulas that require the
% knowledge of the tangent of the half angle. We want to specify the angles
% in sexagesimal degrees, not in radians, so we can make accurate reductions to
-% the main quadrants. we use the formulas
+% the main quadrants. We use the formulas
% \begin{eqnarray*}
% \sin\theta &=& \frac{2}{\cot x + \tan x}\\
% \cos\theta &=& \frac{\cot x - \tan x}{\cot x + \tan x}\\
@@ -628,11 +1141,11 @@
%
% The first macro is the service routine that computes the tangent and the
% cotangent of the half angle in radians; since we have to use always the
-% reciprocal if this value, we call it |\X| but ins spite of the similarity it
+% reciprocal of this value, we call it |\X@| but in spite of the similarity it
% is the reciprocal of $x$. Notice that parameter \texttt{\#1} must be a length.
% \begin{macrocode}
\def\g@tTanCotanFrom#1to#2and#3{%
-\DividE 114.591559\p@ by#1to\X \@tdB=\X\p@
+\DividE 114.591559\p@ by#1to\X@ \@tdB=\X@\p@
% \end{macrocode}
% Computations are done with the help of counter |\I|, of the length |\@tdB|,
% and the auxiliary control sequences |\Tan| and |\Cot| whose meaning is
@@ -661,9 +1174,16 @@
% half angle, we can compute the real trigonometric functions we are interested
% in. The sine value is computed after reducing the sine argument to the
% interval $0^\circ< \theta<180^\circ$; actually special values such as
-% $0^\circ$,$90^\circ$, $180^\circ$, et cetera, are taken care separately, so
+% $0^\circ$, $90^\circ$, $180^\circ$, et cetera, are taken care separately, so
% that CPU time is saved for these special cases. The sine sign is taken care
% separately according to the quadrant of the sine argument.
+%
+% Since all computations are done within a group, a trick is necessary in order to
+% extract the sine value from the group; this is done by defining within the group
+% a macro (in this case |\endSinOf|) with the expanded definition of the result,
+% but in charge of of closing the group, so that when the group is closed the
+% auxiliary function is not defined any more, although its expansion keeps getting
+% executed so that the expanded result is thrown beyond the group end.
% \begin{macrocode}
\def\SinOf#1to#2{\begingroup%
\@tdA=#1\p@%
@@ -672,7 +1192,7 @@
\else%
\@whiledim\@tdA<-180\p@\do{\advance\@tdA 360\p@}%
\fi \ifdim\@tdA=\z@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA>\z@
\def\Segno{+}%
@@ -684,26 +1204,29 @@
\@tdA=-\@tdA \advance\@tdA 180\p@
\fi
\ifdim\@tdA=90\p@
- \xdef#2{\Segno1}%
+ \def\@tempA{\Segno1}%
\else
\ifdim\@tdA=180\p@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA<\p@
\@tdA=\Segno0.0174533\@tdA
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to \@tempA%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA=\T\p@ \advance\@tdA \Tp\p@
- \DividE \Segno2\p@ by\@tdA to#2%
+ \DividE \Segno2\p@ by\@tdA to \@tempA%
\fi
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endSinOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endSinOf}%
% \end{macrocode}
%
-% For the computation of the cosine we behave in a similar way.
+% For the computation of the cosine we behave in a similar way using also the identical
+% trick for throwing the result beyond the group end.
% \begin{macrocode}
\def\CosOf#1to#2{\begingroup%
\@tdA=#1\p@%
@@ -724,31 +1247,33 @@
\@tdA=-\@tdA \advance\@tdA 180\p@
\fi
\ifdim\@tdA=\z@
- \gdef#2{\Segno1}%
+ \def\@tempA{\Segno1}%
\else
\ifdim\@tdA<\p@
\@tdA=0.0174533\@tdA \Numero\@tempA\@tdA
\@tdA=\@tempA\@tdA \@tdA=-.5\@tdA
\advance\@tdA \p@
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to\@tempA%
\else
\ifdim\@tdA=90\p@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA=\Tp\p@ \advance\@tdA-\T\p@
\@tdB=\Tp\p@ \advance\@tdB\T\p@
- \DividE\Segno\@tdA by\@tdB to#2%
+ \DividE\Segno\@tdA by\@tdB to\@tempA%
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endCosOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endCosOf}%
% \end{macrocode}
%
% For the tangent computation we behave in a similar way, except that we
% consider the fundamental interval as $0^\circ<\theta<90^\circ$; for the odd
% multiples of $90^\circ$ we assign the result a \TeX\ infinity value, that is
-% the maximum number in points a dimension can be.
+% the maximum a dimension can be.
% \begin{macrocode}
\def\TanOf#1to#2{\begingroup%
\@tdA=#1\p@%
@@ -758,7 +1283,7 @@
\@whiledim\@tdA<-90\p@\do{\advance\@tdA 180\p@}%
\fi%
\ifdim\@tdA=\z@%
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA>\z@
\def\Segno{+}%
@@ -767,29 +1292,38 @@
\@tdA=-\@tdA
\fi
\ifdim\@tdA=90\p@
- \xdef#2{\Segno16383.99999}%
+ \def\@tempA{\Segno16383.99999}%
\else
\ifdim\@tdA<\p@
\@tdA=\Segno0.0174533\@tdA
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to\@tempA%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA\Tp\p@ \advance\@tdA -\T\p@
- \DividE\Segno2\p@ by\@tdA to#2%
+ \DividE\Segno2\p@ by\@tdA to\@tempA%
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endTanOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endTanOf}%
% \end{macrocode}
%
% \subsection{Arcs and curves preliminary information}
% We would like to define now a macro for drawing circular arcs of any radius
% and any angular aperture; the macro should require the arc center, the
-% arc starting point and the angular aperture. The command should have the
-% following syntax:
+% arc starting point and the angular aperture. The arc has its reference point in
+% its center, therefore it does not need to be put in place by the command |\put|;
+% nevertheless if |\put| is used, it may displace the arc into another position.
+% The command should have the following syntax:
% \begin{flushleft}\ttfamily
% \cs{Arc}(\meta{{\rmfamily center}})(\meta{{\rmfamily starting
-% point}}){\meta{{\rmfamily angle}}}
+% point}}){\marg{{\rmfamily angle}}}
+% \end{flushleft}
+% which is totally equivalent to:
+% \begin{flushleft}\ttfamily
+% \string\put(\meta{\rmfamily center})\string{\string\Arc(0,0)(\meta{\rmfamily starting
+% point})\marg{\rmfamily angle}\string}
% \end{flushleft}
% If the \meta{angle} is positive the arc runs counterclockwise from the
% starting point; clockwise if it's negative.
@@ -808,12 +1342,12 @@
% We need therefore macros for summing, subtracting, multiplying, dividing
% complex numbers, for determining they directions (unit vectors); a unit vector
% is the complex number divided by its magnitude so that the result is the
-% Cartesian form of the Euler's equation
+% Cartesian form of the Euler's formula
% \[
% \mathrm{e}^{\mathrm{j}\phi} = \cos\phi+\mathrm{j}\sin\phi
% \]
%
-% The magnitude of a vector id determined by taking a clever square root of a
+% The magnitude of a vector is determined by taking a clever square root of a
% function of the real and the imaginary parts; see further on.
%
% It's better to represent each complex number with one control sequence; this
@@ -840,9 +1374,9 @@
% then taken as the reference one so that, if $a$ is larger than $b$, the
% square root of the sum of their squares is computed as such:
% \[
-% M = \sqrt{a^2+b^2} = a\sqrt{1+(b/a)^2}
+% M = \sqrt{a^2+b^2} = \vert a\vert\sqrt{1+(b/a)^2}
% \]
-% In this way the radicand never exceeds 2 and its is quite easy taking its
+% In this way the radicand never exceeds 2 and it is quite easy to get its
% square root by means of the Newton iterative process; due to the quadratic
% convergence, five iterations are more than sufficient. When one of the
% components is zero, the Newton iterative process is skipped. The overall
@@ -858,9 +1392,10 @@
\DividE\@tempdima by\@tempdimb to\@T
\@tempdimc=\@tempdimb
\fi
-\ifdim\@T\p@>\z@
+\ifdim\@T\p@=\z@
+\else
\@tempdima=\@T\p@ \@tempdima=\@T\@tempdima
- \advance\@tempdima\p@ %
+ \advance\@tempdima\p@%
\@tempdimb=\p@%
\@tempcnta=5\relax
\@whilenum\@tempcnta>\z@\do{\DividE\@tempdima by\@tempdimb to\@T
@@ -885,8 +1420,8 @@
\ifdim\@tempdimc=\z@\else
\DividE\t@X\p@ by\@tempdimc to\t@X
\DividE\t@Y\p@ by\@tempdimc to\t@Y
- \MakeVectorFrom\t@X\t@Y to#2\relax
-\fi\ignorespaces}%
+\fi
+\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
% \end{macrocode}
%
% A cumulative macro uses the above ones for determining with one call both the
@@ -899,7 +1434,10 @@
\def\ModAndDirOfVect#1to#2and#3{%
\GetCoord(#1)\t@X\t@Y
\ModOfVect#1to#2%
-\DividE\t@X\p@ by\@tempdimc to\t@X \DividE\t@Y\p@ by\@tempdimc to\t@Y
+\ifdim\@tempdimc=\z@\else
+ \DividE\t@X\p@ by\@tempdimc to\t@X
+ \DividE\t@Y\p@ by\@tempdimc to\t@Y
+\fi
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
% \end{macrocode}
% The next macro computes the magnitude and the direction of the difference of
@@ -910,25 +1448,25 @@
% and is described further on.
% \begin{macrocode}
\def\DistanceAndDirOfVect#1minus#2to#3and#4{%
-\SubVect#2from#1to\@tempa \ModAndDirOfVect\@tempa to#3and#4\relax
-\ignorespaces}%
+\SubVect#2from#1to\@tempa
+\ModAndDirOfVect\@tempa to#3and#4\ignorespaces}%
% \end{macrocode}
% We now have two macros intended to fetch just the real or, respectively, the
% imaginary part of the input complex number.
% \begin{macrocode}
\def\XpartOfVect#1to#2{%
-\GetCoord(#1)#2\@tempa
-\ignorespaces}%
+\GetCoord(#1)#2\@tempa\ignorespaces}%
%
\def\YpartOfVect#1to#2{%
-\GetCoord(#1)\@tempa#2\relax
-\ignorespaces}%
+\GetCoord(#1)\@tempa#2\ignorespaces}%
% \end{macrocode}
% With the next macro we create a direction vector (second argument) from a
% given angle (first argument).
% \begin{macrocode}
-\def\DirFromAngle#1to#2{\CosOf#1to\t@X%
-\SinOf#1to\t@Y\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
+\def\DirFromAngle#1to#2{%
+\CosOf#1to\t@X
+\SinOf#1to\t@Y
+\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
% \end{macrocode}
%
% Sometimes it is necessary to scale a vector by an arbitrary real factor; this
@@ -953,17 +1491,17 @@
% addition:
% \begin{macrocode}
\def\AddVect#1and#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\tu@X\p@
-\advance\@tempdima\td@X\p@ \Numero\t@X\@tempdima \@tempdima\tu@Y\p@
-\advance\@tempdima\td@Y\p@ \Numero\t@Y\@tempdima
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\tu@X\p@\advance\@tempdima\td@X\p@ \Numero\t@X\@tempdima
+\@tempdima\tu@Y\p@\advance\@tempdima\td@Y\p@ \Numero\t@Y\@tempdima
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
% \end{macrocode}
% Then the subtraction:
% \begin{macrocode}
\def\SubVect#1from#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\td@X\p@
-\advance\@tempdima-\tu@X\p@ \Numero\t@X\@tempdima \@tempdima\td@Y\p@
-\advance\@tempdima-\tu@Y\p@ \Numero\t@Y\@tempdima
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\td@X\p@\advance\@tempdima-\tu@X\p@ \Numero\t@X\@tempdima
+\@tempdima\td@Y\p@\advance\@tempdima-\tu@Y\p@ \Numero\t@Y\@tempdima
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
% \end{macrocode}
%
@@ -971,18 +1509,18 @@
% that we want to multiply by the second operand or by the complex conjugate of
% the second operand; it would be nice if we could use the usual
% postfixed asterisk notation for the complex conjugate, but I could not find
-% a simple means for doing so; therefore I use the prefixed notation, that is
+% a simple means for doing so; therefore I use the prefixed notation, that is
% I put the asterisk before the second operand. The first part of the
% multiplication macro just takes care of the multiplicand and then checks for
% the asterisk; if there is no asterisk it calls a second service macro that
-% performs a regular complex multiplication, otherwise it calls a third
+% performs a regular complex multiplication, otherwise it calls a third
% service macro that executes the conjugate multiplication.
% \begin{macrocode}
\def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}%
%
\def\@MultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\tu@X\p@
-\@tempdimb\tu@Y\p@
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\tu@X\p@ \@tempdimb\tu@Y\p@
\@tempdimc=\td@X\@tempdima\advance\@tempdimc-\td@Y\@tempdimb
\Numero\t@X\@tempdimc
\@tempdimc=\td@Y\@tempdima\advance\@tempdimc\td@X\@tempdimb
@@ -1013,12 +1551,13 @@
% \subsubsection{Arcs}
% We start with tracing
% a circular arc of arbitrary center, arbitrary starting point and arbitrary
-% aperture; The first macro checks the aperture; if this is not zero it
+% aperture; the first macro checks the aperture; if this is not zero it
% actually proceeds with the necessary computations, otherwise it does
% nothing.
% \begin{macrocode}
\def\Arc(#1)(#2)#3{\begingroup
-\@tdA=#3\p@ \ifdim\@tdA=\z@\else
+\@tdA=#3\p@
+\ifdim\@tdA=\z@\else
\@Arc(#1)(#2)%
\fi
\endgroup\ignorespaces}%
@@ -1039,7 +1578,7 @@
% If the rotation angle is larger than $360^\circ$ a message is issued that
% informs the user that the angle will be reduced modulo $360^\circ$; this
% operation is performed by successive subtractions rather than with modular
-% arithmetics on the assumption that in general one subtraction suffices.
+% arithmetics on the assumption that in general one subtraction suffices.
% \begin{macrocode}
\Numero\@gradi\@tdA
\ifdim\@tdA>360\p@
@@ -1143,16 +1682,16 @@
% |\VerctorArc| draws an arrow at the ending point of the arc; the second macro
% |\VectorARC| draws arrows at both ends; the arrows have the same shape as
% those for vectors; actually they are drawn by putting a vector of zero
-% length at the proper arc end(s), therefore they are styled as traditional or
-% PostScript arrows according to the option of the \texttt{pict2e} package.
+% length at the proper arc end(s), therefore they are styled as traditional \LaTeX\
+% or PostScript arrows according to the option of the \texttt{pict2e} package.
%
% But the specific drawing done here shortens the arc so as not to overlap on
-% the arrow(s); the only or both arrows are also lightly tilted in order to
+% the arrow(s); the only arrow (or both ones) are also lightly tilted in order to
% avoid the impression of a corner where the arc enters the arrow tip.
%
% All these operations require a lot of ``playing'' with vector directions,
% but even if the operations are numerous, they do not do anything else but:
-% (a) determining the end point and its direction ; (b) determining the arrow
+% (a) determining the end point and its direction; (b) determining the arrow
% length as an angular quantity, i.e. the arc amplitude that must be subtracted
% from the total arc to be drawn; (c) the direction of the arrow should be
% corresponding to the tangent to the arc at the point where the arrow tip is
@@ -1179,19 +1718,20 @@
\fi
\endgroup\ignorespaces}%
% \end{macrocode}
-% The single arrowed arc is defined with the following long macro where all the
+%
+% The single arrowed arc is defined with the following long macro where all the
% described operations are performed more or less in the described succession;
% probably the macro requires a little cleaning, but since it works fine I did
% not try to optimize it for time or number of tokens. The final part of the
% macro is almost identical to that of the plain arc; the beginning also is
% quite similar. The central part is dedicated to the positioning of the arrow
% tip and to the necessary calculations for determining the tip tilt and the
-% reduction of the total arc length;pay attention that the arrow length, stored in
+% reduction of the total arc length; pay attention that the arrow length, stored in
% |\@tdE| is a real length, while the radius stored in |\@Raggio| is just a multiple
-% of the |\unitlength|, so that the division (that yields a good angular approximation
-% to the arrow length as seen from the center of the arc) must be done with real
-% lengths. The already defined |\@@Arc| macro actually draws the curved vector
-% stem without stroking it.
+% of the |\unitlength|, so that the division (that yields a good angular
+% approximation to the arrow length as seen from the center of the arc) must be done
+% with real lengths. The already defined |\@@Arc| macro actually draws the curved
+% vector stem without stroking it.
% \begin{macrocode}
\def\@VArc(#1)(#2){%
\ifdim\@tdA>\z@
@@ -1253,7 +1793,7 @@
\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\ifx\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
-\MultVect\@V by\@Dir to\@sPun
+\MultVect\@V by\@Dir to\@sPun% corrects the end point
\edef\@tempA{\ifx\Segno-\m@ne\else\@ne\fi}%
\MultVect\@sPun by 0,\@tempA to\@vPun
\DirOfVect\@vPun to\@Dir
@@ -1264,7 +1804,7 @@
\DirFromAngle\@tempB to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
\GetCoord(\@Dir)\@xnum\@ynum
-\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}%
+\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% arrow tip at the end point
\@tdE =\DeltaGradi\p@
\advance\@tdA -2\@tdE \Numero\@gradi\@tdA
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY
@@ -1274,9 +1814,9 @@
\@tdE\ifx\Segno--\fi\DeltaGradi\p@
\Numero\@tempB{0.5\@tdE}%
\DirFromAngle\@tempB to\@Dird
-\MultVect\@vPun by\@Dird to\@vPun
+\MultVect\@vPun by\@Dird to\@vPun% corrects the starting point
\DirOfVect\@vPun to\@Dir\GetCoord(\@Dir)\@xnum\@ynum
-\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}
+\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}% arrow tip at the starting point
\edef\@tempa{\ifx\Segno--\fi\DeltaGradi}%
\DirFromAngle\@tempa to \@Dir
\SubVect\@Cent from\@pPun to\@V
@@ -1301,7 +1841,7 @@
% to draw almost anything. It traces a single Bézier spline from a first point
% where the tangent direction is specified to a second point where again it is
% specified the tangent direction. Actually this is a special (possibly useless)
-% case where the general |\Curve| macro could do the same or a better job. In
+% case where the general |\curve| macro could do the same or a better job. In
% any case\dots
% \begin{macrocode}
\def\CurveBetween#1and#2WithDirs#3and#4{%
@@ -1309,7 +1849,7 @@
\CurveTo#2WithDir{#4}\CurveFinish}%
% \end{macrocode}
%
-% Actually the above macro is a special case of concatenation of the triplet
+% Actually the above macro is a special case of concatenation of the triplet
% formed by macros |\StartCurve|, |\CurveTo| and|\CurveFinish|; the second of
% which can be repeated an arbitrary number of times.
%
@@ -1452,8 +1992,7 @@
\fi
% \end{macrocode}
% \dots\ from when the ``left'' direction is not perpendicular to the chord; it
-% might
-% be parallel and we must distinguish the cases for the other direction~\dots
+% might be parallel and we must distinguish the cases for the other direction~\dots
% \begin{macrocode}
\else
\ifdim\@Xpuno\p@=\z@
@@ -1464,9 +2003,7 @@
\ifdim\@Ypzero\p@=\z@
\@tdA=0.333333\p@
\Numero\@Mcpzero{\@Chord\@tdA}%
- \ifdim\@Ypuno\p@=\z@
- \edef\@Mcpuno{\@Mcpzero}%
- \fi
+ \edef\@Mcpuno{\@Mcpzero}%
% \end{macrocode}
% \dots\ from when the left direction is oblique and the other direction is
% either parallel to the chord~\dots
@@ -1491,7 +2028,7 @@
\fi
% \end{macrocode}
% The control sequence |\@Dwpuno| contains the right direction for forming the
-% triangle; we cam make the weighed subdivision of the chord according to the
+% triangle; we can make the weighed subdivision of the chord according to the
% horizontal components of the directions; we eventually turn negative values
% to positive ones since we are interested in the magnitudes of the control
% vectors.
@@ -1506,7 +2043,7 @@
\@tdD=\p@ \advance\@tdD-\@Fact\p@
\ifdim\@tdD<\z@ \@tdD=-\@tdD\fi
% \end{macrocode}
-% before dividing by the denominator we have to check the directions, although
+% Before dividing by the denominator we have to check the directions, although
% oblique to the chord are not parallel to one another; in this case there is
% no question of a weighed subdivision of the chord
% \begin{macrocode}
@@ -1531,7 +2068,7 @@
% Now we have all data we need and we determine the positions of the control
% points; we do not work any more on the rotated diagram of the horizontal
% chord, but we operate on the original points and directions; all we had to
-% compute, after all, were the distances of the control point along the
+% compute, after all, were the distances of the control points along the
% specified directions; remember that the ``left'' control point is along the
% positive ``left'' direction, while the ``right'' control point precedes the
% curve node along the ``right'' direction, so that a vector subtraction must
@@ -1581,15 +2118,15 @@
% regular parentheses while direction components are grouped within angle
% brackets. The first call of the macro initializes the drawing process and
% checks for the next node and direction; if a second node is missing, it issues
-% a warning message and does not draw anything. The second macro defines the
-% path to the next point and checks for another node; if the next list item is
-% a square bracket delimited argument, it interprets it as a change of
-% direction, while if it is another parenthesis delimited argument it interprets
-% it as a new node-direction specification;
-% if the node and direction list is terminated, it issues the stroking command
-% and exits the recursive process. The |@ChangeDir| macro is just an interface
-% for executing the regular |\ChangeDir| macro, but also for recursing again by
-% recalling |\@Curve|.
+% a warning message and does not draw anything. It does not check for a change in
+% direction, because it would be meaningless at the beginning of a curve.
+% The second macro defines the path to the next point and checks for another node;
+% if the next list item is a square bracket delimited argument, it interprets it as
+% a change of direction, while if it is another parenthesis delimited argument it
+% interprets it as a new node-direction specification; if the node and direction
+% list is terminated, it issues the stroking command and exits the recursive
+% process. The |@ChangeDir| macro is just an interface for executing the regular
+% |\ChangeDir| macro, but also for recursing again by recalling |\@Curve|.
% \begin{macrocode}
\def\Curve(#1)<#2>{%
\StartCurveAt#1WithDir{#2}%
diff --git a/Master/texmf-dist/source/latex/curve2e/curve2e.ins b/Master/texmf-dist/source/latex/curve2e/curve2e.ins
deleted file mode 100644
index b16bd21a1c0..00000000000
--- a/Master/texmf-dist/source/latex/curve2e/curve2e.ins
+++ /dev/null
@@ -1,42 +0,0 @@
-%%
-%% --------------- start of docstrip commands ------------------
-%%
-\def\batchfile{curve2e.ins}
-\input docstrip.tex
-\preamble
-
-Copyright 2005 Claudio Beccari All rights reserved.
-
- This system is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-
-IMPORTANT NOTICE:
-
-This work may be distributed and/or modified under the
-conditions of the LaTeX Project Public License, either version 1.3
-of this license or (at your option) any later version.
-The latest version of this license is in
- http://www.latex-project.org/lppl.txt
-and version 1.3 or later is part of all distributions of LaTeX
-version 2003/12/01 or later.
-
-This work has the LPPL maintenance status "author-maintained".
-
-This work consists of all files listed in manifest.txt.
-
-
-If you receive only some of these files from someone, complain!
-
-\endpreamble
-\def\batchfile{curve2e.dst} % ignored in distribution
-\input docstrip.tex % ignored in distribution
-
-\keepsilent
-
-\Msg{*** Generating package curve2e ***}
-
-\generateFile{curve2e.sty}{t}{\from{curve2e.dtx}{package}}
-
-\endinput
diff --git a/Master/texmf-dist/tex/latex/curve2e/curve2e.sty b/Master/texmf-dist/tex/latex/curve2e/curve2e.sty
index 8f1bc3286f7..e5b98239417 100644
--- a/Master/texmf-dist/tex/latex/curve2e/curve2e.sty
+++ b/Master/texmf-dist/tex/latex/curve2e/curve2e.sty
@@ -5,51 +5,37 @@
%% The original source files were:
%%
%% curve2e.dtx (with options: `package')
+%% ______________________________________________________
+%% The curve2e package for LaTeX and XeLATeX
+%% Copyright (C) 2010 Claudio Beccari
+%% All rights reserved
%%
-%% Copyright 2005 Claudio Beccari All rights reserved.
-%%
-%% This system is distributed in the hope that it will be useful,
-%% but WITHOUT ANY WARRANTY; without even the implied warranty of
-%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-%%
-%%
-%% IMPORTANT NOTICE:
-%%
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
-%% version 2003/12/01 or later.
-%%
-%% This work has the LPPL maintenance status "author-maintained".
-%%
-%% This work consists of all files listed in manifest.txt.
-%%
-%%
-%% If you receive only some of these files from someone, complain!
+%% License information appended
%%
%%
%% File `curve2e.dtx'.
-%% Copyright (C) 2005--2006 Claudio Beccari all rights reserved.
+%% Copyright (C) 2005--2010 Claudio Beccari all rights reserved.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{curve2e}%
- [2008/05/04 v.1.01 Extension package for pict2e]
+ [2010/11/08 v.1.30 Extension package for pict2e]
\RequirePackage{color}
\RequirePackageWithOptions{pict2e}[2004/06/01]
\ifcase\pIIe@mode\relax
\or %Postscript
- \def\roundcap{\special{ps:: 1 setlinecap}}%
- \def\squarecap{\special{ps:: 0 setlinecap}}%
- \def\roundjoin{\special{ps:: 1 setlinejoin}}%
- \def\beveljoin{\special{ps:: 2 setlinejoin}}%
+ \providecommand\roundcap{\special{ps:: 1 setlinecap}}%
+ \providecommand\squarecap{\special{ps:: 0 setlinecap}}%
+ \newcommand\roundjoin{\special{ps:: 1 setlinejoin}}%
+ \providecommand\beveljoin{\special{ps:: 2 setlinejoin}}%
+ \providecommand\miterjoin{\special{ps:: 0 setlinejoin}}%
\or %pdf
- \def\roundcap{\pdfliteral{1 J}}%
- \def\squarecap{\pdfliteral{0 J}}%
- \def\roundjoin{\pdfliteral{1 j}}%
- \def\beveljoin{\pdfliteral{2 j}}%
+ \@ifundefined{XeTeXrevision}{}
+ {\def\pdfliteral#1{\special{pdf: literal #1}}}%
+ \providecommand\roundcap{\pdfliteral{1 J}}%
+ \providecommand\squarecap{\pdfliteral{0 J}}%
+ \providecommand\roundjoin{\pdfliteral{1 j}}%
+ \providecommand\beveljoin{\pdfliteral{2 j}}%
+ \providecommand\miterjoin{\pdfliteral{0 j}}%
\fi
\def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}%
\def\TROF{\tracingcommands\z@ \tracingmacros\z@}%
@@ -65,9 +51,9 @@
\def\thicklines{\linethickness{\defaultlinewidth}}%
\def\thinlines{\linethickness{.5\defaultlinewidth}}%
\thinlines\ignorespaces}
-\def\Line(#1,#2){\pIIe@moveto\z@\z@
+\def\LIne(#1,#2){\pIIe@moveto\z@\z@
\pIIe@lineto{#1\unitlength}{#2\unitlength}\pIIe@strokeGraph}%
-\def\LINE(#1)(#2){\@killglue\polyline(#1)(#2)}%
+\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}%
\def\line(#1)#2{\begingroup
\@linelen #2\unitlength
\ifdim\@linelen<\z@\@badlinearg\else
@@ -80,8 +66,29 @@
\pIIe@moveto\z@\z@
\pIIe@lineto{\d@mX\@linelen}{\d@mY\@linelen}%
\pIIe@strokeGraph
-\fi
+ \fi
\endgroup\ignorespaces}%
+\ifx\Dline\undefined
+\def\Dline(#1,#2)(#3,#4)#5{%
+\begingroup
+ \countdef\NumA254\countdef\NumB252\relax
+ \MakeVectorFrom{#1}{#2}to\V@ttA
+ \MakeVectorFrom{#3}{#4}to\V@ttB
+ \SubVect\V@ttA from\V@ttB to\V@ttC
+ \ModOfVect\V@ttC to\DlineMod
+ \DividE\DlineMod\p@ by#5\p@ to\NumD
+ \NumA\expandafter\Integer\NumD??
+ \ifodd\NumA\else\advance\NumA\@ne\fi
+ \NumB=\NumA \divide\NumB\tw@
+ \DividE\DlineMod\p@ by\NumA\p@ to\D@shMod
+ \DividE\p@ by\NumA\p@ to \@tempa
+ \MultVect\V@ttC by\@tempa,0 to\V@ttB
+ \MultVect\V@ttB by 2,0 to\V@ttC
+ \advance\NumB\@ne
+ \edef\@mpt{\noexpand\endgroup
+ \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}{\noexpand\LIne(\V@ttB)}}%
+ \@mpt\ignorespaces}%
+\fi
\def\GetCoord(#1)#2#3{%
\expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces}
\def\SplitNod@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}%
@@ -125,13 +132,16 @@
\expandafter\put\expandafter(#1){\expandafter\Vector\expandafter(\@tempa)}%
\endgroup\ignorespaces}
\let\lp@r( \let\rp@r)
-\def\polyline(#1){\@killglue\beveljoin\GetCoord(#1)\d@mX\d@mY
+\providecommand*\polyline[1][\beveljoin]{\p@lylin@[#1]}
+
+\def\p@lylin@[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY
\pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}%
\@ifnextchar\lp@r{\p@lyline}{%
\PackageWarning{curve2e}%
{Polygonal lines require at least two vertices!\MessageBreak
Control your polygonal line specification\MessageBreak}%
\ignorespaces}}
+
\def\p@lyline(#1){\GetCoord(#1)\d@mX\d@mY
\pIIe@lineto{\d@mX\unitlength}{\d@mY\unitlength}%
\@ifnextchar\lp@r{\p@lyline}{\pIIe@strokeGraph\ignorespaces}}
@@ -150,37 +160,30 @@
\advance\@tempcnta-\count252\fi\edef#3{\number\@tempcnta}\ignorespaces}%
\def\Integer#1.#2??{#1}%
\ifx\DividE\undefined
- \def\DividE#1by#2to#3{%
- \begingroup
- \dimendef\Numer=254\relax \dimendef\Denom=252\relax
- \countdef\Num 254\relax
- \countdef\Den 252\relax
- \countdef\I=250\relax
- \Numer #1\relax \Denom #2\relax
- \ifdim\Denom<\z@ \Denom -\Denom \Numer -\Numer\fi
- \def\segno{}\ifdim\Numer<\z@ \def\segno{-}\Numer -\Numer\fi
- \ifdim\Denom=\z@
- \ifdim\Numer>\z@\def\Q{16383.99999}\else\def\Q{-16383.99999}\fi
- \else
- \Num=\Numer \Den=\Denom \divide\Num\Den
- \edef\Q{\number\Num.}%
- \advance\Numer -\Q\Denom \I=6\relax
- \@whilenum \I>\z@ \do{\DividEDec\advance\I\m@ne}%
- \fi
- \xdef#3{\segno\Q}\endgroup
- }%
- \def\DividEDec{\Numer=10\Numer \Num=\Numer \divide\Num\Den
- \edef\q{\number\Num}\edef\Q{\Q\q}\advance\Numer -\q\Denom}%
+\ifx\dimexpr\undefined\else
+\def\DividE#1by#2to#3{%
+\begingroup
+\countdef\Num2254\relax \countdef\Den2252\relax
+\dimendef\@DimA 2254
+\Num=\p@ \@DimA=#2\relax \Den=\@DimA
+\ifnum\Den=\z@
+\edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\maxdimen}}%
+\else
+\@DimA=#1\relax
+\@DimA=\dimexpr\@DimA*\Num/\Den\relax
+\edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\@DimA}}%
\fi
-\ifx\undefined\@Numero% s
+\x}
+\fi\fi
+\ifx\undefined\@Numero%
{\let\cc\catcode \cc`p=12\cc`t=12\gdef\@Numero#1pt{#1}}%
\fi
\ifx\undefined\Numero
- \def\Numero#1#2{\dimen254
-#2\edef#1{\expandafter\@Numero\the\dimen254}\ignorespaces}%
+ \def\Numero#1#2{\dimen254#2\relax
+ \edef#1{\expandafter\@Numero\the\dimen254}\ignorespaces}%
\fi
\def\g@tTanCotanFrom#1to#2and#3{%
-\DividE 114.591559\p@ by#1to\X \@tdB=\X\p@
+\DividE 114.591559\p@ by#1to\X@ \@tdB=\X@\p@
\countdef\I=254\def\Tan{0}\I=11\relax
\@whilenum\I>\z@\do{%
\@tdC=\Tan\p@ \@tdD=\I\@tdB
@@ -195,7 +198,7 @@
\else%
\@whiledim\@tdA<-180\p@\do{\advance\@tdA 360\p@}%
\fi \ifdim\@tdA=\z@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA>\z@
\def\Segno{+}%
@@ -207,23 +210,25 @@
\@tdA=-\@tdA \advance\@tdA 180\p@
\fi
\ifdim\@tdA=90\p@
- \xdef#2{\Segno1}%
+ \def\@tempA{\Segno1}%
\else
\ifdim\@tdA=180\p@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA<\p@
\@tdA=\Segno0.0174533\@tdA
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to \@tempA%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA=\T\p@ \advance\@tdA \Tp\p@
- \DividE \Segno2\p@ by\@tdA to#2%
+ \DividE \Segno2\p@ by\@tdA to \@tempA%
\fi
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endSinOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endSinOf}%
\def\CosOf#1to#2{\begingroup%
\@tdA=#1\p@%
\ifdim\@tdA>\z@%
@@ -241,25 +246,27 @@
\@tdA=-\@tdA \advance\@tdA 180\p@
\fi
\ifdim\@tdA=\z@
- \gdef#2{\Segno1}%
+ \def\@tempA{\Segno1}%
\else
\ifdim\@tdA<\p@
\@tdA=0.0174533\@tdA \Numero\@tempA\@tdA
\@tdA=\@tempA\@tdA \@tdA=-.5\@tdA
\advance\@tdA \p@
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to\@tempA%
\else
\ifdim\@tdA=90\p@
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA=\Tp\p@ \advance\@tdA-\T\p@
\@tdB=\Tp\p@ \advance\@tdB\T\p@
- \DividE\Segno\@tdA by\@tdB to#2%
+ \DividE\Segno\@tdA by\@tdB to\@tempA%
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endCosOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endCosOf}%
\def\TanOf#1to#2{\begingroup%
\@tdA=#1\p@%
\ifdim\@tdA>90\p@%
@@ -268,7 +275,7 @@
\@whiledim\@tdA<-90\p@\do{\advance\@tdA 180\p@}%
\fi%
\ifdim\@tdA=\z@%
- \gdef#2{0}%
+ \def\@tempA{0}%
\else
\ifdim\@tdA>\z@
\def\Segno{+}%
@@ -277,19 +284,21 @@
\@tdA=-\@tdA
\fi
\ifdim\@tdA=90\p@
- \xdef#2{\Segno16383.99999}%
+ \def\@tempA{\Segno16383.99999}%
\else
\ifdim\@tdA<\p@
\@tdA=\Segno0.0174533\@tdA
- \DividE\@tdA by\p@ to#2%
+ \DividE\@tdA by\p@ to\@tempA%
\else
\g@tTanCotanFrom\@tdA to\T and\Tp
\@tdA\Tp\p@ \advance\@tdA -\T\p@
- \DividE\Segno2\p@ by\@tdA to#2%
+ \DividE\Segno2\p@ by\@tdA to\@tempA%
\fi
\fi
\fi
-\endgroup\ignorespaces}%
+\edef\endTanOf{\noexpand\endgroup
+ \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}%
+\endTanOf}%
\def\MakeVectorFrom#1#2to#3{\edef#3{#1,#2}\ignorespaces}%
\def\CopyVect#1to#2{\edef#2{#1}\ignorespaces}%
\def\ModOfVect#1to#2{\GetCoord(#1)\t@X\t@Y
@@ -302,9 +311,10 @@
\DividE\@tempdima by\@tempdimb to\@T
\@tempdimc=\@tempdimb
\fi
-\ifdim\@T\p@>\z@
+\ifdim\@T\p@=\z@
+\else
\@tempdima=\@T\p@ \@tempdima=\@T\@tempdima
- \advance\@tempdima\p@ %
+ \advance\@tempdima\p@%
\@tempdimb=\p@%
\@tempcnta=5\relax
\@whilenum\@tempcnta>\z@\do{\DividE\@tempdima by\@tempdimb to\@T
@@ -319,24 +329,27 @@
\ifdim\@tempdimc=\z@\else
\DividE\t@X\p@ by\@tempdimc to\t@X
\DividE\t@Y\p@ by\@tempdimc to\t@Y
- \MakeVectorFrom\t@X\t@Y to#2\relax
-\fi\ignorespaces}%
+\fi
+\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
\def\ModAndDirOfVect#1to#2and#3{%
\GetCoord(#1)\t@X\t@Y
\ModOfVect#1to#2%
-\DividE\t@X\p@ by\@tempdimc to\t@X \DividE\t@Y\p@ by\@tempdimc to\t@Y
+\ifdim\@tempdimc=\z@\else
+ \DividE\t@X\p@ by\@tempdimc to\t@X
+ \DividE\t@Y\p@ by\@tempdimc to\t@Y
+\fi
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
\def\DistanceAndDirOfVect#1minus#2to#3and#4{%
-\SubVect#2from#1to\@tempa \ModAndDirOfVect\@tempa to#3and#4\relax
-\ignorespaces}%
+\SubVect#2from#1to\@tempa
+\ModAndDirOfVect\@tempa to#3and#4\ignorespaces}%
\def\XpartOfVect#1to#2{%
-\GetCoord(#1)#2\@tempa
-\ignorespaces}%
+\GetCoord(#1)#2\@tempa\ignorespaces}%
\def\YpartOfVect#1to#2{%
-\GetCoord(#1)\@tempa#2\relax
-\ignorespaces}%
-\def\DirFromAngle#1to#2{\CosOf#1to\t@X%
-\SinOf#1to\t@Y\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
+\GetCoord(#1)\@tempa#2\ignorespaces}%
+\def\DirFromAngle#1to#2{%
+\CosOf#1to\t@X
+\SinOf#1to\t@Y
+\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
\def\ScaleVect#1by#2to#3{\GetCoord(#1)\t@X\t@Y
\@tempdima=\t@X\p@ \@tempdima=#2\@tempdima\Numero\t@X\@tempdima
\@tempdima=\t@Y\p@ \@tempdima=#2\@tempdima\Numero\t@Y\@tempdima
@@ -345,19 +358,19 @@
\@tempdima=-\t@Y\p@\Numero\t@Y\@tempdima
\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}%
\def\AddVect#1and#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\tu@X\p@
-\advance\@tempdima\td@X\p@ \Numero\t@X\@tempdima \@tempdima\tu@Y\p@
-\advance\@tempdima\td@Y\p@ \Numero\t@Y\@tempdima
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\tu@X\p@\advance\@tempdima\td@X\p@ \Numero\t@X\@tempdima
+\@tempdima\tu@Y\p@\advance\@tempdima\td@Y\p@ \Numero\t@Y\@tempdima
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
\def\SubVect#1from#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\td@X\p@
-\advance\@tempdima-\tu@X\p@ \Numero\t@X\@tempdima \@tempdima\td@Y\p@
-\advance\@tempdima-\tu@Y\p@ \Numero\t@Y\@tempdima
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\td@X\p@\advance\@tempdima-\tu@X\p@ \Numero\t@X\@tempdima
+\@tempdima\td@Y\p@\advance\@tempdima-\tu@Y\p@ \Numero\t@Y\@tempdima
\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}%
\def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}%
\def\@MultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y
-\GetCoord(#2)\td@X\td@Y \@tempdima\tu@X\p@
-\@tempdimb\tu@Y\p@
+\GetCoord(#2)\td@X\td@Y
+\@tempdima\tu@X\p@ \@tempdimb\tu@Y\p@
\@tempdimc=\td@X\@tempdima\advance\@tempdimc-\td@Y\@tempdimb
\Numero\t@X\@tempdimc
\@tempdimc=\td@Y\@tempdima\advance\@tempdimc\td@X\@tempdimb
@@ -375,7 +388,8 @@
\ScaleVect#1by\@Mod to\@tempa
\MultVect\@tempa by\@Dir to#3\ignorespaces}%
\def\Arc(#1)(#2)#3{\begingroup
-\@tdA=#3\p@ \ifdim\@tdA=\z@\else
+\@tdA=#3\p@
+\ifdim\@tdA=\z@\else
\@Arc(#1)(#2)%
\fi
\endgroup\ignorespaces}%
@@ -512,7 +526,7 @@
\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\ifx\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
-\MultVect\@V by\@Dir to\@sPun
+\MultVect\@V by\@Dir to\@sPun% corrects the end point
\edef\@tempA{\ifx\Segno-\m@ne\else\@ne\fi}%
\MultVect\@sPun by 0,\@tempA to\@vPun
\DirOfVect\@vPun to\@Dir
@@ -523,7 +537,7 @@
\DirFromAngle\@tempB to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
\GetCoord(\@Dir)\@xnum\@ynum
-\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}%
+\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% arrow tip at the end point
\@tdE =\DeltaGradi\p@
\advance\@tdA -2\@tdE \Numero\@gradi\@tdA
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY
@@ -533,9 +547,9 @@
\@tdE\ifx\Segno--\fi\DeltaGradi\p@
\Numero\@tempB{0.5\@tdE}%
\DirFromAngle\@tempB to\@Dird
-\MultVect\@vPun by\@Dird to\@vPun
+\MultVect\@vPun by\@Dird to\@vPun% corrects the starting point
\DirOfVect\@vPun to\@Dir\GetCoord(\@Dir)\@xnum\@ynum
-\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}
+\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}% arrow tip at the starting point
\edef\@tempa{\ifx\Segno--\fi\DeltaGradi}%
\DirFromAngle\@tempa to \@Dir
\SubVect\@Cent from\@pPun to\@V
@@ -587,9 +601,7 @@
\ifdim\@Ypzero\p@=\z@
\@tdA=0.333333\p@
\Numero\@Mcpzero{\@Chord\@tdA}%
- \ifdim\@Ypuno\p@=\z@
- \edef\@Mcpuno{\@Mcpzero}%
- \fi
+ \edef\@Mcpuno{\@Mcpzero}%
\else
\ifdim\@Ypuno\p@=\z@
\@tdA=0.333333\p@
@@ -657,6 +669,17 @@
\@ifnextchar[\@ChangeDir\CurveFinish}}
\def\@ChangeDir[#1]{\ChangeDir<#1>\@Curve}
-\endinput
+%%
+%% Copyright 2005-2010 Claudio Beccari
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "author-maintained"
+%%
+%% This work consists of this file curve2e.dtx, a README file
+%% and the derived files curve2e.sty and curve2e.pdf.
+%%
%%
%% End of file `curve2e.sty'.