Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Dernière révision Les deux révisions suivantes | ||
3_composition:tableaux:colonnes:faire_varier_la_largeur_de_colonnes [2018/05/23 16:48] joseph.wright |
3_composition:tableaux:colonnes:faire_varier_la_largeur_de_colonnes [2021/05/24 19:20] jejust Traduction en français. Compilation des exemples. |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Comment avoir des colonnes de largeur variable dans un tableau? ====== |
- | ID: Q-varwidcol | + | |
- | revised: 2014-06-10 | + | |
- | --- | + | |
- | # Variable-width columns in tables | + | |
- | This is a slightly different take on the problem addressed in | ||
- | '' | ||
- | a column whose size we can't absolutely predict when we design the | ||
- | document. | ||
- | While the basic techniques (the [`tabularx`](https:// | + | Il s'agit d'une version légèrement différente du problème abordé dans |
- | and [`ltxtable`](https:// | + | « [[3_composition/tableaux/fixer_la_largeur_d_un_tableau|Comment fixer la largeur d'un tableau?]] ». |
- | fixed-width _table_ problem, there's one extra tool that we can | + | Ici, nous avons une colonne dont nous ne pouvons pas prévoir la taille |
- | call to our aid, which may be preferable in some situations. | + | au moment de l'écriture du document. |
- | Suppose we have data in one column which we read from an external | + | Si les techniques de base sont les mêmes pour ce problème que pour celui des tableaux à largeur déterminée, |
- | source, and the source itself isn't entirely predictable. | + | avec les extensions [[ctanpkg> |
- | the column may end up pretty narrow in every row of the table, or it | + | il existe un outil supplémentaire que nous pouvons appeler à notre secours et est préférable |
- | may be wide enough that the table would run over the edge of the page; | + | dans certaines situations. |
- | however, we don't want to make the column as wide as possible '' | + | |
- | in case'', | + | |
- | column to be as small as possible, but have the possibility to spread | + | |
- | to a maximum width and (if even that width is exceeded) turn into a | + | |
- | `p`-style column. | + | |
- | The [`varwidth`](https:// | + | Supposons que le contenu d'une colonne soit lu à partir d'une source externe, |
- | '' | + | et que la source elle-même ne soit pas entièrement prévisible. Ce contenu |
- | a solution. | + | est parfois étroit, mais d' |
- | [`array`](https:// | + | cependant, nous ne voulons pas rendre la colonne aussi large que possible « juste au cas où », |
- | ```latex | + | en donnant une taille fixe au tableau. Nous aimerions que la colonne soit aussi petite que possible, |
- | \usepackage{array} | + | mais qu' |
- | \usepackage{varwidth} | + | en question est dépassée, de se transformer en une colonne de style '' |
- | ``` | + | se répartisse sur plusieurs lignes. |
- | [`varwidth`](https:// | + | |
- | can use as follows: | + | The [[ctanpkg> |
- | ```latex | + | "[[FAQ-varwidth|automatic sizing of minipages]]", provides |
+ | a solution. | ||
+ | [[ctanpkg> | ||
+ | |||
+ | L' | ||
+ | « [[3_composition: | ||
+ | offre une solution. Si vous la chargez en même temps que l' | ||
+ | elle définira un nouveau type de colonne, '' | ||
+ | |||
+ | <WRAP column 50ex> | ||
+ | < | ||
+ | \documentclass{article} | ||
+ | | ||
+ | \usepackage{varwidth} | ||
+ | |||
+ | \begin{document} | ||
\begin{tabular}{l V{3.5cm} r} | \begin{tabular}{l V{3.5cm} r} | ||
foo & blah & bar \\ | foo & blah & bar \\ | ||
foo & blah blah & bar \\ | foo & blah blah & bar \\ | ||
\end{tabular} | \end{tabular} | ||
- | ``` | + | \end{document} |
- | when the second | + | </ |
- | or you can use it as follows: | + | </ |
- | ```latex | + | < |
+ | < | ||
+ | \documentclass{article} | ||
+ | \usepackage{array} | ||
+ | \usepackage{varwidth} | ||
+ | \pagestyle{empty} | ||
+ | |||
+ | \begin{document} | ||
+ | \begin{tabular}{l V{3.5cm} r} | ||
+ | foo & blah & bar \\ | ||
+ | foo & blah blah & bar \\ | ||
+ | \end{tabular} | ||
+ | \end{document} | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP clear/> | ||
+ | |||
+ | Dans l' | ||
+ | Voyons ce qui se passe quand son contenu s' | ||
+ | |||
+ | <WRAP column 50ex> | ||
+ | < | ||
+ | \documentclass{article} | ||
+ | \usepackage{array} | ||
+ | \usepackage{varwidth} | ||
+ | |||
+ | \begin{document} | ||
\begin{tabular}{l V{3.5cm} r} | \begin{tabular}{l V{3.5cm} r} | ||
foo & blah & bar \\ | foo & blah & bar \\ | ||
Ligne 50: | Ligne 78: | ||
& bar \\ | & bar \\ | ||
\end{tabular} | \end{tabular} | ||
- | ``` | + | \end{document} |
+ | </ | ||
+ | </ | ||
+ | <WRAP column 30ex> | ||
+ | < | ||
+ | \documentclass{article} | ||
+ | \usepackage{array} | ||
+ | \usepackage{varwidth} | ||
+ | \pagestyle{empty} | ||
+ | |||
+ | \begin{document} | ||
+ | \begin{tabular}{l V{3.5cm} r} | ||
+ | foo & blah & bar \\ | ||
+ | foo & blah blah & bar \\ | ||
+ | foo & blah blah blah blah blah blah | ||
+ | & bar \\ | ||
+ | \end{tabular} | ||
+ | \end{document} | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP clear/> | ||
+ | |||
where the second column will end up noticeably wider, and will wrap to | where the second column will end up noticeably wider, and will wrap to | ||
a second line in the third row. | a second line in the third row. | ||
+ | où la deuxième colonne sera sensiblement plus large, et s' | ||
+ | |||
+ | |||
+ | ----- | ||
+ | //Source:// [[faquk> | ||
+ | |||
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||