% ----------------------------------------------------------------------------------------------
% The table-fct package.
%
%         Dresser le tableau de variations d'une fonction et le tableau de convexité de sa courbe.
%		  To draw variations table of a function and convexity table of its curve.
%
%
% ----------------------------------------------------------------------------------------------
% Version: 1.1 
% Date: 2016-08-15
% Maintainer:   Sidi Mohamed LAKHDAR
% E-Mail: 	14.lakhdar@gmail.com 
% Copyright 2016 Sidi Mohamed LAKHDAR. All rights reserved.
% Licence: LaTeX Project Public License (version 1.3) 
%
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
%
% The latest version of this license is in
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% 
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Sidi Mohamed LAKHDAR.
% ----------------------------------------------------------------------------------------------
%
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me. 
%                        E-Mail: 	14.lakhdar@gmail.com 
%
% ----------------------------------------------------------------------------------------------
\listfiles
\def\fileversion{1.1}
\def\filedate{2016/08/15}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{table-fct}[%
  \filedate\space v\fileversion\space
    table-fct document style. Sidi Mohamed LAKHDAR]        
%------------------------------------------------------------------------------------------------
%--------------------------                Packages
%------------------------------------------------------------------------------------------------
\RequirePackage[cmyk,table]{xcolor} 
\RequirePackage{graphicx}
\RequirePackage[usenames,dvipsnames]{pstricks}
\RequirePackage{pstricks-add}
\RequirePackage{xifthen}
\RequirePackage{environ}
\RequirePackage{xkeyval}
\RequirePackage{xargs}
% --------------------------------------------------------------------------------------------
% --------------------------				Variables
% --------------------------------------------------------------------------------------------
\newlength{\Pos}\setlength{\Pos}{0cm}
\newlength{\Tpos}
\newlength{\TTpos}
\newlength{\Xunit}%\setlength{\Xunit}{1cm}
\newlength{\Yunit}%\setlength{\Yunit}{1cm}
\newcommand{\Scal}{1}
\newcommand{\Bcolor}{black}
\makeatletter
\define@key{mesures}{Xunit}[0.8cm]{\setlength{\Xunit}{#1}}
\define@key{mesures}{Yunit}[0.6cm]{\setlength{\Yunit}{#1}}
\define@key{mesures}{Scal}[1]{\renewcommand{\Scal}{#1}}
\define@key{mesures}{Bcolor}[black]{\renewcommand{\Bcolor}{#1}}
\makeatother
\setkeys{mesures}{Xunit,Yunit,Scal,Bcolor}
% --------------------------------------------------------------------------------------------
% --------------------------				Environement table-type1
% --------------------------------------------------------------------------------------------
\NewEnviron{table-type1}[3][]
{\setkeys{mesures}{#1}%
\scalebox{\Scal}{%
\begin{normalsize}
\psset{xunit=\Xunit,yunit=\Yunit,linecolor=\Bcolor,hatchcolor=\Bcolor,linewidth=1pt}
\begin{pspicture}(-0.5,-0.1)(6,5.5)
\linS
\colF{#2}{#3}
\linM
\BODY
\linF
\end{pspicture}
\end{normalsize}}}
[\newline]
% ----------------------------------------------------------------------------------------------
% --------------------------				Commandes for table-type1 
% ----------------------------------------------------------------------------------------------
\newcommand{\colF}[2]{\addtolength{\Pos}{.3\Xunit}
\rput(\Pos,4.5){#1}\rput(\Pos,2){#2}
\psline{-}(-0.4,5)(1,5)
\psline{-}(-0.4,4)(1,4)
\psline{-}(-0.4,0)(1,0)
\addtolength{\Pos}{0.7\Xunit}}
%---------------------------
\newcommand{\colX}[3]{\setlength{\Tpos}{\Pos}\addtolength{\Pos}{.5\Xunit}
\rput(\Pos,4.5){#1}
\rput(\Pos,3.5){#2}
\rput(\Pos,0.5){#3}
\addtolength{\Pos}{.5\Xunit}
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colND}[1]{\setlength{\Tpos}{\Pos}\addtolength{\Pos}{.1\Xunit}
\psline{-}(\Pos,0)(\Pos,4)
\addtolength{\Pos}{.2\Xunit}
\rput(\Pos,4.5){#1}
\addtolength{\Pos}{.2\Xunit}
\psline{-}(\Pos,0)(\Pos,4)
\addtolength{\Pos}{.1\Xunit}
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colNDV}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,0)(\Pos,4)
\rput(\Pos,4.5){#1}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%---------------------------
\newcommand{\colC}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{2.0\Xunit}
\psline{->}(\Tpos,1)(\Pos,3)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colD}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{2.0\Xunit}
\psline{->}(\Tpos,3)(\Pos,1)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colV}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{2\Xunit}
\psframe[fillstyle=vlines](\Tpos,0)(\Pos,4)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%-----------------------------------------
\newcommand{\colCvx}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{1.0\Xunit}
\psarc{-}(\Pos,2.7){1.0\Xunit}{-180}{0}
\addtolength{\Pos}{1.0\Xunit}
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colCcv}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{1.0\Xunit}
\psarc{-}(\Pos,1.3){1.0\Xunit}{0}{180}
\addtolength{\Pos}{1.0\Xunit}
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\colIflx}[1]{\setlength{\Tpos}{\Pos}\setlength{\TTpos}{\Pos}
\addtolength{\Pos}{2.2\Xunit}\addtolength{\TTpos}{1.1\Xunit}
\rput(\TTpos,4.5){#1}\rput(\TTpos,1){point}\rput(\TTpos,0.5){d'inflexion}
\psline{-}(\Tpos,0)(\TTpos,4)
\psline{-}(\TTpos,4)(\Pos,0)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%---------------------------
\newcommand{\linS}{
\psline{-}(-0.4,0)(-0.4,5)}
%---------------------------
\newcommand{\linM}{
\psline{-}(1,0)(1,5)}
%---------------------------
\newcommand{\linF}{
\psline{-}(\Pos,0)(\Pos,5)
\setlength{\Pos}{0\Xunit}}
% --------------------------------------------------------------------------------------------
% --------------------------				Environement table-type2
% --------------------------------------------------------------------------------------------
\NewEnviron{table-type2}[4][]
{\setkeys{mesures}{#1}%
\scalebox{\Scal}{%
\begin{normalsize}
\psset{xunit=\Xunit,yunit=\Yunit,linecolor=\Bcolor,hatchcolor=\Bcolor,linewidth=1pt}
\begin{pspicture}(-0.5,-0.1)(6,6.5)
\linnS
\collF{#2}{#3}{#4}
\linnM
\BODY
\linnF
\end{pspicture}
\end{normalsize}}}
[\newline]
% ----------------------------------------------------------------------------------------------
% --------------------------				Commandes for table-type2
% ----------------------------------------------------------------------------------------------
\newcommand{\collF}[3]{\addtolength{\Pos}{.3\Xunit}
\rput(\Pos,5.5){#1}\rput(\Pos,4.5){#2}\rput(\Pos,2){#3}
\psline{-}(-0.4,6)(1,6)
\psline{-}(-0.4,5)(1,5)
\psline{-}(-0.4,4)(1,4)
\psline{-}(-0.4,0)(1,0)
\addtolength{\Pos}{0.7\Xunit}}
%---------------------------
\newcommand{\collX}[4][]{\setlength{\Tpos}{\Pos}\addtolength{\Pos}{.5\Xunit}
\rput(\Pos,5.5){#2}#1
\rput(\Pos,3.5){#3}
\rput(\Pos,0.5){#4}
\addtolength{\Pos}{.5\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collNd}[3]{\setlength{\Tpos}{\Pos}\setlength{\TTpos}{\Pos}
\addtolength{\TTpos}{.3\Xunit}
\psline{-}(\TTpos,4)(\TTpos,5)
\addtolength{\TTpos}{.4\Xunit}
\psline{-}(\TTpos,4)(\TTpos,5)
\addtolength{\Pos}{.5\Xunit}
\rput(\Pos,5.5){#1}
\rput(\Pos,3.5){#2}
\rput(\Pos,0.5){#3}
\addtolength{\Pos}{.5\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collNdv}[3]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,4)(\Pos,5)
\rput(\Pos,5.5){#1}
\rput(\Pos,3.5){#2}
\rput(\Pos,0.5){#3}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collND}[1]{\setlength{\Tpos}{\Pos}%\addtolength{\Pos}{.1\Xunit}
\psline{-}(\Pos,0)(\Pos,5)
\addtolength{\Pos}{.2\Xunit}
\rput(\Pos,5.5){#1}
\addtolength{\Pos}{.2\Xunit}
\psline{-}(\Pos,0)(\Pos,5)
%\addtolength{\Pos}{.1\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collNDV}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,0)(\Pos,5)
\rput(\Pos,5.5){#1}
\addtolength{\Pos}{.4\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%---------------------------
\newcommand{\collC}{\setlength{\Tpos}{\Pos}\addtolength{\Pos}{1.0\Xunit}
\rput(\Pos,4.5){$+$}
\addtolength{\Pos}{1.0\Xunit}
\psline{->}(\Tpos,1)(\Pos,3)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collCz}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.3\Xunit}
\rput(\Pos,4.5){$+$}
\addtolength{\Pos}{.7\Xunit}
\rput(\Pos,5.5){#1}
\rput(\Pos,4.5){$0$}
\psline{-}(\Pos,4)(\Pos,5)
\addtolength{\Pos}{.7\Xunit}
\rput(\Pos,4.5){$+$}
\addtolength{\Pos}{.3\Xunit}
\psline{->}(\Tpos,1)(\Pos,3)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collD}{\setlength{\Tpos}{\Pos}\addtolength{\Pos}{1.0\Xunit}
\rput(\Pos,4.5){$-$}
\addtolength{\Pos}{1.0\Xunit}
\psline{->}(\Tpos,3)(\Pos,1)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collDz}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.3\Xunit}
\rput(\Pos,4.5){$-$}
\addtolength{\Pos}{.7\Xunit}
\rput(\Pos,5.5){#1}
\rput(\Pos,4.5){$0$}
\psline{-}(\Pos,4)(\Pos,5)
\addtolength{\Pos}{.7\Xunit}
\rput(\Pos,4.5){$-$}
\addtolength{\Pos}{.3\Xunit}
\psline{->}(\Tpos,3)(\Pos,1)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collV}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{2\Xunit}
\psframe[fillstyle=vlines](\Tpos,0)(\Pos,5)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collCvx}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{1.0\Xunit}
\psarc{-}(\Pos,2.7){1.0\Xunit}{-180}{0}
\rput(\Pos,4.5){$+$}
\addtolength{\Pos}{1.0\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collCvxz}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.2\Xunit}
\rput(\Pos,4.5){$+$}
\addtolength{\Pos}{.8\Xunit}
\rput(\Pos,5.5){#1}
\psarc{-}(\Pos,2.7){1.0\Xunit}{-180}{0}
\rput(\Pos,4.5){$0$}\psline{-}(\Pos,5)(\Pos,4)
\addtolength{\Pos}{.8\Xunit}
\rput(\Pos,4.5){$+$}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collCcv}{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{1.0\Xunit}
\psarc{-}(\Pos,1.3){1.0\Xunit}{0}{180}
\rput(\Pos,4.5){$-$}
\addtolength{\Pos}{1.0\Xunit}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collCcvz}[1]{\setlength{\Tpos}{\Pos}
\addtolength{\Pos}{.2\Xunit}
\rput(\Pos,4.5){$-$}
\addtolength{\Pos}{.8\Xunit}
\rput(\Pos,5.5){#1}
\psarc{-}(\Pos,1.3){1.0\Xunit}{0}{180}
\rput(\Pos,4.5){$0$}\psline{-}(\Pos,5)(\Pos,4)
\addtolength{\Pos}{.8\Xunit}
\rput(\Pos,4.5){$-$}
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
%%---------------------------
\newcommand{\collIflx}[1]{\setlength{\Tpos}{\Pos}\setlength{\TTpos}{\Pos}
\addtolength{\Pos}{2.2\Xunit}\addtolength{\TTpos}{1.1\Xunit}
\rput(\TTpos,5.5){#1}\rput(\TTpos,1){point}\rput(\TTpos,0.5){d'inflexion}
\rput(\TTpos,4.5){$0$}\psline{-}(\TTpos,5)(\TTpos,4)
\psline{-}(\Tpos,0)(\TTpos,4)
\psline{-}(\TTpos,4)(\Pos,0)
\psline{-}(\Pos,6)(\Tpos,6)
\psline{-}(\Pos,5)(\Tpos,5)
\psline{-}(\Pos,4)(\Tpos,4)
\psline{-}(\Pos,0)(\Tpos,0)}
% ---------------------------
\newcommand{\Zro}{
\psline{-}(\Pos,4)(\Pos,5)
\rput(\Pos,4.5){$0$}}
%---------------------------
\newcommand{\linnS}{
\psline{-}(-0.4,0)(-0.4,6)}
%---------------------------
\newcommand{\linnM}{
\psline{-}(1,0)(1,6)}
%---------------------------
\newcommand{\linnF}{
\psline{-}(\Pos,0)(\Pos,6)
\setlength{\Pos}{0\Xunit}}
%---------------------------
%%--------------------------------------------------------------------------------------------------
% --------------------------------------------------------------------------------------------------
% ----------------------------                 Fin du package                -----------------------
% --------------------------------------------------------------------------------------------------
\endinput