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 Prochaine révision Les deux révisions suivantes | ||
3_composition:tableaux:colonnes:faire_varier_la_largeur_de_colonnes [2018/05/24 08:31] joseph.wright |
3_composition:tableaux:colonnes:faire_varier_la_largeur_de_colonnes [2018/12/02 22:49] jejust |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Variable-width columns in tables ====== |
- | section: How do I do& | + | |
- | subsection: Tables, figures and diagrams | + | |
- | date: 2014-06-10 | + | |
- | --- | + | |
- | # Variable-width columns in tables | ||
This is a slightly different take on the problem addressed in | This is a slightly different take on the problem addressed in | ||
- | '' | + | "[[FAQ-fixwidtab|fixed-width tables]]" --- here we have |
a column whose size we can't absolutely predict when we design the | a column whose size we can't absolutely predict when we design the | ||
document. | document. | ||
- | While the basic techniques (the [`tabularx`](https:// | + | While the basic techniques (the [[ctanpkg> |
- | and [`ltxtable`](https:// | + | and [[ctanpkg> |
- | fixed-width | + | fixed-width |
call to our aid, which may be preferable in some situations. | call to our aid, which may be preferable in some situations. | ||
Ligne 21: | Ligne 16: | ||
the column may end up pretty narrow in every row of the table, or it | the column may end up pretty narrow in every row of the table, or it | ||
may be wide enough that the table would run over the edge of the page; | may be wide enough that the table would run over the edge of the page; | ||
- | however, we don't want to make the column as wide as possible | + | however, we don't want to make the column as wide as possible |
- | in case'' | + | in case", by defining a fixed size for the table. |
column to be as small as possible, but have the possibility to spread | 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 | to a maximum width and (if even that width is exceeded) turn into a | ||
- | `p`-style column. | + | '' |
- | The [`varwidth`](https:// | + | The [[ctanpkg> |
- | '' | + | "[[FAQ-varwidth|automatic sizing of minipages]]", provides |
- | a solution. | + | a solution. |
- | [`array`](https:// | + | [[ctanpkg> |
- | ```latex | + | |
+ | < | ||
\usepackage{array} | \usepackage{array} | ||
\usepackage{varwidth} | \usepackage{varwidth} | ||
- | ``` | + | </ |
- | [`varwidth`](https:// | + | [[ctanpkg> |
can use as follows: | can use as follows: | ||
- | ```latex | + | |
+ | < | ||
\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} | ||
- | ``` | + | </ |
when the second column ends up less than 3.5cm wide; | when the second column ends up less than 3.5cm wide; | ||
or you can use it as follows: | or you can use it as follows: | ||
- | ```latex | + | |
+ | < | ||
\begin{tabular}{l V{3.5cm} r} | \begin{tabular}{l V{3.5cm} r} | ||
foo & blah & bar \\ | foo & blah & bar \\ | ||
Ligne 52: | Ligne 50: | ||
& bar \\ | & bar \\ | ||
\end{tabular} | \end{tabular} | ||
- | ``` | + | </ |
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. | ||
+ | |||
+ | --- | ||
+ | |||
+ | //Source:// [[faquk> | ||
+ | |||
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||