diff options
Diffstat (limited to 'macros')
22 files changed, 1179 insertions, 1972 deletions
diff --git a/macros/latex/contrib/curve2e/README.txt b/macros/latex/contrib/curve2e/README.txt index 3e797117be..ae0202fb22 100644 --- a/macros/latex/contrib/curve2e/README.txt +++ b/macros/latex/contrib/curve2e/README.txt @@ -10,7 +10,7 @@ %% License information appended %% File README.txt for package curve2e - [2019-10-17 v.2.0.3 Extension package for pict2e] + [2019-10-21 v.2.0.4 Extension package for pict2e] @@ -106,7 +106,7 @@ claudio dot beccari at gmail dot com %% %% This work consists of file curve2e.dtx, and the derived files %% curve2e.sty and curve2e.pdf, plus the auxiliary derived files -%% README.txt and manifest.txt. +%% README.txt and curve2e-v161.sty. %% %% %% End of file `README.txt'. diff --git a/macros/latex/contrib/curve2e/curve2e-v161.sty b/macros/latex/contrib/curve2e/curve2e-v161.sty deleted file mode 100644 index af7081e23d..0000000000 --- a/macros/latex/contrib/curve2e/curve2e-v161.sty +++ /dev/null @@ -1,906 +0,0 @@ -%% -%% This is file `curve2e-v161.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% curve2e.dtx (with options: `v161') -%% -%% Copyright (C) 2005--2019 Claudio Beccari all rights reserved. -%% License information appended -%% - - - -\NeedsTeXFormat{LaTeX2e}[2016/01/01] -\ProvidesPackage{curve2e-v161}% - [2019/02/07 v.1.61 Extension package for pict2e] - -\RequirePackage{color} -\RequirePackageWithOptions{pict2e}[2014/01/01] -\RequirePackage{xparse} -\def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}% -\def\TROF{\tracingcommands\z@ \tracingmacros\z@}% -\ifx\undefined\@tdA \newdimen\@tdA \fi -\ifx\undefined\@tdB \newdimen\@tdB \fi -\ifx\undefined\@tdC \newdimen\@tdC \fi -\ifx\undefined\@tdD \newdimen\@tdD \fi -\ifx\undefined\@tdE \newdimen\@tdE \fi -\ifx\undefined\@tdF \newdimen\@tdF \fi -\ifx\undefined\defaultlinewidth \newdimen\defaultlinewidth \fi -\gdef\linethickness#1{\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}% -\newcommand\defaultlinethickness[1]{\defaultlinewidth=#1\relax -\def\thicklines{\linethickness{\defaultlinewidth}}% -\def\thinlines{\linethickness{.5\defaultlinewidth}}% -\thinlines\ignorespaces} -\def\LIne(#1){{\GetCoord(#1)\@tX\@tY - \moveto(0,0) - \pIIe@lineto{\@tX\unitlength}{\@tY\unitlength}\strokepath}\ignorespaces}% -\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}% -\def\line(#1)#2{\begingroup - \@linelen #2\unitlength - \ifdim\@linelen<\z@\@badlinearg\else - \expandafter\DirOfVect#1to\Dir@line - \GetCoord(\Dir@line)\d@mX\d@mY - \ifdim\d@mX\p@=\z@\else - \DividE\ifdim\d@mX\p@<\z@-\fi\p@ by\d@mX\p@ to\sc@lelen - \@linelen=\sc@lelen\@linelen - \fi - \moveto(0,0) - \pIIe@lineto{\d@mX\@linelen}{\d@mY\@linelen}% - \strokepath - \fi -\endgroup\ignorespaces}% -\ifx\Dashline\undefined -\def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}} -\def\Dashline@(#1)(#2)#3{% -\bgroup - \countdef\NumA3254\countdef\NumB3252\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DlineMod - \DivideFN\DlineMod by#3 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\egroup - \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}% - {\noexpand\LIne(\V@ttB)}}% - \@mpt\ignorespaces}% -\let\Dline\Dashline - -\def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}} -\fi -\ifx\Dotline\undefined -\def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}} -\def\Dotline@(#1)(#2)#3{% -\bgroup - \countdef\NumA 3254\relax \countdef\NumB 3255\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DotlineMod - \DivideFN\DotlineMod by#3 to\NumD - \NumA=\expandafter\Integer\NumD.?? - \DivVect\V@ttC by\NumA,0 to\V@ttB - \advance\NumA\@ne - \edef\@mpt{\noexpand\egroup - \noexpand\multiput(\V@ttA)(\V@ttB){\number\NumA}% - {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}% - \@mpt\ignorespaces}% - -\def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}} -\fi -\AtBeginDocument{\@ifpackageloaded{eso-pic}{% -\renewcommand\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}}{}} - -\def\GetCoord(#1)#2#3{% -\expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces} -\def\isnot@polar#1:#2!!{\def\@tempOne{#2}\ifx\@tempOne\empty -\expandafter\@firstoftwo\else -\expandafter\@secondoftwo\fi -{\SplitNod@@}{\SplitPolar@@}} - -\def\SplitNod@(#1)#2#3{\isnot@polar#1:!!(#1)#2#3}% -\def\SplitNod@@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}% -\def\SplitPolar@@(#1:#2)#3#4{\DirFromAngle#1to\@DirA -\ScaleVect\@DirA by#2to\@DirA -\expandafter\SplitNod@@\expandafter(\@DirA)#3#4} - -\let\originalput\put -\def\put(#1){\bgroup\GetCoord(#1)\@tX\@tY -\edef\x{\noexpand\egroup\noexpand\originalput(\@tX,\@tY)}\x} - -\let\originalmultiput\multiput -\let\original@multiput\@multiput - -\long\def\@multiput(#1)#2#3{\bgroup\GetCoord(#1)\@mptX\@mptY -\edef\x{\noexpand\egroup\noexpand\original@multiput(\@mptX,\@mptY)}% -\x{#2}{#3}\ignorespaces} - -\gdef\multiput(#1)#2{\bgroup\GetCoord(#1)\@mptX\@mptY -\edef\x{\noexpand\egroup\noexpand\originalmultiput(\@mptX,\@mptY)}\x(}%) - \def\vector(#1)#2{% - \begingroup - \GetCoord(#1)\d@mX\d@mY - \@linelen#2\unitlength - \ifdim\d@mX\p@=\z@\ifdim\d@mY\p@=\z@\@badlinearg\fi\fi - \ifdim\@linelen<\z@ \@linelen=-\@linelen\fi - \MakeVectorFrom\d@mX\d@mY to\@Vect - \DirOfVect\@Vect to\Dir@Vect - \YpartOfVect\Dir@Vect to\@ynum \@ydim=\@ynum\p@ - \XpartOfVect\Dir@Vect to\@xnum \@xdim=\@xnum\p@ - \ifdim\d@mX\p@=\z@ - \else\ifdim\d@mY\p@=\z@ - \else - \DividE\ifdim\@xnum\p@<\z@-\fi\p@ by\@xnum\p@ to\sc@lelen - \@linelen=\sc@lelen\@linelen - \fi - \fi - \@tdB=\@linelen -\pIIe@concat\@xdim\@ydim{-\@ydim}\@xdim{\@xnum\@linelen}{\@ynum\@linelen}% - \@linelen\z@ - \pIIe@vector - \fillpath - \@linelen=\@tdB - \@tdA=\pIIe@FAW\@wholewidth - \@tdA=\pIIe@FAL\@tdA - \advance\@linelen-\@tdA - \ifdim\@linelen>\z@ - \moveto(0,0) - \pIIe@lineto{\@xnum\@linelen}{\@ynum\@linelen}% - \strokepath\fi - \endgroup} -\def\Vector(#1){{% -\GetCoord(#1)\@tX\@tY -\ifdim\@tX\p@=\z@\vector(\@tX,\@tY){\@tY} -\else -\vector(\@tX,\@tY){\@tX}\fi}} -\def\VECTOR(#1)(#2){\begingroup -\SubVect#1from#2to\@tempa -\expandafter\put\expandafter(#1){\expandafter\Vector\expandafter(\@tempa)}% -\endgroup\ignorespaces} -\let\lp@r( \let\rp@r) -\renewcommand*\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}% - {Polylines require at least two vertices!\MessageBreak - Control your polyline 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}{\strokepath\ignorespaces}} -\providecommand\polygon{} -\RenewDocumentCommand\polygon{s O{\beveljoin} }{\@killglue\begingroup -\IfBooleanTF{#1}{\@tempswatrue}{\@tempswafalse}% -\@polygon[#2]} - -\def\@polygon[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY - \pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}% - \@ifnextchar\lp@r{\@@polygon}{% - \PackageWarning{curve2e}% - {Polygons require at least two vertices!\MessageBreak - Control your polygon specification\MessageBreak}% - \ignorespaces}} - - \def\@@polygon(#1){\GetCoord(#1)\d@mX\d@mY - \pIIe@lineto{\d@mX\unitlength}{\d@mY\unitlength}% - \@ifnextchar\lp@r{\@@polygon}{\pIIe@closepath - \if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi - \endgroup - \ignorespaces}} -\def\GraphGrid(#1,#2){\bgroup\textcolor{red}{\linethickness{.1\p@}% -\RoundUp#1modulo10to\@GridWd \RoundUp#2modulo10to\@GridHt -\@tempcnta=\@GridWd \divide\@tempcnta10\relax \advance\@tempcnta\@ne -\multiput(0,0)(10,0){\@tempcnta}{\line(0,1){\@GridHt}}% -\@tempcnta=\@GridHt \divide\@tempcnta10\advance\@tempcnta\@ne -\multiput(0,0)(0,10){\@tempcnta}{\line(1,0){\@GridWd}}\thinlines}% -\egroup\ignorespaces} -\def\RoundUp#1modulo#2to#3{\expandafter\@tempcnta\Integer#1.??% -\count254\@tempcnta\divide\count254by#2\relax -\multiply\count254by#2\relax -\count252\@tempcnta\advance\count252-\count254 -\ifnum\count252>0\advance\count252-#2\relax -\advance\@tempcnta-\count252\fi\edef#3{\number\@tempcnta}\ignorespaces}% -\def\Integer#1.#2??{#1}% -\ifdefined\dimexpr - \unless\ifdefined\DividE -\def\DividE#1by#2to#3{\bgroup -\dimendef\Num2254\relax \dimendef\Den2252\relax -\dimendef\@DimA 2250 -\Num=\p@ \Den=#2\relax -\ifdim\Den=\z@ - \edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\strip@pt\maxdimen}}% -\else - \@DimA=#1\relax - \edef\x{% - \noexpand\egroup\noexpand\def\noexpand#3{% - \strip@pt\dimexpr\@DimA*\Num/\Den\relax}}% -\fi -\x\ignorespaces}% -\fi - \unless\ifdefined\DivideFN - \def\DivideFN#1by#2to#3{\DividE#1\p@ by#2\p@ to{#3}}% - \fi - \unless\ifdefined\MultiplY - \def\MultiplY#1by#2to#3{\bgroup - \dimendef\@DimA 2254 \dimendef\@DimB2255 - \@DimA=#1\p@\relax \@DimB=#2\p@\relax - \edef\x{% - \noexpand\egroup\noexpand\def\noexpand#3{% - \strip@pt\dimexpr\@DimA*\@DimB/\p@\relax}}% - \x\ignorespaces}% - \let\MultiplyFN\MultiplY - \fi -\fi - -\unless\ifdefined\Numero - \def\Numero#1#2{\bgroup\dimen3254=#2\relax - \edef\x{\noexpand\egroup\noexpand\edef\noexpand#1{% - \strip@pt\dimen3254}}\x\ignorespaces}% -\fi -\def\g@tTanCotanFrom#1to#2and#3{% -\DividE 114.591559\p@ by#1to\X@ \@tdB=\X@\p@ -\countdef\I=2546\def\Tan{0}\I=11\relax -\@whilenum\I>\z@\do{% - \@tdC=\Tan\p@ \@tdD=\I\@tdB - \advance\@tdD-\@tdC \DividE\p@ by\@tdD to\Tan - \advance\I-2\relax}% -\def#2{\Tan}\DividE\p@ by\Tan\p@ to\Cot \def#3{\Cot}\ignorespaces}% -\def\SinOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>\z@% - \@whiledim\@tdA>180\p@\do{\advance\@tdA -360\p@}% -\else% - \@whiledim\@tdA<-180\p@\do{\advance\@tdA 360\p@}% -\fi \ifdim\@tdA=\z@ - \def\@tempA{0}% -\else - \ifdim\@tdA>\z@ - \def\Segno{+}% - \else - \def\Segno{-}% - \@tdA=-\@tdA - \fi - \ifdim\@tdA>90\p@ - \@tdA=-\@tdA \advance\@tdA 180\p@ - \fi - \ifdim\@tdA=90\p@ - \def\@tempA{\Segno1}% - \else - \ifdim\@tdA=180\p@ - \def\@tempA{0}% - \else - \ifdim\@tdA<\p@ - \@tdA=\Segno0.0174533\@tdA - \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 \@tempA% - \fi - \fi - \fi -\fi -\edef\endSinOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endSinOf}% -\def\CosOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>\z@% - \@whiledim\@tdA>360\p@\do{\advance\@tdA -360\p@}% -\else% - \@whiledim\@tdA<\z@\do{\advance\@tdA 360\p@}% -\fi -\ifdim\@tdA>180\p@ - \@tdA=-\@tdA \advance\@tdA 360\p@ -\fi -\ifdim\@tdA<90\p@ - \def\Segno{+}% -\else - \def\Segno{-}% - \@tdA=-\@tdA \advance\@tdA 180\p@ -\fi -\ifdim\@tdA=\z@ - \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\@tempA% - \else - \ifdim\@tdA=90\p@ - \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\@tempA% - \fi - \fi -\fi -\edef\endCosOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endCosOf}% -\def\TanOf#1to#2{\bgroup% -\@tdA=#1\p@% -\ifdim\@tdA>90\p@% - \@whiledim\@tdA>90\p@\do{\advance\@tdA -180\p@}% -\else% - \@whiledim\@tdA<-90\p@\do{\advance\@tdA 180\p@}% -\fi% -\ifdim\@tdA=\z@% - \def\@tempA{0}% -\else - \ifdim\@tdA>\z@ - \def\Segno{+}% - \else - \def\Segno{-}% - \@tdA=-\@tdA - \fi - \ifdim\@tdA=90\p@ - \def\@tempA{\Segno16383.99999}% - \else - \ifdim\@tdA<\p@ - \@tdA=\Segno0.0174533\@tdA - \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\@tempA% - \fi - \fi -\fi -\edef\endTanOf{\noexpand\egroup - \noexpand\def\noexpand#2{\@tempA}\noexpand\ignorespaces}% -\endTanOf}% -\def\ArcTanOf#1to#2{\bgroup -\countdef\Inverti 4444\Inverti=0 -\def\Segno{} -\edef\@tF{#1}\@tdF=\@tF\p@ \@tdE=57.295778\p@ -\@tdD=\ifdim\@tdF<\z@ -\@tdF\def\Segno{-}\else\@tdF\fi -\ifdim\@tdD>\p@ -\Inverti=\@ne -\@tdD=\dimexpr\p@*\p@/\@tdD\relax -\fi -\unless\ifdim\@tdD>0.02\p@ - \def\@tX{\strip@pt\dimexpr57.295778\@tdD\relax}% -\else - \edef\@tX{45}\relax - \countdef\I 2523 \I=9\relax - \@whilenum\I>0\do{\TanOf\@tX to\@tG - \edef\@tG{\strip@pt\dimexpr\@tG\p@-\@tdD\relax}\relax - \MultiplY\@tG by57.295778to\@tG - \CosOf\@tX to\@tH - \MultiplY\@tH by\@tH to\@tH - \MultiplY\@tH by\@tG to \@tH - \edef\@tX{\strip@pt\dimexpr\@tX\p@ - \@tH\p@\relax}\relax - \advance\I\m@ne}% -\fi -\ifnum\Inverti=\@ne -\edef\@tX{\strip@pt\dimexpr90\p@-\@tX\p@\relax} -\fi -\edef\x{\egroup\noexpand\edef\noexpand#2{\Segno\@tX}}\x\ignorespaces}% -\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 -\@tempdima=\t@X\p@ \ifdim\@tempdima<\z@ \@tempdima=-\@tempdima\fi -\@tempdimb=\t@Y\p@ \ifdim\@tempdimb<\z@ \@tempdimb=-\@tempdimb\fi -\ifdim\@tempdima=\z@ - \ifdim\@tempdimb=\z@ - \def\@T{0}\@tempdimc=\z@ - \else - \def\@T{0}\@tempdimc=\@tempdimb - \fi -\else - \ifdim\@tempdima>\@tempdimb - \DividE\@tempdimb by\@tempdima to\@T - \@tempdimc=\@tempdima - \else - \DividE\@tempdima by\@tempdimb to\@T - \@tempdimc=\@tempdimb - \fi -\fi -\unless\ifdim\@tempdimc=\z@ - \unless\ifdim\@T\p@=\z@ - \@tempdima=\@T\p@ \@tempdima=\@T\@tempdima - \advance\@tempdima\p@% - \@tempdimb=\p@% - \@tempcnta=5\relax - \@whilenum\@tempcnta>\z@\do{\DividE\@tempdima by\@tempdimb to\@T - \advance\@tempdimb \@T\p@ \@tempdimb=.5\@tempdimb - \advance\@tempcnta\m@ne}% - \@tempdimc=\@T\@tempdimc - \fi -\fi -\Numero#2\@tempdimc -\ignorespaces}% -\def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y -\ModOfVect#1to\@tempa -\unless\ifdim\@tempdimc=\z@ - \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#2\ignorespaces}% -\def\ModAndDirOfVect#1to#2and#3{% -\GetCoord(#1)\t@X\t@Y -\ModOfVect#1to#2% -\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\ignorespaces}% -\def\XpartOfVect#1to#2{% -\GetCoord(#1)#2\@tempa\ignorespaces}% -\def\YpartOfVect#1to#2{% -\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\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t@X}{\t@Y}% -\def\s@gno{}\def\addflatt@ngle{0} -\ifdim\t@X\p@=\z@ - \ifdim\t@Y\p@=\z@ - \def\ArcTan{0}% - \else - \def\ArcTan{90}% - \ifdim\t@Y\p@<\z@\def\s@gno{-}\fi - \fi -\else - \ifdim\t@Y\p@=\z@ - \ifdim\t@X\p@<\z@ - \def\ArcTan{180}% - \else - \def\ArcTan{0}% - \fi - \else - \ifdim\t@X\p@<\z@% - \def\addflatt@ngle{180}% - \edef\t@X{\strip@pt\dimexpr-\t@X\p@}% - \edef\t@Y{\strip@pt\dimexpr-\t@Y\p@}% - \ifdim\t@Y\p@<\z@ - \def\s@gno{-}% - \edef\t@Y{-\t@Y}% - \fi - \fi - \DivideFN\t@Y by\t@X to \t@A - \ArcTanOf\t@A to\ArcTan - \fi -\fi -\edef\ArcTan{\unless\ifx\s@gno\empty\s@gno\fi\ArcTan}% -\unless\ifnum\addflatt@ngle=0\relax - \edef\ArcTan{% - \strip@pt\dimexpr\ArcTan\p@\ifx\s@gno\empty-\else+\fi - \addflatt@ngle\p@\relax}% -\fi -\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}% -\x\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 -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% -\def\ConjVect#1to#2{\GetCoord(#1)\t@X\t@Y -\@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 -\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 -\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@ -\@tempdimc=\td@X\@tempdima\advance\@tempdimc-\td@Y\@tempdimb -\Numero\t@X\@tempdimc -\@tempdimc=\td@Y\@tempdima\advance\@tempdimc\td@X\@tempdimb -\Numero\t@Y\@tempdimc -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% -\def\@ConjMultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y -\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@X\@tempdimb\advance\@tempdimc-\td@Y\@tempdima -\Numero\t@Y\@tempdimc -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces} -\def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir -\DividE\p@ by\@Mod\p@ to\@Mod \ConjVect\@Dir to\@Dir -\ScaleVect#1by\@Mod to\@tempa -\MultVect\@tempa by\@Dir to#3\ignorespaces}% -\def\Arc(#1)(#2)#3{\begingroup -\@tdA=#3\p@ -\unless\ifdim\@tdA=\z@ - \@Arc(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\@Arc(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi -\Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#2from#1to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% -\def\@@Arc{% -\pIIe@moveto{\@pPunX\unitlength}{\@pPunY\unitlength}% -\ifdim\@tdA>180\p@ - \advance\@tdA-180\p@ - \Numero\@gradi\@tdA - \SubVect\@pPun from\@Cent to\@V - \AddVect\@V and\@Cent to\@sPun - \MultVect\@V by0,-1.3333333to\@V \if\Segno-\ScaleVect\@V by-1to\@V\fi - \AddVect\@pPun and\@V to\@pcPun - \AddVect\@sPun and\@V to\@scPun - \GetCoord(\@pcPun)\@pcPunX\@pcPunY - \GetCoord(\@scPun)\@scPunX\@scPunY - \GetCoord(\@sPun)\@sPunX\@sPunY - \pIIe@curveto{\@pcPunX\unitlength}{\@pcPunY\unitlength}% - {\@scPunX\unitlength}{\@scPunY\unitlength}% - {\@sPunX\unitlength}{\@sPunY\unitlength}% - \CopyVect\@sPun to\@pPun -\fi -\ifdim\@tdA>\z@ - \DirFromAngle\@gradi to\@Dir \if\Segno-\ConjVect\@Dir to\@Dir \fi - \SubVect\@Cent from\@pPun to\@V - \MultVect\@V by\@Dir to\@V - \AddVect\@Cent and\@V to\@sPun - \@tdA=.5\@tdA \Numero\@gradi\@tdA - \DirFromAngle\@gradi to\@Phimezzi - \GetCoord(\@Phimezzi)\@cosphimezzi\@sinphimezzi - \@tdB=1.3333333\p@ \@tdB=\@Raggio\@tdB - \@tdC=\p@ \advance\@tdC -\@cosphimezzi\p@ \Numero\@tempa\@tdC - \@tdB=\@tempa\@tdB - \DividE\@tdB by\@sinphimezzi\p@ to\@cZ - \ScaleVect\@Phimezzi by\@cZ to\@Phimezzi - \ConjVect\@Phimezzi to\@mPhimezzi - \if\Segno-% - \let\@tempa\@Phimezzi - \let\@Phimezzi\@mPhimezzi - \let\@mPhimezzi\@tempa - \fi - \SubVect\@sPun from\@pPun to\@V - \DirOfVect\@V to\@V - \MultVect\@Phimezzi by\@V to\@Phimezzi - \AddVect\@sPun and\@Phimezzi to\@scPun - \ScaleVect\@V by-1to\@V - \MultVect\@mPhimezzi by\@V to\@mPhimezzi - \AddVect\@pPun and\@mPhimezzi to\@pcPun - \GetCoord(\@pcPun)\@pcPunX\@pcPunY - \GetCoord(\@scPun)\@scPunX\@scPunY - \GetCoord(\@sPun)\@sPunX\@sPunY - \pIIe@curveto{\@pcPunX\unitlength}{\@pcPunY\unitlength}% - {\@scPunX\unitlength}{\@scPunY\unitlength}% - {\@sPunX\unitlength}{\@sPunY\unitlength}% -\fi} -\def\VectorArc(#1)(#2)#3{\begingroup -\@tdA=#3\p@ \ifdim\@tdA=\z@\else - \@VArc(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\VectorARC(#1)(#2)#3{\begingroup -\@tdA=#3\p@ -\ifdim\@tdA=\z@\else - \@VARC(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\@VArc(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi \Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun -\@tdE=\pIIe@FAW\@wholewidth \@tdE=\pIIe@FAL\@tdE -\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi -\@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 -\edef\@tempA{\ifx\Segno-\m@ne\else\@ne\fi}% -\MultVect\@sPun by 0,\@tempA to\@vPun -\DirOfVect\@vPun to\@Dir -\AddVect\@sPun and #1 to \@sPun -\GetCoord(\@sPun)\@tdX\@tdY -\@tdD\ifx\Segno--\fi\DeltaGradi\p@ -\@tdD=.5\@tdD \Numero\DeltaGradi\@tdD -\DirFromAngle\DeltaGradi to\@Dird -\MultVect\@Dir by*\@Dird to\@Dir -\GetCoord(\@Dir)\@xnum\@ynum -\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% -\@tdE =\ifx\Segno--\fi\DeltaGradi\p@ -\advance\@tdA -\@tdE \Numero\@gradi\@tdA -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% -\def\@VARC(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi \Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun -\@tdE=\pIIe@FAW\@wholewidth \@tdE=0.8\@tdE -\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi -\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD -\@tdD=\if\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD -\DirFromAngle\@tempa to\@Dir -\MultVect\@V by\@Dir to\@sPun% corrects the end point -\edef\@tempA{\if\Segno--\fi1}% -\MultVect\@sPun by 0,\@tempA to\@vPun -\DirOfVect\@vPun to\@Dir -\AddVect\@sPun and #1 to \@sPun -\GetCoord(\@sPun)\@tdX\@tdY -\@tdD\if\Segno--\fi\DeltaGradi\p@ -\@tdD=.5\@tdD \Numero\@tempB\@tdD -\DirFromAngle\@tempB to\@Dird -\MultVect\@Dir by*\@Dird to\@Dir -\GetCoord(\@Dir)\@xnum\@ynum -\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrowt ip -\@tdE =\DeltaGradi\p@ -\advance\@tdA -2\@tdE \Numero\@gradi\@tdA -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\SubVect\@Cent from\@pPun to \@V -\edef\@tempa{\if\Segno-\else-\fi\@ne}% -\MultVect\@V by0,\@tempa to\@vPun -\@tdE\if\Segno--\fi\DeltaGradi\p@ -\Numero\@tempB{0.5\@tdE}% -\DirFromAngle\@tempB to\@Dird -\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}}% starting point arrow tip -\edef\@tempa{\if\Segno--\fi\DeltaGradi}% -\DirFromAngle\@tempa to \@Dir -\SubVect\@Cent from\@pPun to\@V -\MultVect\@V by\@Dir to\@V -\AddVect\@Cent and\@V to\@pPun -\GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% -\def\CurveBetween#1and#2WithDirs#3and#4{% -\StartCurveAt#1WithDir{#3}\relax -\CurveTo#2WithDir{#4}\CurveFinish\ignorespaces}% -\def\StartCurveAt#1WithDir#2{% -\begingroup -\GetCoord(#1)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Pzero -\pIIe@moveto{\@tempa\unitlength}{\@tempb\unitlength}% -\GetCoord(#2)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Dzero -\DirOfVect\@Dzero to\@Dzero -\ignorespaces} -\def\ChangeDir<#1>{% -\GetCoord(#1)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Dzero -\DirOfVect\@Dzero to\@Dzero -\ignorespaces} -\def\CurveFinish{\strokepath\endgroup\ignorespaces}% -\def\FillCurve{\fillpath\endgroup\ignorespaces} -\def\CurveEnd{\fillstroke\endgroup\ignorespaces} -\def\CbezierTo#1WithDir#2AndDists#3And#4{% -\GetCoord(#1)\@tX\@tY \MakeVectorFrom\@tX\@tY to\@Puno -\GetCoord(#2)\@tX\@tY \MakeVectorFrom\@tX\@tY to \@Duno -\DirOfVect\@Duno to\@Duno -\ScaleVect\@Dzero by#3to\@Czero \AddVect\@Pzero and\@Czero to\@Czero -\ScaleVect\@Duno by-#4to \@Cuno \AddVect\@Puno and\@Cuno to \@Cuno -\GetCoord(\@Czero)\@XCzero\@YCzero -\GetCoord(\@Cuno)\@XCuno\@YCuno -\GetCoord(\@Puno)\@XPuno\@YPuno -\pIIe@curveto{\@XCzero\unitlength}{\@YCzero\unitlength}% - {\@XCuno\unitlength}{\@YCuno\unitlength}% - {\@XPuno\unitlength}{\@YPuno\unitlength}% -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces}% -\def\CbezierBetween#1And#2WithDirs#3And#4UsingDists#5And#6{% -\StartCurveAt#1WithDir{#3}\relax -\CbezierTo#2WithDir#4AndDists#5And{#6}\CurveFinish} - -\def\@isTension#1;#2!!{\def\@tempA{#1}% -\def\@tempB{#2}\unless\ifx\@tempB\empty\strip@semicolon#2\fi} -\def\strip@semicolon#1;{\def\@tempB{#1}} -\def\CurveTo#1WithDir#2{% -\def\@Tuno{1}\def\@Tzero{1}\relax -\edef\@Puno{#1}\@isTension#2;!!% -\expandafter\DirOfVect\@tempA to\@Duno -\bgroup\unless\ifx\@tempB\empty\GetCoord(\@tempB)\@Tzero\@Tuno\fi -\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord -\MultVect\@Dzero by*\@DirChord to \@Dpzero -\MultVect\@Duno by*\@DirChord to \@Dpuno -\GetCoord(\@Dpzero)\@DXpzero\@DYpzero -\GetCoord(\@Dpuno)\@DXpuno\@DYpuno -\DivideFN\@Chord by2 to\@semichord -\ifdim\@DXpzero\p@=\z@ - \@tdA=1.333333\p@ - \Numero\@KCzero{\@semichord\@tdA}% -\fi -\ifdim\@DYpzero\p@=\z@ - \@tdA=1.333333\p@ - \Numero\@Kpzero{\@semichord\@tdA}% -\fi -\unless\ifdim\@DXpzero\p@=\z@ - \unless\ifdim\@DYpzero\p@=\z@ - \edef\@CosDzero{\ifdim\@DXpzero\p@<\z@ -\fi\@DXpzero}% - \edef\@SinDzero{\ifdim\@DYpzero\p@<\z@ -\fi\@DYpzero}% - \@tdA=\@semichord\p@ \@tdA=1.333333\@tdA - \DividE\@tdA by\@SinDzero\p@ to \@KCzero - \@tdA=\dimexpr(\p@-\@CosDzero\p@)\relax - \DividE\@KCzero\@tdA by\@SinDzero\p@ to \@KCzero - \fi -\fi -\MultiplyFN\@KCzero by \@Tzero to \@KCzero -\ScaleVect\@Dzero by\@KCzero to\@CPzero -\AddVect\@Pzero and\@CPzero to\@CPzero -\ifdim\@DXpuno\p@=\z@ - \@tdA=-1.333333\p@ - \Numero\@KCuno{\@semichord\@tdA}% -\fi -\ifdim\@DYpuno\p@=\z@ - \@tdA=-1.333333\p@ - \Numero\@KCuno{\@semichord\@tdA}% -\fi -\unless\ifdim\@DXpuno\p@=\z@ - \unless\ifdim\@DYpuno\p@=\z@ - \edef\@CosDuno{\ifdim\@DXpuno\p@<\z@ -\fi\@DXpuno}% - \edef\@SinDuno{\ifdim\@DYpuno\p@<\z@ -\fi\@DYpuno}% - \@tdA=\@semichord\p@ \@tdA=-1.333333\@tdA - \DividE\@tdA by \@SinDuno\p@ to \@KCuno - \@tdA=\dimexpr(\p@-\@CosDuno\p@)\relax - \DividE\@KCuno\@tdA by\@SinDuno\p@ to \@KCuno - \fi -\fi -\MultiplyFN\@KCuno by \@Tuno to \@KCuno -\ScaleVect\@Duno by\@KCuno to\@CPuno -\AddVect\@Puno and\@CPuno to\@CPuno -\GetCoord(\@Puno)\@XPuno\@YPuno -\GetCoord(\@CPzero)\@XCPzero\@YCPzero -\GetCoord(\@CPuno)\@XCPuno\@YCPuno -\pIIe@curveto{\@XCPzero\unitlength}{\@YCPzero\unitlength}% - {\@XCPuno\unitlength}{\@YCPuno\unitlength}% - {\@XPuno\unitlength}{\@YPuno\unitlength}\egroup -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces}% -\def\Curve{\@ifstar{\let\fillstroke\fillpath\Curve@}% -{\let\fillstroke\strokepath\Curve@}} -\def\Curve@(#1)<#2>{% - \StartCurveAt#1WithDir{#2}% - \@ifnextchar\lp@r\@Curve{% - \PackageWarning{curve2e}{% - Curve specifications must contain at least two nodes!\Messagebreak - Please, control your Curve specifications\MessageBreak}}} -\def\@Curve(#1)<#2>{% - \CurveTo#1WithDir{#2}% - \@ifnextchar\lp@r\@Curve{% - \@ifnextchar[\@ChangeDir\CurveEnd}} -\def\@ChangeDir[#1]{\ChangeDir<#1>\@Curve} -\def\Qurve{\@ifstar{\let\fillstroke\fillpath\Qurve@}% -{\let\fillstroke\strokepath\Qurve@}} - -\def\Qurve@(#1)<#2>{% - \StartCurveAt#1WithDir{#2}% - \@ifnextchar\lp@r\@Qurve{% - \PackageWarning{curve2e}{% - Quadratic curve specifications must contain at least - two nodes!\Messagebreak - Please, control your Qurve specifications\MessageBreak}}}% -\def\@Qurve(#1)<#2>{\QurveTo#1WithDir{#2}% - \@ifnextchar\lp@r\@Qurve{% - \@ifnextchar[\@ChangeQDir\CurveEnd}}% -\def\@ChangeQDir[#1]{\ChangeDir<#1>\@Qurve}% -\def\QurveTo#1WithDir#2{% -\edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup -\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord -\MultVect\@Dzero by*\@Duno to \@Scalar -\YpartOfVect\@Scalar to \@YScalar -\ifdim\@YScalar\p@=\z@ -\PackageWarning{curve2e}% - {Quadratic Bezier arcs cannot have their starting\MessageBreak - and ending directions parallel or antiparallel with\MessageBreak - each other. This arc is skipped and replaced with - a dotted line.\MessageBreak}% - \Dotline(\@Pzero)(\@Puno){2}\relax -\else -\MultVect\@Dzero by*\@DirChord to \@Dpzero -\MultVect\@Duno by*\@DirChord to \@Dpuno -\GetCoord(\@Dpzero)\@DXpzero\@DYpzero -\GetCoord(\@Dpuno)\@DXpuno\@DYpuno -\MultiplyFN\@DXpzero by\@DXpuno to\@XXD -\MultiplyFN\@DYpzero by\@DYpuno to\@YYD -\unless\ifdim\@YYD\p@<\z@\ifdim\@XXD\p@<\z@ -\PackageWarning{curve2e}% - {Quadratic Bezier arcs cannot have inflection points\MessageBreak - Therefore the tangents to the starting and ending arc\MessageBreak - points cannot be directed to the same half plane.\MessageBreak - This arc is skipped and replaced by a dotted line\MessageBreak}% - \Dotline(\@Pzero)(\@Puno){2}\fi -\else -\edef\@CDzero{\@DXpzero}\relax -\edef\@SDzero{\@DYpzero}\relax -\edef\@CDuno{\@DXpuno}\relax -\edef\@SDuno{\@DYpuno}\relax -\MultiplyFN\@SDzero by\@CDuno to\@tempA -\MultiplyFN\@SDuno by\@CDzero to\@tempB -\edef\@tempA{\strip@pt\dimexpr\@tempA\p@-\@tempB\p@}\relax -\@tdA=\@SDuno\p@ \@tdB=\@Chord\p@ \@tdC=\@tempA\p@ -\edef\@tempC{\strip@pt\dimexpr \@tdA*\@tdB/\@tdC}\relax -\MultiplyFN\@tempC by\@CDzero to \@XC -\MultiplyFN\@tempC by\@SDzero to \@YC -\ModOfVect\@XC,\@YC to\@KC -\ScaleVect\@Dzero by\@KC to\@CP -\AddVect\@Pzero and\@CP to\@CP -\GetCoord(\@Pzero)\@XPzero\@YPzero -\GetCoord(\@Puno)\@XPuno\@YPuno -\GetCoord(\@CP)\@XCP\@YCP -\@ovxx=\@XPzero\unitlength \@ovyy=\@YPzero\unitlength -\@ovdx=\@XCP\unitlength \@ovdy=\@YCP\unitlength -\@xdim=\@XPuno\unitlength \@ydim=\@YPuno\unitlength - \pIIe@bezier@QtoC\@ovxx\@ovdx\@ovro - \pIIe@bezier@QtoC\@ovyy\@ovdy\@ovri - \pIIe@bezier@QtoC\@xdim\@ovdx\@clnwd - \pIIe@bezier@QtoC\@ydim\@ovdy\@clnht - \pIIe@moveto\@ovxx\@ovyy - \pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim -\fi\fi\egroup -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces} - - -%% -%% -%% 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 file curve2e.dtx, and the derived files -%% curve2e.sty and curve2e.pdf, plus the auxiliary derived files -%% README.txt and ltxdoc.cfg, although the latter can be freely -%% modified before running pdfltex, in order to include or exclude -%% typesetting of the bundle code. -%% -%% -%% End of file `curve2e-v161.sty'. diff --git a/macros/latex/contrib/curve2e/curve2e.dtx b/macros/latex/contrib/curve2e/curve2e.dtx index 015b659d79..9f8a34835a 100644 --- a/macros/latex/contrib/curve2e/curve2e.dtx +++ b/macros/latex/contrib/curve2e/curve2e.dtx @@ -22,7 +22,7 @@ This work is "author-maintained" This work consists of file curve2e.dtx, and the derived files curve2e.sty and curve2e.pdf, plus the auxiliary derived files -README.txt and manifest.txt. +README.txt and curve2e-v161.sty. \endpostamble \askforoverwritefalse @@ -47,7 +47,7 @@ README.txt and manifest.txt. %<+package>\ProvidesPackage{curve2e}% %<+readme>File README.txt for package curve2e %<*package|readme> - [2019-10-17 v.2.0.3 Extension package for pict2e] + [2019-10-21 v.2.0.4 Extension package for pict2e] %</package|readme> %<*driver> \documentclass{ltxdoc}\errorcontextlines=9 @@ -104,7 +104,7 @@ README.txt and manifest.txt. %</driver> % \fi % -% \CheckSum{5571} +% \CheckSum{5569} % \begin{abstract} % This file documents the |curve2e| extension package to the |pict2e| % bundle implementation that has been described by Lamport @@ -2231,22 +2231,22 @@ README.txt and manifest.txt. } % \end{macrocode} % In order to avoid problems with divisions by zero, or with numbers that -% yield results to large to be used as multipliers of lengths, it would be -% preferable that the above code be preceded or followed by some tests and -% possible messages. Actually we decided to avoid such tests and messages, -% because the internal L3 functions already provide some. This is what it -% was done in the previous versions of this package, when the |\fpeval| L3 -% function was not available. -% -% Notice that operands |#1| and |#2| may be integer numbers or fractional, -% or mixed numbers. They may be also dimensions, but while dimensions in -% printer points (72.27pt=1in) are handled as assumed, when different -% units are used, the length must be enclosed in parentheses: +% yield results to large to be used as multipliers of lengths, it would +% be preferable that the above code be preceded or followed by some tests +% and possible messages. Actually we decided to avoid such tests and +% messages, because the internal L3 functions already provide some. This +% is what it was done in the previous versions of this package, when the +% |\fpeval| L3 function was not available. +% +% Notice that operands |#1| and |#2| may be integer numbers or +% fractional, or mixed numbers. They may be also dimensions, but while +% dimensions in printer points (72.27pt=1in) are handled as assumed, when +% different units are used, the length must be enclosed in parentheses: %\begin{verbatim} %\DividE(1mm)by(3mm) to\result %\end{verbatim} -% yields correctly |\result=0.33333333|. Without parentheses the result is -% unpredictable. +% yields correctly |\result=0.33333333|. Without parentheses the result +% is unpredictable. % % For backward compatibility we need an alias. % \begin{macrocode} @@ -2262,12 +2262,13 @@ README.txt and manifest.txt. \def\MultiplY#1by#2to#3{\edef#3{\fpeval{#1 * #2}}}\relax \let\MultiplyFN\MultiplY % \end{macrocode} -% but with multiplication it is better to avoid computations with lengths. +% but with multiplication it is better to avoid computations with +% lengths. % -% The next macro uses the \verb|\strip@pt| \LaTeX\ kernel macro to get the -% numerical value of a measure in points. One has to call |\Numero| with -% a control sequence and a dimension; the dimension value in points is -% assigned to the control sequence. +% The next macro uses the \verb|\strip@pt| \LaTeX\ kernel macro to get +% the numerical value of a measure in points. One has to call |\Numero| +% with a control sequence and a dimension; the dimension value in points +% is assigned to the control sequence. % \begin{macrocode} \unless\ifdefined\Numero \def\Numero#1#2{\bgroup\dimen3254=#2\relax @@ -2447,20 +2448,20 @@ README.txt and manifest.txt. % in the mathematical sense of an ordered pair of real numbers; it can be % viewed as a vector joining the origin of the coordinate axes to the % coordinates indicated by the ordered pair; it can be interpreted as a -% roto-amplification operator that scales its operand and rotates it about -% a pivot point; besides the usual conventional representation used by the -% mathematicians where the ordered pair is enclosed in round parentheses -% (which is in perfect agreement with the standard code used by the -% |picture| environment) there is the other conventional representation -% used by the engineers that stresses the roto-amplification nature of a -% complex number: +% roto-amplification operator that scales its operand and rotates it +% about a pivot point; besides the usual conventional representation used +% by the mathematicians where the ordered pair is enclosed in round +% parentheses (which is in perfect agreement with the standard code used +% by the |picture| environment) there is the other conventional +% representation used by the engineers that stresses the +% roto-amplification nature of a complex number: %\[ %(x, y) = x + \mathrm{j}y =M \mathrm{e}^{\mathrm{j}\theta} %\] % Even the imaginary unit is indicated with $\mathrm{i}$ by the -% mathematicians and with $\mathrm{j}$ by the engineers. In spite of these -% differences, these objects, the \emph{complex numbers}, are used without -% any problem by both mathematicians and engineers. +% mathematicians and with $\mathrm{j}$ by the engineers. In spite of +% these differences, these objects, the \emph{complex numbers}, are used +% without any problem by both mathematicians and engineers. % % The important point is that these objects can be summed, subtracted, % multiplied, divided, raised to any power (integer, fractional, positive @@ -2470,21 +2471,22 @@ README.txt and manifest.txt. % doing some of these operations. % % In facts we need macros for summing, subtracting, multiplying, dividing -% complex numbers, for determining their directions (unit vectors); a unit -% vector is the complex number divided by its magnitude so that the result -% is the cartesian or polar form of the Euler's formula +% complex numbers, for determining their directions (unit vectors); a +% unit vector is the complex number divided by its magnitude so that the +% result is the cartesian or polar form of the Euler's formula % \[ % \mathrm{e}^{\mathrm{j}\phi} = \cos\phi+\mathrm{j}\sin\phi % \] % -% The magnitude of a vector is determined by taking a ‘clever’ square root -% of a function of the real and the imaginary parts; see further on. +% The magnitude of a vector is determined by taking a ‘clever’ square +% root of a function of the real and the imaginary parts; see further on. % % It's better to represent each complex number with one control sequence; % this implies frequent assembling and disassembling the pair of real % numbers that make up a complex number. These real components are -% assembled into the defining control sequence as a couple of coordinates, -% i.e.\ two comma separated integer or fractional signed decimal numbers. +% assembled into the defining control sequence as a couple of +% coordinates, i.e.\ two comma separated integer or fractional signed +% decimal numbers. % % For assembling two real numbers into a complex number we use the % following elementary macro: @@ -2496,8 +2498,8 @@ README.txt and manifest.txt. \def\CopyVect#1to#2{\edef#2{#1}\ignorespaces}% % \end{macrocode} % The magnitude is determined with the macro |\ModOfVect| with delimited -% arguments; as usual it is assumed that the results are retrieved by means -% of control sequences, not used directly. +% arguments; as usual it is assumed that the results are retrieved by +% means of control sequences, not used directly. % % In the preceding version of package |curve2e| the magnitude $M$ was % determined by taking the moduli of the real and imaginary parts, by @@ -2507,16 +2509,18 @@ README.txt and manifest.txt. % \[ % M = \sqrt{a^2+b^2} = \vert a\vert\sqrt{1+(b/a)^2} % \] -% In this way the radicand never exceeds 2 and it was quite easy to get its -% square root by means of the Newton iterative process; due to the +% In this way the radicand never exceeds 2 and it was quite easy to get +% its square root by means of the Newton iterative process; due to the % quadratic convergence, five iterations were more than sufficient. When -% one of the components was zero, the Newton iterative process was skipped. +% one of the components was zero, the Newton iterative process was +% skipped. % With the availability of the |xfp| package and its floating point % algorithms it is much easier to compute the magnitude of a complex % number; since these algorithms allow to use very large numbers, it is % not necessary to normalise the complex number components to the largest -% one; therefore the code is much simpler than the ne used for implementing -% the Newton method in the previous versions of this package. +% one; therefore the code is much simpler than the one used for +% implementing the Newton method in the previous versions of this +% package. % \begin{macrocode} \def\ModOfVect#1to#2{\GetCoord(#1)\t@X\t@Y \edef#2{\fpeval{sqrt(\t@X*\t@X + \t@Y*\t@Y)}}\relax @@ -2524,16 +2528,16 @@ README.txt and manifest.txt. % \end{macrocode} % % Since the macro for determining the magnitude of a vector is available, -% we can now normalize the vector to its magnitude, therefore getting the +% we can now normalise the vector to its magnitude, therefore getting the % Cartesian form of the direction vector. If by any chance the direction % of the null vector is requested, the output is again the null vector, -% without normalization. +% without normalisation. % \begin{macrocode} \def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y \ModOfVect#1to\@tempa \unless\ifdim\@tempa\p@=\z@ - \DividE\t@X\p@ by\@tempa to\t@X - \DividE\t@Y\p@ by\@tempa to\t@Y + \DividE\t@X by\@tempa to\t@X + \DividE\t@Y by\@tempa to\t@Y \fi \MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% % \end{macrocode} @@ -2541,29 +2545,29 @@ README.txt and manifest.txt. % A cumulative macro uses the above ones to determine with one call both % the magnitude and the direction of a complex number. The first argument % is the input complex number, the second its magnitude, and the third is -% again a complex number normalised to unit magnitude (unless the input was -% the null complex number); remember always that output quantities must be -% specified with control sequences to be used at a later time. +% again a complex number normalised to unit magnitude (unless the input +% was the null complex number); remember always that output quantities +% must be specified with control sequences to be used at a later time. % \begin{macrocode} \def\ModAndDirOfVect#1to#2and#3{% \GetCoord(#1)\t@X\t@Y \ModOfVect#1to#2% \DirOfVect#1to#3\ignorespaces}% % \end{macrocode} -% The next macro computes the magnitude and the direction of the difference -% of two complex numbers; the first input argument is the minuend, the -% second is the subtrahend; the output quantities are the third argument -% containing the magnitude of the difference and the fourth is the -% direction of the difference. -% The service macro |\SubVect| executes the difference of two complex +% The next macro computes the magnitude and the direction of the +% difference of two complex numbers; the first input argument is the +% minuend, the second is the subtrahend; the output quantities are the +% third argument containing the magnitude of the difference and the +% fourth is the direction of the difference. +% The service macro |\SubVect| executes the difference of two complex % numbers and is described further on. % \begin{macrocode} \def\DistanceAndDirOfVect#1minus#2to#3and#4{% \SubVect#2from#1to\@tempa \ModAndDirOfVect\@tempa to#3and#4\ignorespaces}% % \end{macrocode} -% We now have two macros intended to fetch just the real or, respectively, -% the imaginary part of the input complex number. +% We now have two macros intended to fetch just the real or, +% respectively, the imaginary part of the input complex number. % \begin{macrocode} \def\XpartOfVect#1to#2{% \GetCoord(#1)#2\@tempa\ignorespaces}% @@ -2571,8 +2575,8 @@ README.txt and manifest.txt. \def\YpartOfVect#1to#2{% \GetCoord(#1)\@tempa#2\ignorespaces}% % \end{macrocode} -% With the next macro we create a direction vector (second argument) from a -% given angle (first argument, in degrees). +% With the next macro we create a direction vector (second argument) from +% a given angle (first argument, in degrees). % \begin{macrocode} \def\DirFromAngle#1to#2{% \CosOf#1to\t@X @@ -2580,8 +2584,9 @@ README.txt and manifest.txt. \MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% % \end{macrocode} % -% Sometimes it is necessary to scale a vector by an arbitrary real factor; -% this implies scaling both the real and imaginary part of the input given vector. +% Sometimes it is necessary to scale a vector by an arbitrary real +% factor; this implies scaling both the real and imaginary part of the +% input given vector. % \begin{macrocode} \def\ScaleVect#1by#2to#3{\GetCoord(#1)\t@X\t@Y \edef\t@X{\fpeval{#2 * \t@X}}\relax @@ -2620,13 +2625,19 @@ README.txt and manifest.txt. % For the multiplication we need to split the operation according to the % fact that we want to multiply by the second operand or by the complex % conjugate of the second operand; it would be nice if we could use the -% usual postfixed asterisk notation for the complex conjugate, but we could -% not find a simple means for doing so; therefore we use the prefixed -% notation, that is I put the asterisk before the second operand. The first -% part of the multiplication macro just takes care of the multiplicand and -% then checks for the asterisk; if there is no asterisk it calls a second -% service macro that performs a regular complex multiplication, otherwise -% it calls a third service macro that executes the conjugate +% usual postfixed asterisk notation for the complex conjugate, but we +% could not find a simple means for doing so\footnote{Actually the simple +% means do exist now through the use of the \texttt{xparse} package, but +% they became available only when the syntax of this +% \texttt{\string\MultVect} macro had been already in use for a long +% time; changing the position of the asterisk at this moment, would mean +% to render the new definition incompatible with the existing source +% document files.}; therefore we use the prefixed notation, that is we +% put the asterisk \emph{before} the second operand. The first part of +% the multiplication macro just takes care of the multiplicand and then +% checks for the asterisk; if there is no asterisk it calls a second +% (service) macro that performs a regular complex multiplication, +% otherwise it calls a third service macro that executes the conjugate % multiplication. % \begin{macrocode} \def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}% @@ -2646,7 +2657,12 @@ README.txt and manifest.txt. % % The division of two complex numbers implies scaling down the dividend % by the magnitude of the divisor and by rotating the dividend scaled -% vector by the opposite direction of the divisor; therefore: +% vector by the conjugate direction of the divisor; +%\[ +% \frac{\vec{N}}{\vec{D}}= \frac{\vec{N}}{M\vec{u}}= +% \frac{\vec{N}}{M}\vec{u}^{\mkern2mu\star} +%\] +%therefore: % \begin{macrocode} \def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir \edef\@Mod{\fpeval{1 / \@Mod}}\relax @@ -3741,8 +3757,8 @@ README.txt curve2e-v161.sty ltxdoc.cfg -curve2e.dtx is the documented TeX source file of file curve2e.sty; you get -both curve2e.sty and curve2e.pdf by running pdflatex on curve2e.dtx. +curve2e.dtx is the documented TeX source file of file curve2e.sty; you +get both curve2e.sty and curve2e.pdf by running pdflatex on curve2e.dtx. The ltxdoc.cfg file customises the way the documentation file is typeset. This .cfg file is not subject to the LPPL licence. @@ -3756,11 +3772,12 @@ standard picture LaTeX environment according to what Leslie Lamport specified in the second edition of his LaTeX manual. This further extension allows to draw lines and vectors with any non -integer slope parameters, to draw dashed lined of any slope, to draw arcs +integer slope parameters, to draw dashed lines of any slope, to draw arcs and curved vectors, to draw curves where just the interpolating nodes are -specified together with the slopes at the nodes; closed paths of any shape -can be filled with color; all coordinates are treated as ordered pairs, -i.e. 'complex numbers'; coordinates may be expressed also in polar form. +specified together with the slopes at the nodes; closed paths of any +shape can be filled with color; all coordinates are treated as ordered +pairs, i.e. 'complex numbers'; coordinates may be expressed also in +polar form. Some of these features have been incorporated in the 2011 version of pict2e; therefore this package avoids any modification to the original pict2e commands. @@ -3768,7 +3785,10 @@ pict2e commands. Curve2e now accepts polar coordinates in addition to the usual cartesian ones; several macros have been upgraded and a new macro for tracing cubic -Bezier splines with their control nodes specified in polar form is available. The same applies to quadratic Bezier splines. +Bezier splines with their control nodes specified in polar form is +available. The same applies to quadratic Bezier splines. The multiput +command has been completely modified in a backwards compatible way, as +to manipulate the increment components. This version solves a conflict with package eso-pic. diff --git a/macros/latex/contrib/curve2e/curve2e.pdf b/macros/latex/contrib/curve2e/curve2e.pdf Binary files differindex 59094e6a2d..f20ef1d96c 100644 --- a/macros/latex/contrib/curve2e/curve2e.pdf +++ b/macros/latex/contrib/curve2e/curve2e.pdf diff --git a/macros/latex/contrib/curve2e/curve2e.sty b/macros/latex/contrib/curve2e/curve2e.sty deleted file mode 100644 index 052cc398b0..0000000000 --- a/macros/latex/contrib/curve2e/curve2e.sty +++ /dev/null @@ -1,729 +0,0 @@ -%% -%% This is file `curve2e.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% curve2e.dtx (with options: `package') -%% -%% Copyright (C) 2005--2019 Claudio Beccari all rights reserved. -%% License information appended -%% -\NeedsTeXFormat{LaTeX2e}[2016/01/01] -\ProvidesPackage{curve2e}% - [2019-10-17 v.2.0.3 Extension package for pict2e] - - - -\IfFileExists{xfp.sty}{% - \RequirePackage{color} - \RequirePackageWithOptions{pict2e}[2014/01/01] - \@ifl@aded{sty}{xparse}{}{\RequirePackage{xparse}} - \@ifl@aded{sty}{xfp}{}{\RequirePackage{xfp}}% -}{% - \RequirePackage{curve2e-v161}% - \PackageWarningNoLine{curve2e}{% - Package xfp is required, but apparently\MessageBreak% - such package cannot be found in this \MessageBreak% - TeX system installation\MessageBreak% - Either your installation is not complete \MessageBreak% - or it is older than 2018-10-17.\MessageBreak% - \MessageBreak% - ***************************************\MessageBreak% - Version 1.61 of curve2e has been loaded\MessageBreak% - instead of the current version\MessageBreak% - ***************************************\MessageBreak}% - \endinput -} -\def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}% -\def\TROF{\tracingcommands\z@ \tracingmacros\z@}% -\ifx\undefined\@tdA \newdimen\@tdA \fi -\ifx\undefined\@tdB \newdimen\@tdB \fi -\ifx\undefined\@tdC \newdimen\@tdC \fi -\ifx\undefined\@tdD \newdimen\@tdD \fi -\ifx\undefined\@tdE \newdimen\@tdE \fi -\ifx\undefined\@tdF \newdimen\@tdF \fi -\ifx\undefined\defaultlinewidth \newdimen\defaultlinewidth \fi -\gdef\linethickness#1{% -\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}% -\newcommand\defaultlinethickness[1]{\defaultlinewidth=#1\relax -\def\thicklines{\linethickness{\defaultlinewidth}}% -\def\thinlines{\linethickness{.5\defaultlinewidth}}\thinlines - \ignorespaces}% -\def\LIne(#1){{\GetCoord(#1)\@tX\@tY - \moveto(0,0) - \pIIe@lineto{\@tX\unitlength}{\@tY\unitlength}\strokepath}\ignorespaces -}% -\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}% -\def\line(#1)#2{\begingroup - \@linelen #2\unitlength - \ifdim\@linelen<\z@\@badlinearg\else - \expandafter\DirOfVect#1to\Dir@line - \GetCoord(\Dir@line)\d@mX\d@mY - \ifdim\d@mX\p@=\z@\else - \edef\sc@lelen{\fpeval{1 / abs(\d@mX)}}\relax - \@linelen=\sc@lelen\@linelen - \fi - \moveto(0,0) - \pIIe@lineto{\d@mX\@linelen}{\d@mY\@linelen}% - \strokepath - \fi -\endgroup\ignorespaces}% -\ifx\Dashline\undefined - \def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}} - - \def\Dashline@(#1)(#2)#3{% - \bgroup - \countdef\NumA3254\countdef\NumB3252\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DlineMod - \DivideFN\DlineMod by#3 to\NumD - \NumA=\fpeval{trunc(\NumD,0)}\relax - \unless\ifodd\NumA\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\egroup - \noexpand\multiput(\V@ttA)(\V@ttC){\number\NumB}% - {\noexpand\LIne(\V@ttB)}}% - \@mpt\ignorespaces}% - \let\Dline\Dashline - - \def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}} -\fi -\ifx\Dotline\undefined - \def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}} - \def\Dotline@(#1)(#2)#3{% - \bgroup - \countdef\NumA 3254\relax \countdef\NumB 3255\relax - \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttA - \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V@ttB - \SubVect\V@ttA from\V@ttB to\V@ttC - \ModOfVect\V@ttC to\DotlineMod - \DivideFN\DotlineMod by#3 to\NumD - \NumA=\fpeval{trunc(\NumD,0)}\relax - \DivVect\V@ttC by\NumA,0 to\V@ttB - \advance\NumA\@ne - \edef\@mpt{\noexpand\egroup - \noexpand\multiput(\V@ttA)(\V@ttB){\number\NumA}% - {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}% - \@mpt\ignorespaces}% - - \def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}}% -\fi -\AtBeginDocument{\@ifpackageloaded{eso-pic}{% -\renewcommand\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}}{}}% -\def\GetCoord(#1)#2#3{% -\expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces} -\def\SplitNod@(#1)#2#3{\isnot@polar#1:!!(#1)#2#3}% -\def\isnot@polar#1:#2!!{\def\@tempOne{#2}\ifx\@tempOne\empty -\expandafter\@firstoftwo\else -\expandafter\@secondoftwo\fi -{\SplitNod@@}{\SplitPolar@@}} - -\def\SplitNod@@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}% -\def\SplitPolar@@(#1:#2)#3#4{\DirFromAngle#1to\@DirA -\ScaleVect\@DirA by#2to\@DirA -\expandafter\SplitNod@@\expandafter(\@DirA)#3#4} -\let\originalput\put -\def\put(#1){\bgroup\GetCoord(#1)\@tX\@tY -\edef\x{\noexpand\egroup\noexpand\originalput(\@tX,\@tY)}\x} -\RenewDocumentCommand{\multiput}{ d() d() m m o }{% -\IfNoValueTF{#1}{\PackageError{curve2e}{% - \string\multiput\space initial point coordinates missing}% - {Nothing done}}% - {\IfNoValueTF{#2}{\PackageError{curve2e}{% - \string\multiput\space Increment components missing}% - {Nothing done}% - }% - {\GetCoord(#2)\dX\dY - \put(#1){\def\X{0}\def\Y{0}\@multicnt=#3\relax - \@whilenum \@multicnt > \z@\do{% - \put(\X,\Y){#4}\IfValueTF{#5}{#5}{% - \edef\X{\fpeval{\X+\dX}}\edef\Y{\fpeval{\Y+\dY}}}% - \advance\@multicnt\m@ne - }% - }} - }% -} - \def\vector(#1)#2{% - \begingroup - \GetCoord(#1)\d@mX\d@mY - \@linelen#2\unitlength - \ifdim\d@mX\p@=\z@\ifdim\d@mY\p@=\z@\@badlinearg\fi\fi - \ifdim\@linelen<\z@ \@linelen=-\@linelen\fi - \MakeVectorFrom\d@mX\d@mY to\@Vect - \DirOfVect\@Vect to\Dir@Vect - \YpartOfVect\Dir@Vect to\@ynum \@ydim=\@ynum\p@ - \XpartOfVect\Dir@Vect to\@xnum \@xdim=\@xnum\p@ - \ifdim\d@mX\p@=\z@ - \else\ifdim\d@mY\p@=\z@ - \else - \edef\sc@lelen{\fpeval{1 / abs(\@xnum)}}\relax - \@linelen=\sc@lelen\@linelen - \fi - \fi - \@tdB=\@linelen -\pIIe@concat\@xdim\@ydim{-\@ydim}\@xdim{\@xnum\@linelen}{\@ynum\@linelen}% - \@linelen\z@ - \pIIe@vector - \fillpath - \@linelen=\@tdB - \@tdA=\pIIe@FAW\@wholewidth - \@tdA=\pIIe@FAL\@tdA - \advance\@linelen-\@tdA - \ifdim\@linelen>\z@ - \moveto(0,0) - \pIIe@lineto{\@xnum\@linelen}{\@ynum\@linelen}% - \strokepath\fi - \endgroup} -\def\Vector(#1){{% -\GetCoord(#1)\@tX\@tY -\ifdim\@tX\p@=\z@ - \vector(\@tX,\@tY){\@tY}% -\else - \vector(\@tX,\@tY){\@tX}% -\fi}} -\def\VECTOR(#1)(#2){\begingroup -\SubVect#1from#2to\@tempa -\expandafter\put\expandafter(#1){\expandafter\Vector\expandafter(\@tempa)}% -\endgroup\ignorespaces} -\def\VVECTOR(#1)(#2){{\SubVect#1from#2to\@tempb -\ScaleVect\@tempb by0.5to\@tempb -\AddVect\@tempb and#1to\@tempb -\VECTOR(\@tempb)(#2)\VECTOR(\@tempb)(#1)\ignorespaces}} -\let\lp@r( \let\rp@r) -\renewcommand*\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}% - {Polylines require at least two vertices!\MessageBreak - Control your polyline 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}{\strokepath\ignorespaces}} -\providecommand\polygon{} -\RenewDocumentCommand\polygon{s O{\beveljoin} }{\@killglue\begingroup -\IfBooleanTF{#1}{\@tempswatrue}{\@tempswafalse}% -\@polygon[#2]} - -\def\@polygon[#1](#2){\@killglue#1\GetCoord(#2)\d@mX\d@mY - \pIIe@moveto{\d@mX\unitlength}{\d@mY\unitlength}% - \@ifnextchar\lp@r{\@@polygon}{% - \PackageWarning{curve2e}% - {Polygons require at least two vertices!\MessageBreak - Control your polygon specification\MessageBreak}% - \ignorespaces}} - - \def\@@polygon(#1){\GetCoord(#1)\d@mX\d@mY - \pIIe@lineto{\d@mX\unitlength}{\d@mY\unitlength}% - \@ifnextchar\lp@r{\@@polygon}{\pIIe@closepath - \if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi - \endgroup - \ignorespaces}} - -\def\GraphGrid(#1,#2){\bgroup\textcolor{red}{\linethickness{.1\p@}% -\RoundUp#1modulo10to\@GridWd \RoundUp#2modulo10to\@GridHt -\@tempcnta=\@GridWd \divide\@tempcnta10\relax \advance\@tempcnta\@ne -\multiput(0,0)(10,0){\@tempcnta}{\line(0,1){\@GridHt}}% -\@tempcnta=\@GridHt \divide\@tempcnta10\advance\@tempcnta\@ne -\multiput(0,0)(0,10){\@tempcnta}{\line(1,0){\@GridWd}}\thinlines}% -\egroup\ignorespaces} -\def\RoundUp#1modulo#2to#3{\expandafter\@tempcnta\Integer#1.??% -\count254\@tempcnta\divide\count254by#2\relax -\multiply\count254by#2\relax -\count252\@tempcnta\advance\count252-\count254 -\ifnum\count252>0\advance\count252-#2\relax -\advance\@tempcnta-\count252\fi\edef#3{\number\@tempcnta}\ignorespaces}% -\def\Integer#1.#2??{#1}% - -\def\DividE#1by#2to#3{% - \edef#3{\fpeval{#1 / #2}}\relax -} -\let\DivideFN\DividE -\def\MultiplY#1by#2to#3{\edef#3{\fpeval{#1 * #2}}}\relax -\let\MultiplyFN\MultiplY -\unless\ifdefined\Numero - \def\Numero#1#2{\bgroup\dimen3254=#2\relax - \edef\x{\noexpand\egroup\noexpand\edef\noexpand#1{% - \strip@pt\dimen3254}}\x\ignorespaces}% -\fi -\def\SinOf#1to#2{\edef#2{\fpeval{round(sind#1,6)}}}\relax -\def\CosOf#1to#2{\edef#2{\fpeval{round(cosd#1,6)}}}\relax -\def\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t@X}{\t@Y}% -\def\s@gno{}% -\ifdim\t@X\p@=\z@ - \ifdim\t@Y\p@=\z@ - \def\ArcTan{0}% vettore nullo - \else - \def\ArcTan{90}% vettore verticale - \ifdim\t@Y\p@<\z@\def\ArcTan{-90}\fi - \fi -\else - \ifdim\t@Y\p@=\z@% vettore orizzontale - \ifdim\t@X\p@<\z@ - \def\ArcTan{180}% - \else - \def\ArcTan{0}% - \fi - \else % vettore qualsiasi - \edef\ArcTan{\fpeval{atand(\t@Y / \t@X)}}\relax - \ifdim\t@X\p@<\z@% vettore nei quadranti di sinistra - \ifdim\t@Y\p@<\z@ - \edef\ArcTan{\fpeval{\ArcTan - 180}}\relax - \else - \edef\ArcTan{\fpeval{\ArcTan + 180}}\relax - \fi - \fi - \fi -\fi -\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}% -\x\ignorespaces} -\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 -\edef#2{\fpeval{sqrt(\t@X*\t@X + \t@Y*\t@Y)}}\relax -\ignorespaces}% -\def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y -\ModOfVect#1to\@tempa -\unless\ifdim\@tempa\p@=\z@ - \DividE\t@X\p@ by\@tempa to\t@X - \DividE\t@Y\p@ by\@tempa to\t@Y -\fi -\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% -\def\ModAndDirOfVect#1to#2and#3{% -\GetCoord(#1)\t@X\t@Y -\ModOfVect#1to#2% -\DirOfVect#1to#3\ignorespaces}% -\def\DistanceAndDirOfVect#1minus#2to#3and#4{% -\SubVect#2from#1to\@tempa -\ModAndDirOfVect\@tempa to#3and#4\ignorespaces}% -\def\XpartOfVect#1to#2{% -\GetCoord(#1)#2\@tempa\ignorespaces}% -\def\YpartOfVect#1to#2{% -\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 -\edef\t@X{\fpeval{#2 * \t@X}}\relax -\edef\t@Y{\fpeval{#2 * \t@Y}}\relax -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% -\def\ConjVect#1to#2{\GetCoord(#1)\t@X\t@Y -\edef\t@Y{-\t@Y}% -\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 -\edef\t@X{\fpeval{\tu@X + \td@X}}\relax -\edef\t@Y{\fpeval{\tu@Y + \td@Y}}\relax -\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 -\edef\t@X{\fpeval{\td@X - \tu@X}}\relax -\edef\t@Y{\fpeval{\td@Y - \tu@Y}}\relax -\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 -\edef\t@X{\fpeval{\tu@X * \td@X - \tu@Y * \td@Y}}\relax -\edef\t@Y{\fpeval{\tu@Y * \td@X + \tu@X * \td@Y}}\relax -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces}% -\def\@ConjMultVect#1by#2to#3{\GetCoord(#1)\tu@X\tu@Y -\GetCoord(#2)\td@X\td@Y -\edef\t@X{\fpeval{\tu@X * \td@X + \tu@Y * \td@Y}}\relax -\edef\t@Y{\fpeval{\tu@Y * \td@X - \tu@X * \td@Y}}\relax -\MakeVectorFrom\t@X\t@Y to#3\ignorespaces} -\def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir -\edef\@Mod{\fpeval{1 / \@Mod}}\relax -\ConjVect\@Dir to\@Dir -\ScaleVect#1by\@Mod to\@tempa -\MultVect\@tempa by\@Dir to#3\ignorespaces}% -\def\Arc(#1)(#2)#3{\begingroup -\@tdA=#3\p@ -\unless\ifdim\@tdA=\z@ - \@Arc(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\@Arc(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi -\Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#2from#1to\@V \ModOfVect\@V to\@Raggio -\CopyVect#2to\@pPun -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc\strokepath\ignorespaces}% -\def\@@Arc{% -\pIIe@moveto{\@pPunX\unitlength}{\@pPunY\unitlength}% -\ifdim\@tdA>180\p@ - \advance\@tdA-180\p@ - \Numero\@gradi\@tdA - \SubVect\@pPun from\@Cent to\@V - \AddVect\@V and\@Cent to\@sPun - \MultVect\@V by0,-1.3333333to\@V - \if\Segno-\ScaleVect\@V by-1to\@V\fi - \AddVect\@pPun and\@V to\@pcPun - \AddVect\@sPun and\@V to\@scPun - \GetCoord(\@pcPun)\@pcPunX\@pcPunY - \GetCoord(\@scPun)\@scPunX\@scPunY - \GetCoord(\@sPun)\@sPunX\@sPunY - \pIIe@curveto{\@pcPunX\unitlength}{\@pcPunY\unitlength}% - {\@scPunX\unitlength}{\@scPunY\unitlength}% - {\@sPunX\unitlength}{\@sPunY\unitlength}% - \CopyVect\@sPun to\@pPun -\fi -\ifdim\@tdA>\z@ - \DirFromAngle\@gradi to\@Dir \if\Segno-\ConjVect\@Dir to\@Dir \fi - \SubVect\@Cent from\@pPun to\@V - \MultVect\@V by\@Dir to\@V - \AddVect\@Cent and\@V to\@sPun - \@tdA=.5\@tdA \Numero\@gradi\@tdA - \DirFromAngle\@gradi to\@Phimezzi - \GetCoord(\@Phimezzi)\@cosphimezzi\@sinphimezzi - \@tdB=1.3333333\p@ \@tdB=\@Raggio\@tdB - \@tdC=\p@ \advance\@tdC -\@cosphimezzi\p@ \Numero\@tempa\@tdC - \@tdB=\@tempa\@tdB - \DividE\@tdB by\@sinphimezzi\p@ to\@cZ - \ScaleVect\@Phimezzi by\@cZ to\@Phimezzi - \ConjVect\@Phimezzi to\@mPhimezzi - \if\Segno-% - \let\@tempa\@Phimezzi - \let\@Phimezzi\@mPhimezzi - \let\@mPhimezzi\@tempa - \fi - \SubVect\@sPun from\@pPun to\@V - \DirOfVect\@V to\@V - \MultVect\@Phimezzi by\@V to\@Phimezzi - \AddVect\@sPun and\@Phimezzi to\@scPun - \ScaleVect\@V by-1to\@V - \MultVect\@mPhimezzi by\@V to\@mPhimezzi - \AddVect\@pPun and\@mPhimezzi to\@pcPun - \GetCoord(\@pcPun)\@pcPunX\@pcPunY - \GetCoord(\@scPun)\@scPunX\@scPunY - \GetCoord(\@sPun)\@sPunX\@sPunY - \pIIe@curveto{\@pcPunX\unitlength}{\@pcPunY\unitlength}% - {\@scPunX\unitlength}{\@scPunY\unitlength}% - {\@sPunX\unitlength}{\@sPunY\unitlength}% -\fi} -\def\VectorArc(#1)(#2)#3{\begingroup -\@tdA=#3\p@ \ifdim\@tdA=\z@\else - \@VArc(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\VectorARC(#1)(#2)#3{\begingroup -\@tdA=#3\p@ -\ifdim\@tdA=\z@\else - \@VARC(#1)(#2)% -\fi -\endgroup\ignorespaces}% -\def\@VArc(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi \Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun -\@tdE=\pIIe@FAW\@wholewidth \@tdE=\pIIe@FAL\@tdE -\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi -\@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 -\edef\@tempA{\ifx\Segno-\m@ne\else\@ne\fi}% -\MultVect\@sPun by 0,\@tempA to\@vPun -\DirOfVect\@vPun to\@Dir -\AddVect\@sPun and #1 to \@sPun -\GetCoord(\@sPun)\@tdX\@tdY -\@tdD\ifx\Segno--\fi\DeltaGradi\p@ -\@tdD=.5\@tdD \Numero\DeltaGradi\@tdD -\DirFromAngle\DeltaGradi to\@Dird -\MultVect\@Dir by*\@Dird to\@Dir -\GetCoord(\@Dir)\@xnum\@ynum -\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% -\@tdE =\ifx\Segno--\fi\DeltaGradi\p@ -\advance\@tdA -\@tdE \Numero\@gradi\@tdA -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% -\def\@VARC(#1)(#2){% -\ifdim\@tdA>\z@ - \let\Segno+% -\else - \@tdA=-\@tdA \let\Segno-% -\fi \Numero\@gradi\@tdA -\ifdim\@tdA>360\p@ - \PackageWarning{curve2e}{The arc aperture is \@gradi\space degrees - and gets reduced\MessageBreak% - to the range 0--360 taking the sign into consideration}% - \@whiledim\@tdA>360\p@\do{\advance\@tdA-360\p@}% -\fi -\SubVect#1from#2to\@V \ModOfVect\@V to\@Raggio \CopyVect#2to\@pPun -\@tdE=\pIIe@FAW\@wholewidth \@tdE=0.8\@tdE -\DividE\@tdE by \@Raggio\unitlength to\DeltaGradi -\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD -\@tdD=\if\Segno--\fi\@gradi\p@ \Numero\@tempa\@tdD -\DirFromAngle\@tempa to\@Dir -\MultVect\@V by\@Dir to\@sPun% corrects the end point -\edef\@tempA{\if\Segno--\fi1}% -\MultVect\@sPun by 0,\@tempA to\@vPun -\DirOfVect\@vPun to\@Dir -\AddVect\@sPun and #1 to \@sPun -\GetCoord(\@sPun)\@tdX\@tdY -\@tdD\if\Segno--\fi\DeltaGradi\p@ -\@tdD=.5\@tdD \Numero\@tempB\@tdD -\DirFromAngle\@tempB to\@Dird -\MultVect\@Dir by*\@Dird to\@Dir -\GetCoord(\@Dir)\@xnum\@ynum -\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrowt ip -\@tdE =\DeltaGradi\p@ -\advance\@tdA -2\@tdE \Numero\@gradi\@tdA -\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY -\SubVect\@Cent from\@pPun to \@V -\edef\@tempa{\if\Segno-\else-\fi\@ne}% -\MultVect\@V by0,\@tempa to\@vPun -\@tdE\if\Segno--\fi\DeltaGradi\p@ -\Numero\@tempB{0.5\@tdE}% -\DirFromAngle\@tempB to\@Dird -\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}}% starting point arrow tip -\edef\@tempa{\if\Segno--\fi\DeltaGradi}% -\DirFromAngle\@tempa to \@Dir -\SubVect\@Cent from\@pPun to\@V -\MultVect\@V by\@Dir to\@V -\AddVect\@Cent and\@V to\@pPun -\GetCoord(\@pPun)\@pPunX\@pPunY -\@@Arc -\strokepath\ignorespaces}% -\def\CurveBetween#1and#2WithDirs#3and#4{% - \StartCurveAt#1WithDir{#3}\relax - \CurveTo#2WithDir{#4}\CurveFinish\ignorespaces -}% -\def\StartCurveAt#1WithDir#2{% -\begingroup -\GetCoord(#1)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Pzero -\pIIe@moveto{\@tempa\unitlength}{\@tempb\unitlength}% -\GetCoord(#2)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Dzero -\DirOfVect\@Dzero to\@Dzero -\ignorespaces} -\def\ChangeDir<#1>{% -\GetCoord(#1)\@tempa\@tempb -\CopyVect\@tempa,\@tempb to\@Dzero -\DirOfVect\@Dzero to\@Dzero -\ignorespaces} -\def\CurveFinish{\strokepath\endgroup\ignorespaces}% -\def\FillCurve{\fillpath\endgroup\ignorespaces} -\def\CurveEnd{\fillstroke\endgroup\ignorespaces} -\def\CbezierTo#1WithDir#2AndDists#3And#4{% -\GetCoord(#1)\@tX\@tY \MakeVectorFrom\@tX\@tY to\@Puno -\GetCoord(#2)\@tX\@tY \MakeVectorFrom\@tX\@tY to \@Duno -\DirOfVect\@Duno to\@Duno -\ScaleVect\@Dzero by#3to\@Czero \AddVect\@Pzero and\@Czero to\@Czero -\ScaleVect\@Duno by-#4to \@Cuno \AddVect\@Puno and\@Cuno to \@Cuno -\GetCoord(\@Czero)\@XCzero\@YCzero -\GetCoord(\@Cuno)\@XCuno\@YCuno -\GetCoord(\@Puno)\@XPuno\@YPuno -\pIIe@curveto{\@XCzero\unitlength}{\@YCzero\unitlength}% - {\@XCuno\unitlength}{\@YCuno\unitlength}% - {\@XPuno\unitlength}{\@YPuno\unitlength}% -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces}% -\def\CbezierBetween#1And#2WithDirs#3And#4UsingDists#5And#6{% -\StartCurveAt#1WithDir{#3}\relax -\CbezierTo#2WithDir#4AndDists#5And{#6}\CurveFinish} - -\def\@isTension#1;#2!!{\def\@tempA{#1}% -\def\@tempB{#2}\unless\ifx\@tempB\empty\strip@semicolon#2\fi} - -\def\strip@semicolon#1;{\def\@tempB{#1}} -\def\CurveTo#1WithDir#2{% -\def\@Tuno{1}\def\@Tzero{1}\relax -\edef\@Puno{#1}\@isTension#2;!!% -\expandafter\DirOfVect\@tempA to\@Duno -\bgroup\unless\ifx\@tempB\empty\GetCoord(\@tempB)\@Tzero\@Tuno\fi -\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord -\MultVect\@Dzero by*\@DirChord to \@Dpzero -\MultVect\@Duno by*\@DirChord to \@Dpuno -\GetCoord(\@Dpzero)\@DXpzero\@DYpzero -\GetCoord(\@Dpuno)\@DXpuno\@DYpuno -\DivideFN\@Chord by2 to\@semichord -\ifdim\@DXpzero\p@=\z@ - \@tdA=1.333333\p@ - \Numero\@KCzero{\@semichord\@tdA}% -\fi -\ifdim\@DYpzero\p@=\z@ - \@tdA=1.333333\p@ - \Numero\@Kpzero{\@semichord\@tdA}% -\fi -\unless\ifdim\@DXpzero\p@=\z@ - \unless\ifdim\@DYpzero\p@=\z@ - \edef\@CosDzero{\ifdim\@DXpzero\p@<\z@ -\fi\@DXpzero}% - \edef\@SinDzero{\ifdim\@DYpzero\p@<\z@ -\fi\@DYpzero}% - \@tdA=\@semichord\p@ \@tdA=1.333333\@tdA - \DividE\@tdA by\@SinDzero\p@ to \@KCzero - \@tdA=\dimexpr(\p@-\@CosDzero\p@)\relax - \DividE\@KCzero\@tdA by\@SinDzero\p@ to \@KCzero - \fi -\fi -\MultiplyFN\@KCzero by \@Tzero to \@KCzero -\ScaleVect\@Dzero by\@KCzero to\@CPzero -\AddVect\@Pzero and\@CPzero to\@CPzero -\ifdim\@DXpuno\p@=\z@ - \@tdA=-1.333333\p@ - \Numero\@KCuno{\@semichord\@tdA}% -\fi -\ifdim\@DYpuno\p@=\z@ - \@tdA=-1.333333\p@ - \Numero\@KCuno{\@semichord\@tdA}% -\fi -\unless\ifdim\@DXpuno\p@=\z@ - \unless\ifdim\@DYpuno\p@=\z@ - \edef\@CosDuno{\ifdim\@DXpuno\p@<\z@ -\fi\@DXpuno}% - \edef\@SinDuno{\ifdim\@DYpuno\p@<\z@ -\fi\@DYpuno}% - \@tdA=\@semichord\p@ \@tdA=-1.333333\@tdA - \DividE\@tdA by \@SinDuno\p@ to \@KCuno - \@tdA=\dimexpr(\p@-\@CosDuno\p@)\relax - \DividE\@KCuno\@tdA by\@SinDuno\p@ to \@KCuno - \fi -\fi -\MultiplyFN\@KCuno by \@Tuno to \@KCuno -\ScaleVect\@Duno by\@KCuno to\@CPuno -\AddVect\@Puno and\@CPuno to\@CPuno -\GetCoord(\@Puno)\@XPuno\@YPuno -\GetCoord(\@CPzero)\@XCPzero\@YCPzero -\GetCoord(\@CPuno)\@XCPuno\@YCPuno -\pIIe@curveto{\@XCPzero\unitlength}{\@YCPzero\unitlength}% - {\@XCPuno\unitlength}{\@YCPuno\unitlength}% - {\@XPuno\unitlength}{\@YPuno\unitlength}\egroup -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces}% -\def\Curve{\@ifstar{\let\fillstroke\fillpath\Curve@}% -{\let\fillstroke\strokepath\Curve@}} - -\def\Curve@(#1)<#2>{% - \StartCurveAt#1WithDir{#2}% - \@ifnextchar\lp@r\@Curve{% - \PackageWarning{curve2e}{% - Curve specifications must contain at least two nodes!\Messagebreak - Please, control your \string\Curve\space specifications\MessageBreak}}} -\def\@Curve(#1)<#2>{% - \CurveTo#1WithDir{#2}% - \@ifnextchar\lp@r\@Curve{% - \@ifnextchar[\@ChangeDir\CurveEnd}} -\def\@ChangeDir[#1]{\ChangeDir<#1>\@Curve} -\def\Qurve{\@ifstar{\let\fillstroke\fillpath\Qurve@}% -{\let\fillstroke\strokepath\Qurve@}} - -\def\Qurve@(#1)<#2>{% - \StartCurveAt#1WithDir{#2}% - \@ifnextchar\lp@r\@Qurve{% - \PackageWarning{curve2e}{% - Quadratic curve specifications must contain at least - two nodes!\Messagebreak - Please, control your Qurve specifications\MessageBreak}}}% - -\def\@Qurve(#1)<#2>{\QurveTo#1WithDir{#2}% - \@ifnextchar\lp@r\@Qurve{% - \@ifnextchar[\@ChangeQDir\CurveEnd}}% - -\def\@ChangeQDir[#1]{\ChangeDir<#1>\@Qurve}% -\def\QurveTo#1WithDir#2{% -\edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup -\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord -\MultVect\@Dzero by*\@Duno to \@Scalar -\YpartOfVect\@Scalar to \@YScalar -\ifdim\@YScalar\p@=\z@ -\PackageWarning{curve2e}% - {Quadratic Bezier arcs cannot have their starting\MessageBreak - and ending directions parallel or antiparallel with\MessageBreak - each other. This arc is skipped and replaced with - a dotted line.\MessageBreak}% - \Dotline(\@Pzero)(\@Puno){2}\relax -\else -\MultVect\@Dzero by*\@DirChord to \@Dpzero -\MultVect\@Duno by*\@DirChord to \@Dpuno -\GetCoord(\@Dpzero)\@DXpzero\@DYpzero -\GetCoord(\@Dpuno)\@DXpuno\@DYpuno -\MultiplyFN\@DXpzero by\@DXpuno to\@XXD -\MultiplyFN\@DYpzero by\@DYpuno to\@YYD -\unless\ifdim\@YYD\p@<\z@\ifdim\@XXD\p@<\z@ -\PackageWarning{curve2e}% - {Quadratic Bezier arcs cannot have inflection points\MessageBreak - Therefore the tangents to the starting and ending arc\MessageBreak - points cannot be directed to the same half plane.\MessageBreak - This arc is skipped and replaced by a dotted line\MessageBreak}% - \Dotline(\@Pzero)(\@Puno){2}\fi -\else -\edef\@CDzero{\@DXpzero}\relax -\edef\@SDzero{\@DYpzero}\relax -\edef\@CDuno{\@DXpuno}\relax -\edef\@SDuno{\@DYpuno}\relax -\MultiplyFN\@SDzero by\@CDuno to\@tempA -\MultiplyFN\@SDuno by\@CDzero to\@tempB -\edef\@tempA{\strip@pt\dimexpr\@tempA\p@-\@tempB\p@}\relax -\@tdA=\@SDuno\p@ \@tdB=\@Chord\p@ \@tdC=\@tempA\p@ -\edef\@tempC{\strip@pt\dimexpr \@tdA*\@tdB/\@tdC}\relax -\MultiplyFN\@tempC by\@CDzero to \@XC -\MultiplyFN\@tempC by\@SDzero to \@YC -\ModOfVect\@XC,\@YC to\@KC -\ScaleVect\@Dzero by\@KC to\@CP -\AddVect\@Pzero and\@CP to\@CP -\GetCoord(\@Pzero)\@XPzero\@YPzero -\GetCoord(\@Puno)\@XPuno\@YPuno -\GetCoord(\@CP)\@XCP\@YCP -\@ovxx=\@XPzero\unitlength \@ovyy=\@YPzero\unitlength -\@ovdx=\@XCP\unitlength \@ovdy=\@YCP\unitlength -\@xdim=\@XPuno\unitlength \@ydim=\@YPuno\unitlength - \pIIe@bezier@QtoC\@ovxx\@ovdx\@ovro - \pIIe@bezier@QtoC\@ovyy\@ovdy\@ovri - \pIIe@bezier@QtoC\@xdim\@ovdx\@clnwd - \pIIe@bezier@QtoC\@ydim\@ovdy\@clnht - \pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim -\fi\fi\egroup -\CopyVect\@Puno to\@Pzero -\CopyVect\@Duno to\@Dzero -\ignorespaces} - -%% -%% -%% 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 file curve2e.dtx, and the derived files -%% curve2e.sty and curve2e.pdf, plus the auxiliary derived files -%% README.txt and manifest.txt. -%% -%% -%% End of file `curve2e.sty'. diff --git a/macros/latex/contrib/scontents/README.md b/macros/latex/contrib/scontents/README.md index cc40a94214..73e9648df8 100644 --- a/macros/latex/contrib/scontents/README.md +++ b/macros/latex/contrib/scontents/README.md @@ -1,6 +1,6 @@ ## scontents — Stores LaTeX contents in memory or files -- Version: 1.4 -- Date: 2019/10/03 +- Version: 1.5 +- Date: 2019-10-24 - Author: Pablo González ## Description @@ -18,9 +18,21 @@ The package loads and depends on updated versions of: ## Installation The package `scontents` is present in `TeXLive` and `MiKTeX`, use the -package manager to install. For a manual installation, put `scontents.dtx` -in your working directory and run `tex scontents.dtx`. - +package manager to install. + +For manual installation, download `scontents.zip` and unzip it, then move +the files to appropriate locations: +``` + scontents.tex -> TDS:tex/generic/scontents/ + scontents-code.tex -> TDS:tex/generic/scontents/ + scontents.sty -> TDS:tex/latex/scontents/ + t-scontents.mkvi -> TDS:tex/context/third/scontents/ + scontents.pdf -> TDS:doc/latex/scontents/ + README.md -> TDS:doc/latex/scontents/ + scontents.dtx -> TDS:source/latex/scontents/ + scontents.ins -> TDS:source/latex/scontents/ +``` +then run `mktexlsr`. ## Examples The file `scontents.pdf` contains attached examples, which can be extracted @@ -34,3 +46,4 @@ conditions of the [LaTeX Project Public License](https://www.latex-project.org/l - README.md (this file) - scontents.pdf (documentation) - scontents.dtx (master file that produced all files) +- scontents.ins (installer to extract all files) diff --git a/macros/latex/contrib/scontents/scontents.dtx b/macros/latex/contrib/scontents/scontents.dtx index fd0504e7a2..4b77c043ee 100644 --- a/macros/latex/contrib/scontents/scontents.dtx +++ b/macros/latex/contrib/scontents/scontents.dtx @@ -6,68 +6,21 @@ % LaTeX Project Public License, either version 1.3c 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 +% http://www.latex-project.org/lppl.txt % % and version 1.3c or later is part of all distributions of LaTeX version % 2005/12/01 or later. -% +% % This work is "maintained" (as per the LPPL maintenance status) % by Pablo González Luengo. -% -% This work consists of the file scontents.dtx -% and the derived files scontents.ins, -% scontents.pdf and -% scontents.sty. -% -%<*internal> -\def\nameofplainTeX{plain} -\ifx\fmtname\nameofplainTeX\else - \expandafter\begingroup -\fi -%</internal> -%<*install> -\input l3docstrip.tex -\keepsilent -\askforoverwritefalse -\preamble - -Copyright (C) 2019 by Pablo González L <pablgonz@educarchile.cl> - -This work may be distributed and/or modified under the conditions of the -LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version -2005/12/01 or later. - -This work is "maintained" (as per the LPPL maintenance status) -by Pablo González Luengo. - -This work consists of the file scontents.dtx -and the derived files scontents.ins, - scontents.pdf and - scontents.sty. - -\endpreamble -\usedir{tex/latex/scontents} -\generate{% - \file{\jobname.sty}{\from{\jobname.dtx}{package}}% -}% -%</install> -%<install>\endbatchfile -%<*internal> -\usedir{source/latex/scontents} -\generate{ - \file{\jobname.ins}{\from{\jobname.dtx}{install}} -} -\ifx\fmtname\nameofplainTeX - \expandafter\endbatchfile -\else - \expandafter\endgroup -\fi -%</internal> +% +% This work consists of the files scontents.dtx and +% scontents.ins, +% and the derived files scontents.sty, +% scontents.tex, +% t-scontents.mkvi and +% scontents-code.tex. +% %<*driver> \documentclass[full]{l3doc} % imakeidx also opens a write stream for the .idx file, and that conflicts @@ -372,8 +325,11 @@ and the derived files scontents.ins, \lstdefinelanguage{scontents-doc}{ texcsstyle=*,% escapechar=`,% - showstringspaces=false,% - extendedchars=true, % + extendedchars=true,% + breakatwhitespace=true,% + breaklines=true,% + keepspaces=true,% + columns=fullflexible,% stringstyle= {\color{red}},% basicstyle=\ttfamily\small,% alsoletter=-,% @@ -382,28 +338,30 @@ and the derived files scontents.ins, commentstyle=\lmmitalic\small\itshape\color{lightgray},% % Important words 1 keywordstyle=[1]{\color{gray}},% - keywords=[1]{begin,end},% + keywords=[1]{begin,end,Verbatim},% % Other words 2 keywordstyle=[2]{\color{blue!75}},% - keywords=[2]{usepackage,section,documentclass},% + keywords=[2]{usepackage,section,documentclass,input,usemodule},% % Other words 3 keywordstyle=[3]{\color{optcolor!85}},% keywords=[3]{document,article},% % Reserved words 4 (scontents pkg) keywordstyle=[4]{\color{mypkgcolor}},% keywords=[4]{scontents,Scontents,getstored,typestored,verbatimsc,% - endverbatimsc,countsc,meaningsc},% + endverbatimsc,countsc,meaningsc,foreachsc,macros + endscontents,startscontents,stopscontents},% % Reserved in red keywordstyle=[5]{\color{red}},% - keywords=[5]{makeatletter,makeatother,let},% + keywords=[5]{makeatletter,makeatother,let,verb,undefined,makebox},% % Reserved in orange keywordstyle=[6]{\color{optcolor}},% - keywords=[6]{verb,myverb,store-cmd,store-env,print-env,write-env,% - write-out,width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},% + keywords=[6]{store-cmd,store-env,print-env,write-env,% + start,stopt,wrapper,sep,step,before,after,write-out,% + width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},% % Reserved in orange keywordstyle=[7]{\color{OrangeRed}},% - keywords=[7]{foreach,DefineVerbatimEnvironment,lstnewenvironment,newminted},% -% literateee + keywords=[7]{DefineVerbatimEnvironment,lstnewenvironment,newminted,newenvironment},% +% literate literate=*{\{}{{\textcolor{gray}{\{}}}{1} {\}}{{\textcolor{gray}{\}}}}{1} {[}{{\textcolor{gray}{[}}}{1} @@ -440,6 +398,7 @@ and the derived files scontents.ins, escapechar=`,% upquote=true,% numbersep=1em,% + columns=fullflexible,% numberstyle=\tiny\color{lightgray}\noaccsupp,% literate=*{\%}{{\bfseries\textcolor{gray}{\%}}}{1} } @@ -449,7 +408,7 @@ and the derived files scontents.ins, \lstMakeShortInline[language=scontents-doc,basicstyle=\ttfamily]§ % Get file info -\GetFileInfo{\jobname.sty} +\GetFileInfo{scontents.sty} % Config hyperref \hypersetup{ @@ -463,7 +422,7 @@ and the derived files scontents.ins, pdfsubject = {Documentation for \fileversion{} [\filedate] },% pdfcopyright = {\textcopyright 2019 by Pablo González}, pdfcontacturl = {https://github.com/pablgonz/scontents}, - pdfkeywords = {contents, external files, expl3, xparse, l3seq, Store contents}, + pdfkeywords = {sequences, contents, external files, expl3, xparse, l3seq, store contents}, pdfstartview = {FitH},% bookmarksopenlevel = 1,% } @@ -554,7 +513,7 @@ and the derived files scontents.ins, % \section{Motivation and Acknowledgments} % % In \hologo{(La)TeX} there is no direct way to record content for later use, although -% you can do this using "\macros", recording \mymeta{verbatim content} is a +% you can do this using §\macros§, recording \mymeta{verbatim content} is a % problem, usually you can avoid this by creating external files or boxes. The % general idea of this package is to try to imitate this implementation % \emph{buffers} that has \hologo{ConTeXt} which allows you to save content in @@ -593,8 +552,8 @@ and the derived files scontents.ins, % \medskip % % The \mypkg*{scontents} package loads \mypkg{expl3}, \mypkg{xparse} and -% \mypkg{l3keys2e}. This package can be used with "xelatex", "lualatex" -% , "pdflatex" and the classical workflow §latex>dvips>ps2pdf§. +% \mypkg{l3keys2e}. This package can be used with "plain", "context", "xelatex", +% "lualatex", "pdflatex" and the classical workflow §latex>dvips>ps2pdf§. % % \thispagestyle{plain} % @@ -616,9 +575,9 @@ and the derived files scontents.ins, % by making use \mymeta{sequences}. % \end{scontents} % -% The package uses a \myoarg{key \textnormal{\textcolor{gray}{=}} val} -% system for the options and is loaded in the usual way: +% The package is loaded in the usual way: % +% \subsubsection*{For \hologo{LaTeX} users} % \iffalse %<*example> % \fi @@ -640,6 +599,30 @@ and the derived files scontents.ins, %</example> % \fi % +% \subsubsection*{For \hologo{plainTeX} users} +% +% \iffalse +%<*example> +% \fi +\begin{examplecode}[frame=single] +\input scontents.tex +\end{examplecode} +% \iffalse +%</example> +% \fi +% +% \subsubsection*{For \hologo{ConTeXt} users} +% +% \iffalse +%<*example> +% \fi +\begin{examplecode}[frame=single] +\usemodule{scontents} +\end{examplecode} +% \iffalse +%</example> +% \fi +% % \subsection{The TAB character} % \label{sec:tabcharacter} % @@ -667,7 +650,7 @@ and the derived files scontents.ins, % % As a general recommendation \enquote{Do not use "TAB" character unless strictly % necessary}, for example within a \emph{verbatim} environment that supports -% this character such as §Verbatim§ of the package \mypkg{fancyvrb} or §lstlisting§ +% this character such as \myenv{Verbatim} of the package \mypkg{fancyvrb} or \myenv{lstlisting} % of the package \mypkg{listings} or when you want to generate a §MakeFile§ file. % % \subsection{Configuration of the options} @@ -718,7 +701,7 @@ and the derived files scontents.ins, % This key is necessary only if the last line is the closing of some % environment defined by the \mypkg{fancyvrb} package as §\end{Verbatim}§ % or another environment that does not support a comments \enquote{\textcolor{gray}{\%}} -% after closing §\end{...}%§. This key is available for the \myenv*{scontents} +% after closing §\end{§\textcolor{gray}{...}§}%§. This key is available for the \myenv*{scontents} % environment and the \ics*{Scontents} command. % % \keyexamp{width-tab}{integer}{1} @@ -776,13 +759,13 @@ and the derived files scontents.ins, % \end{syntax} % % The \myenv*{scontents} environment allows you to \mymeta{store} and \mymeta{write} -% content, including \emph{verbatim} material. After the package has been loaded, -% the environment can be used both in the preamble and in the body of the document. +% content, including \emph{verbatim} material. After the package has been +% loaded, the environment can be used both in the preamble and in the body +% of the document. % -% For the correct operation §\begin{scontents}§ and §\end{scontents}§ must be in -% different lines, all \mymeta{keys} must be passed in a \mymeta{single line} separated -% by commas \enquote{without vertical spaces} and \enquote{without separation} of -% the start of the environment. +% For the correct operation §\begin{scontents}§ and §\end{scontents}§ must +% be in different lines, all \mymeta{keys} must be passed separated by +% commas and \enquote{without separation} of the start of the environment. % \end{function} % % Comments \enquote{\textcolor{gray}{\%}} or \enquote{any character} after @@ -818,6 +801,11 @@ This text is in the outer environment (after nested). % It is advisable to store content within sequences with different names, % so as not to get lost in the order in which content is stored. % +% In \hologo{plainTeX} there is not environments as in \hologo{LaTeX}. +% Instead of using the environment \myenv*{scontents}, one should use a +% \emph{pseudo environment} delimited by \ics*{scontents} and \ics*{endscontents}. +% \hologo{ConTeXt} users should use \ics*{startscontents} and \ics*{stopscontents}. +% % \subsection*{Options for environment} % % The environment options can be configured globally using option @@ -836,7 +824,7 @@ This text is in the outer environment (after nested). % running the environment. The content is extracted from the \mymeta{sequence} % in which it is stored. % -% \newpage +% \medskip % % \keyexamp{write-env}{file.ext}{not used} % Sets the name of the \mymeta{external file} in which the \mymeta{contents} of @@ -925,11 +913,63 @@ This text is in the outer environment (after nested). % \end{syntax} % \end{function} % -% The command \ics*{getstored} gets the content stored in \mymeta{seq name} +% The command \ics*{getstored} gets the content stored in \mymarg{seq name} % according to the \mymeta{index} in which it was stored. The command is % robust and can be used as an \mymeta{argument} for another command. If the % optional argument is not passed it defaults to the first element stored -% in the \mymeta{seq name}. +% in the \mymarg{seq name}. +% +% \subsection{The command \cs{foreachsc}} +% \label{sec:foreachsc} +% +% \vspace*{-10pt} +% +% \begin{function}{\foreachsc} +% \begin{syntax} +% \cmdexamp{foreachsc}[key \textnormal{\textcolor{gray}{=}} val]{seq name} +% \end{syntax} +% \end{function} +% +% The command \ics*{foreachsc} goes through and executes the command §\getstored§ +% on the contents stored in \mymarg{seq name}. If you pass without options run +% §\getstored§ on all contents stored in \mymarg{seq name}. +% +% \subsection*{Options for command} +% \label{sec:optcmdfor} +% +% \keyexamp{sep}{code}{empty} +% Establishes the separation between each content stored in \mymarg{seq name}. +% For example, you can use §sep={\\[10pt]}§ for vertical separation of stored +% contents. +% +% \keyexamp{step}{integer}{1} +% Sets the increment (\mymeta{step}) applied to the value set by key §start§ +% for each element stored in the \mymarg{seq name}. The value must be a +% \mymeta{positive integer}. +% +% \keyexamp{start}{integer}{1} +% Sets the \mymeta{index} number of the \mymarg{seq name} from which execution +% will start. The value must be a \mymeta{positive integer}. +% +% \keyexamp{stop}{integer}{total} +% Sets the \mymeta{index} number of the \mymarg{seq name} from which execution +% it will finish executing. The value must be a \mymeta{positive integer}. +% +% \keyexamp{before}{code}{empty} +% Sets the \mymarg{code} that will be executed \mymeta{before} each content stored +% in \mymarg{seq name}. The \mymarg{code} must be passed between braces. +% +% \medskip +% +% \keyexamp{after}{code}{empty} +% Sets the \mymarg{code} that will be executed \mymeta{after} each content stored +% in \mymarg{seq name}. The \mymarg{code} must be passed between braces. +% +% \keyexamp{wrapper}{code \textnormal{\textcolor{gray}{\{\#1\}}} more code}{empty} +% Wraps the content stored in \mymarg{seq name} referenced by \mymarg{\#1}. +% The \mymarg{code} must be passed between braces. For example +% §\foreachsc[wrapper={\makebox[1em][l]{#1}}]{contents}§. +% % % \subsection{The command \cs{typestored}} % \label{sec:typestored} @@ -941,13 +981,12 @@ This text is in the outer environment (after nested). % \cmdexamp{typestored}[index\textnormal{\textcolor{gray}{,}} width-tab \textnormal{\textcolor{gray}{=}} number]{seq name} % \end{syntax} % The command \ics*{typestored} internally places the content stored in -% the \mymeta{seq name} into the \myenv*{verbatimsc} environment. The \mymeta{index} -% number corresponds to the position in which the content is stored in -% the \mymeta{seq name}. +% the \mymarg{seq name} into the \myenv*{verbatimsc} environment. The \mymeta{index} +% corresponds to the position in which the content is stored in the \mymarg{seq name}. % \end{function} % % If the optional argument is not passed it defaults to the first element -% stored in the \mymeta{seq name}. The key §width-tab§ is available for +% stored in the \mymarg{seq name}. The key §width-tab§ is available for % this command. % % The \mypkg{verbatim} package is not compatible with the implementation @@ -955,8 +994,6 @@ This text is in the outer environment (after nested). % a user of that package consider customizing the \myenv*{verbatimsc} % environment. % -% \newpage -% % \subsection{The environment \env{verbatimsc}} % \label{sec:verbatimsc} % @@ -1043,12 +1080,12 @@ This text is in the outer environment (after nested). % \cmdexamp{meaningsc}[index\textnormal{\textcolor{gray}{,}} width-tab \textnormal{\textcolor{gray}{=}} number]{seq name} % \end{syntax} % The command \ics*{meaningsc} executes \ics{meaning} on the content stored -% in \mymeta{seq name}. The \mymeta{index} number corresponds to the position -% in which the content is stored in the \mymeta{seq name}. +% in \mymarg{seq name}. The \mymeta{index} corresponds to the position +% in which the content is stored in the \mymarg{seq name}. % \end{function} % % If the optional argument is not passed it defaults to the first element -% stored in the \mymeta{seq name}. The key §width-tab§ is available for +% stored in the \mymarg{seq name}. The key §width-tab§ is available for % this command. % % \subsection{The command \cs{countsc}} @@ -1060,7 +1097,7 @@ This text is in the outer environment (after nested). % \begin{syntax} % \cmdexamp{countsc}{seq name} % \end{syntax} -% The command \ics*{countsc} count a number of contents stored in \mymeta{seq name}. +% The command \ics*{countsc} count a number of contents stored in \mymarg{seq name}. % \end{function} % % \subsection{The command \cs{cleanseqsc}} @@ -1072,7 +1109,7 @@ This text is in the outer environment (after nested). % \begin{syntax} % \cmdexamp{cleanseqsc}{seq name} % \end{syntax} -% The command \ics*{cleanseqsc} remove all contents stored in \mymeta{seq name}. +% The command \ics*{cleanseqsc} remove all contents stored in \mymarg{seq name}. % \end{function} % % \newpage @@ -1158,7 +1195,6 @@ by making use \mymeta{sequences}. \begin{scontents}[write-out=scexamp1.ltx] \documentclass[12pt,a4paper]{article} \usepackage[store-cmd=solutions]{scontents} -\usepackage{pgffor} \newtheorem{ex}{Exercise} \begin{document} \section{Problems} @@ -1177,9 +1213,7 @@ Second exercise \end{ex} \section{Solutions} -\foreach \i in {1,...,\countsc{solutions}} { -\noindent\textbf{\i} \getstored[\i]{solutions}\par -} +\foreachsc[sep={\\[10pt]}]{solutions} \end{document} \end{scontents} % \iffalse @@ -1200,7 +1234,6 @@ Second exercise \begin{scontents}[write-out=scexamp2.ltx] \documentclass{article} \usepackage[store-env=defexercise,store-cmd=defexercise]{scontents} -\usepackage{pgffor} \pagestyle{empty} \begin{document} % not starred @@ -1218,10 +1251,9 @@ advance evidence from knowledge of the names of its employees in the seventies that the \NSA\ has known that for 40 years.\par \end{scontents} % see all stored -\foreach \i in {1,...,3} { \begin{itemize} -\item \getstored[\i]{defexercise} -\end{itemize}} +\foreachsc[before={\item }]{defexercise} +\end{itemize} % \getstored are robust :) \section{\getstored[2]{defexercise}} \end{document} @@ -1286,7 +1318,6 @@ seventies that the \NSA\ has known that for 40 years.\par \begin{scontents}[write-out=scexamp4.ltx] \documentclass{article} \usepackage{scontents} -\usepackage{pgffor} \pagestyle{empty} \begin{document} \begin{scontents}[store-env=a] @@ -1306,9 +1337,8 @@ Something with no label This is a: \getstored[1]{a}\par This is b: \getstored[2]{a} -\textbf{Print all of them} - -\foreach \i in {1,...,\countsc{a}} {\getstored[\i]{a}\par} +\textbf{Print all of them}\par +\foreachsc[sep={\\[10pt]}]{a} \end{document} \end{scontents} % \iffalse @@ -1554,13 +1584,21 @@ No tab % \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=\descrwidth,nosep,noitemsep] % \item [\fileversion{} (ctan), \filedate] % \begin{itemize} +% \item Add support for \hologo{plainTeX} and \hologo{ConTeXt}. +% \item Split internal code for optimization. +% \item Add support for vertical spaces in |key=val|. +% \item Add |\foreachsc| command. +% \item Check if |verbatim| package is loaded. +% \end{itemize} +% \item [v1.4 (ctan), 2019-10-03] +% \begin{itemize} % \item Add |store-all| key. % \item Messages and keys were separated. % \item Restructuring of documentation. % \item Now the version of |expl3| is checked instead of |xparse|. % \item The internal behavior of \verb+force-eol+ has been modified. % \end{itemize} -% \item [v1.3 (ctan), 2019/09/24] +% \item [v1.3 (ctan), 2019-09-24] % \begin{itemize} % \item The environment can now nest. % \item Added \verb+force-eol+, \verb+verb-font+ and \verb+width-tab+ keys. @@ -1570,17 +1608,17 @@ No tab % \item Remove \verb+filecontentsdef+ dependency. % \item Changing \verb+\regex_replace_all:+ for \verb+\tl_replace_all:+. % \end{itemize} -% \item [v1.2 (ctan), 2019/08/28] +% \item [v1.2 (ctan), 2019-08-28] % \begin{itemize} % \item Restructuring of documentation. % \item Added copy of \verb+\tex_scantokens:D+. % \end{itemize} -% \item [v1.1 (ctan), 2019/08/12] +% \item [v1.1 (ctan), 2019-08-12] % \begin{itemize} % \item Extension of documentation. % \item Replace \verb+\tex_endinput:D+ by \verb+\file_input_stop:+. % \end{itemize} -% \item [v1.0 (ctan), 2019/07/30] +% \item [v1.0 (ctan), 2019-07-30] % \begin{itemize} % \item First public release, % \end{itemize} @@ -1604,10 +1642,6 @@ No tab % \label{sec:Implementation} % \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} % -% \iffalse -%<*package> -% \fi -% % \subsection{Declaration of the package} % % First we set up the module name for \pkg{l3doc}: @@ -1615,30 +1649,155 @@ No tab %<@@=scontents> % \end{macrocode} % -% Then, we can give the traditional declaration of a package written with -% \pkg{expl3} and the necessary packages for its operation. -% +% Now we define some common macros to hold the package date and version: % \begin{macrocode} -\RequirePackage{l3keys2e} -\RequirePackage{xparse}[2019/05/28] -\ProvidesExplPackage{scontents}{2019/10/03}{1.4} - {Stores LaTeX contents in memory or files} +%<loader>\def\ScontentsFileDate{2019-10-24}% +%<core>\def\ScontentsCoreFileDate{2019-10-24}% +%<*loader> +\def\ScontentsFileVersion{1.5}% +\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}% % \end{macrocode} % -% A check to make sure that \pkg{expl3} is not too old +% The \LaTeX{} loader is fairly simple: just load the dependencies, load the +% core code, and then set interfaces up. % +% We also check if the \pkg{verbatim} package is loaded and show a compatibility +% warning. % \begin{macrocode} -\@ifpackagelater { expl3 } { 2019/09/19 } - { } +%<*latex> +\RequirePackage{expl3,xparse,l3keys2e}[2019/05/28] +\ProvidesExplPackage + {scontents} {\ScontentsFileDate} {\ScontentsFileVersion} {\ScontentsFileDescription} +\@ifpackageloaded { verbatim } { - \PackageError { scontents } { Support~package~expl3~too~old } + \iow_term:n { - You~need~to~update~your~installation~of~the~bundles~ - 'l3kernel'~and~'l3packages'.\MessageBreak - Loading~scontents~will~abort! + The~implementation~of~the~'verbatimsc'~environment~\\ + used~by~\tl_to_str:n{\typestored}~is~not~compatible~with~package\\ + 'verbatim'.~Review~the~documentation~and~redefine~\\ + the~'verbatimsc'~environment. } + } { } +%</latex> +% \end{macrocode} +% The Plain and \hologo{ConTeXt} loaders are similar (probably because I don't +% know how to make a proper \hologo{ConTeXt} module :-). We define a +% \LaTeX{}-style ver@scontents.sty macro with version info (just in case): +% \begin{macrocode} +%<*!latex> +%<context>\writestatus{loading}{User Module scontents v\ScontentsFileVersion} +%<context>\unprotect +\input expl3-generic.tex +\ExplSyntaxOn +\tl_gset:cx { ver @ scontents . sty } { \ScontentsFileDate\space + v\ScontentsFileVersion\space \ScontentsFileDescription } +\iow_log:x { Package: ~ scontents ~ \use:c { ver @ scontents . sty } } +%</!latex> +% \end{macrocode} +% +% In Plain, check that the package isn't being loaded twice (\LaTeX{} and +% \hologo{ConTeXt} already defend against that): +% \begin{macrocode} +%<*plain> +\msg_gset:nnn { scontents } { already-loaded } + { The~`scontents'~package~is~already~loaded.~Aborting~input~\msg_line_context:. } +\cs_if_exist:NT \@@_rescan_tokens:n + { + \msg_warning:nn { scontents } { already-loaded } + \ExplSyntaxOff \file_input_stop: } +%</plain> +% \end{macrocode} +% +% \begin{macro}{\g_@@_end_verbatimsc_tl,\c_@@_end_env_tl} +% A token list to match when ending \env{verbatimsc} and \env{scontents} +% environments. +% +% \begin{macrocode} +\tl_new:N \g_@@_end_verbatimsc_tl +\tl_gset_rescan:Nnn + \g_@@_end_verbatimsc_tl + { + \char_set_catcode_other:N \\ +%<*latex> + \char_set_catcode_other:N \{ + \char_set_catcode_other:N \} +%</latex> + } +%<latex> { \end{verbatimsc} } +%<plain> { \endverbatimsc } +%<context> { \stopverbatimsc } +\tl_const:Nx \c_@@_end_env_tl + { + \c_backslash_str +%<latex|plain> end +%<context> stop +%<latex> \c_left_brace_str + scontents +%<latex> \c_right_brace_str + } +% \end{macrocode} +% \end{macro} +% +% Now we load the core \mypkg*{scontents} code: +% \begin{macrocode} +\file_input:n { scontents-code.tex } +% \end{macrocode} +% +% Sometimes we need to detect the format from within a macro: +% \begin{macrocode} +\cs_new:Npn \@@_format_case:nnn #1 #2 #3 +%<latex> {#1} % LaTeX +%<plain> {#2} % Plain/Generic +%<context> {#3} % ConTeXt +% \end{macrocode} +% +% Checking that the package was loaded with the proper loader code. This code +% was copied from \texttt{expl3-code.tex}. +% \begin{macrocode} +%</loader> +%<*core> +\begingroup + \def\next{\endgroup}% + \expandafter\ifx\csname PackageError\endcsname\relax + \begingroup + \def\next{\endgroup\endgroup}% + \def\PackageError#1#2#3% + {% + \endgroup + \errhelp{#3}% + \errmessage{#1 Error: #2!}% + }% + \fi + \expandafter\ifx\csname ScontentsFileDate\endcsname\relax + \def\next + {% + \PackageError{scontents}{No scontents loader detected} + {% + You have attempted to use the scontents code directly rather than using + the correct loader. Loading of scontents will abort. + }% + \endgroup + \endinput + } + \else + \ifx\ScontentsFileDate\ScontentsCoreFileDate + \else + \def\next + {% + \PackageError{scontents}{Mismatched~scontents~files~detected} + {% + You~have~attempted~to~load~scontents~with~mismatched~files:~ + probably~you~have~one~or~more~files~'locally~installed'~which~ + are~in~conflict.~Loading~of~scontents~will~abort. + }% + \endgroup + \endinput + }% + \fi +\fi +\next % \end{macrocode} % % \subsection{Definition of common keys} @@ -1656,7 +1815,6 @@ No tab store-cmd .initial:n = contents, store-cmd .value_required:n = true, verb-font .tl_set:N = \l_@@_verb_font_tl, - verb-font .initial:n = \ttfamily, verb-font .value_required:n = true, print-env .bool_set:N = \l_@@_print_env_bool, print-env .initial:n = false, @@ -1675,14 +1833,18 @@ No tab store-all .meta:n = { store-env = #1 , store-cmd = #1 }, store-all .value_required:n = true } +%</core> +%<loader>\keys_define:nn { scontents } +%<latex> { verb-font .initial:n = \ttfamily } +%<plain|context> { verb-font .initial:n = \tt } % \end{macrocode} % -% We process the \mymeta{keys} as options passed on to the package, the -% package \pkg{l3keys2e} will verify the \mymeta{keys} and will return -% an error when they are \emph{unknown}. -% +% In \LaTeX{} mode we load \mypkg{l3keys2e} process the \mymeta{keys} as options +% passed on to the package, the package \pkg{l3keys2e} will verify the +% \mymeta{keys} and will return an error when they are \emph{unknown}. % \begin{macrocode} -\ProcessKeysOptions { scontents } +%<latex>\ProcessKeysOptions { scontents } +%<*core> % \end{macrocode} % % \subsection{Internal variables} @@ -1690,28 +1852,41 @@ No tab % Now we declare the internal variables we will use. % % \begin{macro}{\l_@@_macro_tmp_tl,\l_@@_fname_out_tl,\l_@@_temp_tl, -% \l_@@_file_tl,\g_@@_temp_tl} +% \l_@@_file_tl,\g_@@_temp_tl,\l_@@_foreach_name_seq_tl, +% \l_@@_foreach_before_tl,\l_@@_foreach_after_tl} % \cs{l_@@_macro_tmp_tl} is a temporary token list to hold the contents % of the macro/environment, \cs{l_@@_fname_out_tl} is used as the name % of the output file, when there's one, \cs{l_@@_file_tl} holds the contents % of an environment as it's being read, and \cs{l_@@_temp_tl} and % \cs{g_@@_temp_tl} are generic temporary token lists. % +% \cs{l_@@_foreach_name_seq_tl} is the name assigned to the sequence on +% which the loop will be made, \cs{l_@@_foreach_before_tl} and \cs{l_@@_foreach_after_tl} +% are token lists in which the assigned material will be placed before +% and after the execution of the §\foreachsc§ loop. +% % \begin{macrocode} \tl_new:N \l_@@_macro_tmp_tl \tl_new:N \l_@@_fname_out_tl \tl_new:N \l_@@_temp_tl \tl_new:N \l_@@_file_tl \tl_new:N \g_@@_temp_tl +\tl_new:N \l_@@_foreach_name_seq_tl +\tl_new:N \l_@@_foreach_before_tl +\tl_new:N \l_@@_foreach_after_tl % \end{macrocode} % \end{macro} % -% \begin{macro}{\l_@@_seq_item_int,\l_@@_env_nesting_int,\l_@@_tmpa_int} +% \begin{macro}{\l_@@_seq_item_int,\l_@@_env_nesting_int,\l_@@_tmpa_int, +% \l_@@_foreach_stop_int} % \cs{l_@@_seq_item_int} stores the index in the sequence of the item % requested to \cs{typestored} or \cs{meaningsc}. \cs{l_@@_env_nesting_int} % stores the current nesting level of the \env{scontents} environment. +% \cs{l_@@_foreach_stop_int} will save the value at which the §\foreachsc§ +% loop will stop. % % \begin{macrocode} +\int_new:N \l_@@_foreach_stop_int \int_new:N \l_@@_seq_item_int \int_new:N \l_@@_env_nesting_int \int_new:N \l_@@_tmpa_int @@ -1731,22 +1906,28 @@ No tab % \end{macrocode} % \end{macro} % -% \begin{macro}{\g_@@_end_verbatimsc_tl,\c_@@_end_env_tl} -% A token list to match when ending \env{verbatimsc} and \env{scontents} -% environments. +% +% \begin{macro}{\l_@@_foreach_before_bool,\l_@@_foreach_after_bool +% \l_@@_foreach_stop_bool,\l_@@_foreach_wrapper_bool} +% Boolean variables used by the §\foreachsc§ loop. % % \begin{macrocode} -\tl_new:N \g_@@_end_verbatimsc_tl -\tl_gset_rescan:Nnn - \g_@@_end_verbatimsc_tl - { - \char_set_catcode_other:N \\ - \char_set_catcode_other:N \{ - \char_set_catcode_other:N \} - } - { \end{verbatimsc} } -\tl_const:Nx \c_@@_end_env_tl - { \c_backslash_str end \c_left_brace_str scontents \c_right_brace_str } +\bool_new:N \l_@@_foreach_before_bool +\bool_set_false:N \l_@@_foreach_before_bool +\bool_new:N \l_@@_foreach_after_bool +\bool_set_false:N \l_@@_foreach_after_bool +\bool_new:N \l_@@_foreach_stop_bool +\bool_set_false:N \l_@@_foreach_stop_bool +\bool_new:N \l_@@_foreach_wrapper_bool +\bool_set_false:N \l_@@_foreach_wrapper_bool +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l_@@_foreach_print_seq} +% The \cs{l_@@_foreach_print_seq} is the sequence used by §\foreachsc§. +% +% \begin{macrocode} +\seq_new:N \l_@@_foreach_print_seq % \end{macrocode} % \end{macro} % @@ -1809,6 +1990,7 @@ No tab % \begin{macrocode} \cs_generate_variant:Nn \tl_remove_once:Nn { NV } \cs_generate_variant:Nn \tl_replace_all:Nnn { Nx, Nxx, Nnx } +\cs_generate_variant:Nn \msg_error:nnnn { nnx } \prg_generate_conditional_variant:Nnn \tl_if_empty:n { f } { TF } % \end{macrocode} % \end{macro} @@ -1862,6 +2044,46 @@ No tab } % \end{macrocode} % +% \subsubsection{Keys for command \cs{foreachsc}} +% +% We define a set of \mymeta{keys} for command §\foreachsc§. +% +% \begin{macrocode} +\keys_define:nn { scontents / foreachsc } + { + before .code:n = { + \bool_set_true:N \l_@@_foreach_before_bool + \tl_set:Nn \l_@@_foreach_before_tl {#1} + }, + before .value_required:n = true, + after .code:n = { + \bool_set_true:N \l_@@_foreach_after_bool + \tl_set:Nn \l_@@_foreach_after_tl {#1} + }, + after .value_required:n = true, + start .int_set:N = \l_@@_foreach_start_int, + start .value_required:n = true, + start .initial:n = 1, + stop .code:n = { + \bool_set_true:N \l_@@_foreach_stop_bool + \int_set:Nn \l_@@_foreach_stop_int {#1} + }, + stop .value_required:n = true, + step .int_set:N = \l_@@_foreach_step_int, + step .value_required:n = true, + step .initial:n = 1, + wrapper .code:n = { + \bool_set_true:N \l_@@_foreach_wrapper_bool + \cs_set_protected:Npn \@@_foreach_wrapper:n ##1 {#1} + }, + wrapper .value_required:n = true, + sep .tl_set:N = \l_@@_foreach_sep_tl, + sep .initial:n = {}, + sep .value_required:n = true, + unknown .code:n = { \@@_parse_foreach_keys:n {#1} } + } +% \end{macrocode} +% % \subsubsection{Key for commands \cs{typestored} and \cs{meaningsc}} % % We define a \mymeta{key} for command §\typestored§ and §\meaningsc§. @@ -1923,6 +2145,27 @@ No tab % \end{macrocode} % \end{macro} % +% \subsubsection{Undefined keys for \cs{foreachsc}} +% +% \begin{macro}{\@@_parse_foreach_keys:n, +% \@@_parse_foreach_keys:nn} +% +% We check the \meta{keys} passed to command §\foreachsc§ and process +% it with \cs{@@_parse_foreach_keys:n}, if the \mymeta{key} is +% \emph{unknown} we return an error message. +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_parse_foreach_keys:nn #1#2 + { + \tl_if_blank:nTF {#2} + { \msg_error:nnn { scontents } { for-key-unknown } {#1} } + { \msg_error:nnnn { scontents } { for-key-value-unknown } {#1} {#2} } + } +\cs_new_protected:Npn \@@_parse_foreach_keys:n #1 + { \exp_args:NV \@@_parse_foreach_keys:nn \l_keys_key_tl {#1} } +% \end{macrocode} +% \end{macro} +% % \subsubsection{Undefined keys for \cs{typestored} and \cs{meaningsc}} % % \begin{macro}{\@@_parse_type_meaning_key:n, @@ -1963,6 +2206,112 @@ No tab % \end{macrocode} % \end{macro} % +% \subsection{Compatibility layer with Plain} +% +% When loading the package outside of \LaTeX{} we can't usually use \pkg{xparse}. +% However since \pkg{xparse} doesn't actually hold any dependency with \LaTeX{} +% except for package-loading commands, we can emulate those commands (much like +% in \pkg{miniltx}) so that \pkg{xparse} is loadable in any format. +% +% The bunch of macros below is adapted from the \LaTeX{} kernel (greatly simplified). +% \begin{macrocode} +%</core> +%<*loader&!latex> +\seq_new:N \l_@@_compat_seq +\cs_new_protected:Npn \@@_compat_redefine:Npn #1 + { + \seq_put_right:Nn \l_@@_compat_seq {#1} + \cs_set_eq:cN { @@_saved_\cs_to_str:N #1: } #1 + \cs_new_protected:Npn #1 + } +\cs_new_protected:Npn \@@_compat_restore: + { \seq_map_function:NN \l_@@_compat_seq \@@_compat_restore:N } +\cs_new_protected:Npn \@@_compat_restore:N #1 + { + \cs_set_eq:Nc #1 { @@_saved_\cs_to_str:N #1: } + \cs_undefine:c { @@_saved_\cs_to_str:N #1: } + } +\cs_generate_variant:Nn \@@_compat_redefine:Npn { c } +\cs_new_protected:Npn \@@_optarg:nn #1 #2 + { \peek_charcode_ignore_spaces:NTF [ {#1} {#1[#2]} } +\cs_new_protected:Npn \@@_stararg:nn #1 #2 + { \peek_charcode_remove_ignore_spaces:NTF * {#1} {#2} } +\@@_compat_redefine:Npn \RequirePackage + { \@@_optarg:nn { \@@_require_auxi:wn } { } } +\cs_new_protected:Npn \@@_require_auxi:wn [#1] #2 + { \@@_optarg:nn { \@@_require_auxii:wnw [{#1}]{#2} } { } } +\cs_new:Npn \@@_zap_space:ww #1~#2 + { + #1 \if_meaning:w #2 \q_mark + \exp_after:wN \use_none:n + \else: + \exp_after:wN \@@_zap_space:ww + \fi: #2 + } +\cs_new_protected:Npn \@@_require_auxii:wnw [#1] #2 [#3] + { + \tl_set:Nx \l_@@_temp_tl { \@@_zap_space:ww #2 ~ \q_mark } + \clist_map_function:NN \l_@@_temp_tl \@@_require_auxiii:n + } +\cs_new_protected:Npn \@@_require_auxiii:n #1 + { \str_if_eq:eeF {expl3} {#1} { \msg_error:nnn { scontents } { invalid-package } {#1} } } +\msg_new:nnn { scontents } { invalid-package } + { Package~`#1'~invalid~in~scontents.~This~is~an~error~in~scontents. } +\@@_compat_redefine:cpn { @ifpackagelater } #1 + { \exp_args:Nc \@@_package_later_aux:Nn { ver@#1.sty } } +\cs_new_protected:Npn \@@_package_later_aux:Nn #1 #2 + { + \int_compare:nNnTF + { \exp_after:wN \@@_parse_version:w #1 //00 \q_mark } < + { \exp_after:wN \@@_parse_version:w #2 //00 \q_mark } + } +\cs_new:Npn \@@_parse_version:w #1 { \@@_parse_version_auxi:w 0#1 } +\cs_new:Npn \@@_parse_version_auxi:w #1/#2/#3#4#5 \q_mark + { \@@_parse_version_auxii:w #1-#2-#3#4 \q_mark } +\cs_new:Npn \@@_parse_version_auxii:w #1-#2-#3#4#5 \q_mark + { \tl_if_blank:nF {#2} {#1} #2 #3 #4 } +\@@_compat_redefine:Npn \ProvidesExplPackage #1 #2 #3 #4 + { \@@_provides_aux:nn {#1} { #2 \ifx\relax#3\relax\else v#3\space\fi #4 } } +\cs_new_protected:Npn \@@_provides_aux:nn #1 #2 + { + \tl_gset:cx { ver@#1.sty } {#2} + \iow_log:n { Package~#1:~#2 } + \ExplSyntaxOn + } +\@@_compat_redefine:Npn \DeclareOption + { \@@_stararg:nn { \use_none:n } { \use_none:nn } } +\@@_compat_redefine:Npn \ProcessOptions + { \@@_stararg:nn { } { } } +% \end{macrocode} +% +% Now that the compatibility layer is defined, we can finally load \pkg{xparse}. +% \pkg{xparse} expects to be loaded with \cs{ExplSyntaxOff} (not much harm would +% be done otherwise, but just to be on the safe side). +% +% Within \pkg{xparse} a §\RequirePackage{expl3}§ is done. We can ignore that since +% we have already loaded \pkg{expl3}. Next, a §\@ifpackagelater§ test is done: +% we do that test too to ensure that \pkg{xparse} is compatible with the current +% running version of \pkg{expl3}. The following §\ProvidesExplPackage§ simply +% defines §\ver@xparse.sty§ for any other package that might uset it, and then +% does \cs{ExplSyntaxOn}. At the end of the package, \pkg{xparse} parses (heh) +% the package options. Since we don't have those in non-\LaTeX{} formats, they are +% ignored. Okay, so load \pkg{xparse}: +% \begin{macrocode} +\int_set:Nn \l_@@_tmpa_int { \char_value_catcode:n { `\@ } } +\char_set_catcode_letter:N \@ +\exp_after:wN +\ExplSyntaxOff +\file_input:n { xparse.sty } +\ExplSyntaxOn +\char_set_catcode:nn { `\@ } { \l_@@_tmpa_int } +\@@_compat_restore: +%</loader&!latex> +%<*core> +% \end{macrocode} +% (actually we don't need to do \cs{ExplSyntaxOn} there because we don't have +% \LaTeX{}'s full package loading mechanism, so the \pkg{expl3} syntax remains +% active after \pkg{xparse} is loaded, but it doesn't harm either). +% % \subsection{Programming of the sequences} % % The storage of the package is done using |seq| variables. Here we @@ -2013,7 +2362,7 @@ No tab % % \begin{macro}{\@@_lastfrom_seq:n} % \cs{@@_lastfrom_seq:n} retrieves the last saved item from the -% sequence when \cs{l_@@__print_env_bool} or \cs{l_@@__print_cmd_bool} +% sequence when \cs{l_@@_print_env_bool} or \cs{l_@@_print_cmd_bool} % is true. % % \begin{macrocode} @@ -2048,15 +2397,39 @@ No tab % is divided into three parts. This implementation is taken from answer % by Enrico Gregorio in \url{https://tex.stackexchange.com/a/487746/7832}. % -% \begin{macro}{scontents} +% \begin{macro}{ +% scontents, +% \scontents, +% \startscontents, +% \endscontents, +% \stopscontents, +% \@@_scontents_env_begin:, +% \@@_scontents_env_end:, +% } % This is the main environment used in the document. % % \begin{macrocode} -\NewDocumentEnvironment { scontents } { } +%</core> +%<*loader> +%<!context>\NewDocumentEnvironment { scontents } { } +%<context>\cs_new_protected:Npn \startscontents + { +%<plain|context> \group_begin: + \@@_scontents_env_begin: + } +%<context>\cs_new_protected:Npn \stopscontents + { + \@@_scontents_env_end: +%<plain|context> \group_end: + } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_scontents_env_begin: { \char_set_catcode_active:N \^^M \@@_start_environment:w } +\cs_new_protected:Npn \@@_scontents_env_end: { \@@_stop_environment: \@@_atend_environment: @@ -2069,54 +2442,58 @@ No tab % Define a \myoarg{key \textnormal{\textcolor{gray}{=}} val} for % environment \env{scontents} % -% \begin{macro}{\@@_environment_inline:w,\@@_environment_keys:w, -% \@@_environment_junk:nw,\@@_environment_junk:xw} -% The macro \cs{@@_environment_inline:w} is called from the +% \begin{macro}{\@@_grab_optional:n,\@@_grab_optional:w} +% The macro \cs{@@_grab_optional:w} is called from the % \env{scontents} environment with the tokens following the -% §\begin{scontents}§. If the immediate next token (ignoring spaces) -% is a §[§, then we look for an optional argument delimited by a §]§. -% All the remaining tokens are treated as junk and an error is raised -% if they are non-blank. +% §\begin{scontents}§ when the next character is a §[§. This function +% is defined using \mypkg{xparse} to exploit its delimited argument +% processor. % +% The function is called from a context where §^^M§ is active, so +% \cs{@@_normalise_line_ends:N} is used to replace active §^^M§ +% characters by spaces. % \begin{macrocode} -\cs_new_protected:Npn \@@_environment_inline:w +%</core> +%<*loader> +\NewDocumentCommand \@@_grab_optional:w { r[] } + { \@@_grab_optional:n {#1} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_grab_optional:n #1 { - \peek_charcode_ignore_spaces:NTF [ % ] - { \@@_environment_keys:w } + \tl_if_novalue:nF {#1} { - \@@_environment_junk:xw - { after~\c_backslash_str begin{scontents} } + \tl_set:Nn \l_@@_temp_tl {#1} + \@@_normalise_line_ends:N \l_@@_temp_tl + \keys_set:nV { scontents / scontents } \l_@@_temp_tl } + \@@_start_after_option:w } -\cs_new_protected:Npn \@@_environment_keys:w [ #1 ] - { - \keys_set:nn { scontents / scontents } {#1} - \@@_environment_junk:xw - { after~optional~argument~to~\c_backslash_str begin{scontents} } - } -\cs_new_protected:Npn \@@_environment_junk:nw #1 #2 \q_@@_mark - { - \tl_if_blank:nF {#2} - { \msg_error:nnnn { scontents } { junk-after-begin } {#1} {#2} } - } -\cs_generate_variant:Nn \@@_environment_junk:nw { x } % \end{macrocode} % \end{macro} % % \subsubsection{The environment itself} % -% \begin{macro}{\@@_start_environment:w,\@@_stop_environment:} +% \begin{macro}{\@@_start_environment:w,\@@_start_after_option:w, +% \@@_check_line_and_process:xn,\@@_stop_environment:} % Here we make §^^I§, §^^L§ and §^^M§ active characters so that the end of % line can be \enquote{seen} to be used as a delimiter, and \hologo{TeX} doesn't try to -% eliminate space-like characters. First we check if the line -% directly after §\begin{scontents}§ contains an optional argument -% enclosed in §[...]§ or other tokens. The trailing tokens are -% treated as junk and an error is raised. The -% \cs{@@_environment_inline:w} macro checks for those cases. +% eliminate space-like characters. +% +% First we check if the immediate next token after §\begin{scontents}§ +% is a §[§. If it is, then \cs{@@_grab_optional:w} is called +% to do the heavy lifting. \cs{@@_grab_optional:w} processes the optional +% argument and calls \cs{@@_start_after_option:w}. % -% \cs{@@_start_environment:w} calls the \cs{@@_file_tl_write_start:V} -% function, which will then read the contents of the environment and -% optionally store them in a token list or write to an external file. +% \cs{@@_start_after_option:w} also checks for trailing tokens after +% the optional argument and issues an error if any. +% +% In all cases \cs{@@_check_line_and_process:xn} is called to check that +% the rest of the §\begin{scontents}§ is empty and then process +% the environment. \cs{@@_check_line_and_process:xn} calls the +% \cs{@@_file_tl_write_start:V} function, which will then read the contents +% of the environment and optionally store them in a token list or write to +% an external file. % % When that's done, \cs{@@_file_write_stop:N} does the cleanup and the % read token list is smuggled out of the verbatim group. This part of @@ -2132,9 +2509,27 @@ No tab \char_set_catcode_active:N \^^I \char_set_catcode_active:N \^^L \char_set_catcode_active:N \^^M + \cs_new_protected:Npn \@@_normalise_line_ends:N #1 + { \tl_replace_all:Nnn #1 { ^^M } { ~ } } \cs_new_protected:Npn \@@_start_environment:w #1 ^^M { - \@@_environment_inline:w #1 \q_@@_mark + \tl_if_head_is_N_type:nTF {#1} + { + \str_if_eq:eeTF { \tl_head:n {#1} } { [ } + { \@@_grab_optional:w #1 ^^M } + { \@@_check_line_and_process:xn { } {#1} } + } + { \@@_check_line_and_process:xn { } {#1} } + } + \cs_new_protected:Npn \@@_start_after_option:w #1 ^^M + { \@@_check_line_and_process:xn { [...] } {#1} } + \cs_new_protected:Npn \@@_check_line_and_process:xn #1 #2 + { + \tl_if_blank:nF {#2} + { + \msg_error:nnxn { scontents } { junk-after-begin } + { after~\c_backslash_str begin{scontents} #1 } {#2} + } \@@_make_control_chars_active: \group_begin: \@@_file_tl_write_start:V \l_@@_fname_out_tl @@ -2145,6 +2540,8 @@ No tab \exp_args:NNNV \group_end: \tl_set:Nn \l_@@_macro_tmp_tl \l_@@_macro_tmp_tl + \tl_if_empty:NT \l_@@_macro_tmp_tl + { \msg_warning:nnn { scontents } { empty-environment } } } % \end{macrocode} % \end{macro} @@ -2217,7 +2614,10 @@ No tab { \@@_verb_processor_output:n {#1} } \cs_set_protected:Npx \@@_ret:w { - \exp_not:N \end{scontents} + \@@_format_case:nnn + { \exp_not:N \end{scontents} } % LaTeX + { \endscontents } % Plain/Generic + { \stopscontents } % ConTeXt \bool_lazy_or:nnF { \tl_if_blank_p:n {#2} } { \str_if_eq_p:ee {#2} { \c_percent_str } } @@ -2246,7 +2646,21 @@ No tab } } \cs_new:Npn \@@_remove_leading_nl:n #1 - { \exp_not:o { \@@_remove_leading_nl:w #1 } } + { + \tl_if_head_is_N_type:nTF {#1} + { + \exp_args:Nf + \@@_remove_leading_nl:nn + { \tl_head:n {#1} } {#1} + } + { \exp_not:n {#1} } + } + \cs_new:Npn \@@_remove_leading_nl:nn #1 #2 + { + \token_if_eq_meaning:NNTF ^^J #1 + { \exp_not:o { \@@_remove_leading_nl:w #2 } } + { \exp_not:n {#2} } + } \cs_new:Npn \@@_remove_leading_nl:w ^^J { } % \end{macrocode} % \end{macro} @@ -2344,15 +2758,87 @@ No tab { \@@_lastfrom_seq:n \l_@@_name_seq_env_tl } } } +%</core> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\verbatim,\endverbatim} +% In Plain we emulate \LaTeX's \env{verbatim} environment. +% \begin{macrocode} +%<*plain> +\bool_new:N \l_@@_temp_bool +\cs_new_protected:Npn \verbatim + { \@@_verbatim_aux: \frenchspacing \@@_vobeyspaces: \@@_xverb: } +\cs_new_protected:Npn \@@_verbatim_aux: + { + \skip_vertical:N \parskip + \int_set:Nn \parindent { 0pt } + \skip_set:Nn \parfillskip { 0pt plus 1fil } + \int_set:Nn \parskip { 0pt plus0pt minus0pt } + \tex_par:D + \bool_set_false:N \l_@@_temp_bool + \cs_set:Npn \par + { + \bool_if:NTF \l_@@_temp_bool + { + \mode_leave_vertical: + \null + \tex_par:D + \penalty \interlinepenalty + } + { + \bool_set_true:N \l_@@_temp_bool + \mode_if_horizontal:T + { \tex_par:D \penalty \interlinepenalty } + } + } + \cs_set_eq:NN \do \char_set_catcode_other:N + \dospecials \obeylines + \tl_use:N \l_@@_verb_font_tl + \cs_set_eq:NN \do \@@_do_noligs:N + \@@_nolig_list: + \tex_everypar:D \exp_after:wN + { \tex_the:D \tex_everypar:D \tex_unpenalty:D } + } +\cs_new_protected:Npn \@@_nolig_list: + { \do\`\do\<\do\>\do\,\do\'\do\- } +\cs_new_protected:Npn \@@_vobeyspaces: + { \@@_set_active_eq:NN \ \@@_xobeysp: } +\cs_new_protected:Npn \@@_xobeysp: + { \mode_leave_vertical: \nobreak \ } +%</plain> % \end{macrocode} % \end{macro} % -% \subsection{The \cs{Scontents} command} +% \begin{macro}[int]{\dospecials} +% \pkg{xparse} also requires \LaTeX's \cs{dospecials}. In case it doesn't +% exist (at the time \pkg{scontents} is loaded) we define \cs{dospecials} +% to use the \cs{l_char_special_seq}. +% \begin{macrocode} +%<*!latex> +\cs_if_exist:NF \dospecials + { + \cs_new:Npn \dospecials + { \seq_map_function:NN \l_char_special_seq \do } + } +%</!latex> +% \end{macrocode} +% \end{macro} +% +% \subsection{The command \cs{Scontents}} % % User command to \mymeta{stored content}, adapted from % \url{https://tex.stackexchange.com/a/500281/7832}. % -% \begin{macro}{\Scontents,\@@_norm_arg:n,\@@_verb_arg:w} +% \begin{macro}{ +% \Scontents, +% \@@_norm_arg:n, +% \@@_Scontents_auxi:N, +% \Scontents code, +% \@@_Scontents_internal:nn, +% \@@_verb_arg:w, +% \@@_verb_arg_internal:n, +% } % The §\Scontents§ macro starts by parsing an optional argument and % then delegates to \cs{@@_verb_arg:w} or \cs{@@_norm_arg:n} depending whether % a star (§*§) argument is present. @@ -2364,13 +2850,18 @@ No tab % argument parser. % % \begin{macrocode} +%<*loader> \NewDocumentCommand { \Scontents }{ !s !O{} } + { \@@_Scontents_internal:nn {#1} {#2} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_Scontents_internal:nn #1 #2 { \group_begin: - \IfNoValueF {#2} + \tl_if_novalue:nF {#2} { \keys_set:nn { scontents / Scontents } {#2} } \char_set_catcode_active:n { 9 } - \IfBooleanTF {#1} + \bool_if:NTF #1 { \@@_verb_arg:w } { \@@_norm_arg:n } } @@ -2383,7 +2874,13 @@ No tab { \@@_lastfrom_seq:n \l_@@_name_seq_cmd_tl } \group_end: } +%</core> +%<*loader> \NewDocumentCommand { \@@_verb_arg:w } { +v } + { \@@_verb_arg_internal:n {#1} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_verb_arg_internal:n #1 { \tl_set:Nx \l_@@_temp_tl { \exp_not:n {#1} } \tl_replace_all:Nxx \l_@@_temp_tl { \iow_char:N \^^M } { \iow_char:N \^^J } @@ -2404,9 +2901,16 @@ No tab % (robust). % % \begin{macrocode} +%</core> +%<*loader> \NewDocumentCommand { \getstored } { O{1} m } + { \@@_getstored_internal:nn {#1} {#2} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_getstored_internal:nn #1 #2 { \group_begin: + \int_set:Nn \tex_newlinechar:D { `\^^J } \@@_rescan_tokens:x { \@@_getfrom_seq:nn {#1} {#2} } \group_end: @@ -2414,7 +2918,55 @@ No tab % \end{macrocode} % \end{macro} % -% \subsection{The \cs{typestored} command} +% \subsection{The command \cs{foreachsc}} +% +% \begin{macro}{\foreachsc} +% User command §\foreachsc§ to loop over \mymeta{stored content} in |seq|. +% +% \begin{macrocode} +%</core> +%<*loader> +\NewDocumentCommand { \foreachsc } { o m } + { \@@_foreachsc_internal:nn {#1} {#2} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_foreachsc_internal:nn #1 #2 + { + \group_begin: + \tl_if_novalue:nF {#1} { \keys_set:nn { scontents / foreachsc } {#1} } + \tl_set:Nn \l_@@_foreach_name_seq_tl {#2} + \seq_clear:N \l_@@_foreach_print_seq + \bool_if:NF \l_@@_foreach_stop_bool + { + \int_set:Nn \l_@@_foreach_stop_int + { \seq_count:c { g_@@_name_#2_seq } } + } + \int_step_function:nnnN + { \l_@@_foreach_start_int } + { \l_@@_foreach_step_int } + { \l_@@_foreach_stop_int } + \@@_foreach_add_body:n + \seq_use:Nn \l_@@_foreach_print_seq { \tl_use:N \l_@@_foreach_sep_tl } + \group_end: + } +\cs_new_protected:Npn \@@_foreach_add_body:n #1 + { + \seq_put_right:Nx \l_@@_foreach_print_seq + { + \bool_if:NT \l_@@_foreach_before_bool + { \exp_not:V \l_@@_foreach_before_tl } + \bool_if:NTF \l_@@_foreach_wrapper_bool + { \@@_foreach_wrapper:n } + { \use:n } + { \getstored [#1] { \tl_use:N \l_@@_foreach_name_seq_tl } } + \bool_if:NT \l_@@_foreach_after_bool + { \exp_not:V \l_@@_foreach_after_tl } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{The command \cs{typestored}} % % This implementation is an adaptation taken from answer by Phelype Oleinik % in (\url{https://tex.stackexchange.com/a/497651/7832}). @@ -2424,15 +2976,19 @@ No tab % to the log file, and then calls \cs{@@_verb_print:N}. % % \begin{macrocode} +%</core> +%<*loader> \NewDocumentCommand { \typestored } { o m } + { \@@_typestored_internal:nn {#1} {#2} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_typestored_internal:nn #1 #2 { \group_begin: \int_set:Nn \l_@@_seq_item_int { 1 } - \IfValueT {#1} { \keys_set:nn { scontents / typemeaning } {#1} } + \tl_if_novalue:nF {#1} { \keys_set:nn { scontents / typemeaning } {#1} } \tl_set:Nx \l_@@_temp_tl - { - \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#2} - } + { \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#2} } \tl_remove_once:NV \l_@@_temp_tl \c_@@_hidden_space_str \tl_log:N \l_@@_temp_tl \tl_if_empty:NF \l_@@_temp_tl @@ -2456,9 +3012,14 @@ No tab \cs_set_eq:NN \@@_verb_print_EOL: ^^M \cs_set_eq:NN ^^M \scan_stop: \cs_set_eq:cN { do@noligs } \@@_do_noligs:N + \int_set:Nn \tex_newlinechar:D { `\^^J } \@@_rescan_tokens:x { - \exp_not:N \begin{verbatimsc} ^^M + \@@_format_case:nnn + { \exp_not:N \begin{verbatimsc} } % LaTeX + { \verbatimsc } % Plain/Generic + { \startverbatimsc } % ConTeXt + ^^M \exp_not:V #1 ^^M \g_@@_end_verbatimsc_tl } @@ -2476,18 +3037,30 @@ No tab \char_set_active_eq:nN { 9 } \@@_tabs_to_spaces: \@@_xverb:w } +%</core> +%<*loader> \use:x { \cs_new_protected:Npn \exp_not:N \@@_xverb:w ##1 \g_@@_end_verbatimsc_tl +%<latex> { ##1 \exp_not:N \end{verbatimsc} } +%<plain> { ##1 \exp_not:N \endverbatimsc } +%<context> { ##1 \exp_not:N \stopverbatimsc } } - { #1 \end{verbatimsc} } +%<*!context> \NewDocumentEnvironment { verbatimsc } { } { - \cs_set_eq:cN { @xverbatim } \@@_xverb: +%<plain> \group_begin: +%<latex> \cs_set_eq:cN { @xverbatim } \@@_xverb: \verbatim } - { } + { +%<plain> \group_end: + } +%</!context> +%<context>\definetyping[verbatimsc] +%</loader> +%<*core> % \end{macrocode} % \end{macro} % @@ -2532,19 +3105,42 @@ No tab % \@@_make_control_chars_active:, % } % Shortcut definitions for common catcode changes. -% +% The §^^L§ needs a special treatment in non-\LaTeX{} mode +% because in Plain\,\TeX{} it is an \cs{outer} token. % \begin{macrocode} \cs_new_protected:Npn \@@_set_active_eq:NN #1 { \char_set_catcode_active:N #1 \char_set_active_eq:NN #1 } -\cs_new_protected:Npn \@@_make_control_chars_active: - { - \@@_set_active_eq:NN \^^I \@@_tab: - \@@_set_active_eq:NN \^^L \@@_par: - \@@_set_active_eq:NN \^^M \@@_ret:w - } +%</core> +%<*loader> +\group_begin: +%<plain> \char_set_catcode_active:n { `\* } + \cs_new_protected:Npn \@@_plain_disable_outer_par: +%<*plain> + { + \group_begin: + \char_set_lccode:nn { `\* } { `\^^L } + \tex_lowercase:D { \group_end: + \tex_let:D * \scan_stop: + } + } +%</plain> +%<latex|context> { } +\group_end: +%</loader> +%<*core> +\group_begin: + \char_set_catcode_active:N \* + \cs_new_protected:Npn \@@_make_control_chars_active: + { + \@@_plain_disable_outer_par: + \@@_set_active_eq:NN \^^I \@@_tab: + \@@_set_active_eq:NN \^^L \@@_par: + \@@_set_active_eq:NN \^^M \@@_ret:w + } +\group_end: % \end{macrocode} % \end{macro} % @@ -2556,22 +3152,32 @@ No tab % A user-level wrapper for \cs{keys_set:nn}§{ scontents }§. % % \begin{macrocode} +%</core> +%<*loader> \NewDocumentCommand { \setupsc } { +m } { \keys_set:nn { scontents } {#1} } +%</loader> +%<*core> % \end{macrocode} % \end{macro} % -% \subsection{The command meaningsc} +% \subsection{The command \cs{meaningsc}} % % \begin{macro}{\meaningsc} % User command §\meaningsc§ to see content stored in |seq|. % % \begin{macrocode} +%</core> +%<*loader> \NewDocumentCommand { \meaningsc } { o m } + { \@@_meaningsc_internal:nn {#1} {#2} } +%</loader> +%<*core> +\cs_new_protected:Npn \@@_meaningsc_internal:nn #1 #2 { \group_begin: \int_set:Nn \l_@@_seq_item_int { 1 } - \IfValueT {#1} { \keys_set:nn { scontents / typemeaning } {#1} } + \tl_if_novalue:nF {#1} { \keys_set:nn { scontents / typemeaning } {#1} } \@@_meaningsc:n {#2} \group_end: } @@ -2580,9 +3186,7 @@ No tab \cs_new_protected:Npn \@@_meaningsc:n #1 { \tl_set:Nx \l_@@_temp_tl - { - \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#1} - } + { \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#1} } \tl_replace_all:Nxn \l_@@_temp_tl { \iow_char:N \^^J } { ~ } \tl_remove_once:NV \l_@@_temp_tl \c_@@_hidden_space_str \tl_log:N \l_@@_temp_tl @@ -2601,8 +3205,12 @@ No tab % User command §\countsc§ to count number of contents stored in |seq|. % % \begin{macrocode} +%</core> +%<*loader> \NewExpandableDocumentCommand { \countsc } { m } { \seq_count:c { g_@@_name_#1_seq } } +%</loader> +%<*core> % \end{macrocode} % \end{macro} % @@ -2613,8 +3221,12 @@ No tab % A user command §\cleanseqsc§ to clear (remove) a defined |seq|. % % \begin{macrocode} +%</core> +%<*loader> \NewDocumentCommand { \cleanseqsc } { m } { \seq_clear_new:c { g_@@_name_#1_seq } } +%</loader> +%<*core> % \end{macrocode} % \end{macro} % @@ -2677,6 +3289,18 @@ No tab The~command~'\c_backslash_str Scontents'~does~not~have~a~key~called~'#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } +\msg_new:nnnn { scontents } { for-key-unknown } + { The~key~'#1'~is~unknown~by~'\c_backslash_str foreachsc'~and~is~being~ignored.} + { + The~command~'\c_backslash_str foreachsc'~does~not~have~a~key~called~'#1'.\\ + Check~that~you~have~spelled~the~key~name~correctly. + } +\msg_new:nnnn { scontents } { for-key-value-unknown } + { The~key~'#1=#2'~is~unknown~by~'\c_backslash_str foreachsc'~and~is~being~ignored. } + { + The~command~'\c_backslash_str foreachsc'~does~not~have~a~key~called~'#1'.\\ + Check~that~you~have~spelled~the~key~name~correctly. + } \msg_new:nnnn { scontents } { type-key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { @@ -2689,6 +3313,27 @@ No tab This~command~does~not~have~a~key~called~'#1'.\\ This~command~only~accepts~the~key~'width-tab'. } +\msg_new:nnn { scontents } { empty-environment } + { scontents~environment~empty~\msg_line_context:. } +\msg_new:nnnn { scontents } { verbatim-newline } + { Verbatim~argument~of~#1~ended~by~end~of~line. } + { + The~verbatim~argument~of~the~#1~cannot~contain~more~than~one~line,~ + but~the~end~ + of~the~current~line~has~been~reached.~You~may~have~forgotten~the~ + closing~delimiter. + \\ \\ + LaTeX~will~ignore~'#2'. + } +\msg_new:nnnn { scontents } { verbatim-tokenized } + { The~verbatim~#1~cannot~be~used~inside~an~argument. } + { + The~#1~takes~a~verbatim~argument.~ + It~may~not~appear~within~the~argument~of~another~function.~ + It~received~an~illegal~token \tl_if_empty:nF {#3} { ~'#3' } . + \\ \\ + LaTeX~will~ignore~'#2'. + } % \end{macrocode} % % \subsection{Finish package} @@ -2696,9 +3341,7 @@ No tab % Finish package implementation. % % \begin{macrocode} -\file_input_stop: +%</core> +%<plain|context>\ExplSyntaxOff % \end{macrocode} -% \iffalse -%</package> -% \fi % \Finale diff --git a/macros/latex/contrib/scontents/scontents.ins b/macros/latex/contrib/scontents/scontents.ins new file mode 100644 index 0000000000..70db162f19 --- /dev/null +++ b/macros/latex/contrib/scontents/scontents.ins @@ -0,0 +1,70 @@ +\input l3docstrip.tex +\keepsilent +\askforoverwritefalse +\declarepreamble\standard + +Copyright (C) 2019 by Pablo González L <pablgonz@educarchile.cl> + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version +2005/12/01 or later. + +This work is "maintained" (as per the LPPL maintenance status) +by Pablo González Luengo. + +This work consists of the files scontents.dtx and + scontents.ins, +and the derived files scontents.sty, + scontents.tex, + t-scontents.mkvi and + scontents-code.tex. + +\endpreamble +% +\catcode`\@=11 +\let\org@ds@heading\ds@heading +\def\ds@heading{} +\def\MetaPrefix{\perCent D} +\declarepreamble\context + \string\module + [ file=t-scontents, + version=1.5, + title=\string\CONTEXT\ User Module, + subtitle=Storing Contents, + author=Pablo González, + date=2019-10-24, + copyright=Pablo González, + email=pablgonz@educarchile.cl, + license=LPPL] +\endpreamble +\let\ds@heading\org@ds@heading +\let\MetaPrefix\DoubleperCent +% +\usedir{tex/latex/scontents} +\generate{% + \usepreamble\standard + \file{scontents.sty} {\from{scontents.dtx}{loader,latex}}% + \file{scontents.tex} {\from{scontents.dtx}{loader,plain}}% + \file{scontents-code.tex}{\from{scontents.dtx}{core}}% + \edef\tmpa{\standard^^J\context}\usepreamble\tmpa + \file{t-scontents.mkvi} {\from{scontents.dtx}{loader,context}}% +}% + +\Msg{*****************************************************************}% +\Msg{*} +\Msg{* To finish the installation you have to move the files into a } +\Msg{* directory searched by TeX. See README.md for instructions.} +\Msg{*} +\Msg{* To produce the documentation with source code run xelatex }% +\Msg{* thrice on file scontents.dtx }% +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{*****************************************************************}% + +\endbatchfile diff --git a/macros/latex/contrib/scontents/scontents.pdf b/macros/latex/contrib/scontents/scontents.pdf Binary files differindex 8e48969cc4..ee0ed05e8d 100644 --- a/macros/latex/contrib/scontents/scontents.pdf +++ b/macros/latex/contrib/scontents/scontents.pdf diff --git a/macros/latex/contrib/tudscr/README.md b/macros/latex/contrib/tudscr/README.md index a8c40a6c76..6079525067 100644 --- a/macros/latex/contrib/tudscr/README.md +++ b/macros/latex/contrib/tudscr/README.md @@ -4,7 +4,7 @@ Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2012-2019 - tudscr 2019/08/27 v2.06d + tudscr 2019/10/23 v2.06e ---------------------------------------------------------------------------- @@ -53,6 +53,9 @@ Das Bundle beinhaltet: Versionen --------- +**v2.06e** (2019/10/23) ++ Bugfix für Paket `scrlfile v3.27` + **v2.06d** (2019/08/27) + Bugfix für griechische Glyphen im Mathematikmodus beim Einsatz von LuaLaTeX (Ligaturen für angrenzende Glyphen sind entgegen der Definition aktiviert) @@ -245,6 +248,9 @@ The bundle offers: Versions -------- +**v2.06e** (2019/10/23) ++ bug fix for package `scrlfile v3.27` + **v2.06d** (2019/08/27) + bug fix for greek glyphs in math mode when using LuaLaTeX (boundary ligatures are activated contrary to definition) diff --git a/macros/latex/contrib/tudscr/doc/tudscr.pdf b/macros/latex/contrib/tudscr/doc/tudscr.pdf Binary files differindex 30ffccd618..ad14527739 100644 --- a/macros/latex/contrib/tudscr/doc/tudscr.pdf +++ b/macros/latex/contrib/tudscr/doc/tudscr.pdf diff --git a/macros/latex/contrib/tudscr/doc/tudscr_print.pdf b/macros/latex/contrib/tudscr/doc/tudscr_print.pdf Binary files differindex c83ee17fd9..f19d5c7e5c 100644 --- a/macros/latex/contrib/tudscr/doc/tudscr_print.pdf +++ b/macros/latex/contrib/tudscr/doc/tudscr_print.pdf diff --git a/macros/latex/contrib/tudscr/doc/tudscrsource.pdf b/macros/latex/contrib/tudscr/doc/tudscrsource.pdf Binary files differindex 08518292d7..b8f5161304 100644 --- a/macros/latex/contrib/tudscr/doc/tudscrsource.pdf +++ b/macros/latex/contrib/tudscr/doc/tudscrsource.pdf diff --git a/macros/latex/contrib/tudscr/doc/tutorials/mathswap.pdf b/macros/latex/contrib/tudscr/doc/tutorials/mathswap.pdf Binary files differindex cfe485c226..3d2697d4da 100644 --- a/macros/latex/contrib/tudscr/doc/tutorials/mathswap.pdf +++ b/macros/latex/contrib/tudscr/doc/tutorials/mathswap.pdf diff --git a/macros/latex/contrib/tudscr/doc/tutorials/mathtype.pdf b/macros/latex/contrib/tudscr/doc/tutorials/mathtype.pdf Binary files differindex feec6d7a62..7d7587a50d 100644 --- a/macros/latex/contrib/tudscr/doc/tutorials/mathtype.pdf +++ b/macros/latex/contrib/tudscr/doc/tutorials/mathtype.pdf diff --git a/macros/latex/contrib/tudscr/doc/tutorials/treatise.pdf b/macros/latex/contrib/tudscr/doc/tutorials/treatise.pdf Binary files differindex 3d1c94649d..460f57d175 100644 --- a/macros/latex/contrib/tudscr/doc/tutorials/treatise.pdf +++ b/macros/latex/contrib/tudscr/doc/tutorials/treatise.pdf diff --git a/macros/latex/contrib/tudscr/source/doc/tudscr.tex b/macros/latex/contrib/tudscr/source/doc/tudscr.tex index 23ecb82dce..eae520f34a 100644 --- a/macros/latex/contrib/tudscr/source/doc/tudscr.tex +++ b/macros/latex/contrib/tudscr/source/doc/tudscr.tex @@ -29,7 +29,7 @@ \endgroup% } \faculty{\cdurl} -\date{27.08.2019} +\date{23.10.2019} \author{% Falk Hanisch% \expandafter\emailaddress\expandafter{\tudscrmail}% diff --git a/macros/latex/contrib/tudscr/source/doc/tutorials/treatise.tex b/macros/latex/contrib/tudscr/source/doc/tutorials/treatise.tex index 30b1399ce8..8e69888920 100644 --- a/macros/latex/contrib/tudscr/source/doc/tutorials/treatise.tex +++ b/macros/latex/contrib/tudscr/source/doc/tutorials/treatise.tex @@ -79,6 +79,14 @@ \makeatletter \newcommand*\pcolumnfuzz[1]{\pretocmd{\@endpbox}{\hfuzz=#1}{}{}} +\newcommand*\setpspicturecounter[1]{\setcounter{pspicture}{#1}} +\AfterPackage*{pst-pdf}{% + \@ifpackagelater{pst-pdf}{2017/06/23}{% + \renewcommand*\setpspicturecounter[1]{% + \@latex@warning{Package `pst-pdf' was updated}% + } + }{}% +} \makeatother \usepackage{bookmark} @@ -3111,7 +3119,7 @@ paar weitere Einstellungen gemacht. Dies geschieht mit: % Die innerhalb einer Gleitumgebung erzeugte \Package{pstricks}"=Grafik ist in \autoref{fig:pstricks} dargestellt. -% +\setpspicturecounter{24}% \begin{Hint?} \begin{figure} \begin{pspicture}(0,-2)(100,64) diff --git a/macros/latex/contrib/tudscr/source/tudscr-base.dtx b/macros/latex/contrib/tudscr/source/tudscr-base.dtx index 746e696de4..8bbe69e572 100644 --- a/macros/latex/contrib/tudscr/source/tudscr-base.dtx +++ b/macros/latex/contrib/tudscr/source/tudscr-base.dtx @@ -1,4 +1,4 @@ -% \CheckSum{821} +% \CheckSum{903} % \iffalse meta-comment % % TUD-Script -- Corporate Design of Technische Universität Dresden @@ -52,7 +52,7 @@ % \fi % \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi -\ProvidesFile{tudscr-base.dtx}[2019/08/27 v2.06d TUD-Script\space% +\ProvidesFile{tudscr-base.dtx}[2019/10/23 v2.06e TUD-Script\space% % % \iffalse %</dtx> @@ -143,6 +143,89 @@ % \begin{macrocode} \RequirePackage{scrbase}[2018/03/30] % \end{macrocode} +% \changes{v2.06e}{2019/10/23}{Bugfix für \pkg{scrlfile} \val{v3.27}}^^A +% Das Paket \pkg{scrlfile} in der \KOMAScript-Version \val{v3.27} enthält einen +% Bug, der erst mit \val{v3.27a} gefixt wird. +% \ToDo{Bugfix für \pkg{scrlfile} raus, v3.27a notwendig}[v3.27a] +% \begin{macrocode} +\@ifpackageloaded{scrlfile}{% + \@ifpackagelater{scrlfile}{2019/10/13}{}{% + \renewcommand*{\scr@load@hook}[2]{% + \edef\scr@hookname{#1}% + \def\scr@cmd@hook{before}% + \ifx\scr@hookname\scr@cmd@hook + \expandafter\def\csname #2-l@ading\endcsname{#2}% + \fi + \let\scr@cmd@hook\@undefined + \@ifundefined{#2-@#1}{}{% + \@nameuse{#2-@#1}% + \expandafter\let\csname #2-@#1\endcsname\relax + }% + \edef\scr@hookname{#1}% + \def\scr@cmp@hook{after}% + \ifx\scr@hookname\scr@cmp@hook + \expandafter\let\csname #2-l@ading\endcsname\@undefined + \fi + \let\scr@hookname\@undefined + }% + \renewcommand*{\@@AfterClass}[2]{% + \@ifundefined{#2.\@clsextension-l@ading}{% + \@sAfterClass + }{% + \@AfterClass + }% + {#2}% + }% + \renewcommand*{\@@@AfterClass}[2]{% + \@ifundefined{#2.\@clsextension-l@ading}{% + \@ifclassloaded{#2}{% + \@sAfterClass + }{% + \AfterAtEndOfClass + }% + }{% + \AfterAtEndOfClass + }% + {#2}% + }% + \renewcommand*{\@@AfterPackage}[2]{% + \@ifundefined{#2.\@pkgextension-l@ading}{% + \@sAfterPackage + }{% + \@AfterPackage + }% + {#2}% + }% + \renewcommand*{\@@@AfterPackage}[2]{% + \@ifundefined{#2.\@pkgextension-l@ading}{% + \@ifpackageloaded{#2}{% + \@sAfterPackage + }{% + \@AfterAtEndOfPackage + }% + }{% + \@AfterAtEndOfPackage + }% + {#2}% + }% + \renewcommand*{\AfterAtEndOfPackage}[1]{% + \@ifpackageloaded{#1}{% + \@ifundefined{#1.\@pkgextension-l@ading}{% + \@gobbletwo + }{% + \@AfterAtEndOfPackage + }% + }{% + \@AfterAtEndOfPackage + }% + {#1}% + }% + \newcommand*{\@AfterAtEndOfPackage}[1]{% + \scr@set@load@hook{lateafter}{#1.\@pkgextension}% + }% + }% +}{} +% \end{macrocode} % Die folgenden Pakete werden für die Manipulation bereits definierter % Makros sowie zur erweiterten Auswertung boolescher Ausdrücke benötigt. % \begin{macrocode} diff --git a/macros/latex/contrib/tudscr/source/tudscr-comp.dtx b/macros/latex/contrib/tudscr/source/tudscr-comp.dtx index e2edc9dd9f..ece623438d 100644 --- a/macros/latex/contrib/tudscr/source/tudscr-comp.dtx +++ b/macros/latex/contrib/tudscr/source/tudscr-comp.dtx @@ -1,4 +1,4 @@ -% \CheckSum{1451} +% \CheckSum{1452} % \iffalse meta-comment % % TUD-Script -- Corporate Design of Technische Universität Dresden @@ -52,7 +52,7 @@ % \fi % \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi -\ProvidesFile{tudscr-comp.dtx}[2019/08/27 v2.06d TUD-Script\space% +\ProvidesFile{tudscr-comp.dtx}[2019/10/23 v2.06e TUD-Script\space% % % \iffalse %</dtx> @@ -379,6 +379,8 @@ % \changes{v2.06c}{2019/08/20}{neu}^^A % \begin{macro}{\tud@v@2.06d} % \changes{v2.06d}{2019/08/27}{neu}^^A +% \begin{macro}{\tud@v@2.06e} +% \changes{v2.06e}{2019/10/23}{neu}^^A % \begin{macro}{\tud@v@last} % \changes{v2.02}{2014/08/22}{neu}^^A % \changes{v2.03}{2015/01/13}{angepasst}^^A @@ -419,9 +421,11 @@ \csdef{tud@v@2.06b}{4} \csdef{tud@v@2.06c}{4} \csdef{tud@v@2.06d}{4} +\csdef{tud@v@2.06e}{4} \csdef{tud@v@last}{4} % \end{macrocode} % \end{macro}^^A \tud@v@last +% \end{macro}^^A \tud@v@2.06e % \end{macro}^^A \tud@v@2.06d % \end{macro}^^A \tud@v@2.06c % \end{macro}^^A \tud@v@2.06b diff --git a/macros/latex/contrib/tudscr/source/tudscr-manual.dtx b/macros/latex/contrib/tudscr/source/tudscr-manual.dtx index 4df997a44b..3249409e97 100644 --- a/macros/latex/contrib/tudscr/source/tudscr-manual.dtx +++ b/macros/latex/contrib/tudscr/source/tudscr-manual.dtx @@ -1,4 +1,4 @@ -% \CheckSum{4470} +% \CheckSum{4450} % \iffalse meta-comment % % TUD-Script -- Corporate Design of Technische Universität Dresden @@ -52,7 +52,7 @@ % \fi % \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi -\ProvidesFile{tudscr-manual.dtx}[2019/08/20 v2.06c TUD-Script\space% +\ProvidesFile{tudscr-manual.dtx}[2019/10/23 v2.06e TUD-Script\space% % % \iffalse %</dtx> @@ -338,25 +338,6 @@ % \begin{macrocode} \RequirePackage{scrwfile}[2013/08/05] % \end{macrocode} -% Die Umgebungen \env{Preamble}, \env{Trunk} und \env{Hint} sowie deren -% Varianten nutzen das Paket \pkg{filecontents}, um ihren Inhalt in eine -% temporäre Datei zu schreiben und diese direkt mit dem Paket \pkg{listings} -% darzustellen sowie ggf. den Quelltext auszuführen. Beim Überschreiben einer -% Datei wird für gewöhnlich eine Warnung erzeugt. Dies wird mit dem Patch -% unterbunden. -% \begin{macrocode} -\RequirePackage{filecontents}[2011/10/08] -\begingroup% - \catcode`\*=11% - \catcode`\^^M\active% - \catcode`\^^L\active\let^^L\relax% - \catcode`\^^I\active% - \patchcmd{\filec@ntents}{% - \@latex@warning@no@line{Overwriting file `\@currdir#1'}% - }{}{}{\tud@patch@wrn{filec@tents}}% - \global\let\filec@ntents\filec@ntents% -\endgroup% -% \end{macrocode} % % \iffalse %</package> @@ -5294,6 +5275,20 @@ % \end{macrocode} % \end{macro}^^A \StandaloneDate % \end{macro}^^A \StandaloneFile +% \begin{macro}{\filec@ntents@silent} +% \changes{v2.06e}{2019/10/10}{neu}^^A +% Die Umgebungen \env{Preamble}, \env{Trunk} und \env{Hint} sowie deren +% Varianten nutzen die Umgebung \env{filecontents}, um ihren Inhalt in eine +% temporäre Datei zu schreiben und diese direkt mit dem Paket \pkg{listings} +% darzustellen sowie ggf. den Quelltext auszuführen. Beim Überschreiben einer +% Datei wird für gewöhnlich eine Warnung erzeugt. Dies wird mit dem eigens +% definierten Parameter \prm{silent} unterbunden. +% \begin{macrocode} +\providecommand*\filec@ntents@silent{% + \let\@latex@warning@no@line\@gobble% +} +% \end{macrocode} +% \end{macro}^^A \filec@ntents@silent % \begin{macro}{\tud@tut@pre} % \changes{v2.02}{2014/08/19}{neu}^^A % \begin{macro}{\tud@tut@post} @@ -5304,7 +5299,7 @@ % genutzt wird. % \begin{macrocode} \newcommand*\tud@tut@pre{% - \csuse{filecontents*}{\tud@tut@temp.tex}% + \csuse{filecontents*}[force,silent,nosearch]{\tud@tut@temp.tex}% } \newcommand*\tud@tut@post{% \csuse{endfilecontents*}% diff --git a/macros/latex/contrib/tudscr/source/tudscr-version.dtx b/macros/latex/contrib/tudscr/source/tudscr-version.dtx index 10d37f2e8b..8b58d0b69b 100644 --- a/macros/latex/contrib/tudscr/source/tudscr-version.dtx +++ b/macros/latex/contrib/tudscr/source/tudscr-version.dtx @@ -128,7 +128,7 @@ %<*!(package|class)> \fi %</!(package|class)> - \TUD@Version@Check{2019/08/27 v2.06d TUD-Script} + \TUD@Version@Check{2019/10/23 v2.06e TUD-Script} \endgroup % \end{macrocode} % \end{macro}^^A \TUDScriptVersionNumber @@ -174,7 +174,7 @@ % % Als erstes das benötigte \LaTeX-Format. % \begin{macrocode} -%<package|class>\NeedsTeXFormat{LaTeX2e} +%<package|class>\NeedsTeXFormat{LaTeX2e}[2019/10/01] % \end{macrocode} % \begin{macro}{\tudscrmail} % Die E"~Mail-Adresse für Supportanfragen. |