Вы находитесь на странице: 1из 8

Des modèles de tableaux

Stage de Schiltigheim
26/03/2009

1 Modèles basiques
exe 1 Tableau minimal sans lignes
\begin{tabular}{rcccccc}
Pixel de couverture & c & 1 & e & 0 & a & 7 \\
Pixel à cacher & b & 4 & 5 & 8 & 9 & d
\end{tabular}

Pixel de couverture c 1 e 0 a 7
Pixel à cacher b 4 5 8 9 d

exe 2 Position par rapport à la ligne de base


Les composantes rouges \begin{tabular}[t]{cc} c & 1 \\ b & 4 \end{tabular} ,
vertes \begin{tabular}[c]{cc} e & 0 \\5 & 8 \end{tabular} et
bleues\begin{tabular}[b]{cc} a & 7 \\ 9 & d \end{tabular}

a 7
e 0
Les composantes rouges c 1 , vertes et bleues 9 d
5 8
b 4

exe 3 Tableau avec lignes


\begin{tabular}{|r||cc|cc|cc|}\hline
Pixel de couverture & c & 1 & e & 0 & a & 7 \\
Pixel à cacher & b & 4 & 5 & 8 & 9 & d \\ \hline
Pixel codé & c & b & e & 5 & a & 9 \\ \hline
\end{tabular}

Pixel de couverture c 1 e 0 a 7
Pixel à cacher b 4 5 8 9 d
Pixel codé c b e 5 a 9

1
exe 4 Largeur spécifiée, raccourci avec ∗, ligne partielle
Ce tableau sera amélioré par la suite.
\begin{tabular}{|p{2cm}|*{6}{c|}}\hline
Pixel de couverture & c & 1 & e & 0 & a & 7 \\ \cline{1-1} \cline{4-5}
Pixel à cacher & b & 4 & 5 & 8 & 9 & d \\ \cline{4-5}
Pixel codé & c & b & e & 5 & a & 9 \\ \hline
\end{tabular}

Pixel de cou- c 1 e 0 a 7
verture
Pixel à ca- b 4 5 8 9 d
cher
Pixel codé c b e 5 a 9

exe 5 Fusion horizontale de cellules


\begin{tabular}{|*{6}{c|}}\hline
c & 1 & e & 0 & a & 7 \\ \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\multicolumn{2}{|l|}{Red} & \multicolumn{2}{c}{Green} \ &\multicolumn{2}{r|}{Blue} \\
\hline
\end{tabular}

c 1 e 0 a 7
b 4 5 8 9 d
Red Green Blue

exe 6 modification d’alignement


\begin{tabular}{|*{2}{p{1cm}|}}\hline
1&2 \\ \hline
3&4 \\ \hline
1&\multicolumn{1}{r|}{x} \\ \hline
3&4 \\ \hline
\end{tabular}

1 2
3 4
1 x
3 4

2
2 Avec le module array

exe 7 Insertion de séparateurs de colonnes.


