diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex | 310 |
1 files changed, 77 insertions, 233 deletions
diff --git a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex index 412ad2d8d30..cba0a88f804 100644 --- a/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex +++ b/Master/texmf-dist/tex/latex/tkz-base/tkz-tools-utilities.tex @@ -1,15 +1,20 @@ +% tkz-tools-utilities % Copyright 2011 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. +\def\fileversion{3.01c} +\def\filedate{2020/01/23} +\typeout{2020/01/23 3.01c tkz-tools-utilities.tex} +\makeatletter +% for testing results +\def\extractxy#1{% +\pgfextractx{\pgf@x}{\pgfpointanchor{#1}{center}} +\pgfextracty{\pgf@y}{\pgfpointanchor{#1}{center}} +\typeout{#1 \the\pgf@x,\the\pgf@y} +} - -\def\fileversion{1.16 d} -\def\filedate{2018/09/19} - -%<--------------------------------------------------------------------------–> +%<-------------- some tools -------------------------------------------------> \def\tkzutil@empty{} \def\tkzutil@firstofone#1{#1} \def\tkzutil@firstoftwo#1#2{#1} @@ -22,150 +27,70 @@ \expandafter\tkzutil@secondoftwo \fi} %<--------------------------------------------------------------------------–> +\long\def\iftkznodedefined#1#2#3{% + \tkzutil@ifundefined{pgf@sh@ns@#1}{#3}{#2}% +} %<--------------------------------------------------------------------------–> -\global\def\tkzActivOff{% -\edef\tkzTwoPtCode{\the\catcode`\:} -\edef\tkzPtExCode{\the\catcode`\!} -\edef\tkzPtVirCode{\the\catcode`\;} -\catcode`\:=12 \catcode`\!=12 \catcode`\;=12}% -\global\def\tkzActivOn{% -\catcode`\:=\tkzTwoPtCode\relax -\catcode`\!=\tkzPtExCode\relax -\catcode`\;=\tkzPtVirCode\relax +\gdef\tkzActivOff{% + \edef\tkzTwoPtCode{\the\catcode`\:} + \edef\tkzPtExCode{\the\catcode`\!} + \edef\tkzPtVirCode{\the\catcode`\;} + \catcode`\:=12 \catcode`\!=12 \catcode`\;=12 + }% +\gdef\tkzActivOn{% + \catcode`\:=\tkzTwoPtCode\relax + \catcode`\!=\tkzPtExCode\relax + \catcode`\;=\tkzPtVirCode\relax }% - -%<----------------------------– autres tools --------------------------------> -%<-------------------------- Initialisation --------------------------------> -\pgfkeys{ -/tkzsupcol/.cd, - background/.code = {\global\edef\tkz@suc@bkc{#1}},% - text/.code = {\global\edef\tkz@suc@txt{#1}}, -} -\def\tkzSetUpColors{\pgfutil@ifnextchar[{\tkz@SetUpColors}{\tkz@SetUpColors[]}} -\def\tkz@SetUpColors[#1]{% -\begingroup -\pgfkeys{% -tkzsupcol/.cd, - background = \tkz@backgroundcolor, - text = \tkz@textcolor - } -\pgfqkeys{/tkzsupcol}{#1} -\global\edef\tkz@fillcolor{\tkz@suc@bkc} -\global\edef\tkz@mainlinecolor{\tkz@suc@txt} -\global\edef\tkz@textcolor{\tkz@suc@txt} -\global\def\tkz@otherlinecolor{\tkz@suc@txt!50} -\global\edef\tkz@sua@color{\tkz@mainlinecolor} -\pagecolor{\tkz@suc@bkc} -\color{\tkz@suc@txt} - \InputIfFileExists{tkz-base.cfg}{\typeout{Local configuration file tkz-param.cfg found and used}}{\typeout{tkz-base.cfg not found} -%<--------- axes cartesian system ---------------------------------------–> -\global\edef\tkz@init@color{\tkz@textcolor} -\global\def\tkz@init@lw{0.4 pt} -\global\def\tkz@init@xlabel{$x$} -\global\def\tkz@init@ylabel{$y$} -\global\def\tkz@init@tickwd{0.8 pt} -\global\def\tkz@init@ticka{2 pt} -\global\def\tkz@init@tickb{2 pt} -\global\def\tkz@init@rightspace{.5} -\global\def\tkz@init@leftspace{0} -\global\def\tkz@init@upspace{.5} -\global\def\tkz@init@downspace{0} -\global\let\tkzmathstyle\displaystyle -\tikzset{xlabel style/.style={below=3 pt, - inner sep = 1pt, - outer sep = 0pt}} -\tikzset{xaxe style/.style ={>=latex,->}} -\tikzset{ylabel style/.style={left = 3 pt, - inner sep = 1pt, - outer sep = 0pt}} -\tikzset{yaxe style/.style ={>=latex,->}} -%<-------------------------- rep ---------------------------------------–> -\global\edef\tkz@sur@color{\tkz@mainlinecolor} -\global\edef\tkz@sur@colorlabel{\tkz@mainlinecolor} -\global\def\tkz@sur@lw{0.8 pt} -\global\def\tkz@sur@posxlabel{below=2pt} -\global\def\tkz@sur@posylabel{left=2pt} -%<-------------------------- grid ---------------------------------------–> -\global\edef\tkz@grid@color{gray} -\global\def\tkz@grid@lw{0.4 pt} -\global\def\tkzCoeffSubColor{50} -\global\def\tkzCoeffSubLw{0.8} -\global\def\tkz@grid@xstep{0.2} -\global\def\tkz@grid@ystep{0.2} -%<-------------------------- line ---------------------------------------–> -\global\edef\tkz@euc@linecolor{\tkz@mainlinecolor} -\global\def\tkz@euc@linewidth{0.6pt} -\global\def\tkz@euc@linestyle{solid} -\global\def\tkz@euc@lineleft{.2} -\global\def\tkz@euc@lineright{.2} -\global\def\tkz@legend@line@len{1cm} -\global\edef\tkz@euc@segmentcolor{\tkz@mainlinecolor} -\global\edef\tkz@euc@circlecolor{\tkz@mainlinecolor} -\tikzset{line style/.style={% - line width = \tkz@euc@linewidth, - color = \tkz@euc@linecolor, - style = \tkz@euc@linestyle, - add = {\tkz@euc@lineleft} and {\tkz@euc@lineright}}} -%<-------------------------- points -----------------------------------–> -\global\edef\tkz@euc@pointshape{circle} -\global\edef\tkz@euc@pointcolor{\tkz@mainlinecolor} -\global\edef\tkz@euc@labelcolor{\tkz@mainlinecolor} -\global\def\tkz@euc@pointsize{6} -\global\def\tkz@euc@pointpos{below right} -\tikzset{point style/.style={draw = \tkz@euc@pointcolor, - inner sep = 0pt, - shape = \tkz@euc@pointshape, - minimum size = \tkz@euc@pointsize*\pgflinewidth, - fill = \tkz@euc@pointcolor!50}} -%<---------------------------- mark -----------------------------------–> -\global\edef\tkz@mk@color{\tkz@mainlinecolor} -\global\edef\tkz@mk@mark{*} -\global\edef\tkz@mk@size{3pt} -\global\edef\tkz@mk@fill{\tkz@otherlinecolor} -\tikzset{mark style/.style={mark=\tkz@mk@mark,mark size=\tkz@mk@size,mark options={color=\tkz@mk@color,fill=\tkz@mk@fill}}} -\tikzset{arrow coord style/.style={dashed, - \tkz@euc@linecolor, - >=latex', - ->}} -\tikzset{xcoord style/.style={\tkz@euc@labelcolor, - font=\normalsize,text height=1ex, - inner sep = 0pt, - outer sep = 0pt, - fill=\tkz@fillcolor, - below=3pt}} -\tikzset{ycoord style/.style={\tkz@euc@labelcolor, - font=\normalsize,text height=1ex, - inner sep = 0pt, - outer sep = 0pt, - fill=\tkz@fillcolor, - left=3pt}} -%<--------------------------- vector --------------------------------------–> -\tikzset{vector style/.style={>=latex,->}} -%<------------------------- compass -----------------------------------–> -\global\edef\tkz@euc@compasscolor{\tkz@otherlinecolor} -\global\def\tkz@euc@compasswidth{0.4pt} -\global\def\tkz@euc@compassstyle{solid} -\tikzset{compass style/.style={color = \tkz@euc@compasscolor, - line width = \tkz@euc@compasswidth, - style = \tkz@euc@compassstyle}} +%<------ Initialisation of the colors with tkzSetUpColors -----------------> +% Première macro SetUpColors %%%%%%%%%%%%%%%%%%%%% +%Possible +\pgfkeys{/setupcolor/.is family} +\def\setupcolorkeys#1{% + \pgfkeys{/setupcolor,#1}} +\setupcolorkeys{ + background/.estore in = \setupcolor@background, + text/.estore in = \setupcolor@text, + @initial/.style = {background=white,text=black}, + @apply/.code = {\pagecolor{\setupcolor@background}% + \color{\setupcolor@text}% + }, } -\endgroup} +\def\tkzSetUpColors{\pgfutil@ifnextchar[{\tkz@SetUpColors}{\tkz@SetUpColors[]}} +\def\tkz@SetUpColors[#1]{\setupcolorkeys{@initial,#1,@apply}} +%<------ Initialisation of all colors -----------------> +\pgfkeys{/tkzsupallcol/.cd, + background/.store in = \tkz@suac@bkc, + text/.store in = \tkz@suac@txt, + background = \tkz@backgroundcolor,% see tkz-base.cfg + text = \tkz@textcolor% idem + } +\def\tkzSetUpAllColors{\pgfutil@ifnextchar[{\tkz@SetUpAllColors}{% + \tkz@SetUpAllColors[]}} +\def\tkz@SetUpAllColors[#1]{% + \pgfqkeys{/tkzsupallcol}{#1} % now we redine the based colors + \def\tkz@fillcolor{\tkz@suac@bkc} + \def\tkz@mainlinecolor{\tkz@suac@txt} + \def\tkz@textcolor{\tkz@suac@txt} + \def\tkz@otherlinecolor{\tkz@suac@txt!50} + \def\tkz@sua@color{\tkz@suac@txt} + \tkzSetUpAxis[color=\tkz@suac@txt] + \tkzSetUpGrid[color=\tkz@suac@txt] + \pagecolor{\tkz@suac@bkc} + \color{\tkz@suac@txt} +} %<--------------------------------------------------------------------------–> % Pour savoir le nombre de décimales d'un nombre % le nombre dans #1 et le résultat dans \c@pgfmath@countb %<--------------------------------------------------------------------------–> - -\newcommand*\tkz@getdecimal[1]{% - \expandafter\@getdecimal#1.\@nil -} - +\newcommand\tkz@getdecimal[1]{\expandafter\@getdecimal#1.\@nil} \def\@getdecimal#1.#2\@nil{% \ifx\empty#2\empty % Si #2 est vide, c'est qu'il n'y avait pas de point % dans la chaîne initiale \c@pgfmath@countb0 % - \global\def\tkz@decpart{}% + \gdef\tkz@decpart{}% \else % sinon c'est la chaîne qui suit le point décimal... \CountToken{#2}% @@ -174,8 +99,8 @@ tkzsupcol/.cd, \@@getdecimal#2\@nil \fi } -\def\@@getdecimal#1.\@nil{\global\def\tkz@decpart{#1}} -%<--------------------------------------------------------------------------–> +\def\@@getdecimal#1.\@nil{\gdef\tkz@decpart{#1}} +%<---------------------------------------------------------–> % code from JCC modifi \newcommand\CountToken[1]{% \c@pgfmath@countb0 % @@ -192,12 +117,10 @@ tkzsupcol/.cd, \fi } % end code from JCC - -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> +%<---------------------------------------------------------–> % Tools -%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> +%<---------------------------------------------------------–> %<–––––––– code from TeX in Practice ––––––––> -\newif\if@TestSubString \def\SubStringConditional #1#2{% TT\fi \edef\@MainString{#1}% @@ -210,13 +133,12 @@ tkzsupcol/.cd, }% \@TestSubS #1#2\\ \ifx\@MainString\@TestTemp - \@TestSubStringfalse + \tkz@TestSubStringfalse \else - \@TestSubStringtrue + \tkz@TestSubStringtrue \fi - \if@TestSubString + \iftkz@TestSubString } - \def\RecursionMacroEnd #1#2#3{% #1\relax \def\@RecursionMacroEndNext{#2}% @@ -225,7 +147,6 @@ tkzsupcol/.cd, \fi \@RecursionMacroEndNext } - \def\ReplaceSubStrings #1#2#3#4{% \def\@ReplaceResult{#1}% \edef\@ReplaceMain{#2}% @@ -250,89 +171,12 @@ tkzsupcol/.cd, \@EndReplaceSubStrings \@ReplaceSubStrings } -\def\tkzPrintFrac#1#2{% -\begingroup -\tkzReducFrac{#1}{#2} -\global\edef\tkzprintfrac{$ \frac{\tkzMathFirstResult}{\tkzMathSecondResult}$}% - \ifnum\tkzMathFirstResult=0% - \global\edef\tkzprintfrac{$0$}% - \else - \ifnum\tkzMathSecondResult=1 % - \ifnum\tkzMathFirstResult=1 % - \global\edef\tkzprintfrac{$1$}% - \else - \ifnum\tkzMathFirstResult=-1% - \global\edef\tkzprintfrac{$-1$}% - \else - \global\edef\tkzprintfrac{$\tkzMathFirstResult$}% - \fi\fi - \else - \ifnum\tkzMathFirstResult=1 % - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{1}{\tkzMathSecondResult}$}% - \else - \ifnum\tkzMathFirstResult=-1 % - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{-1}{\tkzMathSecondResult}$}% - \else - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult}{% - \tkzMathSecondResult}$}% - \fi\fi\fi\fi -\endgroup} -%<---------------------------------------------------------------------------> -\def\tkzPrintFracWithPi#1#2{% -\begingroup -\tkzReducFrac{#1}{#2} -\global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult\pi}{\tkzMathSecondResult}$}% - \ifnum\tkzMathFirstResult=0% - \global\edef\tkzprintfrac{$0$}% - \else - \ifnum\tkzMathSecondResult=1 % - \ifnum\tkzMathFirstResult=1 % - \global\edef\tkzprintfrac{$\pi$}% - \else - \ifnum\tkzMathFirstResult=-1% - \global\edef\tkzprintfrac{$-\pi$}% - \else - \global\edef\tkzprintfrac{$\tkzMathFirstResult\pi$}% - \fi\fi - \else - \ifnum\tkzMathFirstResult=1 % - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\pi}{\tkzMathSecondResult}$}% - \else - \ifnum\tkzMathFirstResult=-1 % - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{-\pi}{\tkzMathSecondResult}$}% - \else - \global\edef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult\pi}{% - \tkzMathSecondResult}$}% - \fi\fi\fi\fi -\endgroup}% - -%<---------------------------------------------------------------------------> -% chargement des modules -\def\tkz@obj@all{polygons,vectors,arcs,sectors,angles,protractor} -\def\tkz@obj@txt{all} -\def\usetkzobj{\pgfutil@ifnextchar[{\use@usetkzobj}{\use@@usetkzobj}}%} -\def\use@usetkzobj[#1]{\use@@usetkzobj{#1}} -\def\use@@usetkzobj#1{% - \def\tkz@list{#1} - \ifx\tkz@obj@txt\tkz@list \edef\tkz@list{\tkz@obj@all}% - \else - \edef\tkz@list{#1}% - \fi - %\edef\tkz@list{#1}% - \pgfutil@for\tkz@temp:=\tkz@list\do{% - \expandafter\ifx\csname tkz@library@\tkz@temp @loaded\endcsname\relax% - \expandafter\global\expandafter\let\csname tkz@library@\tkz@temp @loaded\endcsname=\pgfutil@empty% - \expandafter\edef\csname tkz@obj@#1@atcode\endcsname{\the\catcode`\@} - \expandafter\edef\csname tkz@obj@#1@barcode\endcsname{\the\catcode`\|} - \catcode`\@=11 - \catcode`\|=12 - \input tkz-obj-\tkz@temp.tex - \catcode`\@=\csname tkz@obj@#1@atcode\endcsname - \catcode`\|=\csname tkz@obj@#1@barcode\endcsname - \fi% - }% -}% -\def\DisabledNumprint{\let\tkz@numprint\numprint -\let\numprint\relax} +%<---------------------------------------------------------–> +\def\DisabledNumprint{% + \let\tkz@numprint\numprint + \let\numprint\relax + } \def\EnabledNumprint{\let\numprint\tkz@numprint} +%<---------------------------------------------------------–> +\makeatother \endinput
\ No newline at end of file |