diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/pict2e/pict2e.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/pict2e/pict2e.dtx | 812 |
1 files changed, 617 insertions, 195 deletions
diff --git a/Master/texmf-dist/source/latex/pict2e/pict2e.dtx b/Master/texmf-dist/source/latex/pict2e/pict2e.dtx index 3f5c87ccb80..cbf8ac02937 100644 --- a/Master/texmf-dist/source/latex/pict2e/pict2e.dtx +++ b/Master/texmf-dist/source/latex/pict2e/pict2e.dtx @@ -2,9 +2,10 @@ % % % -% Copyright (C) 2003-2006 +% Copyright (C) 2003-2008 % Rolf Niepraschk, Rolf.Niepraschk@ptb.de % Hubert Gaesslein +% Josef Tkadlec, j.tkadlec@email.cz % % % This work may be distributed and/or modified under the @@ -22,7 +23,7 @@ % %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{pict2e} -%<package> [2006/03/05 v0.2s Improved picture commands (HjG,RN)] +%<package> [2008/06/29 v0.2u Improved picture commands (HjG,RN,JT)] % %<*driver> \listfiles @@ -43,7 +44,7 @@ \IfFileExists{url.sty}{\usepackage{url}} {\newcommand*\url[1]{\texttt{#1}}} \OnlyDescription -%%\AlsoImplementation +% \AlsoImplementation \EnableCrossrefs \CodelineIndex \RecordChanges @@ -58,9 +59,9 @@ % \fi % % \GetFileInfo{pict2e.sty} -% \def\docdate{2004/08/06} +% \def\docdate{2008/06/29} % -% \CheckSum{1502} +% \CheckSum{2030} % % ^^A ======== % @@ -172,6 +173,10 @@ % \changes{v0.2o}{2004/06/25}{Numerous small fixes in documentation (HjG)} % \changes{v0.2p}{2004/07/06}{Small fixes in documentation (HjG)} % \changes{v0.2s}{2006/03/05}{Wrong PSTricks-like arrows corrected (RN)} +% \changes{v0.2t}{2008/05/11}{All lines by \cmd{\@sline}, +% 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)} % \fi % % \changes{v0.1a}{2003/07/18}{First version. (RN)} @@ -185,6 +190,8 @@ % (2004/07/28 v0.2p). (RN)} % \changes{v0.2q}{2004/08/06}{Fourth release to CTAN % (2004/08/06 v0.2q). (RN/HjG)} +% \changes{v0.2u}{2008/06/29}{Fifth release to CTAN +% (2008/06/29 v0.2u). (JT)} % % % \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment} @@ -558,6 +565,8 @@ % i.e., alpha-testers; % Jens-Uwe Morawski and Herbert Voss have also been helpful with many % suggestions and discussions. +% Thanks to Claudio Beccari (\texttt{curve2e}) for some macros and testing. +% Thanks to Petr Ol\v{s}\'ak for some macros. % \par % Finally we thank the members of The \LaTeX\ Team for taking the time % to evaluate our new implementation of the picture mode commands, and @@ -572,9 +581,10 @@ % corresponds to \textsf{\filename} \fileversion, % dated \filedate, documentation dated \docdate.}} % \author{% -% Hubert G\"a{\ss}lein\thanks{\texttt{HubertJG@open.mind.de}} +% Hubert G\"a{\ss}lein\thanks{\texttt{HubertJG@open.mind.de}}, +% Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@ptb.de}} % \,and -% Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@ptb.de}}} +% Josef Tkadlec\thanks{\texttt{j.tkadlec@email.cz}}} % % \date{\filedate} % @@ -815,10 +825,12 @@ % These restrictions are eliminated by the \texttt{pict2e} package. % \end{ltxquote} % -% However, to avoid overflow of \TeX's integer (dimen) arithmetic, -% the current implementation restricts the slope arguments to -% integers in the range $-1000 \le X,Y \le +1000$, which should be -% enough. +% However, to avoid overflow of \TeX's dimens, the slope arguments are real +% numbers in the range $-16383 \le X,Y \le +16383$. It is usually not a good +% idea to use slope arguments with the absolute value less then $10^{-4}$ +% (the best accuracy is obtained if you use multiples of arguments such that +% you eliminate as much decimal parts as possible). The slope greater then +% 16384 cannot be obtained. % ^^A ??? % % Furthermore, unlike the \SL\ implementation, which silently converts @@ -900,10 +912,13 @@ % These restrictions are eliminated by the \texttt{pict2e} package. % \end{ltxquote} % -% However, to avoid overflow of \TeX's integer (dimen) arithmetic, -% the current implementation restricts the slope arguments to -% integers in the range $-1000 \le X,Y \le +1000$, which should be -% enough. +% However, to avoid overflow of \TeX's dimen arithmetic, the current +% implementation restricts the slope arguments to real numbers in the range +% $-1000 \le X,Y \le +1000$, which should be enough. It is usually not a good +% idea to use slope arguments with the absolute value less then $10^{-4}$ (the +% best accuracy is obtained if you use multiples of arguments such that you +% eliminate as much decimal parts as possible). The slope greater then 16384 +% cannot be obtained. % ^^A ??? % % Furthermore, unlike the \SL\ implementation, which silently converts @@ -1208,6 +1223,136 @@ % \label{fig:qcbezier} % \end{figure} % +% \subsection{Extensions} +% +% This section desribe new commands that extend the possibilities of the +% \texttt{picture} environment. It is not our aim to create a powerful +% collection of macros (like \texttt{pstricks} or \texttt{pgf}). The main goal +% of this package is to eliminate the limitations of the standard +% \texttt{picture} commands. But this is done by \PS\ and \PDF\ operators +% that might be easily used for user-level commands and hence significantly +% improve the drawing possibilities. +% +% \subsubsection{Circle arcs} +% \label{sec:usage:circle-arcs} +% +% \DescribeMacro\arc +% \DescribeMacro{\arc*} +% |\arc|\oarg{ANGLE1,ANGLE2}\marg{RAD}\\ +% |\arc*|\oarg{ANGLE1,ANGLE2}\marg{RAD}\\ +% These commands are generalizations of \cmd{\circle} and \cmd{\circle*} +% commands except that the radius instead of the diameter is given. The +% optional argument is a comma separated pair of angles given in degrees +% (implicit value is $[0,360]$). The arc starts at the point given by +% $ANGLE1$. If $ANGLE2$ is greater than $ANGLE1$ the arc is drawn in the +% positive orientation (anticlockwise), if the $ANGLE2$ is smaller than +% $ANGLE1$ the arc is drawn in the negative orientation (clockwise). The angle +% of the arc is the absolute value the difference of $ANGLE1$ and $ANGLE2$. +% Hence the pair $[-10,80]$ gives the same arc as $[80,-10]$ (a quarter of a +% circle) while the pairs $[80,350]$ and $[350,80]$ give the complementary +% arc. +% +% In fact, the arc is approximated by cubic Bezier curves with an inaccuracy +% smaller than 0.0003 (it seems to be sufficiently good). +% +% If \cmd{\squarecap} is active then \cmd{\arc\marg{RAD}} produces a circle +% with a square. +% +% \subsubsection{Lines, polygons} +% \label{sec:usage:lines+polygons} +% +% \DescribeMacro\Line +% \DescribeMacro\polyline +% \DescribeMacro\polygon +% \DescribeMacro{\polygon*} +% |\Line|\parg{X1,Y1}\parg{X2,Y2}\\ +% |\polyline|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% |\polygon|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% |\polygon*|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% A natural way how to describe a line segment is to give the coordinates of +% the endpoints. The syntax of the \cmd{\line} is different because +% the lines in the standard \texttt{picture} environment are made from small +% line segments of a limited number of slopes given in a font. However, this +% package changes the \cmd{\line} command computing the coordinates of the +% endpoints and using an internal macro for drawing a line segment with given +% endpoints. Hence it would be crazy do not use this possibility directly. +% This is done by the command \cmd{\Line}. The command \cmd{\polyline} draws a +% stroken line connecting points with given coordinates. The command +% \cmd{\polygon} draws a polygon with given vertices, the star variant gives +% filled polygon. At least two points should be given. +% +% These command need not be used within a \cmd{\put} command (if the +% coordinates are absolute). +% +% \subsubsection{Path commands} +% \label{sec:usage:path-commands} +% +% \DescribeMacro\moveto +% \DescribeMacro\lineto +% \DescribeMacro\curveto +% \DescribeMacro\circlearc +% |\moveto|\parg{X,Y}\\ +% |\lineto|\parg{X,Y}\\ +% |\curveto|\parg{X2,Y2}\parg{X3,Y3}\parg{X4,Y4}\\ +% |\circlearc|\oarg{N}\marg{X}\marg{Y}\marg{RAD}\marg{ANGLE1}\marg{ANGLE2}\\ +% These commands directly correspond to the \PS\ and \PDF\ path operators. You +% start defining a path giving its initial point by \cmd{\moveto}. Then you +% can consecutively add a line segment to a given point by \cmd{\lineto}, a +% cubic Bezier curve by \cmd{\curveto} (two control points and the endpoint +% are given) or an arc by \cmd{\circlearc} (mandatory parameters are +% coordinates of the center, radius, initial and final angle). +% +% Drawing arcs is a bit more complicated. There is a special operator only in +% \PS\ (not in \PDF) but also in \PS\ it is approximated by cubic Bezier +% curves. Here we use common definition for \PS\ and \PDF. The arc is drawn +% such that the initial point given by the initial angle is rotated by +% $ANGLE2-ANGLE1$ (anticlockwise for positive value and clockwise for negative +% value) after reducing this difference to the interval $[-720, 720]$. +% Implicitely (the optional parameter $N=0$) before drawing an arc a +% \cmd{\lineto} to the initial point of the arc is added. For $N=1$ +% \cmd{\moveto} instead of \cmd{\lineto} is executed---it is useful if you +% start the path by an arc and do not want to compute and set the initial +% point. For $N=2$ the \cmd{\lineto} before drawing the arc is omitted---it +% leads to a bit shorter code for the path but you should be sure that the +% already defined part of the path ends precisely at the initial point of the +% arc. +% +% \DescribeMacro\closepath +% \DescribeMacro\strokepath +% \DescribeMacro\fillpath +% The command \cmd{\closepath} is equivalent to \cmd{\lineto} to the initial +% point of the path. After defining paths you might use either +% \cmd{\strokepath} to draw them or, for closed paths, \cmd{\fillpath} to draw +% an area bounded by them. +% +% The path construction need not be used within a \cmd{\put} command (if the +% coordinates are absolute). +% +% \subsubsection{Ends of paths, joins of subpaths} +% \label{sec:usage:ends-joins} +% +% \DescribeMacro\buttcap +% \DescribeMacro\roundcap +% \DescribeMacro\squarecap +% The shape of ends of paths is controlled by the following commands: +% \cmd{\buttcap} (implicit) define the end as a line segment, \cmd{\roundcap} +% adds a halfdisc, \cmd{\squarecap} adds a halfsquare. While \cmd{\squarecap} +% is ignored for the path with zero length, \cmd{\roundcap} places a disc to +% the given point. These commands do not apply to \cmd{\vector} and to +% closed paths (\cmd{\circle}, full \cmd{\oval}, path constructions ended by +% \cmd{\closepath}). +% +% \DescribeMacro\mitterjoin +% \DescribeMacro\roundjoin +% \DescribeMacro\beveljoin +% The shape of joins of subpaths is controlled by the following commands: +% \cmd{\mitterjoin} (implicit) might be defined in such a way that +% ``boundaries'' of subpaths are prolonged until they intersect (it might be a +% rather long distance for lines with a small angle between them); +% \cmd{\roundjoin} corresponds to \cmd{\roundcap} for both subpaths; +% \cmd{\beveljoin} adds a convex hull of terminal line segments of both +% subpaths. +% % \StopEventually{^^A % \Acknowledgements % ^^A \typeout{!!! @@ -1594,6 +1739,7 @@ % \begin{macro}{\pIIe@fill@op} % \begin{macro}{\pIIe@curveto@op} % \begin{macro}{\pIIe@concat@op} +% \begin{macro}{\pIIe@closepath@op} % \PS % \begin{macrocode} \or @@ -1604,6 +1750,7 @@ \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} @@ -1612,6 +1759,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\pIIe@moveto@op} % \begin{macro}{\pIIe@lineto@op} @@ -1620,6 +1768,7 @@ % \begin{macro}{\pIIe@fill@op} % \begin{macro}{\pIIe@curveto@op} % \begin{macro}{\pIIe@concat@op} +% \begin{macro}{\pIIe@closepath@op} % \PDF % \begin{macrocode} \or @@ -1630,6 +1779,7 @@ \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} @@ -1638,6 +1788,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \noindent % (Currently, there are no other modes.) @@ -1961,6 +2112,12 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\pIIe@closepath} +% \begin{macrocode} + \newcommand*\pIIe@closepath{\pIIe@addtoGraph\pIIe@closepath@op} +% \end{macrocode} +% \end{macro} +% % \subsection{``Pythagorean Addition'' and Division} % % \begin{macro}{\pIIe@pyth} @@ -2009,7 +2166,7 @@ % \end{macrocode} % $\cmd{\@tempdimc} = 8\,t = 8 \times\mathrm{abs}(x) / s$ % \begin{macrocode} - \pIIe@@divide\@tempdima\@tempdimb + \pIIe@divide\@tempdima\@tempdimb\@tempdimc % \end{macrocode} % $\cmd{\@tempdimc} = 4\tau = (8\,t-4)$ % \begin{macrocode} @@ -2049,74 +2206,87 @@ % $\cmd{\@dashdim} = g \leftarrow (g + u/g)/2$ % \begin{macrocode} \newcommand*\pIIe@@pyth{% - \pIIe@@divide\@tempdima\@dashdim + \pIIe@divide\@tempdima\@dashdim\@tempdimc \advance\@dashdim\@tempdimc \divide\@dashdim\tw@} % \end{macrocode} % \end{macro} % -% \begin{macro}{\pIIe@@divide} -% This division algorithm is similar to the one used for the tangent -% in the \textsf{trig} package~\cite{TRIG}. -% It does not allow large arguments. ^^A ??? -% A~very small denominator argument leads to division by zero. +% \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} -\newcommand*\pIIe@@divide[2]{% +\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 % \end{macrocode} -% $2^{16}$ (sp) +% Make numerator and denominator nonnegative, save sign. % \begin{macrocode} - \@tempcnta\p@ + \ifdim\@Denom<\z@ \@Denom -\@Denom \@Numer -\@Numer \fi + \def\sign{}\ifdim\@Numer<\z@ \def\sign{-}\@Numer -\@Numer \fi % \end{macrocode} -% $2^{30} > \cmd{\maxdimen}$ ! +% Small numerator multiply by $2^{16}$, otherwise by the greatest possible +% power of 2 and divide denominator by proper power of 2. % \begin{macrocode} - \multiply\@tempcnta\two@fourteen - \@clnwd#2\relax - \divide\@clnwd\@iv - \divide\@tempcnta\@clnwd - \@clnht\@tempcnta sp\relax - \@clnwd#1\relax - \@tempdimc\strip@pt\@clnwd\@clnht} + \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 % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\pIIe@divide} -% Improve this documentation! -% \[ -% \mbox{\#3} = -% \frac{2^{30}\cdot \mbox{\#1}}{2^{-2}\cdot \mbox{\#2} \cdot 2^{16}} -% \] -% (The factor \(2^{16}\) is implied by \TeX's division.) +% Divide, $0/0=1$ (this should not appear), $x/0$ as \cmd{\maxdimen} for +% $x\neq0$. % \begin{macrocode} -\newcommand*\pIIe@divide[3]{% - \pIIe@@divide{#1}{#2}% - #3=\@tempdimc} + \ifdim \@Denom=\z@ + \ifdim \@Numer=\z@ \@Numer\p@ \else \@Numer\maxdimen \fi + \else + \divide\@Numer\@Denom + \fi + \global#3\sign\@Numer + \endgroup} % \end{macrocode} % \end{macro} % % \subsection{High-level operations} % % \begin{macro}{\pIIe@checkslopeargs} -% \changes{v0.2o}{2004/06/25}{Macro added (HjG)} % Common code for \cmd{\line} and \cmd{\vector}. % \begin{macrocode} -\newcommand*\pIIe@checkslopeargs{% -% \end{macrocode} -% Missing macro: \cmd{\@abs}\marg{val} -- should be in the kernel! -%\begin{verbatim} -%\def\@abs#1{\ifnum#1<\z@-\fi#1} -%\end{verbatim} -% It would save a plethora of tokens here and in other packages -% and even in the kernel itself -% (e.g., cf.\ \cmd{\vector} in \texttt{ltpictur.dtx}). -% Should we define it in this package? -% \begin{macrocode} - \ifnum\ifnum\@xarg<\z@-\fi\@xarg>\@m \@badlinearg \fi - \ifnum\ifnum\@yarg<\z@-\fi\@yarg>\@m \@badlinearg \fi +\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. +% A bit incompatible with \SL: slope \((0,0)\) raises an error. % \begin{macrocode} - \ifnum\@xarg=\z@ \ifnum\@yarg=\z@ \@badlinearg \fi\fi} + \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} % @@ -2127,32 +2297,41 @@ % \changes{v0.2l}{2004/04/08}{Macro added (RNH/HjG)} % \cmd{\line}\parg{x,y}\marg{$l_x$}: % \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{% - \@xarg #1\relax \@yarg #2\relax - \@linelen #3\unitlength - \pIIe@checkslopeargs - \ifdim\@linelen<\z@\@badlinearg\else - \ifnum\@xarg =\z@ \@vline - \else - \ifnum\@yarg =\z@ \@hline \else \@sline\fi - \fi - \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 - \ifnum\@xarg<\z@\@linelen-\@linelen\fi - \pIIe@divide{\@yarg\p@}{\@xarg\p@}\dimen@ +\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@ + \else + \ifnum\@tempdima<\z@\@linelen-\@linelen\fi + \pIIe@divide\@tempdimb\@tempdima\dimen@ \@ydim=\strip@pt\dimen@\@linelen - \pIIe@moveto\z@\z@ - \pIIe@lineto\@linelen\@ydim - \pIIe@strokeGraph - \endgroup} + \@xdim=\@linelen + \fi + \fi + \pIIe@moveto\z@\z@ + \pIIe@lineto\@xdim\@ydim + \pIIe@strokeGraph + \endgroup} % \end{macrocode} % \end{macro} % @@ -2173,41 +2352,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 - \@xarg#1\relax \@yarg#2\relax - \@linelen#3\unitlength - \pIIe@checkslopeargs - \ifdim\@linelen<\z@ \@badlinearg \else - \pIIe@pyth{\@xarg\p@}{\@yarg\p@}\dimen@ - \ifnum\@xarg=\z@ - \else\ifnum\@yarg=\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@{\@xarg\p@}\@xdim - \@linelen\strip@pt\@xdim\@linelen - \ifdim\@linelen<\z@\@linelen-\@linelen\fi - \fi - \fi + \pIIe@divide\dimen@{\@tempdima}\@xdim + \@linelen\strip@pt\@xdim\@linelen + \ifdim\@linelen<\z@\@linelen-\@linelen\fi + \fi + \fi % \end{macrocode} % \BigIndent $\sin\theta$ and $\cos\theta$ % \begin{macrocode} - \pIIe@divide{\@yarg\p@}\dimen@\@ydim - \pIIe@divide{\@xarg\p@}\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} % @@ -2217,7 +2396,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} % @@ -2244,21 +2423,21 @@ % \textsf{ltxarrows} package option. %\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} @@ -2377,59 +2556,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} % @@ -2518,56 +2697,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 - \@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} % @@ -2592,7 +2771,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. @@ -2601,10 +2780,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 @@ -2613,19 +2792,24 @@ % 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} % % \begin{macro}{\pIIe@circle} -% Approximate a full circle by four quarter circles. +% Approximate a full circle by four quarter circles, use the standard shape +% of ends. % \changes{v0.1g}{2003/08/23}{Changed code (using % \cmd{\pIIe@add@qcircle}). (HjG,RN)} +% \changes{v0.1t}{2008/05/11}{Changed code (using \cmd{\buttcap}. (JT)} % \begin{macrocode} - \newcommand*\pIIe@circle[1]{% - \pIIe@qcircle[1]\z@{#1}\pIIe@qcircle \@ne{#1}% - \pIIe@qcircle \tw@{#1}\pIIe@qcircle\thr@@{#1}} +\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} % @@ -2686,33 +2870,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} % @@ -2725,8 +2909,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} % @@ -2734,10 +2918,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(*) or \protect\oval}% - {The radius of a circle, dot 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} % @@ -2840,6 +3025,10 @@ % \begin{macrocode} \pIIe@get@quadrants{#3}% % \end{macrocode} +% For the whole oval remove use the standard shape of ends. +% \begin{macrocode} + \ifnum15=\@tempcnta \buttcap \fi +% \end{macrocode} % ``\verb+@tempswa+ = false'' means, that we have to suppress the `moveto' % in the following quadrant. % \begin{macrocode} @@ -3003,6 +3192,239 @@ % \end{macrocode} % \end{macro} % +% \subsubsection{Circle arcs} +% \label{sec:implementation:circle-arcs} +% +% 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 +% \end{macrocode} +% \begin{macro}{\pIIe@arc} +% \#1: 0 (implicit) if we connect arc with a current point, 1 if we start +% drawing by this arc, 2 if we continue drawing. Other parameters: +% coordinates of the center (dimensions), radius (dimension), initial and +% final angle. If the final angle is greater then the initial angle, we +% ``draw'' in the positive sense (anticlockwise) otherwise in the negative +% 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} +% \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 +% \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 +% \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 +% \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@@ +% \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 +% \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 +% \end{macrocode} +% Coordinates of the second control point: +% \begin{macrocode} + \@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} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\arc} +% The \cmd{\arc} command generalizes (except that the radius instead of the +% diameter is used) the standard \cmd{\circle} adding as an +% 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} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Lines and polygons} +% \label{sec:implementation:lines-polygons} +% +% \begin{macro}{\Line} +% \begin{macro}{\polyline} +% \begin{macro}{\polygon} +% We use recursive macros for \cmd{\polyline} and \cmd{\polygon}. +% \begin{macrocode} + \let\lp@r( \let\rp@r) + \def\Line(#1,#2)(#3,#4){\polyline(#1,#2)(#3,#4)} + \def\polyline(#1,#2){% + \@killglue + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@polyline}{\PackageWarning{pict2e}% + {Polygonal lines require at least two vertices!}% + \ignorespaces}} + \def\@polyline(#1,#2){% + \pIIe@lineto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@polyline}{\pIIe@strokeGraph\ignorespaces}} + \def\polygon{% + \@killglue + \@ifstar{\begingroup\@tempswatrue\@polygon}% + {\begingroup\@tempswafalse\@polygon}} + \def\@polygon(#1,#2){% + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@@polygon}{\PackageWarning{pict2e}% + {Polygons require at least two vertices!}% + \ignorespaces}} + \def\@@polygon(#1,#2){\pIIe@lineto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@@polygon}{\pIIe@closepath + \if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi + \endgroup + \ignorespaces}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Path commands} +% \label{sec:implementation:path-commands} +% +% \begin{macro}{\moveto} +% \begin{macro}{\lineto} +% \begin{macro}{\curveto} +% \begin{macro}{\circlearc} +% \begin{macro}{\closepath} +% \begin{macro}{\strokepath} +% \begin{macro}{\fillpath} +% Direct access to path constructions in \PS\ and \PDF. +% \begin{macrocode} + \def\moveto(#1,#2){% + \@killglue + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \ignorespaces} + \def\lineto(#1,#2){% + \@killglue + \pIIe@lineto{#1\unitlength}{#2\unitlength}% + \ignorespaces} + \def\curveto(#1,#2)(#3,#4)(#5,#6){% + \@killglue + \pIIe@curveto{#1\unitlength}{#2\unitlength}{#3\unitlength}{#4\unitlength}% + {#5\unitlength}{#6\unitlength}% + \ignorespaces} + \newcommand*\circlearc[6][0]{% + \@killglue + \pIIe@arc[#1]{#2\unitlength}{#3\unitlength}{#4\unitlength}{#5}{#6}% + \ignorespaces} + \def\closepath{\pIIe@closepath} + \def\strokepath{\pIIe@strokeGraph} + \def\fillpath{\pIIe@fillGraph} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Ends of paths, joins of subpaths} +% \label{sec:implementation:ends-joins} +% +% \begin{macro}{\buttcap} +% \begin{macro}{\roundcap} +% \begin{macro}{\squarecap} +% \begin{macro}{\miterjoin} +% \begin{macro}{\roundjoin} +% \begin{macro}{\beveljoin} +% Ends of paths and joins of subpaths in \PS\ and \PDF. +% \begin{macrocode} + \ifcase\pIIe@mode\relax + \or + \def\buttcap{\special{ps:: 0 setlinecap}} + \def\roundcap{\special{ps:: 1 setlinecap}} + \def\squarecap{\special{ps:: 2 setlinecap}} + \def\miterjoin{\special{ps:: 0 setlinejoin}} + \def\roundjoin{\special{ps:: 1 setlinejoin}} + \def\beveljoin{\special{ps:: 2 setlinejoin}} + \or + \def\buttcap{\pdfliteral{0 J}} + \def\roundcap{\pdfliteral{1 J}} + \def\squarecap{\pdfliteral{2 J}} + \def\miterjoin{\pdfliteral{0 j}} + \def\roundjoin{\pdfliteral{1 j}} + \def\beveljoin{\pdfliteral{2 j}} + \fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Commands from other packages} % % \subsubsection{Package \textsf{ebezier}} |