diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/pict2e/pict2e.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/pict2e/pict2e.dtx | 935 |
1 files changed, 486 insertions, 449 deletions
diff --git a/Master/texmf-dist/source/latex/pict2e/pict2e.dtx b/Master/texmf-dist/source/latex/pict2e/pict2e.dtx index cbf8ac02937..814fcef508e 100644 --- a/Master/texmf-dist/source/latex/pict2e/pict2e.dtx +++ b/Master/texmf-dist/source/latex/pict2e/pict2e.dtx @@ -23,7 +23,7 @@ % %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{pict2e} -%<package> [2008/06/29 v0.2u Improved picture commands (HjG,RN,JT)] +%<package> [2008/07/22 v0.2w Improved picture commands (HjG,RN,JT)] % %<*driver> \listfiles @@ -59,9 +59,9 @@ % \fi % % \GetFileInfo{pict2e.sty} -% \def\docdate{2008/06/29} +% \def\docdate{2008/07/22} % -% \CheckSum{2030} +% \CheckSum{2073} % % ^^A ======== % @@ -177,6 +177,8 @@ % added \cmd{\arc}, \cmd{\Line}, \cmd{\polyline}, \cmd{\polygon}, % types of lines and their connections, path commands (JT)} % \changes{v0.2u}{2008/06/29}{Also real slopes for lines and vectors. (JT)} +% \changes{v0.2v}{2008/07/19}{Improved internal division macro. (JT)} +% \changes{v0.2w}{2008/07/22}{Number of points in \cmd{\qbezier} not ignored. (JT)} % \fi % % \changes{v0.1a}{2003/07/18}{First version. (RN)} @@ -192,6 +194,10 @@ % (2004/08/06 v0.2q). (RN/HjG)} % \changes{v0.2u}{2008/06/29}{Fifth release to CTAN % (2008/06/29 v0.2u). (JT)} +% \changes{v0.2v}{2008/07/19}{Sixth release to CTAN +% (2008/07/19 v0.2v). (JT)} +% \changes{v0.2w}{2008/07/22}{Seventh release to CTAN +% (2008/07/19 v0.2v). (JT)} % % % \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment} @@ -1147,9 +1153,9 @@ % |\qbezier|\oarg{N}\parg{AX,AY}\parg{BX,BY}\parg{CX,CY}\\ % |\cbezier|\oarg{N}\parg{AX,AY}\parg{BX,BY}\parg{CX,CY}\parg{DX,DY}\\ % In \SL, the \emph{N} argument specifies the number of points to -% ^^A ??? off by 1 !!! -% plot, with the maximum defined by \cmd{\qbeziermax}. -% ^^A Cite Lamport !!! +% plot: $N+1$ for a positive integer $N$, appropriate number +% (at most \cmd{\qbeziermax}) for $N=0$ or if +% the optional argument is missing. % With \LaTeX\ versions prior to 2003/12/01, the quadratic Bezier % curves plotted by this package will not match those of the \SL\ % implementation exactly, due to a bug in positioning the dots used to @@ -1170,12 +1176,9 @@ % \end{ltxquote} % % \noindent -% More accurately, the argument specifying the maximum number of -% points to plot is simply ignored in this new implementation of -% \textsf{pict2e}, as is \cmd{\qbeziermax}, -% since the \textsf{pict2e} package uses primitive operators of the -% output (back-end) format, using only the given ``control points''. -% (For details, see the implementation part.) +% More accurately, if the optional argument is absent or is 0, +% the \textsf{pict2e} package uses primitive operators of the +% output (back-end) format to draw a full curve. % % \begin{figure} % \noindent @@ -1729,7 +1732,7 @@ % The following definitions allow the \PS\ and \PDF\ operations below % to share some of the code. % \begin{macrocode} -\ifcase\pIIe@mode\relax + \ifcase\pIIe@mode\relax % \end{macrocode} % % \begin{macro}{\pIIe@moveto@op} @@ -1742,15 +1745,15 @@ % \begin{macro}{\pIIe@closepath@op} % \PS % \begin{macrocode} -\or - \newcommand*\pIIe@moveto@op{moveto} - \newcommand*\pIIe@lineto@op{lineto} - \newcommand*\pIIe@setlinewidth@op{setlinewidth} - \newcommand*\pIIe@stroke@op{stroke} - \newcommand*\pIIe@fill@op{fill} - \newcommand*\pIIe@curveto@op{curveto} - \newcommand*\pIIe@concat@op{concat} - \newcommand*\pIIe@closepath@op{closepath} + \or + \newcommand*\pIIe@moveto@op{moveto} + \newcommand*\pIIe@lineto@op{lineto} + \newcommand*\pIIe@setlinewidth@op{setlinewidth} + \newcommand*\pIIe@stroke@op{stroke} + \newcommand*\pIIe@fill@op{fill} + \newcommand*\pIIe@curveto@op{curveto} + \newcommand*\pIIe@concat@op{concat} + \newcommand*\pIIe@closepath@op{closepath} % \end{macrocode} % \end{macro} % \end{macro} @@ -1771,15 +1774,15 @@ % \begin{macro}{\pIIe@closepath@op} % \PDF % \begin{macrocode} -\or - \newcommand*\pIIe@moveto@op{m} - \newcommand*\pIIe@lineto@op{l} - \newcommand*\pIIe@setlinewidth@op{w} - \newcommand*\pIIe@stroke@op{S} - \newcommand*\pIIe@fill@op{f} - \newcommand*\pIIe@curveto@op{c} - \newcommand*\pIIe@concat@op{cm} - \newcommand*\pIIe@closepath@op{h} + \or + \newcommand*\pIIe@moveto@op{m} + \newcommand*\pIIe@lineto@op{l} + \newcommand*\pIIe@setlinewidth@op{w} + \newcommand*\pIIe@stroke@op{S} + \newcommand*\pIIe@fill@op{f} + \newcommand*\pIIe@curveto@op{c} + \newcommand*\pIIe@concat@op{cm} + \newcommand*\pIIe@closepath@op{h} % \end{macrocode} % \end{macro} % \end{macro} @@ -1793,7 +1796,7 @@ % \noindent % (Currently, there are no other modes.) % \begin{macrocode} -\fi + \fi % \end{macrocode} % % \subsection{Low-level operations} @@ -1942,7 +1945,7 @@ % \end{macro} % % \begin{macrocode} -\ifcase\pIIe@mode\relax + \ifcase\pIIe@mode\relax % \end{macrocode} % % \begin{macro}{\pIIe@concat} @@ -1952,22 +1955,22 @@ % \begin{macro}{\pIIe@scale@PTtoBP} % \PS: Use some operators directly. % \begin{macrocode} -\or - \newcommand*\pIIe@concat[6]{% - \begingroup - \pIIe@addtoGraph{[}% - \@tempdima#1\relax \@tempdimb#2\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#3\relax \@tempdimb#4\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#5\relax \@tempdimb#6\relax - \pIIe@add@nums\@tempdima\@tempdimb - \pIIe@addtoGraph{] \pIIe@concat@op}% - \endgroup} - \newcommand*\pIIe@translate[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{translate}} - \newcommand*\pIIe@rotate[1]{\pIIe@add@num{#1}\pIIe@addtoGraph{rotate}} - \newcommand*\pIIe@scale[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{scale}} - \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP \pIIe@PTtoBP scale} + \or + \newcommand*\pIIe@concat[6]{% + \begingroup + \pIIe@addtoGraph{[}% + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@nums\@tempdima\@tempdimb + \pIIe@addtoGraph{] \pIIe@concat@op}% + \endgroup} + \newcommand*\pIIe@translate[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{translate}} + \newcommand*\pIIe@rotate[1]{\pIIe@add@num{#1}\pIIe@addtoGraph{rotate}} + \newcommand*\pIIe@scale[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{scale}} + \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP \pIIe@PTtoBP scale} % \end{macrocode} % \end{macro} % \end{macro} @@ -1982,31 +1985,31 @@ % \begin{macro}{\pIIe@scale@PTtoBP} % \PDF: Emulate. \mbox{\texttt{:-(}} % \begin{macrocode} -\or - \newcommand*\pIIe@concat[6]{% - \begingroup - \@tempdima#1\relax \@tempdimb#2\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#3\relax \@tempdimb#4\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#5\relax \@tempdimb#6\relax - \pIIe@add@nums\@tempdima\@tempdimb - \pIIe@addtoGraph\pIIe@concat@op - \endgroup} - \newcommand*\pIIe@translate[2]{\pIIe@concat\p@\z@\z@\p@{#1}{#2}} - \newcommand*\pIIe@rotate[1]{% - \begingroup - \@tempdima#1\relax - \edef\pIIe@tempa{\strip@pt\@tempdima}% - \CalculateSin\pIIe@tempa - \CalculateCos\pIIe@tempa - \edef\pIIe@tempb{\UseSin\pIIe@tempa}% - \edef\pIIe@tempc{\UseCos\pIIe@tempa}% - \pIIe@concat{\pIIe@tempc\p@}{\pIIe@tempb\p@}% - {-\pIIe@tempb\p@}{\pIIe@tempc\p@}\z@\z@ - \endgroup} - \newcommand*\pIIe@scale[2]{\pIIe@concat{#1}\z@\z@{#2}\z@\z@} - \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP 0 0 \pIIe@PTtoBP 0 0 \pIIe@concat@op} + \or + \newcommand*\pIIe@concat[6]{% + \begingroup + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@nums\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@concat@op + \endgroup} + \newcommand*\pIIe@translate[2]{\pIIe@concat\p@\z@\z@\p@{#1}{#2}} + \newcommand*\pIIe@rotate[1]{% + \begingroup + \@tempdima#1\relax + \edef\pIIe@tempa{\strip@pt\@tempdima}% + \CalculateSin\pIIe@tempa + \CalculateCos\pIIe@tempa + \edef\pIIe@tempb{\UseSin\pIIe@tempa}% + \edef\pIIe@tempc{\UseCos\pIIe@tempa}% + \pIIe@concat{\pIIe@tempc\p@}{\pIIe@tempb\p@}% + {-\pIIe@tempb\p@}{\pIIe@tempc\p@}\z@\z@ + \endgroup} + \newcommand*\pIIe@scale[2]{\pIIe@concat{#1}\z@\z@{#2}\z@\z@} + \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP 0 0 \pIIe@PTtoBP 0 0 \pIIe@concat@op} % \end{macrocode} % \end{macro} % \end{macro} @@ -2017,7 +2020,7 @@ % \noindent % (Currently, there are no other modes.) % \begin{macrocode} -\fi + \fi % \end{macrocode} % % \subsubsection{Path definitions} @@ -2027,7 +2030,7 @@ % Simple things \dots % \begin{macrocode} \newcommand*\pIIe@moveto[2]{% - \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@moveto@op} + \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@moveto@op} % \end{macrocode} % \end{macro} % @@ -2035,7 +2038,7 @@ % \dots\ have to be defined, too. % \begin{macrocode} \newcommand*\pIIe@lineto[2]{% - \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@lineto@op} + \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@lineto@op} % \end{macrocode} % \end{macro} % @@ -2043,24 +2046,24 @@ % We'll use \cmd{\pIIe@rcurveto} to draw quarter circles. % (\cmd{\circle} and \cmd{\oval}). % \begin{macrocode} -\ifcase\pIIe@mode\relax + \ifcase\pIIe@mode\relax % \end{macrocode} % % \begin{macro}{\pIIe@rcurveto} % \PS: % Use the ``rcurveto'' operator directly. % \begin{macrocode} -\or - \newcommand*\pIIe@rcurveto[6]{% - \begingroup - \@tempdima#1\relax \@tempdimb#2\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#3\relax \@tempdimb#4\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#5\relax \@tempdimb#6\relax - \pIIe@add@CP\@tempdima\@tempdimb - \pIIe@addtoGraph{rcurveto}% - \endgroup} + \or + \newcommand*\pIIe@rcurveto[6]{% + \begingroup + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph{rcurveto}% + \endgroup} % \end{macrocode} % \end{macro} % @@ -2071,27 +2074,27 @@ % change the ``current point'' must set \cmd{\pIIe@CPx} and % \cmd{\pIIe@CPy}. % \begin{macrocode} -\or - \newcommand*\pIIe@rcurveto[6]{% - \begingroup - \@tempdima#1\advance\@tempdima\pIIe@CPx\relax - \@tempdimb#2\advance\@tempdimb\pIIe@CPy\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#3\advance\@tempdima\pIIe@CPx\relax - \@tempdimb#4\advance\@tempdimb\pIIe@CPy\relax - \pIIe@add@nums\@tempdima\@tempdimb - \@tempdima#5\advance\@tempdima\pIIe@CPx\relax - \@tempdimb#6\advance\@tempdimb\pIIe@CPy\relax - \pIIe@add@CP\@tempdima\@tempdimb - \pIIe@addtoGraph\pIIe@curveto@op - \endgroup} + \or + \newcommand*\pIIe@rcurveto[6]{% + \begingroup + \@tempdima#1\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#2\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#4\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#6\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@curveto@op + \endgroup} % \end{macrocode} % \end{macro} % % \noindent % (Currently, there are no other modes.) % \begin{macrocode} -\fi + \fi % \end{macrocode} % % \begin{macro}{\pIIe@curveto} @@ -2137,130 +2140,161 @@ % \end{quote} % \changes{v0.2r}{2005/07/15}{Two wrong global assignment changed. (RN)} % \begin{macrocode} -\newcommand*\pIIe@pyth[3]{% - \begingroup - \@tempdima=#1\relax + \newcommand*\pIIe@pyth[3]{% + \begingroup + \@tempdima=#1\relax % \end{macrocode} % $\cmd{\@tempdima}=\mathrm{abs}(x)$ % \begin{macrocode} - \ifnum\@tempdima<\z@\@tempdima=-\@tempdima\fi - \@tempdimb=#2\relax + \ifnum\@tempdima<\z@\@tempdima=-\@tempdima\fi + \@tempdimb=#2\relax % \end{macrocode} % $\cmd{\@tempdimb}=\mathrm{abs}(y)$ % \begin{macrocode} - \ifnum\@tempdimb<\z@\@tempdimb=-\@tempdimb\fi + \ifnum\@tempdimb<\z@\@tempdimb=-\@tempdimb\fi % \end{macrocode} % $\cmd{\@tempdimb} = s = \mathrm{abs}(x)+\mathrm{abs}(y)$ % \begin{macrocode} - \advance\@tempdimb\@tempdima - \ifnum\@tempdimb=\z@ + \advance\@tempdimb\@tempdima + \ifnum\@tempdimb=\z@ % \end{macrocode} % $\cmd{\@tempdimc} = z = \sqrt{(x^2+y^2)}$ % \begin{macrocode} - \@tempdimc=\z@ - \else + \@tempdimc=\z@ + \else % \end{macrocode} % $\cmd{\@tempdima} = 8 \times\mathrm{abs}(x)$ % \begin{macrocode} - \multiply\@tempdima 8\relax + \multiply\@tempdima 8\relax % \end{macrocode} % $\cmd{\@tempdimc} = 8\,t = 8 \times\mathrm{abs}(x) / s$ % \begin{macrocode} - \pIIe@divide\@tempdima\@tempdimb\@tempdimc + \pIIe@divide\@tempdima\@tempdimb\@tempdimc % \end{macrocode} % $\cmd{\@tempdimc} = 4\tau = (8\,t-4)$ % \begin{macrocode} - \advance\@tempdimc -4pt - \multiply\@tempdimc 2 - \edef\pIIe@tempa{\strip@pt\@tempdimc}% + \advance\@tempdimc -4pt + \multiply\@tempdimc 2 + \edef\pIIe@tempa{\strip@pt\@tempdimc}% % \end{macrocode} % $\cmd{\@tempdima} = (8\,\tau)^2$ % \begin{macrocode} - \@tempdima=\pIIe@tempa\@tempdimc + \@tempdima=\pIIe@tempa\@tempdimc % \end{macrocode} % $\cmd{\@tempdima} = [64+(8\,\tau)^2]/2 =(8\,f)^2$ % \begin{macrocode} - \advance\@tempdima 64pt - \divide\@tempdima 2\relax + \advance\@tempdima 64pt + \divide\@tempdima 2\relax % \end{macrocode} % initial guess at $\sqrt{(u)}$ % \begin{macrocode} - \@dashdim=7pt + \@dashdim=7pt % \end{macrocode} % $\cmd{\@dashdim} = \sqrt{(u)}$ % \begin{macrocode} - \pIIe@@pyth\pIIe@@pyth\pIIe@@pyth - \edef\pIIe@tempa{\strip@pt\@dashdim}% - \@tempdimc=\pIIe@tempa\@tempdimb + \pIIe@@pyth\pIIe@@pyth\pIIe@@pyth + \edef\pIIe@tempa{\strip@pt\@dashdim}% + \@tempdimc=\pIIe@tempa\@tempdimb % \end{macrocode} % $\cmd{\@tempdimc} = z = (8\,f)\times s / 8$ % \begin{macrocode} - \global\divide\@tempdimc 8 - \fi - \edef\x{\endgroup#3=\the\@tempdimc}% - \x} + \global\divide\@tempdimc 8 + \fi + \edef\x{\endgroup#3=\the\@tempdimc}% + \x} % \end{macrocode} % \end{macro} % % \begin{macro}{\pIIe@@pyth} % $\cmd{\@dashdim} = g \leftarrow (g + u/g)/2$ % \begin{macrocode} -\newcommand*\pIIe@@pyth{% - \pIIe@divide\@tempdima\@dashdim\@tempdimc - \advance\@dashdim\@tempdimc - \divide\@dashdim\tw@} + \newcommand*\pIIe@@pyth{% + \pIIe@divide\@tempdima\@dashdim\@tempdimc + \advance\@dashdim\@tempdimc + \divide\@dashdim\tw@} % \end{macrocode} % \end{macro} % % \begin{macro}{\pIIe@divide} -% Real numbers are reresented as dimens in \texttt{pt}. If we divide by a -% dimen, it is transformed to a counter and therefore the result is divided -% by $2^{16}$. Hence we need to multiply by $2^{16}$ before the division. We -% multiply the numerator by the greatest power of 2 to avoid overflow and -% divide the denominator by the complementary power of 2. We use -% \cmd{\maxdimen} if the ratio overflow. -% -% -% We store some auxiliary dimens. -% \begin{macrocode} -\ifx\undefined\@maxdimhalfplus \newdimen\@maxdimhalfplus \fi -\ifx\undefined\@maxdim@two@xvi \newdimen\@maxdim@two@xvi \fi -\@maxdimhalfplus=\maxdimen \divide\@maxdimhalfplus\tw@ -\advance\@maxdimhalfplus 1sp -\@maxdim@two@xvi=\maxdimen \divide\@maxdim@two@xvi 65536 -\newcommand*\pIIe@divide[3]{% - \begingroup - \dimendef\@Numer=254\relax \dimendef\@Denom=252\relax - \@Numer=#1\relax \@Denom=#2\relax +% The following macro for division is a slight modification of the macro from +% \texttt{curve2e} by Claudio Beccari with his permission. +% Real numbers are represented as dimens in \texttt{pt}. +% \begin{macrocode} + \newcommand*\pIIe@divide[3]{% +% \end{macrocode} +% All definitions inside a group. +% \begin{macrocode} + \begingroup + \dimendef\Numer=254\relax \dimendef\Denom=252\relax + \countdef\Num=254\relax \countdef\Den=252\relax + \countdef\I=250\relax \countdef\Numb=248\relax + \Numer #1\relax \Denom #2\relax % \end{macrocode} % Make numerator and denominator nonnegative, save sign. % \begin{macrocode} - \ifdim\@Denom<\z@ \@Denom -\@Denom \@Numer -\@Numer \fi - \def\sign{}\ifdim\@Numer<\z@ \def\sign{-}\@Numer -\@Numer \fi + \ifdim\Denom<\z@ \Denom -\Denom \Numer=-\Numer \fi + \ifdim\Numer<\z@ \def\sign{-}\Numer=-\Numer \else \def\sign{}\fi % \end{macrocode} -% Small numerator multiply by $2^{16}$, otherwise by the greatest possible -% power of 2 and divide denominator by proper power of 2. +% Use \cmd{\maxdimen} for $x/0$ (this should not appear). % \begin{macrocode} - \ifdim \@Numer>\@maxdim@two@xvi - \@tempcnta=\z@ - \@whiledim \@Numer<\@maxdimhalfplus - \do {\multiply\@Numer\tw@ \advance\@tempcnta 1}% - \@whilenum \@tempcnta<16 - \do {\divide\@Denom\tw@ \advance\@tempcnta 1}% - \else - \@Numer 65536\@Numer - \fi + \ifdim\Denom=\z@ + \edef\Q{\strip@pt\maxdimen}% + \PackageWarning{pict2e}% + {Division by 0, \sign\strip@pt\maxdimen\space used}{}% + \else +% \end{macrocode} +% Converse to integers and find integer part of the ratio. If it is too +% large (dimension overflow), use \cmd{\maxdimen} otherwise find the +% remainder and start the iteration process to find 6 digits of the decimal +% expression. +% \begin{macrocode} + \Num=\Numer \Den=\Denom + \Numb=\Num \divide\Numb\Den + \ifnum\Numb>16383 + \edef\Q{\strip@pt\maxdimen}% + \PackageWarning{pict2e}% + {Division overflow, \sign\strip@pt\maxdimen\space used}{}% + \else + \edef\Q{\number\Numb.}% + \multiply \Numb\Den \advance\Num -\Numb + \I=6\relax + \@whilenum \I>\z@ \do{\pIIe@@divide\advance\I\m@ne}% + \fi + \fi % \end{macrocode} -% Divide, $0/0=1$ (this should not appear), $x/0$ as \cmd{\maxdimen} for -% $x\neq0$. +% A useful trick to define \#3 outside the group without using \cmd{\global} +% (if the macro is used inside another group.) % \begin{macrocode} - \ifdim \@Denom=\z@ - \ifdim \@Numer=\z@ \@Numer\p@ \else \@Numer\maxdimen \fi - \else - \divide\@Numer\@Denom - \fi - \global#3\sign\@Numer - \endgroup} + \edef\tempend{\noexpand\endgroup\noexpand#3=\sign\Q\p@}% + \tempend} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@@divide} +% Iteration macro for finding decimal expression of the ratio. \cmd{\Num} is +% the remainder of the previous division, \cmd{\Den} is the denominator (both +% are integers). +% \begin{macrocode} + \def\pIIe@@divide{% +% \end{macrocode} +% Reduce both numerator and denominator if necessary to avoid overflow in +% the next step. +% \begin{macrocode} + \@whilenum \Num>214748364 \do{\divide\Num\tw@ \divide\Den\tw@}% +% \end{macrocode} +% Find the next digit of the decimal expression. +% \begin{macrocode} + \multiply \Num 10 + \Numb=\Num \divide\Numb\Den + \edef\Q{\Q\number\Numb}% +% \end{macrocode} +% Find the remainder. +% \begin{macrocode} + \multiply \Numb\Den \advance \Num -\Numb +% \end{macrocode} +% Stop the iteration if the remainder is zero. +% \begin{macrocode} + \ifnum\Num>\z@\else\I=0\fi} % \end{macrocode} % \end{macro} % @@ -2269,24 +2303,24 @@ % \begin{macro}{\pIIe@checkslopeargs} % Common code for \cmd{\line} and \cmd{\vector}. % \begin{macrocode} -\newcommand*\pIIe@checkslopeargsline[2]{% - \pIIe@checkslopeargs{#1}{#2}{16383}} -\newcommand*\pIIe@checkslopeargsvector[2]{% - \pIIe@checkslopeargs{#1}{#2}{1000}} -\newcommand*\pIIe@checkslopeargs[3]{% - \def\@tempa{#1}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% - \def\@tempa{#2}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% + \newcommand*\pIIe@checkslopeargsline[2]{% + \pIIe@checkslopeargs{#1}{#2}{16383}} + \newcommand*\pIIe@checkslopeargsvector[2]{% + \pIIe@checkslopeargs{#1}{#2}{1000}} + \newcommand*\pIIe@checkslopeargs[3]{% + \def\@tempa{#1}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% + \def\@tempa{#2}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% % \end{macrocode} % A bit incompatible with \SL: slope \((0,0)\) raises an error. % \begin{macrocode} - \ifdim #1\p@=\z@ \ifdim #2\p@=\z@ \@badlinearg \fi\fi} -\def\pIIe@checkslopearg #1.#2:#3{% - \def\@tempa{#1}% - \ifx\@tempa\empty\def\@tempa{0}\fi - \ifx\@tempa\space\def\@tempa{0}\fi - \ifnum\ifnum\@tempa<\z@-\fi\@tempa>#3\@badlinearg \fi} -\def\@badlinearg{\PackageError - {pict2e}{Bad \protect\line\space or \protect\vector\space argument}{}} + \ifdim #1\p@=\z@ \ifdim #2\p@=\z@ \@badlinearg \fi\fi} + \def\pIIe@checkslopearg #1.#2:#3{% + \def\@tempa{#1}% + \ifx\@tempa\empty\def\@tempa{0}\fi + \ifx\@tempa\space\def\@tempa{0}\fi + \ifnum\ifnum\@tempa<\z@-\fi\@tempa>#3\@badlinearg \fi} + \def\@badlinearg{\PackageError + {pict2e}{Bad \protect\line\space or \protect\vector\space argument}{}} % \end{macrocode} % \end{macro} % @@ -2299,39 +2333,39 @@ % \changes{v0.2o}{2004/06/25}{Use \cmd{\pIIe@checkslopeargs} (HjG)} % \changes{v0.2t}{2008/05/11}{All lines by \cmd{\@sline} (JT)} % \begin{macrocode} -\def\line(#1,#2)#3{% - \pIIe@checkslopeargsline{#1}{#2}% - \@tempdima=#1pt\relax \@tempdimb=#2pt\relax - \@linelen #3\unitlength - \ifdim\@linelen<\z@ \@badlinearg \else \@sline \fi} + \def\line(#1,#2)#3{% + \pIIe@checkslopeargsline{#1}{#2}% + \@tempdima=#1pt\relax \@tempdimb=#2pt\relax + \@linelen #3\unitlength + \ifdim\@linelen<\z@ \@badlinearg \else \@sline \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@sline} % (The implementation here is different from \cmd{\vector}!) % \begin{macrocode} -\def\@sline{% - \begingroup - \ifdim\@tempdima=\z@ - \ifdim\@tempdimb<\z@\@linelen-\@linelen\fi - \@ydim=\@linelen - \@xdim=\z@ - \else - \ifdim\@tempdimb=\z@ - \ifdim\@tempdima<\z@\@linelen-\@linelen\fi - \@xdim=\@linelen - \@ydim=\z@ + \def\@sline{% + \begingroup + \ifdim\@tempdima=\z@ + \ifdim\@tempdimb<\z@\@linelen-\@linelen\fi + \@ydim=\@linelen + \@xdim=\z@ \else - \ifnum\@tempdima<\z@\@linelen-\@linelen\fi - \pIIe@divide\@tempdimb\@tempdima\dimen@ - \@ydim=\strip@pt\dimen@\@linelen - \@xdim=\@linelen + \ifdim\@tempdimb=\z@ + \ifdim\@tempdima<\z@\@linelen-\@linelen\fi + \@xdim=\@linelen + \@ydim=\z@ + \else + \ifnum\@tempdima<\z@\@linelen-\@linelen\fi + \pIIe@divide\@tempdimb\@tempdima\dimen@ + \@ydim=\strip@pt\dimen@\@linelen + \@xdim=\@linelen + \fi \fi - \fi - \pIIe@moveto\z@\z@ - \pIIe@lineto\@xdim\@ydim - \pIIe@strokeGraph - \endgroup} + \pIIe@moveto\z@\z@ + \pIIe@lineto\@xdim\@ydim + \pIIe@strokeGraph + \endgroup} % \end{macrocode} % \end{macro} % @@ -2352,41 +2386,41 @@ % ^^A (This is faster; is it more accurate?) % \changes{v0.2o}{2004/06/25}{Use \cmd{\pIIe@checkslopeargs} (HjG)} % \begin{macrocode} -\def\vector(#1,#2)#3{% - \begingroup - \pIIe@checkslopeargsvector{#1}{#2}% - \@tempdima=#1pt\relax \@tempdimb=#2pt\relax - \@linelen#3\unitlength - \ifdim\@linelen<\z@ \@badlinearg \else - \pIIe@pyth{\@tempdima}{\@tempdimb}\dimen@ - \ifdim\@tempdima=\z@ - \else\ifdim\@tempdimb=\z@ - \else + \def\vector(#1,#2)#3{% + \begingroup + \pIIe@checkslopeargsvector{#1}{#2}% + \@tempdima=#1pt\relax \@tempdimb=#2pt\relax + \@linelen#3\unitlength + \ifdim\@linelen<\z@ \@badlinearg \else + \pIIe@pyth{\@tempdima}{\@tempdimb}\dimen@ + \ifdim\@tempdima=\z@ + \else\ifdim\@tempdimb=\z@ + \else % \end{macrocode} % This calculation is only necessary, if the vector is actually % sloped. % \begin{macrocode} - \pIIe@divide\dimen@{\@tempdima}\@xdim - \@linelen\strip@pt\@xdim\@linelen - \ifdim\@linelen<\z@\@linelen-\@linelen\fi + \pIIe@divide\dimen@{\@tempdima}\@xdim + \@linelen\strip@pt\@xdim\@linelen + \ifdim\@linelen<\z@\@linelen-\@linelen\fi + \fi \fi - \fi % \end{macrocode} % \BigIndent $\sin\theta$ and $\cos\theta$ % \begin{macrocode} - \pIIe@divide{\@tempdimb}\dimen@\@ydim - \pIIe@divide{\@tempdima}\dimen@\@xdim + \pIIe@divide{\@tempdimb}\dimen@\@ydim + \pIIe@divide{\@tempdima}\dimen@\@xdim % \end{macrocode} % Rotate the following vector\slash arrow outlines by angle $\theta$. % \begin{macrocode} - \pIIe@concat\@xdim\@ydim{-\@ydim}\@xdim\z@\z@ + \pIIe@concat\@xdim\@ydim{-\@ydim}\@xdim\z@\z@ % \end{macrocode} % Internal command to draw the outline of the vector\slash arrow. % \begin{macrocode} - \pIIe@vector - \pIIe@fillGraph - \fi - \endgroup} + \pIIe@vector + \pIIe@fillGraph + \fi + \endgroup} % \end{macrocode} % \end{macro} % @@ -2396,7 +2430,7 @@ % that generates the vector's outline path. % Now initialized by package options, via |\AtEndOfPackage|. % \begin{macrocode} -\newcommand*\pIIe@vector{} + \newcommand*\pIIe@vector{} % \end{macrocode} % \end{macro} % @@ -2421,23 +2455,23 @@ % option. % probably\slash most likely not useful with the default % \textsf{ltxarrows} package option. -%\fi +% \fi % \begin{macrocode} -\newcommand*\pIIe@FAL{}\newcommand*\pIIe@FAW{}\newcommand*\pIIe@CAW{} -\newcommand*\pIIe@FAI{} -\newcommand*\pIIe@@firstnum{}\newcommand*\pIIe@@secondnum{} -\iffalse% the pstricks values gives too small arrows. (RN) -\AtBeginDocument{% - \@ifpackageloaded{pstricks}{% - \def\pIIe@FAL{\psk@arrowlength}% - \def\pIIe@FAW{\expandafter\pIIe@@secondnum\psk@arrowsize}% - \def\pIIe@CAW{\expandafter\pIIe@@firstnum\psk@arrowsize}% - \def\pIIe@FAI{\psk@arrowinset}% - \def\pIIe@@firstnum#1 #2 {#1\p@}% - \def\pIIe@@secondnum#1 #2 {#2}% - }{}% -} -\fi + \newcommand*\pIIe@FAL{}\newcommand*\pIIe@FAW{}\newcommand*\pIIe@CAW{} + \newcommand*\pIIe@FAI{} + \newcommand*\pIIe@@firstnum{}\newcommand*\pIIe@@secondnum{} + \iffalse% the pstricks values gives too small arrows. (RN) + \AtBeginDocument{% + \@ifpackageloaded{pstricks}{% + \def\pIIe@FAL{\psk@arrowlength}% + \def\pIIe@FAW{\expandafter\pIIe@@secondnum\psk@arrowsize}% + \def\pIIe@CAW{\expandafter\pIIe@@firstnum\psk@arrowsize}% + \def\pIIe@FAI{\psk@arrowinset}% + \def\pIIe@@firstnum#1 #2 {#1\p@}% + \def\pIIe@@secondnum#1 #2 {#2}% + }{}% + } + \fi % \end{macrocode} % \end{macro} % \end{macro} @@ -2556,59 +2590,59 @@ % of the arrow head. % ^^A (Orig.\ \LaTeX: only, if length =~0!?) % \begin{macrocode} -\newcommand*\pIIe@vector@ltx{% - \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax - \@ovxx\pIIe@FAL\@ydim - \@xdim\@linelen \advance\@xdim-\@ovxx - \divide\@ydim\tw@ - \divide\@ovxx\tw@ \advance\@ovxx\@xdim - \@ovyy\@ydim - \divide\@ovyy\tw@ \advance\@ovyy-\pIIe@FAI\@ydim + \newcommand*\pIIe@vector@ltx{% + \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax + \@ovxx\pIIe@FAL\@ydim + \@xdim\@linelen \advance\@xdim-\@ovxx + \divide\@ydim\tw@ + \divide\@ovxx\tw@ \advance\@ovxx\@xdim + \@ovyy\@ydim + \divide\@ovyy\tw@ \advance\@ovyy-\pIIe@FAI\@ydim % \end{macrocode} % \noindent % \BigIndent $P_d = P_1 + 1/3 (P_n - P_1)$ % \begin{macrocode} - \pIIe@bezier@QtoC\@linelen\@ovxx\@ovro - \pIIe@bezier@QtoC\z@\@ovyy\@ovri + \pIIe@bezier@QtoC\@linelen\@ovxx\@ovro + \pIIe@bezier@QtoC\z@\@ovyy\@ovri % \end{macrocode} % \BigIndent $P_c = P_7 + 1/3 (P_n - P_7)$ % \begin{macrocode} - \pIIe@bezier@QtoC\@xdim\@ovxx\@clnwd - \pIIe@bezier@QtoC\@ydim\@ovyy\@clnht + \pIIe@bezier@QtoC\@xdim\@ovxx\@clnwd + \pIIe@bezier@QtoC\@ydim\@ovyy\@clnht % \end{macrocode} % \BigIndent $P_1$ % \begin{macrocode} - \pIIe@moveto\@linelen\z@ + \pIIe@moveto\@linelen\z@ % \end{macrocode} % \BigIndent $P_a \quad P_b \quad P_2$ % \begin{macrocode} - \pIIe@curveto\@ovro{-\@ovri}\@clnwd{-\@clnht}\@xdim{-\@ydim}% - \ifdim\@xdim>\z@ + \pIIe@curveto\@ovro{-\@ovri}\@clnwd{-\@clnht}\@xdim{-\@ydim}% + \ifdim\@xdim>\z@ % \end{macrocode} % \BigIndent $P_3$ % \begin{macrocode} - \pIIe@lineto\@xdim{-\@halfwidth}% + \pIIe@lineto\@xdim{-\@halfwidth}% % \end{macrocode} % \BigIndent $P_4$ % \begin{macrocode} - \pIIe@lineto\z@{-\@halfwidth}% + \pIIe@lineto\z@{-\@halfwidth}% % \end{macrocode} % \BigIndent $P_5$ % \begin{macrocode} - \pIIe@lineto\z@{\@halfwidth}% + \pIIe@lineto\z@{\@halfwidth}% % \end{macrocode} % \BigIndent $P_6$ % \begin{macrocode} - \pIIe@lineto\@xdim{\@halfwidth}% - \fi + \pIIe@lineto\@xdim{\@halfwidth}% + \fi % \end{macrocode} % \BigIndent $P_7$ % \begin{macrocode} - \pIIe@lineto\@xdim\@ydim + \pIIe@lineto\@xdim\@ydim % \end{macrocode} % \BigIndent $P_c \quad P_d \quad P_1$ % \begin{macrocode} - \pIIe@curveto\@clnwd\@clnht\@ovro\@ovri\@linelen\z@} + \pIIe@curveto\@clnwd\@clnht\@ovro\@ovri\@linelen\z@} % \end{macrocode} % \end{macro} % @@ -2697,56 +2731,56 @@ % of the arrow head. % ^^A (Orig.\ \LaTeX: only, if length =~0!?) % \begin{macrocode} -\newcommand*\pIIe@vector@pst{% - \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax - \@ovxx\pIIe@FAL\@ydim - \@xdim\@linelen \advance\@xdim-\@ovxx - \divide\@ydim\tw@ - \@ovyy\@ydim \advance\@ovyy-\@halfwidth - \@ovdx\pIIe@FAI\@ovxx - \pIIe@divide\@ovdx\@ydim\@tempdimc - \@ovxx\strip@pt\@ovyy\@tempdimc - \advance\@ovxx\@xdim - \advance\@ovdx\@xdim + \newcommand*\pIIe@vector@pst{% + \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax + \@ovxx\pIIe@FAL\@ydim + \@xdim\@linelen \advance\@xdim-\@ovxx + \divide\@ydim\tw@ + \@ovyy\@ydim \advance\@ovyy-\@halfwidth + \@ovdx\pIIe@FAI\@ovxx + \pIIe@divide\@ovdx\@ydim\@tempdimc + \@ovxx\strip@pt\@ovyy\@tempdimc + \advance\@ovxx\@xdim + \advance\@ovdx\@xdim % \end{macrocode} % \BigIndent $P_1$ % \begin{macrocode} - \pIIe@moveto\@linelen\z@ + \pIIe@moveto\@linelen\z@ % \end{macrocode} % \BigIndent $P_2$ % \begin{macrocode} - \pIIe@lineto\@xdim{-\@ydim}% - \ifdim\@xdim>\z@ + \pIIe@lineto\@xdim{-\@ydim}% + \ifdim\@xdim>\z@ % \end{macrocode} % \BigIndent $P_3$ % \begin{macrocode} - \pIIe@lineto\@ovxx{-\@halfwidth}% + \pIIe@lineto\@ovxx{-\@halfwidth}% % \end{macrocode} % \BigIndent $P_4$ % \begin{macrocode} - \pIIe@lineto\z@{-\@halfwidth}% + \pIIe@lineto\z@{-\@halfwidth}% % \end{macrocode} % \BigIndent $P_5$ % \begin{macrocode} - \pIIe@lineto\z@{\@halfwidth}% + \pIIe@lineto\z@{\@halfwidth}% % \end{macrocode} % \BigIndent $P_6$ % \begin{macrocode} - \pIIe@lineto\@ovxx{\@halfwidth}% - \else + \pIIe@lineto\@ovxx{\@halfwidth}% + \else % \end{macrocode} % \BigIndent $P_i$ % \begin{macrocode} - \pIIe@lineto\@ovdx\z@ - \fi + \pIIe@lineto\@ovdx\z@ + \fi % \end{macrocode} % \BigIndent $P_7$ % \begin{macrocode} - \pIIe@lineto\@xdim\@ydim + \pIIe@lineto\@xdim\@ydim % \end{macrocode} % \BigIndent $P_1$ % \begin{macrocode} - \pIIe@lineto\@linelen\z@} + \pIIe@lineto\@linelen\z@} % \end{macrocode} % \end{macro} % @@ -2756,14 +2790,14 @@ % \begin{macro}{\@circle} % The circle will either be stroked \dots % \begin{macrocode} - \def\@circle#1{\begingroup \@tempswafalse\pIIe@circ{#1}} + \def\@circle#1{\begingroup \@tempswafalse\pIIe@circ{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@dot} % \dots\ or filled. % \begin{macrocode} - \def\@dot#1{\begingroup \@tempswatrue\pIIe@circ{#1}} + \def\@dot#1{\begingroup \@tempswatrue\pIIe@circ{#1}} % \end{macrocode} % \end{macro} % @@ -2771,7 +2805,7 @@ % Common code. % ^^A (Could\slash should be named \cmd{\@circ}!?) % \begin{macrocode} -\newcommand*\pIIe@circ[1]{% + \newcommand*\pIIe@circ[1]{% % \end{macrocode} % We need the radius instead of the diameter. % Unlike \SL, we check for negative or zero diameter argument. @@ -2780,10 +2814,10 @@ % argument (RN,HjG)} % \changes{v0.2n}{2004/04/22}{Allow zero diameter (RN/HjG)} % \begin{macrocode} - \@tempdima#1\unitlength - \ifdim\@tempdima<\z@ \pIIe@badcircarg \fi - \divide\@tempdima\tw@ - \pIIe@circle\@tempdima + \@tempdima#1\unitlength + \ifdim\@tempdima<\z@ \pIIe@badcircarg \fi + \divide\@tempdima\tw@ + \pIIe@circle\@tempdima % \end{macrocode} % With the current state of affairs, we could use % \cmd{\pIIe@drawGraph} directly; but that would possibly be a case of @@ -2792,8 +2826,8 @@ % Use of the |@tempswa| switch both here and inside quarter-circle! % Hence a group is necessary there.) % \begin{macrocode} - \if@tempswa \pIIe@fillGraph \else \pIIe@strokeGraph \fi - \endgroup} + \if@tempswa \pIIe@fillGraph \else \pIIe@strokeGraph \fi + \endgroup} % \end{macrocode} % \end{macro} % @@ -2804,12 +2838,12 @@ % \cmd{\pIIe@add@qcircle}). (HjG,RN)} % \changes{v0.1t}{2008/05/11}{Changed code (using \cmd{\buttcap}. (JT)} % \begin{macrocode} -\newcommand*\pIIe@circle[1]{% - \begingroup - \buttcap - \pIIe@qcircle[1]\z@{#1}\pIIe@qcircle \@ne{#1}% - \pIIe@qcircle \tw@{#1}\pIIe@qcircle\thr@@{#1}% - \endgroup} + \newcommand*\pIIe@circle[1]{% + \begingroup + \buttcap + \pIIe@qcircle[1]\z@{#1}\pIIe@qcircle \@ne{#1}% + \pIIe@qcircle \tw@{#1}\pIIe@qcircle\thr@@{#1}% + \endgroup} % \end{macrocode} % \end{macro} % @@ -2870,33 +2904,33 @@ % Sacrifice a save level (otherwise a private ``switch'' macro were % necessary!) % \begin{macrocode} -\newcommand*\pIIe@qcircle[3][0]{% - \begingroup - \@ovro#3\relax \@ovri0.55228474983\@ovro - \@tempdimc\@ovri \advance\@tempdimc-\@ovro - \ifnum#1>\z@ \@tempswatrue \else \@tempswafalse \fi - \ifcase#2\relax + \newcommand*\pIIe@qcircle[3][0]{% + \begingroup + \@ovro#3\relax \@ovri0.55228474983\@ovro + \@tempdimc\@ovri \advance\@tempdimc-\@ovro + \ifnum#1>\z@ \@tempswatrue \else \@tempswafalse \fi + \ifcase#2\relax % \end{macrocode} % \BigIndent NE % \begin{macrocode} - \pIIe@@qcircle\@ovro\z@\z@\@ovri\@tempdimc\@ovro{-\@ovro}\@ovro - \or + \pIIe@@qcircle\@ovro\z@\z@\@ovri\@tempdimc\@ovro{-\@ovro}\@ovro + \or % \end{macrocode} % \BigIndent NW % \begin{macrocode} - \pIIe@@qcircle\z@\@ovro{-\@ovri}\z@{-\@ovro}\@tempdimc{-\@ovro}{-\@ovro}% - \or + \pIIe@@qcircle\z@\@ovro{-\@ovri}\z@{-\@ovro}\@tempdimc{-\@ovro}{-\@ovro}% + \or % \end{macrocode} % \BigIndent SW % \begin{macrocode} - \pIIe@@qcircle{-\@ovro}\z@\z@{-\@ovri}{-\@tempdimc}{-\@ovro}\@ovro{-\@ovro}% - \or + \pIIe@@qcircle{-\@ovro}\z@\z@{-\@ovri}{-\@tempdimc}{-\@ovro}\@ovro{-\@ovro}% + \or % \end{macrocode} % \BigIndent SE % \begin{macrocode} - \pIIe@@qcircle\z@{-\@ovro}\@ovri\z@\@ovro{-\@tempdimc}\@ovro\@ovro - \fi - \endgroup} + \pIIe@@qcircle\z@{-\@ovro}\@ovri\z@\@ovro{-\@tempdimc}\@ovro\@ovro + \fi + \endgroup} % \end{macrocode} % \end{macro} % @@ -2909,8 +2943,8 @@ % least much easier) to re-use this macro for the rounded corners of % ovals. % \begin{macrocode} -\newcommand*\pIIe@@qcircle[8]{% - \if@tempswa\pIIe@moveto{#1}{#2}\fi \pIIe@rcurveto{#3}{#4}{#5}{#6}{#7}{#8}} + \newcommand*\pIIe@@qcircle[8]{% + \if@tempswa\pIIe@moveto{#1}{#2}\fi \pIIe@rcurveto{#3}{#4}{#5}{#6}{#7}{#8}} % \end{macrocode} % \end{macro} % @@ -2918,11 +2952,11 @@ % \changes{v0.2h}{2004/01/07}{New error message. (RN,HjG)} % Obvious cousin to |\@badlinearg| from the \LaTeX\ kernel. % \begin{macrocode} -\newcommand*\pIIe@badcircarg{% - \PackageError{pict2e}% - {Illegal argument in \protect\circle(*), \protect\oval, \protect\arc(*) or - \protect\circlearc.}% - {The radius of a circle, dot, arc or oval corner must be greater than zero.}}% + \newcommand*\pIIe@badcircarg{% + \PackageError{pict2e}% + {Illegal argument in \protect\circle(*), \protect\oval, \protect\arc(*) or + \protect\circlearc.}% + {The radius of a circle, dot, arc or oval corner must be greater than zero.}}% % \end{macrocode} % \end{macro} % @@ -2940,7 +2974,7 @@ % argument of \cmd{\oval} by the \LaTeX\ manual % \cite[p.~223]{LAMPORT}. % \begin{macrocode} -\newcommand*\maxovalrad{20pt} + \newcommand*\maxovalrad{20pt} % \end{macrocode} % \end{macro} % @@ -2955,8 +2989,8 @@ % See \cmd{\Gin@defaultbp} and \cmd{\Gin@def@bp} from % \texttt{graphics.dtx}. % \begin{macrocode} -\newcommand*\pIIe@defaultUL[2]{% - \afterassignment\pIIe@def@UL\dimen@#2\unitlength\relax{#1}{#2}} + \newcommand*\pIIe@defaultUL[2]{% + \afterassignment\pIIe@def@UL\dimen@#2\unitlength\relax{#1}{#2}} % \end{macrocode} % However, things are simpler in our case, since we always need the % value stored in \cmd{\dimen@}. @@ -2966,14 +3000,14 @@ % \changes{v0.2n}{2004/04/22}{Moved radius test to \cmd{\oval}, % where it belongs (RN/HjG)} % \begin{macrocode} -\newcommand*\pIIe@def@UL{} -\def\pIIe@def@UL#1\relax#2#3{% + \newcommand*\pIIe@def@UL{} + \def\pIIe@def@UL#1\relax#2#3{% % \if!#1!% % \def#2{#3}% \edef ? % \else % \edef#2{\strip@pt\dimen@}% % \fi - \edef#2{\the\dimen@}} + \edef#2{\the\dimen@}} % \end{macrocode} % \end{macro} % \end{macro} @@ -2990,15 +3024,15 @@ % (RN/HjG)} % \changes{v0.2n}{2004/04/22}{Allow zero diameter (RN/HjG)} % \begin{macrocode} -\newcommand*\pIIe@maxovalrad{} -\renewcommand*\oval[1][\maxovalrad]{% - \begingroup \pIIe@defaultUL\pIIe@maxovalrad{#1}% - \ifdim\pIIe@maxovalrad<\z@ \pIIe@badcircarg \fi + \newcommand*\pIIe@maxovalrad{} + \renewcommand*\oval[1][\maxovalrad]{% + \begingroup \pIIe@defaultUL\pIIe@maxovalrad{#1}% + \ifdim\pIIe@maxovalrad<\z@ \pIIe@badcircarg \fi % \end{macrocode} % Can't close the group here, since arguments must be parsed. % (This is done by calling the saved original.) % \begin{macrocode} - \pIIe@oldoval} + \pIIe@oldoval} % \end{macrocode} % \end{macro} % \end{macro} @@ -3006,33 +3040,33 @@ % \begin{macro}{\@oval} % (This is called in turn by the saved original.) % \begin{macrocode} -\def\@oval(#1,#2)[#3]{% + \def\@oval(#1,#2)[#3]{% % \end{macrocode} % In analogy to circles, we need only half of the size value. % \begin{macrocode} - \@ovxx#1\unitlength \divide\@ovxx\tw@ - \@ovyy#2\unitlength \divide\@ovyy\tw@ - \@tempdimc \ifdim\@ovyy>\@ovxx \@ovxx \else \@ovyy \fi - \ifdim\pIIe@maxovalrad<\@tempdimc \@tempdimc\pIIe@maxovalrad\relax \fi + \@ovxx#1\unitlength \divide\@ovxx\tw@ + \@ovyy#2\unitlength \divide\@ovyy\tw@ + \@tempdimc \ifdim\@ovyy>\@ovxx \@ovxx \else \@ovyy \fi + \ifdim\pIIe@maxovalrad<\@tempdimc \@tempdimc\pIIe@maxovalrad\relax \fi % \end{macrocode} % Subtract the radius of the corners to get coordinates for the % straight line segments. % \begin{macrocode} - \@xdim\@ovxx \advance\@xdim-\@tempdimc - \@ydim\@ovyy \advance\@ydim-\@tempdimc + \@xdim\@ovxx \advance\@xdim-\@tempdimc + \@ydim\@ovyy \advance\@ydim-\@tempdimc % \end{macrocode} % Determine which parts of the oval we have to draw. % \begin{macrocode} - \pIIe@get@quadrants{#3}% + \pIIe@get@quadrants{#3}% % \end{macrocode} % For the whole oval remove use the standard shape of ends. % \begin{macrocode} - \ifnum15=\@tempcnta \buttcap \fi + \ifnum15=\@tempcnta \buttcap \fi % \end{macrocode} % ``\verb+@tempswa+ = false'' means, that we have to suppress the `moveto' % in the following quadrant. % \begin{macrocode} - \@tempswatrue + \@tempswatrue % \end{macrocode} % The following isn't strictly necessary, but yields a single (unfragmented) % path even for \verb+[r]+ (right half of oval only). @@ -3041,35 +3075,35 @@ % \noindent % Bits 3 and 0 set? (SE/NE) % \begin{macrocode} - \ifnum9=\@tempcnta - \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ + \ifnum9=\@tempcnta + \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ % \end{macrocode} % Bit 0 set! (NE) % \begin{macrocode} - \@tempcnta\@ne - \fi + \@tempcnta\@ne + \fi % \end{macrocode} % Bit 0 set? (NE) % \begin{macrocode} - \pIIe@qoval\@ovxx\z@\@ovxx\@ydim\z@\@tempdimc\z@\@ovyy + \pIIe@qoval\@ovxx\z@\@ovxx\@ydim\z@\@tempdimc\z@\@ovyy % \end{macrocode} % Bit 1 set? (NW) % \begin{macrocode} - \pIIe@qoval\z@\@ovyy{-\@xdim}\@ovyy\@ne\@tempdimc{-\@ovxx}\z@ + \pIIe@qoval\z@\@ovyy{-\@xdim}\@ovyy\@ne\@tempdimc{-\@ovxx}\z@ % \end{macrocode} % Bit 2 set? (SW) % \begin{macrocode} - \pIIe@qoval{-\@ovxx}\z@{-\@ovxx}{-\@ydim}\tw@\@tempdimc\z@{-\@ovyy}% + \pIIe@qoval{-\@ovxx}\z@{-\@ovxx}{-\@ydim}\tw@\@tempdimc\z@{-\@ovyy}% % \end{macrocode} % Bit 3 set? (SE) % \begin{macrocode} - \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ + \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ % \end{macrocode} % Now we've finished, draw the oval and finally close the group opened % by \cmd{\oval} above. % \begin{macrocode} - \pIIe@strokeGraph - \endgroup} + \pIIe@strokeGraph + \endgroup} % \end{macrocode} % \end{macro} % @@ -3083,7 +3117,7 @@ % (\PS: We could use the \texttt{arc} or \texttt{arcto} operator!) % \begin{macrocode} \newcommand*\pIIe@qoval[8]{% -% \end{macrocode} +% \end{macrocode} % Bit set? % \begin{macrocode} \ifodd\@tempcnta @@ -3113,13 +3147,13 @@ % We abuse \cmd{\@setfpsbit} from the float processing modules of the % kernel. % ^^A (Should this go to section low-level?) -% \begin{macrocode} +% \begin{macrocode} \newcommand*\pIIe@get@quadrants[1]{% \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue \@tempcnta\z@ \@tfor\reserved@a:=#1\do{\csname @ov\reserved@a false\endcsname}% \if@ovr \if@ovb\@setfpsbit2\fi \if@ovt\@setfpsbit4\fi \fi \if@ovl \if@ovb\@setfpsbit1\fi \if@ovt\@setfpsbit8\fi \fi} -% \end{macrocode} +% \end{macrocode} % \end{macro} % % \subsubsection{Quadratic Bezier Curve} @@ -3131,9 +3165,8 @@ % \changes{v0.2o}{2004/06/25} % {Supply \cmd{\ignorespaces} to match kernel version (HjG)} % \changes{v0.2p}{2004/07/27}{\cmd{\@killglue} added. (RN)} -% \#1, the maximum number of points to use, is simply ignored, -% as well as \cmd{\qbeziermax}. % +% If \#1=0 the primitive operators ot the (back-end) format are used. % The kernel version of \cmd{\@bezier} uses \cmd{\put} internally, % which features \cmd{\@killglue} and \cmd{\ignorespaces} commands % in turn (at the beginning and end, respectively). @@ -3141,11 +3174,12 @@ % by hand. % \begin{macrocode} \def\@bezier#1(#2,#3)(#4,#5)(#6,#7){% + \ifnum #1=\z@ % \end{macrocode} % \BigIndent $P_0=(\#2,\#3)$\quad$P_m=(\#4,\#5)$\quad$P_3=(\#6,\#7)$ % \begin{macrocode} - \@killglue - \begingroup + \@killglue + \begingroup \@ovxx#2\unitlength \@ovyy#3\unitlength \@ovdx#4\unitlength \@ovdy#5\unitlength \@xdim#6\unitlength \@ydim#7\unitlength @@ -3169,8 +3203,11 @@ % \begin{macrocode} \pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim \pIIe@strokeGraph - \endgroup - \ignorespaces} + \endgroup + \ignorespaces + \else + \pIIe@old@bezier{#1}(#2,#3)(#4,#5)(#6,#7) + \fi} % \end{macrocode} % \end{macro} % @@ -3185,10 +3222,10 @@ % \noindent % (Missing: Reference for mathematical formula. Or is this trivial?) % \begin{macrocode} - \newcommand*\pIIe@bezier@QtoC[3]{% - \@tempdimc#1\relax \advance\@tempdimc-#2\relax - \divide\@tempdimc\thr@@ \advance\@tempdimc #2\relax - #3\@tempdimc} + \newcommand*\pIIe@bezier@QtoC[3]{% + \@tempdimc#1\relax \advance\@tempdimc-#2\relax + \divide\@tempdimc\thr@@ \advance\@tempdimc #2\relax + #3\@tempdimc} % \end{macrocode} % \end{macro} % @@ -3197,9 +3234,9 @@ % % We need some auxiliary dimensions. % \begin{macrocode} -\ifx\undefined\@arclen \newdimen\@arclen \fi -\ifx\undefined\@arcrad \newdimen\@arcrad \fi -\ifx\undefined\@tempdimd \newdimen\@tempdimd \fi + \ifx\undefined\@arclen \newdimen\@arclen \fi + \ifx\undefined\@arcrad \newdimen\@arcrad \fi + \ifx\undefined\@tempdimd \newdimen\@tempdimd \fi % \end{macrocode} % \begin{macro}{\pIIe@arc} % \#1: 0 (implicit) if we connect arc with a current point, 1 if we start @@ -3210,85 +3247,85 @@ % sense (clockwise). First we check whether the radius is not negative and % reduce the rotation to the interval $[-720,720]$. % \begin{macrocode} -\newcommand*\pIIe@arc[6][0]{% - \@arcrad #4\relax - \ifdim \@arcrad<\z@ \pIIe@badcircarg \else - \@arclen #6\p@ \advance\@arclen -#5\p@ - \ifdim \@arclen<\z@ \def\sign{-}\else\def\sign{}\fi - \ifdim \sign\@arclen>720\p@ - \PackageWarning {pict2e}{The arc angle is reduced to -720..720}% - \@whiledim \sign\@arclen>720\p@ \do {\advance\@arclen-\sign360\p@}% - \@tempdima #5\p@ \advance\@tempdima \@arclen - \edef\@angleend{\strip@pt\@tempdima}% - \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{\@angleend}% - \else - \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{#6}% - \fi - \fi} + \newcommand*\pIIe@arc[6][0]{% + \@arcrad #4\relax + \ifdim \@arcrad<\z@ \pIIe@badcircarg \else + \@arclen #6\p@ \advance\@arclen -#5\p@ + \ifdim \@arclen<\z@ \def\sign{-}\else\def\sign{}\fi + \ifdim \sign\@arclen>720\p@ + \PackageWarning {pict2e}{The arc angle is reduced to -720..720}% + \@whiledim \sign\@arclen>720\p@ \do {\advance\@arclen-\sign360\p@}% + \@tempdima #5\p@ \advance\@tempdima \@arclen + \edef\@angleend{\strip@pt\@tempdima}% + \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{\@angleend}% + \else + \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{#6}% + \fi + \fi} % \end{macrocode} % If the angle (its absolute value) is too large, the arc is recursively % divided into 2 parts until the angle is at most 90~degrees. % \begin{macrocode} -\newcommand*\pIIe@@arc[6]{% - \begingroup - \ifdim \sign\@arclen>90\p@ - \divide\@arclen 2 - \@tempdima #5\p@ \advance\@tempdima \@arclen - \edef\@anglemid{\strip@pt\@tempdima}% - \def\@temp{\pIIe@@arc{#1}{#2}{#3}{#4}{#5}}% - \expandafter\@temp\expandafter{\@anglemid}% - \def\@temp{\pIIe@@arc{2}{#2}{#3}{#4}}% - \expandafter\@temp\expandafter{\@anglemid}{#6}% - \else + \newcommand*\pIIe@@arc[6]{% + \begingroup + \ifdim \sign\@arclen>90\p@ + \divide\@arclen 2 + \@tempdima #5\p@ \advance\@tempdima \@arclen + \edef\@anglemid{\strip@pt\@tempdima}% + \def\@temp{\pIIe@@arc{#1}{#2}{#3}{#4}{#5}}% + \expandafter\@temp\expandafter{\@anglemid}% + \def\@temp{\pIIe@@arc{2}{#2}{#3}{#4}}% + \expandafter\@temp\expandafter{\@anglemid}{#6}% + \else % \end{macrocode} % We approximate the arc by a Bezier curve. First we calculate the % coordinates of the initial point: % \begin{macrocode} - \CalculateSin{#5}\CalculateCos{#5}% - \@tempdima\UseCos{#5}\@arcrad \advance\@tempdima #2\relax - \@tempdimb\UseSin{#5}\@arcrad \advance\@tempdimb #3\relax + \CalculateSin{#5}\CalculateCos{#5}% + \@tempdima\UseCos{#5}\@arcrad \advance\@tempdima #2\relax + \@tempdimb\UseSin{#5}\@arcrad \advance\@tempdimb #3\relax % \end{macrocode} % The coordinates are added to the path if and how necessary: % \begin{macrocode} - \ifcase #1\relax - \pIIe@lineto\@tempdima\@tempdimb - \or \pIIe@moveto\@tempdima\@tempdimb - \or - \else \PackageWarning {pict2e}% - {Illegal obligatory argument in \protect\circlearc.}% - \fi + \ifcase #1\relax + \pIIe@lineto\@tempdima\@tempdimb + \or \pIIe@moveto\@tempdima\@tempdimb + \or + \else \PackageWarning {pict2e}% + {Illegal obligatory argument in \protect\circlearc.}% + \fi % \end{macrocode} % The distance of control points from the endpoints is $\frac 43 r \tan \frac % \varphi4$ ($\varphi$ is the angle and $r$ is the radius of the arc). % \begin{macrocode} - \@tempdimc\@arclen \divide\@tempdimc\@iv - \edef\@angle{\strip@pt\@tempdimc}\CalculateTan{\@angle}% - \@linelen\UseTan{\@angle}\@arcrad \@linelen4\@linelen \divide\@linelen\thr@@ + \@tempdimc\@arclen \divide\@tempdimc\@iv + \edef\@angle{\strip@pt\@tempdimc}\CalculateTan{\@angle}% + \@linelen\UseTan{\@angle}\@arcrad \@linelen4\@linelen \divide\@linelen\thr@@ % \end{macrocode} % Coordinates of the first control point, added to the path: % \begin{macrocode} - \advance\@tempdima-\UseSin{#5}\@linelen - \advance\@tempdimb \UseCos{#5}\@linelen - \pIIe@add@nums\@tempdima\@tempdimb + \advance\@tempdima-\UseSin{#5}\@linelen + \advance\@tempdimb \UseCos{#5}\@linelen + \pIIe@add@nums\@tempdima\@tempdimb % \end{macrocode} % Coordinates of the endpoint: % \begin{macrocode} - \CalculateSin{#6}\CalculateCos{#6}% - \@tempdima \UseCos{#6}\@arcrad \advance\@tempdima #2\relax - \@tempdimb \UseSin{#6}\@arcrad \advance\@tempdimb #3\relax + \CalculateSin{#6}\CalculateCos{#6}% + \@tempdima \UseCos{#6}\@arcrad \advance\@tempdima #2\relax + \@tempdimb \UseSin{#6}\@arcrad \advance\@tempdimb #3\relax % \end{macrocode} % Coordinates of the second control point: % \begin{macrocode} - \@tempdimc \UseSin{#6}\@linelen \advance\@tempdimc \@tempdima - \@tempdimd-\UseCos{#6}\@linelen \advance\@tempdimd \@tempdimb + \@tempdimc \UseSin{#6}\@linelen \advance\@tempdimc \@tempdima + \@tempdimd-\UseCos{#6}\@linelen \advance\@tempdimd \@tempdimb % \end{macrocode} % Adding the second control point and the endpoint to the path % \begin{macrocode} - \pIIe@add@nums\@tempdimc\@tempdimd - \pIIe@add@CP\@tempdima\@tempdimb - \pIIe@addtoGraph\pIIe@curveto@op - \fi - \endgroup} + \pIIe@add@nums\@tempdimc\@tempdimd + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@curveto@op + \fi + \endgroup} % \end{macrocode} % \end{macro} % \begin{macro}{\arc} @@ -3297,17 +3334,17 @@ % obligatory first parameter comma separated pair of angles (initial and % final). % \begin{macrocode} -\newcommand*\arc{\@ifstar{\@tempswatrue\@arc}{\@tempswafalse\@arc}} -\newcommand*\@arc[2][0,360]{\@@arc(#1){#2}} -\def\@@arc(#1,#2)#3{% - \if@tempswa - \pIIe@moveto\z@\z@ - \pIIe@arc{\z@}{\z@}{#3\unitlength}{#1}{#2}% - \pIIe@closepath\pIIe@fillGraph - \else - \pIIe@arc[1]{\z@}{\z@}{#3\unitlength}{#1}{#2}% - \pIIe@strokeGraph - \fi} + \newcommand*\arc{\@ifstar{\@tempswatrue\@arc}{\@tempswafalse\@arc}} + \newcommand*\@arc[2][0,360]{\@@arc(#1){#2}} + \def\@@arc(#1,#2)#3{% + \if@tempswa + \pIIe@moveto\z@\z@ + \pIIe@arc{\z@}{\z@}{#3\unitlength}{#1}{#2}% + \pIIe@closepath\pIIe@fillGraph + \else + \pIIe@arc[1]{\z@}{\z@}{#3\unitlength}{#1}{#2}% + \pIIe@strokeGraph + \fi} % \end{macrocode} % \end{macro} % @@ -3524,7 +3561,7 @@ % \end{macrocode} % % -%\ifdeveloping +% \ifdeveloping % % \section{Bugs} % @@ -3552,11 +3589,11 @@ % \hline % \end{tabular} % -%\iffalse +% \iffalse % \newenvironment{erratalist} % {\begin{longtable}{r>{\raggedright}p{2cm}l>{\raggedright}p{10cm}l}} % {\endgobble\end{longtable}} -%\fi +% \fi % % \bigskip % \noindent @@ -3663,7 +3700,7 @@ % \tabularnewline \hline % \end{longtable} % -%\fi +% \fi % % % \Finale |