summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tabvar/tabvar.sty
blob: 956039fa1acde1b0f73b57c2749c7dfe6b69b00b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
%%
%% 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-2007 <Daniel.Flipo at univ-lille1.fr>
%%
\NeedsTeXFormat{LaTeX2e}[1997/06/01]
\ProvidesFile{tabvar.sty}
             [2007/08/08 v1.11 (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
  \input{supp-pdf}
  \DeclareGraphicsRule{*}{mps}{*}{}
\fi
\newsavebox{\arup}
\newsavebox{\ardown}
\newsavebox{\arhor}
\providecommand{\@ptsize}{0}
\sbox{\arup}  {\includegraphics[scale=1.\@ptsize]{tabvar.1}}
\sbox{\ardown}{\includegraphics[scale=1.\@ptsize]{tabvar.2}}
\sbox{\arhor} {\includegraphics[scale=1.\@ptsize]{tabvar.3}}
\newcommand{\FlecheCm}{\raisebox{.5ex}{\usebox{\arup}}}
\newcommand{\FlecheDm}{\raisebox{.5ex}{\usebox{\ardown}}}
\newcommand{\FlecheHm}{\raisebox{.5ex}{\usebox{\arhor}}}
\AtBeginDocument{%
  \ifFlechesMP
    \newcommand{\FlecheC}{\FlecheCm}%
    \newcommand{\FlecheD}{\FlecheDm}%
    \newcommand{\FlecheH}{\FlecheHm}%
  \else
    \DeclareFontFamily{U}{tv}{}%
    \DeclareFontShape{U}{tv}{m}{n}{<->tabvar}{}%
    \DeclareSymbolFont{tvsymbols}{U}{tv}{m}{n}%
    \DeclareMathSymbol{\enearrow}{\mathrel}{tvsymbols}{"25}%
    \DeclareMathSymbol{\esearrow}{\mathrel}{tvsymbols}{"26}%
    \DeclareMathSymbol{\eastarrow}{\mathrel}{tvsymbols}{"21}%
    \newcommand{\FlecheC}{\ensuremath{\enearrow}}%
    \newcommand{\FlecheD}{\ensuremath{\esearrow}}%
    \newcommand{\FlecheH}{\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}{5em}
\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{N}{%
   >{\columncolor{TVcolor}[\TVcolorLeftSep][\TVcolorRightSep]}
   c}
\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=\@niveaux
   \advance\@tempcnta by -\@pos
   \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{\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'.