%%
%% This is file `tabvar.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tabvar.dtx  (with options: `sty')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from tabvar.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file tabvar.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% Copyright (C) Daniel Flipo 2003-2013 <daniel.flipo at free.fr>
%%
\NeedsTeXFormat{LaTeX2e}[1997/06/01]
\ProvidesFile{tabvar.sty}
             [2013/01/21 v1.7 (Daniel Flipo)]
\newif\ifFlechesMP \FlechesMPfalse
\DeclareOption{FlechesMP}{\FlechesMPtrue}
\DeclareOption{FlechesPS}{\FlechesMPfalse}
\ProcessOptions
\RequirePackage{array}
\RequirePackage{colortbl}
\RequirePackage{varwidth}
\RequirePackage{ifthen}
\RequirePackage{graphicx}
\RequirePackage{ifpdf}
\ifpdf
  \DeclareGraphicsRule{*}{mps}{*}{}
\fi
\providecommand{\f@size}{10}
\newcommand{\TVarrowscale}{\strip@pt\dimexpr\f@size pt/10\relax}
\newcommand*{\TVarrowscolstretch}{1}
\newcommand*{\TV@arrowcol@stretch}[1]{%
     \makebox[\TVarrowscolstretch\width][c]{#1}}
\newcommand*{\enearrow}{\enearrowi}
\newcommand*{\esearrow}{\esearrowi}
\newcommand*{\eastarrow}{\eastarrowi}
\newcommand*{\FlechesPS}[1]{%
  \renewcommand*{\enearrow}{%
    \csname enearrow\romannumeral#1\endcsname}%
  \renewcommand*{\esearrow}{%
    \csname esearrow\romannumeral#1\endcsname}%
  \renewcommand*{\eastarrow}{%
    \csname eastarrow\romannumeral#1\endcsname}%
}
\AtBeginDocument{%
  \ifFlechesMP
    \newsavebox{\arup}%
    \newsavebox{\ardown}%
    \newsavebox{\arhor}%
    \sbox{\arup}{\includegraphics[scale=\TVarrowscale]{tabvar.1}}%
    \sbox{\ardown}{\includegraphics[scale=\TVarrowscale]{tabvar.2}}%
    \sbox{\arhor}{\includegraphics[scale=\TVarrowscale]{tabvar.3}}%
    \newcommand*{\FlecheC}{%
        \TV@arrowcol@stretch{\raisebox{.5ex}{\usebox{\arup}}}}%
    \newcommand*{\FlecheD}{%
        \TV@arrowcol@stretch{\raisebox{.5ex}{\usebox{\ardown}}}}%
    \newcommand*{\FlecheH}{%
        \TV@arrowcol@stretch{\raisebox{.5ex}{\usebox{\arhor}}}}%
  \else
    \DeclareFontFamily{U}{tv}{}%
    \DeclareFontShape{U}{tv}{m}{n}{<->tabvar}{}%
    \DeclareSymbolFont{tvsymbols}{U}{tv}{m}{n}%
    \DeclareMathSymbol{\eastarrowi}{\mathrel}{tvsymbols}{"21}%
    \DeclareMathSymbol{\enearrowi}{\mathrel}{tvsymbols}{"25}%
    \DeclareMathSymbol{\esearrowi}{\mathrel}{tvsymbols}{"26}%
    \DeclareMathSymbol{\eastarrowii}{\mathrel}{tvsymbols}{"31}%
    \DeclareMathSymbol{\enearrowii}{\mathrel}{tvsymbols}{"35}%
    \DeclareMathSymbol{\esearrowii}{\mathrel}{tvsymbols}{"36}%
    \DeclareMathSymbol{\eastarrowiii}{\mathrel}{tvsymbols}{"3B}%
    \DeclareMathSymbol{\enearrowiii}{\mathrel}{tvsymbols}{"3F}%
    \DeclareMathSymbol{\esearrowiii}{\mathrel}{tvsymbols}{"40}%
    \DeclareMathSymbol{\eastarrowiv}{\mathrel}{tvsymbols}{"46}%
    \DeclareMathSymbol{\enearrowiv}{\mathrel}{tvsymbols}{"4A}%
    \DeclareMathSymbol{\esearrowiv}{\mathrel}{tvsymbols}{"4B}%
    \newcommand*{\FlecheC}{%
            \TV@arrowcol@stretch{\ensuremath{\enearrow}}}%
    \newcommand*{\FlecheD}{%
            \TV@arrowcol@stretch{\ensuremath{\esearrow}}}%
    \newcommand*{\FlecheH}{%
            \TV@arrowcol@stretch{\ensuremath{\eastarrow}}}%
  \fi}
\newdimen\TVextraheight
\setlength{\TVextraheight}{.7\baselineskip}
\newcount\@niveaux
\newcount\@pos
\newif\if@socle
\newcommand{\niveau}[2]{\global\@pos=#1 \global\@niveaux=#2
                        \global\@socletrue}
\newcommand{\@socle}{%
  \ifnum\@pos=1 \@soclefalse \fi
  \if@socle
    \rule{\z@}{\TVextraheight}%
    \@tempcnta=\@pos
    \advance\@tempcnta by -1
    \whiledo{\@tempcnta>0}{\TVnl \null \advance\@tempcnta by -1}%
  \fi}
\newif\ifreset@niveaux
\newcommand{\reset@niveaux}{%
  \ifreset@niveaux
    \global\@niveaux=1 \global\@pos=1 \global\@soclefalse
  \fi}
\newdimen\TVmaxcolwidth
\setlength{\TVmaxcolwidth}{\linewidth}
\newcolumntype{C}{%
   >{\begin{varwidth}[b]{\TVmaxcolwidth}\let\TVnl=\\
     \let\\=\TVtabularnewline $}%
   c%
   <{\@socle \reset@niveaux
     $\@finalstrut\@arstrutbox\end{varwidth}}}
\newcolumntype{L}{%
   >{\begin{varwidth}[b]{\TVmaxcolwidth}\let\TVnl=\\
     \let\\=\TVtabularnewline $}%
   l%
   <{\@socle \reset@niveaux
     $\@finalstrut\@arstrutbox\end{varwidth}}}
\newcolumntype{R}{%
   >{\begin{varwidth}[b]{\TVmaxcolwidth}\let\TVnl=\\
     \let\\=\TVtabularnewline $}%
   r%
   <{\@socle \reset@niveaux
     $\@finalstrut\@arstrutbox\end{varwidth}}}
\definecolor{TVcolor}{gray}{0.7}
\newdimen\TVarraycolsep
\newdimen\TVcolorLeftSep
\newdimen\TVcolorRightSep
\setlength{\TVcolorLeftSep}{\TVarraycolsep}
\setlength{\TVcolorRightSep}{\TVarraycolsep}
\newcolumntype{U}{%
   >{\columncolor{TVcolor}[\TVcolorLeftSep][\TVcolorRightSep]}
   c}
\AtBeginDocument{%
  \@ifundefined{NC@find@N}%
     {\newcolumntype{N}{U}}%
     {\PackageWarning{tabvar}{Le type de colonne N est d\'efini par
                              ailleurs. \MessageBreak Remplacer N par
                              U dans \protect\begin{tabvar}{...N...}
                              \MessageBreak}}%
}
\newcommand{\decroit}{\FlecheD
                      \global\advance\@pos by -1
                      \ifnum\@pos<1
                      \PackageError{tabvar.sty}%
                        {Les arguments la commande
                         \protect\niveau\space sont incorrects}%
                      \fi}
\newcommand{\croit}  {\raisebox{-\baselineskip}{\FlecheC}%
                      \global\advance\@pos by 1
                      \ifnum\@pos>\@niveaux
                      \PackageError{tabvar.sty}%
                        {Les arguments la commande
                         \protect\niveau\space sont incorrects}%
                      \fi}
\newcommand{\constante}{\FlecheH}
\newcommand{\barre@dth}{%
   \ifnum\@niveaux=1
     \@tempdimc=\TVarraystretch\baselineskip
   \else
     \@tempcnta=\@niveaux
     \advance\@tempcnta by -1
     \@tempdimc=\@tempcnta\baselineskip
     \@tempdimb=\TVextraheight
     \ifdim\@tempdimb<.7\baselineskip
       \@tempdimb=.7\baselineskip
     \fi
     \advance\@tempdimc by \@tempdimb
     \advance\@tempdimc by \dp\@arstrutbox
   \fi
   \@tempdimb=\dp\@arstrutbox}
\newcommand{\dbarre}{%
   \barre@dth
   \rule[-\@tempdimb]{.5\p@}{\@tempdimc}%
   \kern 2\p@
   \rule[-\@tempdimb]{.5\p@}{\@tempdimc}%
   \@soclefalse}
\newsavebox{\tab@box}
\definecolor{TVbarrecolor}{gray}{0.7}
\newcommand{\barre}[1]{%
   \sbox{\tab@box}{\ensuremath{#1}}%
   \barre@dth
   \@tempcnta=\@pos
   \advance\@tempcnta by -1
   \advance\@tempdimb by \@tempcnta\baselineskip
   \raisebox{-\@tempdimb}[0pt][0pt]{%
      \makebox[\wd\tab@box][c]{\color{TVbarrecolor}%
                               \rule{.5\p@}{\@tempdimc}}}%
   \kern-\wd\tab@box\usebox{\tab@box}%
}
\newcommand{\discont}[4][0]{%
     \settowidth{\@tempdimc}{\ensuremath{#2}}%
     \settowidth{\@tempdimb}{\ensuremath{#4}}%
     \ifdim\@tempdimc<\@tempdimb \@tempdimc=\@tempdimb\fi
     \rule{\z@}{\TVextraheight}%
     \@soclefalse
     \ifthenelse{\equal{#3}{<}}%
     {\makebox[\@tempdimc]{\ensuremath{#4}}%
      \@tempcnta=#1
      \whiledo{\@tempcnta>0}{\TVnl \null \advance\@tempcnta by -1}%
      \TVnl
      \makebox[\@tempdimc]{\ensuremath{#2}}%
      \@tempcnta=\@pos
      \advance\@tempcnta by -1
      \whiledo{\@tempcnta>0}{\TVnl \null \advance\@tempcnta by -1}%
      \global\advance\@pos by 1
      \global\advance\@pos by #1
     }%
     {\ifthenelse{\equal{#3}{>}}%
     {\makebox[\@tempdimc]{\ensuremath{#2}}%
      \@tempcnta=#1
      \whiledo{\@tempcnta>0}{\TVnl \null \advance\@tempcnta by -1}%
      \TVnl
      \makebox[\@tempdimc]{\ensuremath{#4}}%
      \@tempcnta=\@pos
      \advance\@tempcnta by -2
      \advance\@tempcnta by -#1
      \whiledo{\@tempcnta>0}{\TVnl \null \advance\@tempcnta by -1}%
      \global\advance\@pos by -1
      \global\advance\@pos by -#1
     }%
     {\PackageError{tabvar.sty}%
        {Le second argument de \protect\discont\space doit \^etre
         \MessageBreak soit '<' soit '>'}}%
     }%
}
\newcommand*{\TVcenter}[1]{%
  \@tempcnta=\@niveaux \advance\@tempcnta by -1 \divide\@tempcnta by 2
  \@tempdimb=\@tempcnta\baselineskip
  \ifodd\@niveaux\else\advance\@tempdimb by .5\baselineskip\fi
  \@pos=1\raisebox{\@tempdimb}{\ensuremath{#1}}%
}
\newsavebox\TVbox
\newdimen\TVextraheight
\newdimen\TVextradepth
\setlength{\TVextraheight}{2pt}
\setlength{\TVextradepth}{2pt}
\newdimen\TV@tempa
\newdimen\TV@tempb
\newcommand{\TVstretch}[2][0pt]{%
  \edef\tmp{#1}%
  \sbox{\TVbox}{\ensuremath{#2}}%
  \settoheight{\TV@tempa}{\usebox{\TVbox}}%
  \settodepth {\TV@tempb}{\usebox{\TVbox}}%
  \ifdim\tmp=0pt
    \addtolength{\TV@tempa}{\TVextraheight}%
    \addtolength{\TV@tempb}{\TVextradepth}%
  \else
    \ifdim\tmp>0pt
      \addtolength{\TV@tempa}{\tmp}%
    \else
      \addtolength{\TV@tempb}{-\tmp}%
    \fi
  \fi
  \usebox{\TVbox}%
  \addtolength{\TV@tempa}{\TV@tempb}%
  \rule[-\TV@tempb]{0pt}{\TV@tempa}%
}
\newcommand{\TVarraystretch}{1.5}
\setlength{\TVarraycolsep}{1pt}
\newenvironment{tabvar}[1]
  {\renewcommand{\arraystretch}{\TVarraystretch}%
   \setlength{\arraycolsep}{\TVarraycolsep}%
   \global\@niveaux=1 \global\@pos=1 \global\@soclefalse
   \def\TVtabularnewline{\reset@niveauxtrue\tabularnewline}%
   \begin{array}{#1}}
  {\end{array}}
\InputIfFileExists{tabvar.cfg}
   {\typeout{loading tabvar.cfg}}
   {\typeout{tabvar.cfg not found, using default values}}
\endinput
%%
%% End of file `tabvar.sty'.
