Tables
- A table uses the
tabularenvironment. You first describe the columns:
{l c r}means three columns: left-aligned, centred, right-aligned.
Tableaux
- Un tableau utilise l'environnement
tabular. Vous décrivez d'abord les colonnes :
\begin{tabular}{l c r}
left & centre & right \\
\end{tabular}
{l c r}signifie trois colonnes : left-aligné (gauche), centred (centré), right-aligné (droite).
Rows and cells
- Inside,
&jumps to the next column and\\starts a new row:
- The number of cells in each row must match the number of columns you declared.
Lignes et cellules
- À l'intérieur,
&passe à la colonne suivante et\\commence une nouvelle ligne :
\begin{tabular}{l l}
Apple & 5 \\
Banana & 3 \\
\end{tabular}
- Le nombre de cellules dans chaque ligne doit correspondre au nombre de colonnes déclarées.
Lines (optional)
- Add
|between column letters for vertical lines, and\hlinefor horizontal ones:
- For a cleaner look, professionals use the
booktabspackage instead of many lines.
Lignes (optionnel)
- Ajoutez
|entre les lettres de colonnes pour des lignes verticales, et\hlinepour des lignes horizontales :
\begin{tabular}{|l|l|}
\hline
Apple & 5 \\ \hline
\end{tabular}
- Pour un rendu plus propre, les professionnels utilisent le paquet
booktabsau lieu de nombreuses lignes.
Common mistakes
tabularneeds a column spec like{lcr}; separate cells with&and end rows with\\.- The number of
&per row must fit the column spec.
Erreurs courantes
tabularnécessite une spécification de colonnes comme{lcr}; séparez les cellules avec&et terminez les lignes avec\\.- Le nombre de
&par ligne doit correspondre à la spécification des colonnes.
Build a small two-column table with \begin{tabular}{l l}. Separate the two cells in a row with &, and end each row with \\. Add the rows for Bob (30) and Mei (25). · Construisez une petite table à deux colonnes avec \begin{tabular}{l l}. Séparez les deux cellules d'une ligne avec &, et terminez chaque ligne avec \\. Ajoutez les lignes pour Bob (30) et Mei (25).
Add lines to the table. Put \hline at the top, after the header row, and at the bottom, and use |l|l| in the column spec for vertical lines. · Ajoutez des lignes à la table. Placez \hline en haut, après la ligne d'en-tête, et en bas, et utilisez |l|l| dans la spécification des colonnes pour les lignes verticales.