diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-25 01:20:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-25 01:20:13 +0000 |
commit | c1ab1e338ec295e77a4e66c90e809d183b4da895 (patch) | |
tree | aad5fa35895461644c319891c98d10ae793e4c25 /Master/texmf-dist/source | |
parent | ee9bd506b9173d5ba88462a23050a184dcf99cca (diff) |
curve2e (25feb20)
git-svn-id: svn://tug.org/texlive/trunk@53900 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/curve2e/curve2e.dtx | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/Master/texmf-dist/source/latex/curve2e/curve2e.dtx b/Master/texmf-dist/source/latex/curve2e/curve2e.dtx index d3877066764..0b35ef2c19b 100644 --- a/Master/texmf-dist/source/latex/curve2e/curve2e.dtx +++ b/Master/texmf-dist/source/latex/curve2e/curve2e.dtx @@ -46,7 +46,7 @@ README.txt and curve2e-v161.sty. %<+package>\ProvidesPackage{curve2e}% %<+readme>File README.txt for package curve2e %<*package|readme> - [2020-01-29 v.2.2.1 Extension package for pict2e] + [2020-02-24 v.2.2.2 Extension package for pict2e] %</package|readme> %<*driver> \documentclass{ltxdoc}\errorcontextlines=9 @@ -179,7 +179,7 @@ README.txt and curve2e-v161.sty. %</driver> % \fi % -% \CheckSum{5578} +% \CheckSum{5582} % \begin{abstract} % This file documents the |curve2e| extension package to the |pict2e| % bundle implementation; the latter was described by Lamport @@ -403,9 +403,9 @@ README.txt and curve2e-v161.sty. % prohibited to use them; by themselves such arcs are not different form % those used by |Curve|, but the final command, |\FillCurve|, should be % used in place of |\CurveFinish|, so as to fill up the closed path with -% the locally specified color; see figure~\ref{fig:colored-curve}. -% It is much more convenient to use the starred version of the |\Curve| -% macro. +% the locally specified color; see the documentation |curve2e-manual.pdf| +% file. It is much more convenient to use the starred version of the +% |\Curve| macro. % \end{enumerate} % % The |pict2e| package already defines macros such as |\moveto|, @@ -753,10 +753,8 @@ README.txt and curve2e-v161.sty. % always referred to the origin of the coordinate axes; the end point % $P_2$ coordinates are referred to the origin of the axes if in % cartesian form, while with the polar form they are referred to $P_1$; -% both coordinate types have their usefulness and -% figures~\ref{fig:dashedlines} on page~\pageref{fig:dashedlines} -% and~\ref{fig:dottedlines} on page~\pageref{fig:dottedlines} show how -% to use such coordinate types. +% both coordinate types have their usefulness: see the documentation +% |curve2e-manual.pdf| file. % % The above mentioned macros create dashed lines between two given % points, with a dash length that must be specified, or dotted lines, @@ -988,7 +986,7 @@ README.txt and curve2e-v161.sty. % course it is the user responsibility to pay attention to the scales of % the two axes and to write meaningful expressions; the figure and code % shown in the first part of this documentation show some examples: -% see pages~\pageref{pag:multiput} and~\pageref{pag:orologio}. +% see the documentation |curve2e-manual.pdf| file. % \begin{macrocode} \RenewDocumentCommand{\multiput}{O{0,0} d() d() m m o }{% \IfNoValueTF{#2}{\PackageError{curve2e}% @@ -1204,8 +1202,8 @@ README.txt and curve2e-v161.sty. % The \texttt{pict2e} documentation says that if the vector length is % zero the macro draws only the arrow tip; this may work with macro % |\vector|, certainly not with |\Vector| and |\VECTOR|. This might be -% useful for adding an arrow tip to a circular arc. See examples in -% figure~\ref{fig:vectors} on page~\pageref{fig:vectors}. +% useful for adding an arrow tip to a circular arc. See the documentation +% |curve2e-manual.pdf| file. % % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1350,7 +1348,43 @@ README.txt and curve2e-v161.sty. % a single argument is assumed to contain the grid dimensions, while % if both arguments are given, the first one is the lower left corner % offset, and the second one the grid dimensions. -% \begin{macrocode} +% +% In order to render the red grid a little more automatic, a subsidiary +% service macro of the |picture| environment has been redefined in order +% to store the coordinates of the lower left and upper right corners +% of the canvas (the compulsory dimensions and the optional lower left +% corner shift arguments to the |picture| opening statement) in two +% new variables, so that when the user specifies the (non vanishing) +% dimensions of the canvas, the necessary data are already available +% and there is no need to repeat them to draw the grid. The new +% argument-less macro is named |\AutoGrid|, while the complete +% macro is |\GraphGrid| that requires its arguments as specified +% before. The advantage of the availability of both commands, +% consists in the fact that |\AutoGrid| covers the whole canvas, +% while |\GraphGrid| may compose a grid that covers either the whole +% canvas or just a part of it. In both cases, though, it is necessary +% the all the canvas coordinates are specified as multiples of 10 +% (|\unitlength|s). This is simple when |\GraphGrid| is used, while +% with |\AutoGrid| the specification is in the opening environment +% statement; and such multiples of 10 might not be the best ones +% for the final drawing and should be fine tuned after finishing +% the drawing and the grid is not necessary anymore. +% The actual |\AutoGrid| command definition accepts two parenthesis +% delimited arguments, that are not being used in the macro expansion; +% in this way it is easier to replace |\GraphGrid| with |\AutoGrid| if +% it is desired to do so. The opposite action, of corse is not so simple +% if the |\AutoGrid| command is not followed by one or two arguments +% as |\GraphGrid| requires. +% \begin{macrocode} +\def\@picture(#1,#2)(#3,#4){% + \edef\pict@urcorner{#1,#2}% New statement + \edef\pict@llcorner{#3,#4}% New statement + \@picht#2\unitlength + \setbox\@picbox\hb@xt@#1\unitlength\bgroup + \hskip -#3\unitlength + \lower #4\unitlength\hbox\bgroup + \ignorespaces} +% \def\Gr@phGrid(#1,#2){\bgroup\textcolor{red}{\linethickness{.1\p@}% \RoundUp#1modulo10to\@GridWd \RoundUp#2modulo10to\@GridHt \@tempcnta=\@GridWd \divide\@tempcnta10\relax \advance\@tempcnta\@ne @@ -1358,21 +1392,23 @@ README.txt and curve2e-v161.sty. \@tempcnta=\@GridHt \divide\@tempcnta10\advance\@tempcnta\@ne \multiput(0,0)(0,10){\@tempcnta}{\line(1,0){\@GridWd}}\thinlines}% \egroup\ignorespaces} + +\NewDocumentCommand\AutoGrid{d() d()}{\bgroup% +\put(\pict@llcorner){\expandafter\Gr@phGrid\expandafter(\pict@urcorner)}% +\egroup\ignorespaces} + + \NewDocumentCommand\GraphGrid{r() d()}{% \IfValueTF{#2}{\put(#1){\Gr@phGrid(#2)}}% {\put(0,0){\Gr@phGrid(#1)}}} % \end{macrocode} % Rounding up is useful because also the grid margins fall on coordinates -% multiples of 10. It resorts to the |\Integer| macro that will be -% described in a while. +% multiples of 10. % \begin{macrocode} -\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\RoundUp#1modulo#2to#3{ +\edef#3{\fpeval{(ceil(#1/#2,0))*#2}}}% +% % \end{macrocode} % The |\Integer| macro takes a possibly fractional number whose decimal % separator, if present, \textit{must} be the decimal point and uses the @@ -1392,7 +1428,8 @@ README.txt and curve2e-v161.sty. % This is not the place to complain about the fact that all programs of % the \TeX\ system used only integer arithmetics; now, with the 2018 % distribution of the modern \TeX\ system, package |xfp| is available: -% this package resorts in the background to language \LaTeX\,3; this language now can compute fractional number +% this package resorts in the background to language \LaTeX\,3; this +% language now can compute fractional number % operations coded in decimal, not in binary, and accepts also numbers % written in the usual way in computer science, that is as a fractional, % possibly signed, number followed by an expression that contains the @@ -2074,8 +2111,8 @@ README.txt and curve2e-v161.sty. % control points lay on the perpendicular to the vectors that join the % arc center to the starting and end points respectively. % -% With reference to figure~\ref{fig:arcspline} on -% page~\pageref{fig:arcspline}, the points $P_1$ and $P_2$ +% With reference to figure~11 of the documentation |curve2e-manual.pdf| +% file, the points $P_1$ and $P_2$ % are the arc end-points; $C_1$ and $C_2$ are the Bézier-spline % control-points; $P$ is the arc mid-point, that should be distant from % the center of the arc the same as $P_1$ and $P_2$. @@ -2535,8 +2572,8 @@ README.txt and curve2e-v161.sty. % \end{macrocode} % -% An example of use is shown in figure~\ref{fig:Cbezier} on -% page~\pageref{fig:Cbezier}; notice that the tangents at the end points +% An example of use is shown in figure~13 of the |curve2e-manual.pdf| file; +% notice that the tangents at the end points % are the same for the black curve drawn with |\CurveBetween| and the % five red curves drawn with |\CbezierBetween|; the five red curves % differ only for the distance of their control point $C_0$ from the @@ -2771,8 +2808,8 @@ README.txt and curve2e-v161.sty. % macro |\CbezierBetween| in order to use the general internal cubic % Bézier splines in a more comfortable way. % -% As it can be seen in figure~\ref{fig:sinewave} on -% page~\pageref{fig:sinewave} the two diagrams should approximately +% As it can be seen in figure~15 of the |curve2e-manual.pdf| file, the +% two diagrams should approximately % represent a sine wave. With Bézier curves, that resort on polynomials, % it is impossible to represent a transcendental function, but it is only % possible to approximate it. It is evident that the approximation @@ -3000,17 +3037,16 @@ README.txt and curve2e-v161.sty. % \end{macrocode} % % An example of usage is shown at the left in -% figure~\ref{fig:quadratic-arcs}\footnote{The commands \cs{legenda}, +% figure~16\footnote{The commands \cs{legenda}, % \cs{Pall} and \cs{Zbox} are specifically defined in the preamble of % this document; they must be used within a \texttt{picture} environment. % \cs{legenda} draws a framed legend made up of a single (short) math -% formula; \cs{Pall} is just a shorthand to put a filled small circle at a +% formula; \cs{Pall} is just a shorthand to put a sized dot at a % specified position' \cs{Zbox} puts a symbol in math mode a little % displaced in the proper direction relative to a specified position. % They are just handy to label certain objects in a \texttt{picture} -% diagram, but they are not part of the \texttt{curve2e} package.} on -% page~\pageref{fig:quadratic-arcs} created with the code shown in the -% same page. +% diagram, but they are not part of the \texttt{curve2e} package.} in +% figure~16 created with the code shown in the same page as the figure. % % Notice also that the inflexed line is made with two arcs that meet at % the inflection point; the same is true for the line that resembles |