diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tkz-fct')
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-fct/tkz-fct.sty | 583 |
1 files changed, 283 insertions, 300 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-fct/tkz-fct.sty b/Master/texmf-dist/tex/latex/tkz-fct/tkz-fct.sty index 86aa260a027..881066229b0 100644 --- a/Master/texmf-dist/tex/latex/tkz-fct/tkz-fct.sty +++ b/Master/texmf-dist/tex/latex/tkz-fct/tkz-fct.sty @@ -1,27 +1,17 @@ -% Copyright 2011 by Alain Matthes +% Copyright 2020 by Alain Matthes % % This file may be distributed and/or modified % % 1. under the LaTeX Project Public License and/or % 2. under the GNU Public License. -% - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % % - % tkz-fct.sty encodage : utf8 % - % % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % % - % Créé par Alain Matthes le 16-01-2011 % - % % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Objet : fonctions numériques en 2D with gnuplot - % constants from tkz-base % \tkz@init@xstep % \tkz@init@ystep +\typeout{2020/02/06 1.2 beta function tkz-fct} %<---------------------------------------------------------------------------> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tkz-fct}[2011/06/01 1.16 c function ] +\ProvidesPackage{tkz-fct}[2020/02/06 1.2 beta function ] \newcount\tkz@tkzf@fct \edef\tkzTWOPTCode{\the\catcode`\:} \tkz@tkzf@fct=0 % @@ -29,7 +19,7 @@ %<---------------------------------------------------------------------------> % Initialisation %<---------------------------------------------------------------------------> -\RequirePackage{tkz-base} +\RequirePackage{tkz-base,fp} % % Code from Christian Tellechea 2009 % modified by AM % modified \FP@pow from fp.sty \def\FP@pow#1#2#3{% @@ -82,26 +72,28 @@ \newif\iftkz@draw \newif\iftkz@fp \def\tkz@dmin{-5}\def\tkz@dmax{5} -\pgfkeys{% -/tkzfct/.cd, -domain/.code args={#1:#2} {\FPeval\tkz@min{(#1)} - \FPeval\tkz@max{(#2)}}, -samples/.code = {\edef\tkz@fct@samples{#1}}, -id/.code = {\edef\tkz@fct@id{#1}}, -fp/.is if = tkz@fp, -fp/.default = false, -/tkzfct/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}}} +\global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016 +\global\let\tkz@tmp@xb\tkz@init@xmax% modif 2016 +\global\let\tkz@tmp@ya\tkz@init@ymin% modif 2016 +\global\let\tkz@tmp@yb\tkz@init@ymax% modif 2016 +\catcode`\:=12 +\pgfkeys{/@tkzfct/.cd, + domain/.code args = {#1:#2} {\FPeval\tkz@min{(#1)} + \FPeval\tkz@max{(#2)}}, + domain = \tkz@tmp@xa:\tkz@tmp@xb, + samples/.store in = \tkz@fct@samples, + id/.store in = \tkz@fct@id, + fp/.is if = tkz@fp, + fp/.default = false, + samples = 200, + fp = true, + id = tkzfct, + /@tkzfct/.search also = {/tikz}, +}% \def\tkzFct{\pgfutil@ifnextchar[{\tkzActivOff\tkz@fct}{\tkz@fct[]}} \def\tkz@fct[#1]#2{% -\pgfkeys{/tkzfct/.cd, -domain = \@xa:\@xb, -samples = 200, -fp = true, -id = tkzfct} -\pgfqkeys{/tkzfct}{#1}% +\pgfqkeys{/@tkzfct}{#1}% \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -116,12 +108,14 @@ id = tkzfct} \def\x{(x*\tkz@init@xstep)}% \expandafter\edef\csname tkzFctgnu\@alph\tkz@tkzf@fct \endcsname{#2}% \expandafter\edef\csname tkzFctgnuLast\endcsname{#2} -\begin{scope}[samples = \tkz@fct@samples,#1] - \clip (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb); - \draw[xshift = -\tkz@x@delta cm,yshift = -\tkz@y@delta cm,/tkzfct/.cd]% - plot[id=\tkz@fct@id,domain= \tkz@ba:\tkz@bb]% - function{(#2)/\tkz@init@ystep};% -\end{scope} +% %%%%%%% +\begin{scope} + \clip (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb); + \draw[#1, xshift = -\tkz@x@delta cm,yshift = -\tkz@y@delta cm]% + plot[ samples = \tkz@fct@samples,id=\tkz@fct@id, + domain= \tkz@ba:\tkz@bb] function{(#2)/\tkz@init@ystep};% +\end{scope} +% %%%%%%% \let\tkz@tmp@xstep\tkz@init@xstep \def\tkz@init@xstep{1} \iftkz@fp% @@ -140,27 +134,25 @@ id = tkzfct} %<---------------------------------------------------------------------------> % point d'une courbe (new method) %<---------------------------------------------------------------------------> -\pgfkeys{% -/tkzfctpt/.cd, -draw/.is if = tkz@draw, -draw/.default = true, -with/.code = \global\def\tkz@fct@used{#1}, -ref/.code = \global\def\tkz@fct@ref{#1}} +\pgfkeys{/tkzfctpt/.cd, + draw/.is if = tkz@draw, + draw/.default = true, + with/.store in = \tkz@fct@used, + ref/.store in = \tkz@fct@ref, + draw = false, + with = {}, + ref = {} + } \def\tkzDefPointByFct{\pgfutil@ifnextchar[{\tkz@fctpoint}{\tkz@fctpoint[]}} \def\tkz@fctpoint[#1](#2){% -\pgfkeys{/tkzfctpt/.cd, - draw = false, - with = {}, - ref = {}} \pgfqkeys{/tkzfctpt}{#1} - - \FPeval\x{(#2)}% + \FPeval\x{(#2)}% \ifx\tkzutil@empty\tkz@fct@used \FPeval\tkz@fx{\tkzFctLast} \else \edef\tkz@fct{\csname tkzFct\tkz@fct@used\endcsname} - \FPeval\tkz@fx{\tkz@fct} + \FPeval\tkz@fx{\tkz@fct} \fi \tkzDefPoint(\x,\tkz@fx){tkzPointResult}% \iftkz@draw @@ -174,28 +166,24 @@ ref/.code = \global\def\tkz@fct@ref{#1}} %<---------------------------------------------------------------------------> % tangente \tkzDrawTangentLine %<---------------------------------------------------------------------------> -\pgfkeys{% -/tkztan/.cd, -draw/.is if = tkz@draw, -draw/.default = true, -with/.code = \global\def\tkz@fct@used{#1}, -kr/.code = {\edef\tkz@tan@kr{#1}}, -kl/.code = {\edef\tkz@tan@kl{#1}}, -/tkztan/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}} +\pgfkeys{/@tkztan/.cd, + with/.store in = \tkz@fct@used, + kr/.store in = \tkz@tan@kr, + kl/.store in = \tkz@tan@kl, + draw/.is if = tkz@draw, + draw/.default = true, + draw = false, + with = {}, + kr = 1, + kl = 1, + /@tkztan/.search also = {/tikz}, }% %<---------------------------------------------------------------------------> \def\tkzDrawTangentLine{\pgfutil@ifnextchar[{\tkz@DrawTangentLine}{% \tkz@DrawTangentLine[]}} \def\tkz@DrawTangentLine[#1](#2){% \begingroup -\pgfkeys{/tkztan/.cd, - draw = false, - with = {}, - kr = 1, - kl = 1} -\pgfqkeys{/tkztan}{#1} +\pgfqkeys{/@tkztan}{#1} \FPeval\x{(#2)}% \ifx\tkzutil@empty\tkz@fct@used \FPeval\tkz@img{\tkzFctLast} @@ -219,7 +207,7 @@ kl/.code = {\edef\tkz@tan@kl{#1}}, \FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img}% \FPmul{\tkz@slope}{\tkz@deltay}{1000000}% \protected@edef\tkz@temp{% -\noexpand\draw[/tkztan/tan style,/tkztan/.cd,#1]}\tkz@temp% +\noexpand\draw[/tkztan/tan style,/@tkztan/.cd,#1]}\tkz@temp% (tkzPointResult)--++(\tkz@krx,-\tkz@kry*\tkz@slope); \fi % demi tgt --> gauche @@ -230,7 +218,7 @@ kl/.code = {\edef\tkz@tan@kl{#1}}, \FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img} \FPmul{\tkz@slope}{\tkz@deltay}{-1000000} \protected@edef\tkz@temp{% -\noexpand\draw[/tkztan/tan style,/tkztan/.cd,#1]}\tkz@temp% +\noexpand\draw[/tkztan/tan style,/@tkztan/.cd,#1]}\tkz@temp% (tkzPointResult)--++(-\tkz@klx,\tkz@kly*\tkz@slope); \fi \iftkz@draw @@ -239,29 +227,26 @@ kl/.code = {\edef\tkz@tan@kl{#1}}, \endgroup } %<---------------------------------------------------------------------------> -% tkzArea +% tkzArea %<---------------------------------------------------------------------------> \pgfkeys{% /tkzarea/.cd, -domain/.code args={#1:#2} {\FPeval\tkz@min{(#1)} - \FPeval\tkz@max{(#2)}}, -opacity/.code = {\edef\tkz@fct@opacity{#1}}, -id/.code = {\edef\tkz@fct@id{#1}}, -color/.code = {\edef\tkz@fct@color{#1}}, -samples/.code = {\edef\tkz@fct@samples{#1}}, -/tkzarea/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}}} + domain/.code args={#1:#2} {\FPeval\tkz@min{(#1)} + \FPeval\tkz@max{(#2)}}, + opacity/.store in = \tkz@fct@opacity, + id/.store in = \tkz@fct@id, + color/.store in = \tkz@fct@color, + samples/.store in = \tkz@fct@samples, + domain = -5:5, + color = \tkz@otherlinecolor, + samples = 200, + id = tkzfonct, + opacity = .5, + /tkzarea/.search also = {/tikz} + } \def\tkzArea{\pgfutil@ifnextchar[{\catcode`\:=12 \tkz@aire}{\tkz@aire[]}} \def\tkz@aire[#1]{% -\begingroup -\pgfkeys{% -/tkzarea/.cd, -domain = -5:5, -color = \tkz@otherlinecolor, -samples = 200, -id = tkzfonct, -opacity = .5} +\begingroup \pgfqkeys{/tkzarea}{#1} \iftkz@init@NO \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% @@ -287,39 +272,37 @@ opacity = .5} \endgroup } \let\tkzDrawArea\tkzArea + %<---------------------------------------------------------------------------> % tkzAreafg %<---------------------------------------------------------------------------> -\pgfkeys{/tkzareafg/.cd, -domain/.code args={#1:#2} {\FPeval\tkz@min{(#1)} - \FPeval\tkz@max{(#2)}}, -between/.code args={#1 and #2}{\def\tkz@below{#1} - \def\tkz@above{#2}}, -opacity/.code = {\edef\tkz@fct@opacity{#1}}, -id/.code = {\edef\tkz@fct@id{#1}}, -color/.code = {\edef\tkz@fct@color{#1}}, -samples/.code = {\edef\tkz@fct@samples{#1}}, -/tkzareafg/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}}} -\def\tkzAreafg{\pgfutil@ifnextchar[{\tkz@airefg}{\tkz@airefg[]}} +\pgfkeys{/@tkzareafg/.cd, + domain/.code args ={#1:#2} {\FPeval\tkz@min{(#1)} + \FPeval\tkz@max{(#2)}}, + between/.code args ={#1 and #2}{\def\tkz@below{#1} + \def\tkz@above{#2}}, + opacity/.store in = \tkz@fct@opacity, + id/.store in = \tkz@fct@id, + color/.store in = \tkz@fct@color, + samples/.store in = \tkz@fct@samples, + domain = -5:5, + between = a and b, + color = lightgray, + samples = 200, + id = tkzfonct, + opacity = .5, + /@tkzareafg/.search also = {/tikz} + } +\def\tkzAreafg{\pgfutil@ifnextchar[{\tkz@airefg}{\tkz@airefg[]}} \def\tkz@airefg[#1]{% \begingroup -\pgfkeys{/tkzareafg/.cd, -domain = -5:5, -between = a and b, -color = lightgray, -samples = 200, -id = tkzfonct, -opacity = .5 -} -\pgfqkeys{/tkzareafg}{#1} +\pgfqkeys{/@tkzareafg}{#1} \def\tkz@fctsup{\csname tkzFctgnu\tkz@below\endcsname} \def\tkz@fctinf{\csname tkzFctgnu\tkz@above\endcsname} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@xstep}% -\else +\else \FPset{\tkz@x@delta}{0} \FPset{\tkz@y@delta}{0}% \fi% @@ -329,34 +312,33 @@ opacity = .5 \FPdiv\tkz@bb{\tkz@max}{\tkz@init@xstep} \begin{scope}[domain = \tkz@ba:\tkz@bb, samples = \tkz@fct@samples, - id = \tkz@fct@id] + id = \tkz@fct@id] \clip (\tkz@ba,\tkz@ya)--plot function{(\tkz@fctsup)/\tkz@init@ystep}% --(\tkz@bb,\tkz@ya);% \clip (\tkz@ba,\tkz@yb)--plot function{(\tkz@fctinf)/\tkz@init@ystep}% --(\tkz@bb,\tkz@yb); \fill [color = \tkz@fct@color, fill opacity = \tkz@fct@opacity, - /tkzareafg/.cd, + /@tkzareafg/.cd, #1]% (\tkz@ba,\tkz@ya) rectangle (\tkz@bb,\tkz@yb); \end{scope} \endgroup -} -\let\tkzDrawAreafg\tkzAreafg -\def\tkz@pamin{-5}\def\tkz@pamax{5} +} +\let\tkzDrawAreafg\tkzAreafg +\def\tkz@pamin{-5}\def\tkz@pamax{5} %<---------------------------------------------------------------------------> -% tkzFctPar +% tkzFctPar %<---------------------------------------------------------------------------> -\def\tkzFctPar{\pgfutil@ifnextchar[{\catcode`\:=12 \tkz@fctp}{\tkz@fctp[]}} +\def\tkzFctPar{\pgfutil@ifnextchar[{\catcode`\:=12 \tkz@fctp}{\tkz@fctp[]}} \def\tkz@fctp[#1]#2#3{% \begingroup -\pgfkeys{% -/tkzfct/.cd, -domain = \tkz@pamin:\tkz@pamax, -samples = 200, -fp = true, -id = tkzfct} -\pgfqkeys{/tkzfct}{#1} +\pgfkeys{/@tkzfct/.cd, + domain = \tkz@pamin:\tkz@pamax, + samples = 200, + fp = true, + id = tkzfct} +\pgfqkeys{/@tkzfct}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -369,29 +351,29 @@ id = tkzfct} \clip (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb); \draw [xshift = -\tkz@x@delta cm,% yshift = -\tkz@y@delta cm, - /tkzfct/.cd, #1]% + /@tkzfct/.cd, #1]% plot [parametric,domain = \tkz@min:\tkz@max,% id = tkzparfct]% function {(#2)/\tkz@init@xstep,(#3)/\tkz@init@ystep}; \tkzActivOn \end{scope} \endgroup -} +} %<---------------------------------------------------------------------------> -% tkzFctPolar +% tkzFctPolar %<---------------------------------------------------------------------------> -\def\tkz@pomin{0}\def\tkz@pomax{2*pi} +\def\tkz@pomin{0}\def\tkz@pomax{2*pi} \def\tkzFctPolar{\pgfutil@ifnextchar[{% - \catcode`\:=12 \tkz@FctPolar}{\tkz@FctPolar[]}} + \catcode`\:=12 \tkz@FctPolar}{\tkz@FctPolar[]}} \def\tkz@FctPolar[#1]#2{% \begingroup -\pgfkeys{% -/tkzfct/.cd, -domain = \tkz@pomin:\tkz@pomax, -fp = true, -samples = 200, -id = tkzfctpolar} -\pgfqkeys{/tkzfct}{#1} +\pgfkeys{/@tkzfct/.cd, + domain = \tkz@pomin:\tkz@pomax, + fp = true, + samples = 200, + id = tkzfctpolar + } +\pgfqkeys{/@tkzfct}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -399,40 +381,40 @@ id = tkzfctpolar} \FPset{\tkz@x@delta}{0} \FPset{\tkz@y@delta}{0}% \fi% - + \begin{scope} \tkzActivOff \draw [xshift = -\tkz@x@delta cm,% yshift = -\tkz@y@delta cm, - /tkzfct/.cd, #1]% + /@tkzfct/.cd, #1]% plot [raw gnuplot,id = tkzpolarfct]% function { set polar;set samples \tkz@fct@samples ; set trange [\tkz@min:\tkz@max]; plot (#2)/\tkz@init@xstep}; \tkzActivOn \end{scope} \endgroup -} +} %<---------------------------------------------------------------------------> -% tkzDrawRiemannSum +% tkzDrawRiemannSum %<---------------------------------------------------------------------------> -\pgfkeys{/tkzriemann/.cd, -interval/.code args={#1:#2} {\FPeval\tkz@min{(#1)} - \FPeval\tkz@max{(#2)}}, -number/.code = {\edef\tkz@fct@nb{#1}}, -opacity/.code = {\edef\tkz@fct@opacity{#1}}, -color/.code = {\edef\tkz@fct@color{#1}}, -/tkzriemann/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}}} \def\tkzDrawRiemannSum{\pgfutil@ifnextchar[{% - \catcode`\:=12 \tkz@DrawRiemannSum}{\tkz@DrawRiemannSum[]}} +\pgfkeys{/@tkzriemann/.cd, + interval/.code args={#1:#2} {\FPeval\tkz@min{(#1)} + \FPeval\tkz@max{(#2)}}, + number/.store in = \tkz@fct@nb, + opacity/.store in = \tkz@fct@opacity, + color/.store in = \tkz@fct@color, + /@tkzriemann/.search also = {/tikz}, +} +\def\tkzDrawRiemannSum{\pgfutil@ifnextchar[{% + \catcode`\:=12 \tkz@DrawRiemannSum}{\tkz@DrawRiemannSum[]}} \def\tkz@DrawRiemannSum[#1]{% \begingroup -\pgfkeys{% -/tkzriemann/.cd, -interval = 1:2, -number = 10, -opacity = 0.5, -line width = 1pt} -\pgfqkeys{/tkzriemann}{#1} +\pgfkeys{/@tkzriemann/.cd, + interval = 1:2, + number = 10, + opacity = 0.5, + line width = 1pt +} +\pgfqkeys{/@tkzriemann}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -442,39 +424,42 @@ line width = 1pt} \fi% \FPadd\tkz@intwd{\tkz@max}{-\tkz@min} \FPdiv\tkz@delta{\tkz@intwd}{\tkz@fct@nb} -\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} +\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} \begin{scope} \foreach \i in {0,1,...,\tkz@fct@nb}{% \FPeval\x{(\tkz@min+i*\tkz@delta)} \FPeval\tkz@fx{\tkzFcta} \FPadd\tkz@next{\x}{\tkz@delta} - \draw[color=\tkz@fct@color,opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\x ,0 ) rectangle (\tkz@next , \tkz@fx/\tkz@init@ystep ); - } - \end{scope} + \draw[ color=\tkz@fct@color, + opacity=\tkz@fct@opacity, + /@tkzriemann/.cd,#1] (\x ,0 ) rectangle (\tkz@next, + \tkz@fx/\tkz@init@ystep ); +} + \end{scope} \endgroup -} +} %<---------------------------------------------------------------------------> -% tkzDrawRiemannSumInf +% tkzDrawRiemannSumInf %<---------------------------------------------------------------------------> -\pgfkeys{/tkzriemann/.cd, -interval/.code args={#1:#2} {\FPeval\tkz@min{(#1)} - \FPeval\tkz@max{(#2)}}, -number/.code = {\edef\tkz@fct@nb{#1}}, -opacity/.code = {\edef\tkz@fct@opacity{#1}}, -color/.code = {\edef\tkz@fct@color{#1}}, -/tkzriemann/.unknown/.code = {\let\searchname=\pgfkeyscurrentname - \pgfkeysalso{\searchname/.try=#1, - /tikz/\searchname/.retry=#1}}} \def\tkzDrawRiemannSumInf{\pgfutil@ifnextchar[{% - \catcode`\:=12 \tkz@DrawRiemannSumInf}{\tkz@DrawRiemannSumInf[]}} +\pgfkeys{/@tkzriemann/.cd, + interval/.code args={#1:#2} {\FPeval\tkz@min{(#1)} + \FPeval\tkz@max{(#2)}}, + number/.store in = \tkz@fct@nb, + opacity/.store in = \tkz@fct@opacity, + color/.store in = \tkz@fct@color, + /@tkzriemann/.search also = {/tikz}, + } +\def\tkzDrawRiemannSumInf{\pgfutil@ifnextchar[{% + \catcode`\:=12 \tkz@DrawRiemannSumInf}{\tkz@DrawRiemannSumInf[]}} \def\tkz@DrawRiemannSumInf[#1]{% \begingroup -\pgfkeys{% -/tkzriemann/.cd, -interval = 1:2, -number = 10, -opacity = 0.5, -line width = 1pt} -\pgfqkeys{/tkzriemann}{#1} +\pgfkeys{/@tkzriemann/.cd, + interval = 1:2, + number = 10, + opacity = 0.5, + line width = 1pt + } +\pgfqkeys{/@tkzriemann}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -484,42 +469,42 @@ line width = 1pt} \fi% \FPadd\tkz@intwd{\tkz@max}{-\tkz@min} \FPdiv\tkz@delta{\tkz@intwd}{\tkz@fct@nb} -\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} - +\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} + \begin{scope} \foreach \i in {0,1,...,\tkz@fct@nb}{% \FPeval\x{(\tkz@min+i*\tkz@delta)} \FPeval\tkz@fx{\tkzFcta} \let\tkz@firstimg\tkz@fx - \let\tkz@firstx\x - \FPadd\tkz@next{\x}{\tkz@delta} - \let\tkzFctTmp\tkzFcta - \FPset\x{\tkz@next} - \FPeval\tkz@fxnext{\tkzFcta} -\ifdim \tkz@fx pt < \tkz@fxnext pt\relax - \draw[opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@firstimg/\tkz@init@ystep ); -\else -\draw[opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@fxnext/\tkz@init@ystep ); - \fi - } - \end{scope} + \let\tkz@firstx\x + \FPadd\tkz@next{\x}{\tkz@delta} + \let\tkzFctTmp\tkzFcta + \FPset\x{\tkz@next} + \FPeval\tkz@fxnext{\tkzFcta} + \ifdim \tkz@fx pt < \tkz@fxnext pt\relax + \draw[opacity=\tkz@fct@opacity,/@tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@firstimg/\tkz@init@ystep ); +\else +\draw[opacity=\tkz@fct@opacity,/@tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@fxnext/\tkz@init@ystep ); + \fi + } + \end{scope} \endgroup -} +} %<---------------------------------------------------------------------------> -% tkzDrawRiemannSumSup +% tkzDrawRiemannSumSup %<---------------------------------------------------------------------------> \def\tkzDrawRiemannSumSup{\pgfutil@ifnextchar[{% - \catcode`\:=12 \tkz@DrawRiemannSumSup}{\tkz@DrawRiemannSumSup[]}} + \catcode`\:=12 \tkz@DrawRiemannSumSup}{\tkz@DrawRiemannSumSup[]}} \def\tkz@DrawRiemannSumSup[#1]{% \begingroup -\pgfkeys{% -/tkzriemann/.cd, -interval = 1:2, -number = 10, -opacity = 0.5, -line width = 1pt} -\pgfqkeys{/tkzriemann}{#1} +\pgfkeys{/@tkzriemann/.cd, + interval = 1:2, + number = 10, + opacity = 0.5, + line width = 1pt + } +\pgfqkeys{/@tkzriemann}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -529,42 +514,42 @@ line width = 1pt} \fi% \FPadd\tkz@intwd{\tkz@max}{-\tkz@min} \FPdiv\tkz@delta{\tkz@intwd}{\tkz@fct@nb} -\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} - +\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} + \begin{scope} \foreach \i in {0,1,...,\tkz@fct@nb}{% \FPeval\x{(\tkz@min+i*\tkz@delta)} \FPeval\tkz@fx{\tkzFcta} \let\tkz@firstimg\tkz@fx - \let\tkz@firstx\x + \let\tkz@firstx\x \FPadd\tkz@next{\x}{\tkz@delta} \let\tkzFctTmp\tkzFcta \FPset\x{\tkz@next} \FPeval\tkz@fxnext{\tkzFcta} \ifdim \tkz@fx pt > \tkz@fxnext pt\relax - \draw[opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@firstimg/\tkz@init@ystep ); -\else -\draw[opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@fxnext/\tkz@init@ystep ); - \fi - } - \end{scope} + \draw[opacity=\tkz@fct@opacity,/@tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@firstimg/\tkz@init@ystep ); +\else +\draw[opacity=\tkz@fct@opacity,/@tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@fxnext/\tkz@init@ystep ); + \fi + } + \end{scope} \endgroup } %<---------------------------------------------------------------------------> -% tkzDrawRiemannSumMid +% tkzDrawRiemannSumMid %<---------------------------------------------------------------------------> \def\tkzDrawRiemannSumMid{\pgfutil@ifnextchar[{% - \catcode`\:=12 \tkz@DrawRiemannSumMid}{\tkz@DrawRiemannSumMid[]}} + \catcode`\:=12 \tkz@DrawRiemannSumMid}{\tkz@DrawRiemannSumMid[]}} \def\tkz@DrawRiemannSumMid[#1]{% \begingroup -\pgfkeys{% -/tkzriemann/.cd, -interval = 1:2, -number = 10, -opacity = 0.5, -line width = 1pt} -\pgfqkeys{/tkzriemann}{#1} +\pgfkeys{/@tkzriemann/.cd, + interval = 1:2, + number = 10, + opacity = 0.5, + line width = 1pt + } +\pgfqkeys{/@tkzriemann}{#1} \iftkz@init@NO% \FPdiv{\tkz@x@delta}{\tkz@init@xorigine}{\tkz@init@xstep}% \FPdiv{\tkz@y@delta}{\tkz@init@yorigine}{\tkz@init@ystep}% @@ -574,46 +559,43 @@ line width = 1pt} \fi% \FPadd\tkz@intwd{\tkz@max}{-\tkz@min} \FPdiv\tkz@delta{\tkz@intwd}{\tkz@fct@nb} -\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} - +\FPadd\tkz@fct@nb{\tkz@fct@nb}{-1} + \begin{scope} \foreach \i in {0,1,...,\tkz@fct@nb}{% \FPeval\x{(\tkz@min+i*\tkz@delta)} \FPeval\tkz@fx{\tkzFcta} \let\tkz@firstimg\tkz@fx - \let\tkz@firstx\x + \let\tkz@firstx\x \FPadd\tkz@next{\x}{\tkz@delta} \FPset\x{\tkz@next} \FPeval\tkz@fxnext{\tkzFcta} \FPeval\tkz@midimg{(\tkz@firstimg+\tkz@fxnext)/2} - \draw[opacity=\tkz@fct@opacity,/tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@midimg/\tkz@init@ystep ); - } - \end{scope} + \draw[opacity=\tkz@fct@opacity,/@tkzriemann/.cd,#1] (\tkz@firstx ,0 ) rectangle (\tkz@next , \tkz@midimg/\tkz@init@ystep ); + } + \end{scope} \endgroup -} - +} + %<--------------------------------------------------------------------------–> % tkzXH F rien T et [ ou ] %<--------------------------------------------------------------------------–> \def\tkz@ComT{v} % need -\pgfkeys{ - tkzxh/.cd, - posgrad/.code = {\def\tkz@tkzXh@posgrad{#1}}, - left/.code = {\def\tkz@tkzXh@left{#1}}, - right/.code = {\def\tkz@tkzXh@right{#1}}, - color/.code = {\def\tkz@tkzXh@color{#1}}, - } -\def\tkzXH{\pgfutil@ifnextchar[{\tkz@xh}{\tkz@xh[]}} +\pgfkeys{/@tkzxh/.cd, + posgrad/.store in = \tkz@tkzXh@posgrad, + left/.store in = \tkz@tkzXh@left, + right/.store in = \tkz@tkzXh@right, + color/.store in = \tkz@tkzXh@color, + posgrad = {below=6 pt}, + color = \tkz@mainlinecolor, + left = {}, + right = {}, + } +\def\tkzXH{\pgfutil@ifnextchar[{\tkz@xh}{\tkz@xh[]}} \def\tkz@xh[#1]#2{% -\pgfkeys{/tkzxh/.cd, - posgrad = {below=6 pt}, - color = \tkz@mainlinecolor, - left = {}, - right = {} -} - \pgfqkeys{/tkzxh}{#1} + \pgfqkeys{/@tkzxh}{#1} \begingroup \foreach \xA/\RA/\sA/\xB/\RB/\sB in {#2}{% \tkzDefPoint(\xA,0){deb}\tkzDefPoint(\xB,0){fin} @@ -627,7 +609,7 @@ line width = 1pt} \noexpand\node[\tkz@tkzXh@posgrad]}\tkz@temp at (deb){% \tkz@showgrad{\xA}$\numprint{\tkz@result}$};\fi -\ifx\RB\tkz@ComT +\ifx\RB\tkz@ComT \protected@edef\tkz@temp{\noexpand\node[\tkz@tkzXh@posgrad]}\tkz@temp% at (fin){% \tkz@showgrad{\xB}$\numprint{\tkz@result}$};\fi @@ -640,64 +622,65 @@ line width = 1pt} }% \endgroup }% -%<---------------------------------------------------------------------------> -% tangente obsolete -%<---------------------------------------------------------------------------> -\def\tkzTan{\pgfutil@ifnextchar[{\tkz@Tan}{\tkz@Tan[]}} - -\def\tkz@Tan[#1]#2(#3)#{ -\pgfkeys{/tkztan/.cd, -draw = false, -with={}, -kr = 1, -kl = 1} -\pgfqkeys{/tkztan}{#1} - \global\edef\tkz@opttan{#1} - \FPeval\x{(#3)}% - \FPeval\tkz@img{#2} - \let\tkz@yy #2% - \let\tkz@xx\x% - \let\tkz@old@img\tkz@img - \tkz@@Tan -} -\def\tkz@@Tan#1{% -\FPdiv{\tkz@old@x}{\x}{1} -\let\tkz@nexpty\tkz@img -\tkz@ptStar[](\tkz@old@x,\tkz@nexpty){#1} -\FPdiv{\tkz@krx}{\tkz@tan@kr}{\tkz@tmp@xstep} -\FPdiv{\tkz@kry}{\tkz@tan@kr}{\tkz@init@ystep} -\FPdiv{\tkz@klx}{\tkz@tan@kl}{\tkz@tmp@xstep} -\FPdiv{\tkz@kly}{\tkz@tan@kl}{\tkz@init@ystep} - % demi tgt--> droite -\FPifzero{\tkz@tan@kr}% -\else -\FPadd{\x}{\tkz@xx}{0.000001}% -\FPeval\tkz@img{\tkz@yy}% -\FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img}% -\FPmul{\tkz@slope}{\tkz@deltay}{1000000}% -\protected@edef\tkz@temp{ - \noexpand\draw[tan style,/tkztan/.cd,\tkz@opttan,-]}\tkz@temp% - (#1)--++(\tkz@krx,-\tkz@kry*\tkz@slope); -\fi -% demi tgt --> gauche -\FPifzero{\tkz@tan@kl}% - \else -\FPadd{\x}{\tkz@xx}{-0.000001} -\FPeval\tkz@img{\tkz@yy}% -\FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img} -\FPmul{\tkz@slope}{\tkz@deltay}{-1000000} - \protected@edef\tkz@temp{ - \noexpand -\draw[tan style,/tkztan/.cd,\tkz@opttan,-]}\tkz@temp% - (#1)--++(-\tkz@klx,\tkz@kly*\tkz@slope); - \fi -} +% %<---------------------------------------------------------------------------> +% % tangente obsolete +% %<---------------------------------------------------------------------------> +% \def\tkzTan{\pgfutil@ifnextchar[{\tkz@Tan}{\tkz@Tan[]}} +% +% \def\tkz@Tan[#1]#2(#3)#{ +% \pgfkeys{/@tkztan/.cd, +% draw = false, +% with = {}, +% kr = 1, +% kl = 1 +% } +% \pgfqkeys{/@tkztan}{#1} +% \global\edef\tkz@opttan{#1} +% \FPeval\x{(#3)}% +% \FPeval\tkz@img{#2} +% \let\tkz@yy #2% +% \let\tkz@xx\x% +% \let\tkz@old@img\tkz@img +% \tkz@@Tan +% } +% \def\tkz@@Tan#1{% +% \FPdiv{\tkz@old@x}{\x}{1} +% \let\tkz@nexpty\tkz@img +% \tkz@ptStar[](\tkz@old@x,\tkz@nexpty){#1} +% \FPdiv{\tkz@krx}{\tkz@tan@kr}{\tkz@tmp@xstep} +% \FPdiv{\tkz@kry}{\tkz@tan@kr}{\tkz@init@ystep} +% \FPdiv{\tkz@klx}{\tkz@tan@kl}{\tkz@tmp@xstep} +% \FPdiv{\tkz@kly}{\tkz@tan@kl}{\tkz@init@ystep} +% % demi tgt--> droite +% \FPifzero{\tkz@tan@kr}% +% \else +% \FPadd{\x}{\tkz@xx}{0.000001}% +% \FPeval\tkz@img{\tkz@yy}% +% \FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img}% +% \FPmul{\tkz@slope}{\tkz@deltay}{1000000}% +% \protected@edef\tkz@temp{ +% \noexpand\draw[tan style,/@tkztan/.cd,\tkz@opttan,-]}\tkz@temp% +% (#1)--++(\tkz@krx,-\tkz@kry*\tkz@slope); +% \fi +% % demi tgt --> gauche +% \FPifzero{\tkz@tan@kl}% +% \else +% \FPadd{\x}{\tkz@xx}{-0.000001} +% \FPeval\tkz@img{\tkz@yy}% +% \FPadd{\tkz@deltay}{\tkz@old@img}{-\tkz@img} +% \FPmul{\tkz@slope}{\tkz@deltay}{-1000000} +% \protected@edef\tkz@temp{ +% \noexpand +% \draw[tan style,/@tkztan/.cd,\tkz@opttan,-]}\tkz@temp% +% (#1)--++(-\tkz@klx,\tkz@kly*\tkz@slope); +% \fi +% } %<---------------------------------------------------------------------------> % point d'une courbe obsolete %<---------------------------------------------------------------------------> -\def\tkzFctPt{\pgfutil@ifnextchar[{\tkz@fctpt}{\tkz@fctpt[]}} +\def\tkzFctPt{\pgfutil@ifnextchar[{\tkz@fctpt}{\tkz@fctpt[]}} \def\tkz@fctpt[#1]#2(#3)#{% - \global\edef\tkz@optptfct{#1} + \global\edef\tkz@optptfct{#1} \FPeval\x{(#3)}% \FPeval\tkz@y{#2} \tkz@defpoint @@ -707,7 +690,7 @@ kl = 1} \protected@edef\tkz@temp{ \noexpand \tkzDrawPoint[\tkz@optptfct](#1)}\tkz@temp \let\tkz@init@xstep\tkz@tmp@xstep -} +} %<-------------------------- the end ---------------------------------------> \endinput |