% na-position.sty    encodage : UTF8  
% Created By : Naam Mohamed & Salim Bou and distributed under the LPPL license.
% من إنشاء الأستاذين ناعم محمد و سليم بو
%edited by : Walid LAOUIDJI
%gmail: walidlaouidji28@gmail.com
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{na-position}[2020/06/14 version1.2]
%%%%%%%%%%%%%%% 
\RequirePackage{tkz-tab} 
 \def\Nplot{\left(C_f\right)}
\def\Nline{\left(\Delta\right)}
\def\plot{f}
\def\line{y}
\tikzset{pos style/.style = {
                           draw   = \tkzTabDefaultWritingColor}}
%<------------------------------------------>
  \newcommand*{\tkzTabPos}[2][]{%
 \makeatletter
 \setkeys[TAB]{TL}{#1}%   
 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
 \stepcounter{tkz@cnt@line}%
 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
 \setcounter{tkz@cnt@cl}{1}%
 \setcounter{tkz@cnt@pair}{1}%
 \setcounter{tkz@cnt@impair}{1}%
\foreach \x/\tl in {#2}{ 
\ifthenelse{\isodd{\value{tkz@cnt@cl}}}{
\path (N\thetkz@cnt@impair\thetkz@cnt@lg) --coordinate[midway](Z\thetkz@cnt@impair\thetkz@cnt@lg)(N\thetkz@cnt@impair\thetkz@cnt@lgnext); 
\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{z}}{
\draw[line width =\cmdTAB@tbs@lw, pos style ]
([xshift=-01cm]N\thetkz@cnt@impair\thetkz@cnt@lgnext)..controls+(90:0.5)and+(230:1)..(N\thetkz@cnt@impair\thetkz@cnt@lg);
\draw[line width =\cmdTAB@tbs@lw,pos style ]([xshift=01cm]N\thetkz@cnt@impair\thetkz@cnt@lgnext)..controls+(90:0.5)and+(310:1)..
(N\thetkz@cnt@impair\thetkz@cnt@lg);  
\node[anchor=base,font=\scriptsize](pn)at([yshift=-0.2cm]Z\thetkz@cnt@impair\thetkz@cnt@lg){ 
\tabular{c}
  $\Nplot$
\\
    يقطع
    $\Nline$ 
 \\
   في النقطة
   \\  
 {  \tiny      
\ifTAB@VA@help\else\tl\fi}
\endtabular
} ;
              }{%
     \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{}}{}{
%
\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{t}}
{
         \draw[line width = \cmdTAB@tbs@lw,t style]
              (N\thetkz@cnt@impair\thetkz@cnt@lg) -- %
              (N\thetkz@cnt@impair\thetkz@cnt@lgnext);
}{
              %
\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{d}}
{
       \draw[line width =\cmdTAB@tbs@lw,double style]%
         ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@impair\thetkz@cnt@lg)--%
         ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@impair\thetkz@cnt@lgnext);
}{ 
\path (N\thetkz@cnt@impair\thetkz@cnt@lg)-- 
             (N\thetkz@cnt@impair\thetkz@cnt@lgnext); 
 \node at (Z\thetkz@cnt@impair\thetkz@cnt@lg){$\x$};
} 
       }
       }
       }
%       
       \stepcounter{tkz@cnt@impair}%
     }{%
       \path(M\thetkz@cnt@pair\thetkz@cnt@lg)--%
             coordinate[midway](S\thetkz@cnt@pair\thetkz@cnt@lg)%
            (M\thetkz@cnt@pair\thetkz@cnt@lgnext);% 
%%%%%%            
       \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{h}}{
       %
          \setcounter{tkz@cnt@clnext}{\thetkz@cnt@pair}%
          \stepcounter{tkz@cnt@clnext}%
          \pgfmathparse{\cmdTAB@TTS@doubledistance/2+\cmdTAB@tbs@lw}
          \global\let\tkz@deltax\pgfmathresult 
          \fill[h style]([xshift=\tkz@deltax,yshift=-\cmdTAB@tbs@lw/2]%
                                N\thetkz@cnt@pair\thetkz@cnt@lg) 
                          rectangle%
                       ([xshift=-\tkz@deltax,yshift=\cmdTAB@tbs@lw/2]%
                                N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
}{%
       \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+}}
{
 \node[inner sep=0pt,, text width=5em, minimum height = 5em, align = center,font=\scriptsize] at ([yshift=10pt]S\thetkz@cnt@pair\thetkz@cnt@lg) {
 \vbox to 3em{\vfill 
 $\Nplot$ \\
 {فوق}        
         \\
         $\Nline$}};
}
        {   \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-}}
{\node[inner sep=0pt,, text width=5em, minimum height = 5em, align = center,font=\scriptsize] at ([yshift=10pt]S\thetkz@cnt@pair\thetkz@cnt@lg) {
 \vbox to 3em{\vfill
$\Nplot$ \\
 {تحت}        
        \\ $\Nline$}};}{        
           \node at (S\thetkz@cnt@pair\thetkz@cnt@lg) {$\x$}; 
          }}}%%%%%%%%%%%%%%%%%%%%%
         \stepcounter{tkz@cnt@pair}%
        }%
   \stepcounter{tkz@cnt@cl}%
   }
   }
   %
%<-------------------------------The End ------------------------------------>
\endinput