Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| composition:tableaux:cellules:fusionner_des_cellule_dans_une_colonne [2018/05/25 21:22] – joseph.wright | 3_composition:tableaux:cellules:fusionner_des_cellule_dans_une_colonne [2021/11/27 14:49] (Version actuelle) – Correction d'une coquille. yannick.tanguy | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | --- | + | ====== Comment fusionner des cellules d'une même colonne dans un tableau? ====== |
| - | title: Merging cells in a column of a table | + | |
| - | category: floats | + | |
| - | tags: tables figures | + | |
| - | permalink: / | + | |
| - | date: 2014-06-10 | + | |
| - | --- | + | |
| - | # Merging cells in a column of a table | + | Certains tableaux nécessitent une cellule qui s' |
| - | It's easy to come up with a table design that requires a cell that | + | ===== Avec l'extension “multirow” ===== |
| - | spans several rows. An example is something where the left-most | + | |
| - | column labels the rest of the table; this can be done (in simple | + | |
| - | cases) by using | + | |
| - | [diagonal separation in corner cells](/ | + | |
| - | technique rather strictly limits what can be used as the content of | + | |
| - | the cell. | + | |
| - | The [`multirow`](https:// | + | L' |
| - | cells, in a very simple manner. | + | |
| - | might write: | + | <WRAP column 45ex> |
| - | ```latex | + | < |
| \begin{tabular}{|c|c|} | \begin{tabular}{|c|c|} | ||
| \hline | \hline | ||
| - | \multirow{4}{*}{Common g text} | + | \multirow{4}{*}{Texte multiligne} |
| - | & Column g2a\\ | + | & Ligne 1\\ |
| - | & Column g2b \\ | + | & Ligne 2 \\ |
| - | & Column g2c \\ | + | & Ligne 3 \\ |
| - | & Column g2d \\ | + | & Ligne 4 \\ |
| \hline | \hline | ||
| \end{tabular} | \end{tabular} | ||
| - | ``` | + | </ |
| - | and [`multirow`](https: | + | </WRAP> |
| - | center of the space defined by the other rows. Note that the rows | + | |
| - | that don't contain the '' | + | |
| - | cells where the multi-row is going to appear. | + | |
| - | The `*` may be replaced by a column | + | < |
| - | case, the argument may contain forced line-breaks: | + | < |
| - | ```latex | + | \documentclass{article} |
| + | \usepackage{multirow} | ||
| + | \pagestyle{empty} | ||
| + | \begin{document} | ||
| \begin{tabular}{|c|c|} | \begin{tabular}{|c|c|} | ||
| \hline | \hline | ||
| - | \multirow{4}{25mm}{Common\\g text} | + | \multirow{4}{*}{Texte multiligne} |
| - | & Column g2a\\ | + | & Ligne 1 \\ |
| - | & Column g2b \\ | + | & Ligne 2 \\ |
| - | & Column g2c \\ | + | & Ligne 3 \\ |
| - | & Column g2d \\ | + | & Ligne 4 \\ |
| \hline | \hline | ||
| \end{tabular} | \end{tabular} | ||
| - | ``` | + | \end{document} |
| - | A similar effect (with the possibility of a little more | + | </ |
| - | sophistication) may be achieved by putting a smaller table that lines | + | </ |
| - | up the text into a `*`-declared `\multirow`. | + | <WRAP clear /> |
| - | The `\multirow` command may also used to write labels vertically | + | L' |
| - | down one or other side of a table (with the help of the | + | |
| - | [`graphics`](https: | + | Le symbole « '' |
| - | `\rotatebox` command): | + | |
| - | ```latex | + | <WRAP column 45ex> |
| + | <code latex> | ||
| + | \begin{tabular}{|c|c|} | ||
| + | \hline | ||
| + | \multirow{4}{25mm}{Texte% | ||
| + | \\multiligne} | ||
| + | & Ligne 1 \\ | ||
| + | & Ligne 2 \\ | ||
| + | & Ligne 3 \\ | ||
| + | & Ligne 4 \\ | ||
| + | \hline | ||
| + | \end{tabular} | ||
| + | </code> | ||
| + | </WRAP> | ||
| + | |||
| + | <WRAP column 45ex> | ||
| + | < | ||
| + | \documentclass{article} | ||
| + | \usepackage{multirow} | ||
| + | \pagestyle{empty} | ||
| + | \begin{document} | ||
| + | \begin{tabular}{|c|c|} | ||
| + | \hline | ||
| + | \multirow{4}{25mm}{Texte% | ||
| + | | ||
| + | & Ligne 1 \\ | ||
| + | & Ligne 2 \\ | ||
| + | & Ligne 3 \\ | ||
| + | & Ligne 4 \\ | ||
| + | \hline | ||
| + | \end{tabular} | ||
| + | \end{document} | ||
| + | </latexdoc> | ||
| + | </WRAP> | ||
| + | <WRAP clear /> | ||
| + | |||
| + | Un effet similaire (permettant un peu plus de sophistication) peut être obtenu en mettant un tableau plus petit qui aligne le texte dans une commande '' | ||
| + | |||
| + | La commande '' | ||
| + | |||
| + | <WRAP column 45ex> | ||
| + | < | ||
| \begin{tabular}{|l|l|} | \begin{tabular}{|l|l|} | ||
| \hline | \hline | ||
| - | \multirow{4}{*}{\rotatebox{90}{hi there}} | + | \multirow{4}{*}{% |
| - | & Column g2a\\ | + | \rotatebox{90}{Texte}} |
| - | & Column g2b \\ | + | & Ligne 1 \\ |
| - | & Column g2c \\ | + | & Ligne 2 \\ |
| - | & Column g2d \\ | + | & Ligne 3 \\ |
| + | & Ligne 4 \\ | ||
| \hline | \hline | ||
| \end{tabular} | \end{tabular} | ||
| - | ``` | + | </ |
| - | (which gives text going upwards; use angle `-90` for text going | + | </ |
| - | downwards, of course). | + | |
| - | To make a `\multicolumn` multi-row | + | <WRAP column 45ex> |
| - | enclose a `\multirow` inside a `\multicolumn`& | + | < |
| - | around does not work, so: | + | \documentclass{article} |
| - | ```latex | + | \usepackage{multirow} |
| + | \usepackage{graphicx} | ||
| + | \pagestyle{empty} | ||
| + | \begin{document} | ||
| + | \begin{tabular}{|l|l|} | ||
| + | \hline | ||
| + | \multirow{4}{*}{% | ||
| + | \rotatebox{90}{Texte}} | ||
| + | & Ligne 1 \\ | ||
| + | & Ligne 2 \\ | ||
| + | & Ligne 3 \\ | ||
| + | & Ligne 4 \\ | ||
| + | \hline | ||
| + | \end{tabular} | ||
| + | \end{document} | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP clear /> | ||
| + | |||
| + | Cet exemple donne un texte qui va vers le haut. Pour un texte allant vers le bas, il faudrait prendre un angle de '' | ||
| + | |||
| + | Pour créer une cellule s' | ||
| + | |||
| + | <WRAP column 45ex> | ||
| + | < | ||
| \begin{tabular}{|c|c|c|}\hline | \begin{tabular}{|c|c|c|}\hline | ||
| - | \multicolumn{2}{|c|}{\multirow{2}{*}{combined cells}} | + | \multicolumn{2}{|c|}{ |
| - | &top right\\ \cline{3-3} | + | \multirow{2}{*}{Cellules |
| + | | ||
| + | &Haut droit\\ \cline{3-3} | ||
| \multicolumn{2}{|c|}{} | \multicolumn{2}{|c|}{} | ||
| - | &middle right\\ \hline | + | &Centre droit\\ \hline |
| - | bottom left | + | Bas gauche |
| - | &bottom center | + | &Bas centre |
| - | &bottom right\\ \hline | + | &Bas droit\\ \hline |
| \end{tabular} | \end{tabular} | ||
| - | ``` | + | </ |
| - | [`Multirow`](https: | + | </WRAP> |
| - | package (which is also discussed in the answer to | + | |
| - | [spacing lines in tables](/ | + | <WRAP column 45ex> |
| - | optional | + | < |
| - | rows in the multi-row have been opened up with `\bigstrut`. | + | \documentclass{article} |
| + | \usepackage{multirow} | ||
| + | \pagestyle{empty} | ||
| + | \begin{document} | ||
| + | \begin{tabular}{|c|c|c|}\hline | ||
| + | \multicolumn{2}{|c|}{ | ||
| + | | ||
| + | | ||
| + | & | ||
| + | \multicolumn{2}{|c|}{} | ||
| + | & | ||
| + | Bas gauche | ||
| + | & | ||
| + | & | ||
| + | \end{tabular} | ||
| + | \end{document} | ||
| + | </latexdoc> | ||
| + | </WRAP> | ||
| + | <WRAP clear /> | ||
| + | |||
| + | L' | ||
| - | The documentation | + | La documentation |
| - | to be found, as comments, in the package files themselves. | + | |
| + | ----- | ||
| + | //Source:// [[faquk> | ||
| + | {{htmlmetatags> | ||
| + | metatag-og: | ||
| + | metatag-og: | ||
| + | }} | ||

