% tkz-tools-base.tex    
% 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.


%  utf8 encoding

\def\fileversion{1.13 c}% 1.131
\def\filedate{2011/01/19}

%<--------------------------------------------------------------------------–>
\global\let\@xa\tkz@init@xmin
\global\let\@xb\tkz@init@xmax
\global\let\@ya\tkz@init@ymin
\global\let\@yb\tkz@init@ymax 
%<--------------------------------------------------------------------------–>
\gdef\xgrad{1}
\gdef\ygrad{1}
\gdef\tkz@xa{0}
\gdef\tkz@xb{10}
\gdef\tkz@ya{0}
\gdef\tkz@yb{10}
\newif\iftkz@init@NO
\pgfkeys{
  /tkzInit/.cd,
  xmin/.code     = {\def\tkz@init@xmin{#1}},
  xmax/.code     = {\def\tkz@init@xmax{#1}},
  xstep/.code    = {\def\tkz@init@xstep{#1}},
  ymin/.code     = {\def\tkz@init@ymin{#1}},
  ymax/.code     = {\def\tkz@init@ymax{#1}},
  ystep/.code    = {\def\tkz@init@ystep{#1}}, 
  NO/.is if      = tkz@init@NO,
  NO/.default    = true   } 
  
\def\tkzInit{\pgfutil@ifnextchar[{\tkz@Init}{\tkz@Init[]}}                                    
\def\tkz@Init[#1]{%
\pgfkeys{/tkzInit/.cd,
         xmin  = 0,
         xmax  = 10,
         xstep = 1,
         ymin  = 0,
         ymax  = 10,
         ystep = 1,
         NO    = false 
}  
  \pgfqkeys{/tkzInit}{#1}
  \ifx\tkzfctloaded\undefined
    \else   
   \tkz@tkzf@fct=0 %  only if tkz-fct loaded
   \fi   
  \xdef\tkz@init@xorigine{0}
  \xdef\tkz@init@yorigine{0}
  \FPsgn\@xsgmin{\tkz@init@xmin}
  \FPsgn\@xsgmax{\tkz@init@xmax}
  \FPsgn\@ysgmin{\tkz@init@ymin}
  \FPsgn\@ysgmax{\tkz@init@ymax}
  \global\let\@xa\tkz@init@xmin
  \global\let\@xb\tkz@init@xmax
  \global\let\@ya\tkz@init@ymin
  \global\let\@yb\tkz@init@ymax
   \tkz@init@NOfalse  
  \ifx\@xsgmin\@xsgmax \tkz@init@NOtrue \fi
  \ifx\@ysgmin\@ysgmax \tkz@init@NOtrue  \fi
  \iftkz@init@NO%
  \ifx\@xsgmin\@xsgmax
    \FPadd{\tkz@init@xmax}{\tkz@init@xmax}{-\tkz@init@xmin}%
    \edef\tkz@init@xorigine{\tkz@init@xmin}
    \edef\tkz@init@xmin{0}
  \fi

  \ifx\@ysgmin\@ysgmax
    \FPadd{\tkz@init@ymax}{\tkz@init@ymax}{-\tkz@init@ymin}%
    \edef\tkz@init@yorigine{\tkz@init@ymin}
    \edef\tkz@init@ymin{0}
  \fi
  \fi
  \FPdiv{\tkz@xa}{\tkz@init@xmin}{\tkz@init@xstep}
  \FPdiv{\tkz@xb}{\tkz@init@xmax}{\tkz@init@xstep}
  \FPdiv{\tkz@ya}{\tkz@init@ymin}{\tkz@init@ystep}
  \FPdiv{\tkz@yb}{\tkz@init@ymax}{\tkz@init@ystep}
  \tkz@getdecimal{\tkz@init@xstep} % amélioration nb dec et integer
  \global\edef\tkz@init@xdec{\number\c@pgfmath@countb}
  \tkz@getdecimal{\tkz@init@ystep}
  \global\edef\tkz@init@ydec{\number\c@pgfmath@countb} 
}%
%<--------------------------------------------------------------------------–>
\pgfkeys{Clip/.cd, space/.code     = {\def\tkz@CLI@space{#1}}} 

\def\tkzClip{\pgfutil@ifnextchar[{\tkz@Clip}{\tkz@Clip[]}} 
\def\tkz@Clip[#1]{%
\pgfkeys{Clip/.cd,space    = {}} 
\pgfqkeys{/Clip}{#1} 
\ifx\tkzutil@empty\tkz@CLI@space
    \clip (\tkz@xa,\tkz@ya) rectangle (\tkz@xb,\tkz@yb);
 \else
    \FPadd{\tkz@xxa}{\tkz@xa}{-\tkz@CLI@space}
    \FPadd{\tkz@yya}{\tkz@ya}{-\tkz@CLI@space}
    \FPadd{\tkz@xxb}{\tkz@xb}{\tkz@CLI@space}
    \FPadd{\tkz@yyb}{\tkz@yb}{\tkz@CLI@space} 
    \clip (\tkz@xxa,\tkz@yya) rectangle (\tkz@xxb,\tkz@yyb);
\fi
} 
%todo add options
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–> 
\def\tkz@showgrad#1{%
\FPifint{#1}\FPtrunc\tkz@result{#1}{0}\else\FPset\tkz@result{#1}\fi}%

\def\tkz@Xresult{%
\tkz@showgrad{\xgrad}%
 $\numprint{\tkz@result}$%
}%
%<--------------------------------------------------------------------------–>
\def\tkz@Yresult{%
\tkz@showgrad{\ygrad}%
$\numprint{\tkz@result}$
}% 
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–>
\def\tkz@Xshowgradresult{% 
\iftkz@X@orig
\tkz@Xresult% 
\else % orig 
       \iftkz@init@NO% 
          \unless\ifx\tkz@pos\tkz@posmin
          \tkz@Xresult\fi
       \else % NO  
         \unless\ifx\tkz@pos\x@tkzero%
         \tkz@Xresult
         \fi%end of x@tkzero
      \fi%end of NO
\fi%end of orig
}%
%<--------------------------------------------------------------------------–>
\def\tkz@Yshowgradresult{% 
\iftkz@Y@orig
\tkz@Yresult%
\else % orig 
     \iftkz@init@NO%
        \unless\ifx\tkz@pos\tkz@posmin
        \tkz@Yresult\fi
      \else % NO
        \unless\ifx\tkz@pos\y@tkzero%
        \tkz@Yresult
       \fi%end of x@tkzero
    \fi%end of NO
\fi%end of orig
}%
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–>
\def\tkz@Xshowgrad{% 
\iftkz@X@orig
\tkzprintfrac% 
\else % orig 
       \iftkz@init@NO% 
          \unless\ifx\tz@pos\tkz@posmin
          \tkzprintfrac\fi
       \else % NO  
         \unless\ifx\tz@pos\x@tkzero%
         \tkzprintfrac
         \fi%end of x@tkzero
      \fi%end of NO
\fi%end of orig
}%
%<--------------------------------------------------------------------------–>
\def\tkz@Yshowgrad{% 
\iftkz@Y@orig
\tkzprintfrac%
\else % orig 
     \iftkz@init@NO%
        \unless\ifx\tz@pos\tkz@posmin
        \tkzprintfrac\fi
      \else % NO
        \unless\ifx\tz@pos\y@tkzero%
        \tkzprintfrac
       \fi%end of x@tkzero
    \fi%end of NO
\fi%end of orig
}%

%<--------------------------------------------------------------------------–>
%              Setup   axe
%<--------------------------------------------------------------------------–>
\pgfkeys{tkzaxis/.cd,
line width/.code         = {\global\edef\tkz@sua@lw{#1}},
color/.code              = {\global\edef\tkz@sua@color{#1}},
tickwd/.code             = {\global\edef\tkz@sua@tickwd{#1}},
ticka/.code              = {\global\edef\tkz@sua@ticka{#1}},
tickb/.code              = {\global\edef\tkz@sua@tickb{#1}}
} 

\def\tkzSetUpAxis{\pgfutil@ifnextchar[{\tkz@SetUpAxis}{\tkz@SetUpAxis[]}} 
\def\tkz@SetUpAxis[#1]{%
\begingroup
 \pgfkeys{/tkzaxis/.cd,
 line width  = \tkz@init@lw,
 color       = \tkz@init@color,
 tickwd      = \tkz@init@tickwd,
 ticka       = \tkz@init@ticka,
 tickb       = \tkz@init@tickb
 }
\pgfqkeys{/tkzaxis}{#1}
\global\let\tkz@init@lw\tkz@sua@lw
\global\let\tkz@init@gradsize\tkz@sua@gradsize 
\global\let\tkz@init@color\tkz@sua@color 
\global\let\tkz@init@tickwd\tkz@sua@tickwd 
\global\let\tkz@init@ticka\tkz@sua@ticka 
\global\let\tkz@init@tickb\tkz@sua@tickb  
\endgroup}
%<--------------------------------------------------------------------------–>
%                 tkzDrawX      todo améliorer les unités
%<--------------------------------------------------------------------------–>
\pgfkeys{%     prob avec space
tkzdrawX/.cd,
color/.code                = {\global\def\tkz@X@color{#1}},
label/.code                = {\global\def\tkz@X@label{#1}}, 
right space/.code          = {\global\def\tkz@axe@rxspace{#1}}, 
left space/.code           = {\global\def\tkz@axe@lxspace{#1}},
noticks/.is if             = tkz@X@noticks,
noticks/.default           = true, 
trig/.code                 = {\global\def\tkz@X@trig{#1}},    
step/.code                 = {\FPeval\tkz@posnext{#1}},  
tickwd/.code               = {\global\def\tkz@X@tickwd{#1}},
tickup/.code               = {\global\def\tkz@X@tickup{#1}},
tickdn/.code               = {\global\def\tkz@X@tickdn{#1}},   
/tkzdrawX/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}}
                                     
\def\tkzDrawX{\pgfutil@ifnextchar[{\tkz@DrawX}{\tkz@DrawX[]}}
\def\tkz@DrawX[#1]{
\begingroup%
\pgfkeys{/tkzdrawX/.cd,
color       = \tkz@init@color,
label       = \tkz@init@xlabel,
trig        = 0,
step        = \tkz@init@xstep,
right space = \tkz@init@rightspace,
left space  = \tkz@init@leftspace,
noticks     = false,
tickwd      = \tkz@init@tickwd,
tickup      = \tkz@init@ticka,
tickdn      = \tkz@init@tickb}
\pgfqkeys{/tkzdrawX}{#1}
\FPtrunc\tkz@posmax{\tkz@xb}{\tkz@init@xdec}
\FPtrunc\tkz@posmin{\tkz@xa}{\tkz@init@xdec}
\FPadd\tkz@xbsup{\tkz@xb}{\tkz@axe@rxspace}
\FPadd\tkz@xainf{\tkz@xa}{-\tkz@axe@lxspace}
\path (\tkz@xainf,0)--(\tkz@xbsup,0) node(tkz@xline){};
\draw[xaxe style,
      color = \tkz@X@color, 
      /tkzdrawX/.cd, #1] (\tkz@xainf,0)--(\tkz@xbsup,0)
      node[xlabel style, /tkzdrawX/.cd, #1]{\tkz@X@label};
 \iftkz@X@noticks
 \else 
  \ifnum\tkz@X@trig=0
   \FPtrunc\tkz@posmax{\tkz@posmax}{\tkz@init@xdec}%
   \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@xstep}
   \FPadd\tz@posnext{\tkz@posmin}{\tkz@posnext}
   \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% 
     \draw[color = \tkz@X@color,
           line width = \tkz@X@tickwd,
           shift      = {(\tz@pos,0)}]%
           (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn);} 
    \else
       \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% 
       \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}%
        \FPmul\tkz@posmax{\tkz@posmax}{\tkz@X@trig}% 
        \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}%
        \FPmul\tkz@posmin{\tkz@posmin}{\tkz@X@trig}%
        \FPround\tkz@posmin{\tkz@posmin}{0}% 
        \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% 
           \FPmul\tz@pospi{\tz@pos}{\FPpi}
           \FPdiv\tz@pospi{\tz@pospi}{\tkz@X@trig}%
           \draw[color = \tkz@X@color,
                 line width = \tkz@X@tickwd,%
                 shift      = {(\tz@pospi,0)}]%
           (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn);
         }% end foreach
         \fi
 \fi
\endgroup}
%<--------------------------------------------------------------------------–>
\pgfkeys{%     prob avec space
tkzAxeX/.cd,
color/.code                 = {\def\tkz@X@color{#1}},
label/.code                 = {\global\def\tkz@X@label{#1}},
frac/.code                  = {\def\tkzX@frac{#1}},
trig/.code                  = {\def\tkzX@trig{#1}},
/tkzAxeX/.unknown/.code     = {\let\searchname=\pgfkeyscurrentname
                               \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}} 
                                
\def\tkzAxeX{\pgfutil@ifnextchar[{\tkz@AxeX}{\tkz@AxeX[]}}
\def\tkz@AxeX[#1]{%
\begingroup  
\tkzLabelX[#1] \tkzDrawX[#1] 
\endgroup
}


%<--------------------------------------------------------------------------–>
%                 tkzDrawY      todo améliorer les unités
%<--------------------------------------------------------------------------–>
\pgfkeys{%     prob avec space
tkzdrawY/.cd,
color/.code                = {\def\tkz@Y@color{#1}},
label/.code                = {\def\tkz@Y@label{#1}}, 
up space/.code             = {\global\def\tkz@axe@uyspace{#1}}, 
down space/.code           = {\global\def\tkz@axe@dyspace{#1}},
noticks/.is if             = tkz@Y@noticks,
noticks/.default           = true,
trig/.code                 = {\global\def\tkz@Y@trig{#1}},      
step/.code                 = {\FPeval\tkz@posnext{#1}},  
tickwd/.code               = {\global\def\tkz@Y@tickwd{#1}},
ticklt/.code               = {\global\def\tkz@Y@ticklt{#1}},
tickrt/.code               = {\global\def\tkz@Y@tickrt{#1}},   
/tkzdrawY/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}}
                                     
\def\tkzDrawY{\pgfutil@ifnextchar[{\tkz@DrawY}{\tkz@DrawY[]}}
\def\tkz@DrawY[#1]{%
\begingroup
\pgfkeys{/tkzdrawY/.cd,
color       = \tkz@init@color,
label       = \tkz@init@ylabel,
trig        = 0,
step        = \tkz@init@ystep,
up space    = \tkz@init@upspace,
down space  = \tkz@init@downspace,
noticks     = false,
tickwd      = \tkz@init@tickwd,
ticklt      = \tkz@init@tickb,
tickrt      = \tkz@init@ticka}
\pgfqkeys{/tkzdrawY}{#1}
\FPtrunc\tkz@posmax{\tkz@yb}{\tkz@init@ydec}
\FPtrunc\tkz@posmin{\tkz@ya}{\tkz@init@ydec}
\FPadd\tkz@ybsup{\tkz@yb}{\tkz@axe@uyspace}
\FPadd\tkz@yainf{\tkz@ya}{-\tkz@axe@dyspace}
\path (0,\tkz@yainf)--(0,\tkz@ybsup) node(tkz@yline){};
\draw[color = \tkz@Y@color,
      yaxe style,/tkzdrawY/.cd,#1] (0,\tkz@yainf)--(0,\tkz@ybsup)
      node[ylabel style,/tkzdrawY/.cd,#1]{\tkz@Y@label};
 \iftkz@Y@noticks
 \else 
   \ifnum\tkz@Y@trig=0   
   \FPtrunc\tkz@posmax{\tkz@posmax}{\tkz@init@ydec}%
   \FPdiv\tkz@posnext{\tkz@posnext}{\tkz@init@ystep}
   \FPadd\tz@posnext{\tkz@posmin}{\tkz@posnext}
   \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{% 
     \draw[color = \tkz@Y@color,
           line width = \tkz@Y@tickwd,
           shift       = {(0,\tz@pos)}]% 
            (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);}
         \else
       \FPadd{\tkz@posmin}{\tkz@posmin}{.5}% 
       \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}%
        \FPmul\tkz@posmax{\tkz@posmax}{\tkz@Y@trig}% 
        \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}%
        \FPmul\tkz@posmin{\tkz@posmin}{\tkz@Y@trig}%
        \FPround\tkz@posmin{\tkz@posmin}{0}% 
        \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% 
           \FPmul\tz@pospi{\tz@pos}{\FPpi}
           \FPdiv\tz@pospi{\tz@pospi}{\tkz@Y@trig}%
           \draw[color = \tkz@Y@color,
                line width = \tkz@Y@tickwd,%
                          shift      = {(0,\tz@pospi)}]%
           (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);
         }% end foreach
         \fi     
 \fi        
\endgroup}
%<--------------------------------------------------------------------------->
\newif\iftkz@np 
\pgfkeys{%     prob avec space
tkzlabelX/.cd,
frac/.code                  = {\def\tkz@X@frac{#1}},
trig/.code                  = {\def\tkz@X@trig{#1}},  
step/.code                  = {\def\tkz@posnext{#1}},
label options/.code         = {\def\cmd@X@option{#1}},
np off/.is if               = tkz@np,
np off/.default             = true,
orig/.is if                 = tkz@X@orig,
orig/.default               = false,
tickwd/.code                = {\global\def\tkz@X@tickwd{#1}},
tickup/.code                = {\global\def\tkz@X@tickup{#1}},
tickdn/.code                = {\global\def\tkz@X@tickdn{#1}},   
/tkzlabelX/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}}  
                               \def\tkzLabelX{\pgfutil@ifnextchar[{\tkz@LabelX}{\tkz@LabelX[]}}
\def\tkz@LabelX[#1]{% 
\begingroup
\pgfkeys{/tkzlabelX/.cd,
frac          = 0,
trig          = 0,
step          = \tkz@init@xstep,
np off        = false,
orig          = true,
label options = {},
tickwd        = \tkz@init@tickwd,
tickup        = \tkz@init@ticka,
tickdn        = \tkz@init@tickb}  
\pgfqkeys{/tkzlabelX}{#1}
\iftkz@np\let\numprint@saved\numprint %
\let\numprint\relax\fi %    

\FPtrunc\tkz@posmin{\tkz@xa}{\tkz@init@xdec}% 
\FPtrunc\tkz@posmax{\tkz@xb}{\tkz@init@xdec}%
\FPtrunc\x@tkzero{0.0000000}{\tkz@init@xdec}% 

\ifnum\tkz@X@frac=0 %
  \ifnum\tkz@X@trig=0 % affichage normal
   \FPdiv\tz@posnext{\tkz@posnext}{\tkz@init@xstep}
   \FPadd\tz@posnext{\tkz@posmin}{\tz@posnext}      
   \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{%
     \FPtrunc\tkz@pos{\tz@pos}{\tkz@init@xdec}%
     \FPmul{\xgrad}{\tz@pos}{\tkz@init@xstep}%
     \FPadd{\xgrad}{\xgrad}{\tkz@init@xorigine}%
     \FPtrunc\xgrad{\xgrad}{\tkz@init@xdec}%
     \protected@edef\tkz@temp{%
     \noexpand\path[shift = {(\tz@pos,0)}]
     (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)%
     node[xlabel style,%
          fill = \tkz@fillcolor,
                 \cmd@X@option]}\tkz@temp{\tkz@Xshowgradresult}; 
}% 
  \else% trig > 0  
     \FPadd{\tkz@posmin}{\tkz@posmin}{.5}%
     \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}%
     \FPmul\tkz@posmax{\tkz@posmax}{\tkz@X@trig}% 
     \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}%
     \FPmul\tkz@posmin{\tkz@posmin}{\tkz@X@trig}%
     \FPround\tkz@posmin{\tkz@posmin}{0}% 
     \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% 
        \tkzPrintFracWithPi{\tz@pos}{\tkz@X@trig}
        \FPmul\tz@pospi{\tz@pos}{\FPpi}
        \FPdiv\tz@pospi{\tz@pospi}{\tkz@X@trig}%
        \protected@edef\tkz@temp{%
        \noexpand\path[shift      = {(\tz@pospi,0)}]%
        (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)%
           node[xlabel style,
                text height = 8pt,
                fill        = \tkz@fillcolor,
                              \cmd@X@option]}\tkz@temp{\tkz@Xshowgrad};% 
      }% end foreach   
    \fi
\else% frac > 0  
\FPround\tkz@posmin{\tkz@posmin}{0}%  
   \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{%
    \tkzPrintFrac{\tz@pos}{\tkz@X@frac}% 
        \protected@edef\tkz@temp{%
        \noexpand\path[shift      = {(\tz@pos,0)}]%
          (0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn)%
          node[xlabel style,
               text height = 8pt,
               fill        = \tkz@fillcolor,
                             \cmd@X@option]}\tkz@temp{\tkz@Xshowgrad}%
   ;%    
  }% end foreach  
\fi
 \iftkz@np\let\numprint\numprint@saved \fi%      
\endgroup
} 

%<--------------------------------------------------------------------------->
\pgfkeys{%     prob avec space
tkzticksY/.cd,
frac/.code                  = {\def\tkz@Y@frac{#1}},
trig/.code                  = {\def\tkz@Y@trig{#1}},  
step/.code                  = {\def\tkz@posnext{#1}},
label options/.code         = {\def\cmd@Y@option{#1}}, 
np off/.is if               = tkz@np,
np off/.default             = true,
orig/.is if                 = tkz@Y@orig,
orig/.default               = false,
tickwd/.code               = {\global\def\tkz@Y@tickwd{#1}},
ticklt/.code               = {\global\def\tkz@Y@ticklt{#1}},
tickrt/.code               = {\global\def\tkz@Y@tickrt{#1}},      
/tkzticksY/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}}  
                               \def\tkzLabelY{\pgfutil@ifnextchar[{\tkz@LabelY}{\tkz@LabelY[]}}
\def\tkz@LabelY[#1]{%
\begingroup
\pgfkeys{/tkzticksY/.cd,
frac          = 0,
trig          = 0,
step          = \tkz@init@ystep,
np off        = false,  
orig          = true,  
label options = {},
tickwd        = \tkz@init@tickwd,
ticklt        = \tkz@init@tickb,
tickrt        = \tkz@init@ticka} 
\pgfqkeys{/tkzticksY}{#1}
\iftkz@np\let\numprint@saved\numprint %
\let\numprint\relax\fi % 

\FPtrunc\tkz@posmin{\tkz@ya}{\tkz@init@ydec}% 
\FPtrunc\tkz@posmax{\tkz@yb}{\tkz@init@ydec}%
\FPtrunc\y@tkzero{0.0000000}{\tkz@init@ydec}% 

\ifnum\tkz@Y@frac=0
  \ifnum\tkz@Y@trig=0 % affichage normal    
   \FPdiv\tz@posnext{\tkz@posnext}{\tkz@init@ystep}
   \FPadd\tz@posnext{\tkz@posmin}{\tz@posnext}      
   \foreach \tz@pos in {\tkz@posmin,\tz@posnext,...,\tkz@posmax}{%
     \FPtrunc\tkz@pos{\tz@pos}{\tkz@init@ydec}%
     \FPmul{\ygrad}{\tz@pos}{\tkz@init@ystep}%
     \FPadd{\ygrad}{\ygrad}{\tkz@init@yorigine}%
     \FPtrunc\ygrad{\ygrad}{\tkz@init@ydec}%
     \protected@edef\tkz@temp{%
     \noexpand\path[shift = {(0,\tz@pos)}]%
        (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)%
        node[ylabel style, 
             fill  = \tkz@fillcolor,
                     \cmd@Y@option]}\tkz@temp{\tkz@Yshowgradresult};
}
  \else% trig > 0  
     \FPadd{\tkz@posmin}{\tkz@posmin}{.5}%
     \FPdiv\tkz@posmax{\tkz@posmax}{\FPpi}%
     \FPmul\tkz@posmax{\tkz@posmax}{\tkz@Y@trig}% 
     \FPdiv\tkz@posmin{\tkz@posmin}{\FPpi}%
     \FPmul\tkz@posmin{\tkz@posmin}{\tkz@Y@trig}%
     \FPround\tkz@posmin{\tkz@posmin}{0}% 
     \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{% 
        \tkzPrintFracWithPi{\tz@pos}{\tkz@Y@trig}
        \FPmul\tz@pospi{\tz@pos}{\FPpi}
        \FPdiv\tz@pospi{\tz@pospi}{\tkz@Y@trig}%
        \protected@edef\tkz@temp{%
        \noexpand\path[shift      = {(0,\tz@pospi)}]%
             (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)%
             node[ylabel style,
                  text height  = 8pt,
                  fill         = \tkz@fillcolor,
                  \cmd@Y@option]}\tkz@temp{\tkz@Yshowgrad};% 
      }% end foreach   
    \fi    
\else% frac > 0  
\FPround\tkz@posmin{\tkz@posmin}{0}%
  \foreach \tz@pos in {\tkz@posmin,...,\tkz@posmax}{%
    \tkzPrintFrac{\tz@pos}{\tkz@Y@frac}% 
        \protected@edef\tkz@temp{%
        \noexpand\path[shift      = {(0,\tz@pos)}]%
          (\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt)%
          node[ylabel style,
               text height   = 8pt,
               fill          = \tkz@fillcolor,
                               \cmd@Y@option]}\tkz@temp{\tkz@Yshowgrad}%
   ;% 
  }% end foreach
\fi
 \iftkz@np\let\numprint\numprint@saved \fi%      
\endgroup} 
%<--------------------------------------------------------------------------–>
\def\tkzAxeY{\pgfutil@ifnextchar[{\tkz@AxeY}{\tkz@AxeY[]}}
\def\tkz@AxeY[#1]{%
\begingroup
 \tkzDrawY[#1] \tkzLabelY[#1]   
\endgroup}
%<-------------------------------------------------------------------------->
\newif\if@tkz@swap
\pgfkeys{%     prob avec space
  tkzAxeXY/.cd,
  swap/.is if     = @tkz@swap,
  swap/.default   = true,
  /tkzAxeXY/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}}  
  
\def\tkzAxeXY{\pgfutil@ifnextchar[{\tkzAxe@XY}{\tkzAxe@XY[]}}  
\def\tkzAxe@XY[#1]{%
\pgfkeys{
  /tkzAxeXY/.cd,
  swap        = false}
\pgfqkeys{/tkzAxeXY}{#1}   
\if@tkz@swap
\tkzLabelX[#1]\tkzLabelY[#1]\tkzDrawX[#1]\tkzDrawY[#1]
\else
\tkzDrawX[#1]\tkzDrawY[#1]\tkzLabelX[#1]\tkzLabelY[#1]
\fi}
\def\tkzDrawXY{\pgfutil@ifnextchar[{\tkzDraw@XY}{\tkzDraw@XY[]}} 
\def\tkzDraw@XY[#1]{\tkzDrawX[#1]\tkzDrawY[#1]} 
\def\tkzLabelXY{\pgfutil@ifnextchar[{\tkzLabel@XY}{\tkzLabel@XY[]}}
\def\tkzLabel@XY[#1]{\tkzLabelX[#1]\tkzLabelY[#1]}     
%<--------------------------------------------------------------------------–>
%                                grid
%<--------------------------------------------------------------------------–>
\newif\if@tkz@gd@sub 
\pgfkeys{
  /tkzGrid/.cd,
  color/.code      = {\def\tkz@gd@color{#1}%
                      \edef\tkz@gd@subcolor{%
                      \tkz@gd@color!\tkzCoeffSubColor}},
  subxstep/.code   = {\def\tkz@gd@subxstep{#1}},
  subystep/.code   = {\def\tkz@gd@subystep{#1}},
  line width/.code = {\def\tkz@gd@lw{#1}
                      \pgfmathsetlength{\pgf@xa}{\tkzCoeffSubLw*\tkz@gd@lw}
                  \def\tkz@gd@sublw{\pgf@xa}},
  sub/.is if       = @tkz@gd@sub,
  sub/.default     = true ,
    /tkzGrid/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
                              \pgfkeysalso{\searchname/.try=#1,
                               /tikz/\searchname/.retry=#1}}} 
                               
\def\tkzGrid{\pgfutil@ifnextchar[{\tkz@Grid}{\tkz@Grid[]}}
\def\tkz@Grid[#1]{\@ifnextchar({\tkz@@Grid[#1]}%
                               {\tkz@@Grid[#1](\@xa,\@ya)(\@xb,\@yb)}}
\def\tkz@@Grid[#1](#2,#3)(#4,#5){%
\pgfkeys{
  /tkzGrid/.cd,
  sub        = false,
  color      = \tkz@grid@color, 
  subxstep   = \tkz@grid@xstep,
  subystep   = \tkz@grid@ystep,
  line width = \tkz@grid@lw}
  \pgfqkeys{/tkzGrid}{#1}   
    \begingroup
    \FPadd{\tkz@gxa}{#2}{-\tkz@init@xorigine}
    \FPadd{\tkz@gxb}{#4}{-\tkz@init@xorigine}
    \FPadd{\tkz@gya}{#3}{-\tkz@init@yorigine}
    \FPadd{\tkz@gyb}{#5}{-\tkz@init@yorigine}
    \FPdiv{\tkz@gxa}{\tkz@gxa}{\tkz@init@xstep}
    \FPdiv{\tkz@gya}{\tkz@gya}{\tkz@init@ystep}
    \FPdiv{\tkz@gxb}{\tkz@gxb}{\tkz@init@xstep}
    \FPdiv{\tkz@gyb}{\tkz@gyb}{\tkz@init@ystep}
    \if@tkz@gd@sub%
      \FPeval\@subxstep{\tkz@gd@subxstep/\tkz@init@xstep}%
      \FPeval\@subystep{\tkz@gd@subystep/\tkz@init@ystep}%
      \draw [xstep      = \@subxstep cm,%
             ystep      = \@subystep cm,%
             color      = \tkz@gd@subcolor,%
             line width = \tkz@gd@sublw]%
             (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);%
    \fi
    \draw [color      = \tkz@gd@color,%
           line width = \tkz@gd@lw]%
           (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);%
    \endgroup
}%
%<--------------------------------------------------------------------------–>
%                                repère
%<--------------------------------------------------------------------------–>

\newif\iftkz@Rep@orig
\pgfkeys{
  /tkzRep/.cd,
  line width/.code = {\def\tkz@Rep@lw{#1}},
  xlabel/.code     = {\def\tkz@Rep@xlabel{#1}},
  ylabel/.code     = {\def\tkz@Rep@ylabel{#1}},
  posxlabel/.code  = {\def\tkz@Rep@posxlabel{#1}},
  posylabel/.code  = {\def\tkz@Rep@posylabel{#1}},
  xnorm/.code      = {\def\tkz@Rep@xnorm{#1}}, 
  ynorm/.code      = {\def\tkz@Rep@ynorm{#1}},
  color/.code      = {\def\tkz@Rep@color{#1}},
  colorlabel/.code = {\def\tkz@Rep@colorlabel{#1}}}
  % /tkzRep/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
  %                             \pgfkeysalso{\searchname/.try=#1,
  %                              /tikz/\searchname/.retry=#1}}}   
%<--------------------------------------------------------------------------–>
\def\tkzRep{\pgfutil@ifnextchar[{\tkz@Rep}{%
                                 \tkz@Rep[]}} 
\def\tkz@Rep[#1]{%
\pgfkeys{
 /tkzRep/.cd, 
line width         = \tkz@sur@lw,
xlabel      = $\vec{\imath}$,
ylabel      = $\vec{\jmath}$,
posxlabel   = {\tkz@sur@posxlabel}, 
posylabel   = {\tkz@sur@posylabel},
xnorm       = 1,
ynorm       = 1,
color       = \tkz@sur@color,% remove ?
colorlabel  = \tkz@sur@colorlabel}% remove ? 
\pgfqkeys{/tkzRep}{#1} 
\begingroup
  \protected@edef\tkz@temp{%  
  \noexpand\draw [line width=\tkz@Rep@lw,color=\tkz@Rep@color,rep style]%
  (0,0) to node[\tkz@Rep@posylabel,color = \tkz@Rep@colorlabel]}\tkz@temp%
      {\tkz@Rep@ylabel}(0,\tkz@Rep@ynorm);
  \protected@edef\tkz@temp{%
  \noexpand \draw [line width=\tkz@Rep@lw,color=\tkz@Rep@color,rep style]%
   (0,0) to  node[\tkz@Rep@posxlabel,color = \tkz@Rep@colorlabel]}\tkz@temp%
      {\tkz@Rep@xlabel}(\tkz@Rep@xnorm,0);  
\endgroup 
} 

\endinput