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:texte:paragraphes:ajuster_la_taille_d_une_minipage [2018/05/24 08:39] – joseph.wright | 3_composition:texte:paragraphes:ajuster_la_taille_d_une_minipage [2023/01/14 09:18] (Version actuelle) – [Avec l'extension “pbox”] Limitation de pbox bdumont | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Comment optimiser la largeur d' |
- | title: | + | |
- | section: How do I do& | + | |
- | subsection: Odds and ends | + | |
- | date: 2014-06-10 | + | |
- | --- | + | |
- | The `minipage` environment requires you to specify the | + | L'environnement |
- | width of the '' | + | |
- | inconvenient: | + | |
- | `minipage` sets a box that is exactly the width you | + | |
- | specified. | + | |
- | The [`pbox`](https:// | + | ===== Avec l' |
- | that of the longest enclosed line, subject to a maximum width that you | + | |
- | give it. So while `\parbox{2cm}{Hello world!}` produces a | + | |
- | box of width exactly `2cm`, | + | |
- | `\pbox{2cm}{Hello world!}` produces one whose width is | + | |
- | `1.79cm` (if one's using the default `cmr` font for the | + | |
- | text, at least). | + | |
- | `\settominwidth[min]{length}{text}` (which looks (almost) | + | |
- | like the standard `\settowidth` command), and a `\widthofpbox` | + | |
- | function analogous to the `\widthof` command for use with the | + | |
- | [`calc`](https:// | + | |
- | The [`eqparbox`](https://ctan.org/ | + | L' |
- | allowing you to set a series of boxes, all with the same (minimised) | + | |
- | width. (Note that it doesn't accept a limiting maximum width | + | <code latex> |
- | parameter.) The package | + | \parbox{2cm}{Coucou !} |
- | drawn from a joke _curriculum vitae_: | + | |
- | ```latex | + | \pbox{2cm}{Coucou !} |
+ | </code> | ||
+ | |||
+ | La première produit une boîte de largeur exactement '' | ||
+ | |||
+ | L' | ||
+ | * une commande '' | ||
+ | * et une commande '' | ||
+ | |||
+ | <note important> | ||
+ | ===== Avec l'extension “eqparbox” ===== | ||
+ | |||
+ | L' | ||
+ | |||
+ | <WRAP column 60ex> | ||
+ | < | ||
+ | \documentclass{article} | ||
+ | \usepackage{eqparbox} | ||
+ | \pagestyle{empty} | ||
+ | \begin{document} | ||
\noindent% | \noindent% | ||
- | \eqparbox{place}{\textbf{Widgets, Inc.}} \hfill | + | \eqparbox{lieu}{\textbf{Musée D. Knuth}} \hfill |
- | \eqparbox{title}{\textbf{Senior Widget Designer}} \hfill | + | \eqparbox{titre}{\textbf{Chef de projet}} |
- | \eqparbox{dates}{\textbf{1/95--present}} | + | \hfill |
+ | \eqparbox{dates}{\textbf{01/1995--présent}} | ||
- | ... | + | \noindent% |
+ | \eqparbox{lieu}{\textbf{Société L. Lamport}} | ||
+ | \hfill | ||
+ | \eqparbox{titre}{\textbf{Ingénieur}} \hfill | ||
+ | \eqparbox{dates}{\textbf{09/ | ||
+ | \end{document} | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP column 60ex> | ||
+ | < | ||
+ | % Le code est bidouillé en l' | ||
+ | \documentclass{article} | ||
+ | \usepackage{eqparbox} | ||
+ | \pagestyle{empty} | ||
+ | \begin{document} | ||
+ | \begin{tabbing} | ||
\noindent% | \noindent% | ||
- | \eqparbox{place}{\textbf{Thingamabobs, | + | \eqparbox{lieu}{\textbf{Musée D. Knuth\hspace*{1.7cm}}} \hfill |
- | \eqparbox{title}{\textbf{Lead Engineer}} \hfill | + | \eqparbox{title}{\textbf{Chef de projet\hspace*{1cm}}} \hfill |
- | \eqparbox{dates}{\textbf{9/92--12/94}} | + | \eqparbox{dates}{\textbf{01/1995--présent}} \\ |
- | ``` | + | \noindent% |
- | The code makes the three items on each of the heading lines have | + | \eqparbox{lieu}{\textbf{Société L. Lamport}} |
- | exactly the same width, so that the lines as a whole produce a regular | + | \eqparbox{title}{\textbf{Ingénieur}} \hfill \> |
- | pattern down the page. A command `\eqboxwidth` allows you to use | + | \eqparbox{dates}{\textbf{09/ |
- | the measured width of a group: the documentation shows how the command | + | \end{tabbing} |
- | may be used to produce sensible-looking columns that mix `c`-, | + | \end{document} |
- | `r`- or `l`-rows, with the equivalent of a <code class=" | + | </latexdoc> |
- | entry, by making the fixed-width rows an [`eqparbox`](https:// | + | </WRAP> |
- | making the last from a `\parbox` using the width that's been | + | <WRAP clear /> |
- | measured for the group. | + | |
+ | Le code fait en sorte que, pour chacun des trois groupes | ||
+ | |||
+ | Une commande '' | ||
+ | |||
+ | ===== Avec l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | L' | ||
- | The [`varwidth`](https:// | + | ----- |
- | environment which sets the content of the box to match a '' | + | |
- | natural width'' | + | |
- | you would give `minipage`: in effect, it is a '' | + | |
- | replacement.) | + | |
- | `\narrowragged`, | + | |
- | text in the last line of the paragraph (thus producing lines with more | + | |
- | nearly equal lengths than typically happens with `\raggedright` | + | |
- | itself). | + | |
- | The documentation (in the package file) lists various restrictions and | + | //Source:// [[faquk> |
- | things still to be done, but the package is already proving useful for | + | |
- | a variety | + | |
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||