! ne supprime pas l’espace intercolonne
\begin{tabular}{r@{:\ \#}l} \hline
vert amande & c1e0a7\\
pourpre & b4589d\\ \hline
\end{tabular}\qquad
\begin{tabular}{r!{:\ \#}l} \hline
vert amande & c1e0a7\\
pourpre & b4589d\\ \hline
\end{tabular}

vert amande : #c1e0a7 vert amande : # c1e0a7


pourpre : #b4589d pourpre : # b4589d

exe 8 Supprimer l’espace intercolonne


1

3 \begin{center}
4 \begin{tabular}{rl}
5 \hline

6 \colorbox[HTML]{c1e0a7}{\phantom{O}}&\colorbox[HTML]{b4589d}{\phantom{O}}

7 \\\hline \end{tabular}\qquad

9 \bigskip
10

11 \begin{tabular}{@{}r@{}l@{}}
12 \hline
13 \colorbox[HTML]{c1e0a7}{\phantom{O}}&\colorbox[HTML]{b4589d}{\phantom{O}}

14 \\\hline\end{tabular}\qquad

15

16 \bigskip
17

18 \setlength{\tabcolsep}{1cm}
19 \begin{tabular}{rl}
20 \hline

21 \colorbox[HTML]{c1e0a7}{\phantom{O}}&\colorbox[HTML]{b4589d}{\phantom{O}}

22 \\\hline \end{tabular}

23 \end{center}

3
exe 9 Utilisation de motifs
\begin{tabular}{*{3}{>{\bfseries} c >{\color{gray}}c }}
c&1&e&0&a&7\\
b&4&5&8&9&d\\
\end{tabular}

c 1 e 0 a 7
b 4 5 8 9 d

exe 10 reprise de l’exemple 4


On centre verticalement
1 \begin{tabular}{|m{2cm}|*{6}{m{1cm}|}}\hline
2 Pixel de couverture & c & 1 & e & 0 & a & 7 \\ \hline
3 Pixel à cacher & b & 4 & 5 & 8 & 9 & d \\ \hline
4 Pixel codé & c & b & e & 5 & a & 9 \\ \hline
5 \end{tabular}

Pixel de cou-
c 1 e 0 a 7
verture
Pixel à ca-
b 4 5 8 9 d
cher
Pixel codé c b e 5 a 9

On centre horizontalement
1 \begin{tabular}{|m{2cm}|*{6}{>{\centering\arraybackslash}m{1cm}|}}\hline
2 Pixel de couverture & c & 1 & e & 0 & a & 7 \\ \hline
3 Pixel à cacher & b & 4 & 5 & 8 & 9 & d \\ \hline
4 Pixel codé & c & b & e & 5 & a & 9 \\ \hline
5 \end{tabular}

Pixel de cou-
c 1 e 0 a 7
verture
Pixel à ca-
b 4 5 8 9 d
cher
Pixel codé c b e 5 a 9
Une autre solution
1 \begin{tabular}{|m{2cm}|*{6}{>{\centering}m{1cm}|}}\hline
2 Pixel de couverture & c & 1 & e & 0 & a & 7 \tabularnewline \hline
3 Pixel à cacher & b & 4 & 5 & 8 & 9 & d \tabularnewline \hline
4 Pixel codé & c & b & e & 5 & a & 9 \tabularnewline \hline
5 \end{tabular}

Pixel de cou-
c 1 e 0 a 7
verture
Pixel à ca-
b 4 5 8 9 d
cher
Pixel codé c b e 5 a 9

4
exe 11 fusion verticale Avec le module multirow

\begin{tabular}{|c|c|}\hline
\multirow{2}{4cm}{Avant le cryptage} & Pixel à cacher \\
& Pixel de couverture \\ \hline
\multirow{2}{4cm}{Après le cryptage} & Pixel codé \\
& Pixel décodé \\ \hline
\end{tabular}

Pixel à cacher
Avant le cryptage
Pixel de couverture
Pixel codé
Après le cryptage
Pixel décodé
Changer l’alignement ; décaler verticalement.
\renewcommand{\multirowsetup}{\raggedleft}
\begin{tabular}{|c|c|}\hline

\multirow{2}{4cm}{Avant le cryptage} & Pixel à cacher \\


& Pixel de couverture \\ \hline
\multirow{2}{4cm}[2mm]{Après le cryptage} & Pixel codé \\
& Pixel décodé \\ \hline
\end{tabular}

Pixel à cacher
Avant le cryptage
Pixel de couverture
Après le cryptage Pixel codé
Pixel décodé

3 Améliorations

exe 12 Double entrée


%\usepackage{slashbox}
\begin{tabular}{|l||*{4}{c|}}\hline
\backslashbox[25mm]{Produit}{Date}
&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2}
&\makebox[3em]{6/3}\\\hline\hline
Taille-crayon &&&&\\\hline
Gomme&&&&\\\hline
Missile &&&&\\\hline
\end{tabular}

XXX
XXX Date 5/31 6/1 6/2 6/3
Produit XXX
X
Taille-crayon
Gomme
Missile

5
exe 13 Tableaux à l’ancienne
% use packages: array,booktabs
\begin{tabular}{@{}lrlr@{}}\toprule

\multicolumn{4}{c}{Densités de différentes matières} \\ \midrule


\multicolumn{2}{c}{Bois } & \multicolumn{2}{c}{Métal } \\ \cmidrule(r){1-2}\cmidrule
(l){3-4}
Chêne d’Europe & 0,80 & Platine & 21,40 \\
Tilleul & 0,45 & Étain blanc & 7,30 \\
If & 1 & Or & 19,30 \\ \bottomrule
\end{tabular}

Densités de différentes matières


Bois Métal
Chêne d’Europe 0,80 Platine 21,40
Tilleul 0,45 Étain blanc 7,30
If 1 Or 19,30

exe 14 Rotations
% use packages: array
\renewcommand{\arraystretch}{1.4}
\multirowsetup{\raggedright}

\begin{tabular}{|>{\centering}b{0.8cm}|>{\small}b{3cm}>{\scriptsize\raggedleft\
arraybackslash}b{1.2cm}|}\cline{2-3}
\multicolumn{1}{c|}{} & \normalsize Matière & \normalsize Densité \\ \hline
\multirow{4}{0.5cm}{\rotatebox{90}{ Bois}} & Chêne rouge d’Australie & 1,32 \\ \cline
{2-3}
& If & 1 \\ \cline{2-3}
& Chêne d’Europe & 0,80 \\ \cline{2-3}
& Tilleul & 0,45 \\ \hline
\multirow{3}{0.5cm}{\rotatebox{90}{Métal}}& Platine & 21,40 \\ \cline{2-3}
& Argent (comprimé après fusion) & 10,49 \\ \cline{2-3}
& Étain blanc & 7,30 \\ \hline
\end{tabular}

Matière Densité
Chêne rouge d’Aus-
tralie 1,32
Bois

If 1

Chêne d’Europe 0,80

Tilleul 0,45

Platine 21,40
Métal

Argent (comprimé
après fusion) 10,49

Étain blanc 7,30

6
exe 15 rotations et boîtes

\rule{0cm}{3cm}
\begin{tabular}{|*{3}{c c|}}
\multicolumn{2}{c}{\rotatebox{40}{\makebox[3em][l]{Composante Rouge}}}&
\multicolumn{2}{c}{\rotatebox{40}{\makebox[3em][l]{Composante Verte}}}&
\multicolumn{2}{c}{\rotatebox{40}{\makebox[3em][l]{Composante Bleue}}}
\\ \hline
c & 1 & e & 0 & a & 7 \\ \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\end{tabular}

ge te e
ou er leu
t eR t eV t eB
n an an
sa s s
po po po
m m m
Co Co Co
c 1 e 0 a 7
b 4 5 8 9 d

exe 16 Avec la paquetage hhline


%\usepackage{hhline}
\begin{tabular}{||cc||cc||cc||}\hhline{|t:==:t:==:t:==:t|}
c & 1 & e & 0 & a & 7 \\ \hhline{|:==::==::==:|}
b & 4 & 5 & 8 & 9 & d \\ \hhline{|b:==:b:==:b:==:b|}
\end{tabular}

c 1 e 0 a 7
b 4 5 8 9 d

exe 17 Nombres \usepackage{numprint}


\begin{tabular}{|n{8}{5}|n{8}{5}|}\hline
\multicolumn{1}{|c|}{entrée}&\multicolumn{1}{c|}{sortie}\\\hline
1452.36 & 14785.456 \\ \hline
256.3254 & 789566.3521 \\ \hline
9647.854 & 235.689 \\ \hline
45.871 & 1237456.78 \\ \hline
7457896.23 & 326478,5698\\ \hline
\end{tabular}

entrée sortie
1 452,36 14 785,456
256,325 4 789 566,352 1
9 647,854 235,689
45,871 1 237 456,78
7 457 896,23 326 478,569 8

7
4 Réglages

exe 18 Augmenter une hauteur de colonne


\begin{tabular}{|*{6}{c|}}\hline
c & 1 & e & 0 & a & 7 \\[5mm] \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
c & 1 & e & 0 & a & 7 \tabularnewline[2mm] \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\end{tabular}

c 1 e 0 a 7

b 4 5 8 9 d
c 1 e 0 a 7
b 4 5 8 9 d

exe 19 Modifier l’étirement


\renewcommand{\arraystretch}{1.8}
\begin{tabular}{|*{6}{c|}}\hline
c & 1 & e & 0 & a & 7 \\ \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\end{tabular}

c 1 e 0 a 7

b 4 5 8 9 d

exe 20 Réglage vertical


\setlength{\extrarowheight}{5mm}
\begin{tabular}{|*{6}{c|}}\hline
c & \raisebox{2mm}{1} & e & 0 & a & 7 \\ \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\end{tabular}

1
c e 0 a 7

b 4 5 8 9 d

exe 21 Utilisation d’une réglure


\begin{tabular}{|*{6}{c|}}\hline
c\rule[-3mm]{0mm}{8mm} & 1 & e & 0 & a & 7 \\ \hline
b & 4 & 5 & 8 & 9 & d \\ \hline
\end{tabular}

c 1 e 0 a 7
b 4 5 8 9 d

Вам также может понравиться