From b2520c4eee7eb7032ace566b4514f2ff2215f242 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 13 Nov 2010 00:23:45 +0000 Subject: curve2e (12nov10) git-svn-id: svn://tug.org/texlive/trunk@20420 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/curve2e/curve2e.sty | 239 +++++++++++++----------- 1 file changed, 131 insertions(+), 108 deletions(-) (limited to 'Master/texmf-dist/tex/latex/curve2e') 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'. -- cgit v1.2.3