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:latex_fait_des_lignes_trop_longues [2018/06/03 13:18] – d.p.carlisle | 2_composition:texte:paragraphes:latex_fait_des_lignes_trop_longues [2021/02/10 10:12] (Version actuelle) – Explicitation de l'utilisation de \linebreak bdumont | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Comment gérer des lignes qui débordent? ====== |
- | title: (La)TeX makes overfull lines | + | |
- | category: usage | + | |
- | permalink: / | + | |
- | --- | + | |
- | When TeX is building a paragraph, it can make several attempts to | + | Lorsque < |
- | get the line-breaking right; on each attempt it runs the same | + | |
- | algorithm, but gives it different parameters. You can affect the way | + | |
- | TeX's line breaking works by adjusting the parameters: this answer | + | |
- | deals with the " | + | |
- | vital " | + | |
- | "[my words aren't being hyphenated](FAQ-nohyph)" | + | |
- | (and the questions | + | |
- | If you're getting an undesired "overfull box", what has happened is | + | Si vous obtenez l'erreur « overfull box » (boîte qui déborde), < |
- | that TeX has given up: the parameters you gave it don't allow it to | + | |
- | produce a result that _doesn' | + | |
- | Knuth decided the best thing to do was to produce | + | |
- | allow the user to solve the problem. | + | |
- | beyond the envelope of "good taste" defined for this run of TeX, | + | |
- | would be distasteful to any discerning typographer.) The user can | + | |
- | almost always address the problem by rewriting the text that's | + | |
- | provoking the problem& | + | |
- | cases it's impossible to solve the problem without adjusting the | + | |
- | parameters. This answer discusses the approaches one might take to | + | |
- | resolution of the problem, on the assumption that you've got the | + | |
- | hyphenation correct. | + | |
- | The simplest case is where a " | + | ===== Avec la commande |
- | a line; pushing the entire word to a new line isn't going to make much | + | |
- | difference, but it might make things just bad enough that TeX won' | + | |
- | do it by default. | + | |
- | `\linebreak` command: it may solve the problem, and if it does, it | + | |
- | will save an awful lot of fiddling. | + | |
- | parameters: to do that we need to recap the details of TeX's line | + | |
- | breaking mechanisms. | + | |
- | TeX's first attempt at breaking lines is performed without even | + | Le cas le plus simple est celui où un mot court ne parvient pas à être césuré à la fin d'une ligne. Déplacer le mot entier sur une nouvelle ligne ne fait souvent pas grande différence mais cela peut conduire à un résultat si mauvais que < |
- | trying hyphenation: | + | |
- | oddities to the internal value `\pretolerance`, | + | |
- | happens. If it can't get an acceptable break, TeX adds the | + | |
- | hyphenation points allowed by the current patterns, and tries again | + | |
- | using the internal `\tolerance` value. If this pass also fails, and | + | |
- | the internal `\emergencystretch` value is positive, TeX will try | + | |
- | a pass that allows `\emergencystretch` worth of extra stretchability | + | |
- | to the spaces in each line. | + | |
- | In principle, therefore, there are three parameters (other than | + | Sinon, il faut ajuster les paramètres : pour ce faire, nous devons récapituler les détails des mécanismes de coupure de ligne de < |
- | hyphenation) that you can change: `\pretolerance`, `\tolerance` | + | |
- | and `\emergencystretch`. Both the `tolerance` values are | + | ===== Avec les paramètres \pretolerance, |
- | simple numbers, and should be set by TeX primitive count | + | |
- | assignment& | + | < |
- | ```latex | + | * sa première tentative pour couper les lignes est effectuée sans même essayer de couper les mots : il considère que sa tolérance aux bizarreries de saut de ligne vaut la valeur interne '' |
+ | * s'il ne parvient pas à obtenir une coupure acceptable, il ajoute les points de césure autorisés et essaie à nouveau en ayant pour tolérance la valeur interne '' | ||
+ | * si cette passe échoue également et que la valeur interne '' | ||
+ | |||
+ | En principe, il existe donc trois paramètres (autres que la césure) que vous pouvez modifier : '' | ||
+ | |||
+ | < | ||
\pretolerance=150 | \pretolerance=150 | ||
- | ``` | + | </ |
- | For both, an " | + | |
- | `10000`, but infinite tolerance is rarely | + | |
- | appropriate, | + | |
- | `\emergencystretch` is a TeX-internal " | + | Une tolérance « infinie » est représentée par la valeur '' |
- | be set as normal for dimens in Plain TeX; in LaTeX, use | + | |
- | `\setlength`& | + | Par ailleurs, '' |
- | ```latex | + | |
+ | < | ||
\setlength{\emergencystretch}{3em} | \setlength{\emergencystretch}{3em} | ||
- | ``` | + | </ |
- | The choice of method has time implications& | + | Modifier ces paramètres peut avoir des conséquences sur la durée du traitement : chacune des passes |
- | passes | + | |
- | `\emergencystretch`) is less desirable than suppressing one (by | + | |
- | changing `\pretolerance`). | + | |
- | computer that's slow enough that the extra passes | + | |
- | troublesome. | + | |
- | In practice, `\pretolerance` is rarely used other than to manipulate | + | ==== La modification de \pretolerance |
- | the use of hyphenation; | + | |
- | to `100`. | + | |
- | `\pretolerance` to `-1`. | + | |
- | `\tolerance` is often a good method for adjusting spacing; | + | Dans la pratique, '' |
- | Plain TeX and LaTeX both set its value to `200`. LaTeX's | + | |
- | `\sloppy` command sets it to `9999`, as does the | + | ==== La modification de \tolerance |
- | `sloppypar` environment. This value is the largest | + | |
- | available, this side of infinity, and can allow pretty poor-looking | + | Modifier '' |
- | breaks | + | |
- | occasionally use `sloppypar`& | + | Il est plus satisfaisant d' |
- | `\tolerance` is confined to the environment). More satisfactory is | + | |
- | to make small changes to `\tolerance`, incrementally, and then to look to | + | < |
- | see how the change affects the result; very small increases can often | + | |
- | do what's necessary. | + | |
- | parameter, so you need to ensure it's actually applied& | + | |
- | "[ignoring paragraph parameters](FAQ-paraparam)" | + | |
- | LaTeX users could use an environment like: | + | |
- | <!-- {% raw %} --> | + | |
- | ```latex | + | |
\newenvironment{tolerant}[1]{% | \newenvironment{tolerant}[1]{% | ||
\par\tolerance=# | \par\tolerance=# | ||
Ligne 99: | Ligne 50: | ||
\par | \par | ||
} | } | ||
- | ``` | + | </ |
- | <!-- {% endraw %} --> | + | |
- | enclosing entire paragraphs | + | ==== La modification de \emergencystretch ==== |
+ | |||
+ | Comme dit précédemment, | ||
+ | |||
+ | ===== Avec des réglages microtypographiques ===== | ||
+ | |||
+ | ==== Ceux de pdf(La)TeX ==== | ||
+ | |||
+ | Les réglages microtypographiques proposées par pdf(La)TeX sont plus subtiles (mais plus délicates à gérer). Dans la mesure où pdf(La)TeX, le moteur par défaut pour < | ||
+ | * le crénage marginal n' | ||
+ | * la déformation des caractères fonctionne comme une version plus subtile de l' | ||
+ | |||
+ | ==== Ceux de l' | ||
- | The value of `\emergencystretch` is added to the assumed | + | Les réglages microtypographiques sont souvent délicats à contrôler. Toutefois, l'extension [[ctanpkg>microtype|microtype]] soulage l'utilisateur du travail fastidieux de spécification des ajustements de marge et des mises à l' |
- | stretchability of each line of a paragraph, in a further run of the | + | |
- | paragraph formatter in case that the paragraph can't be made to look | + | |
- | right any other way. (The extra scan happens if | + | |
- | `\emergencystretch>0pt`& | + | |
- | could be had from rerunning the paragraph setter.) The example above | + | |
- | set it to `3em`; the Computer Modern fonts ordinarily fit three | + | |
- | space skips to the `em`, so the change would allow anything up | + | |
- | to the equivalent of nine extra spaces in each line. In a line with | + | |
- | lots of spaces, this could be reasonable, but with (say) only three | + | |
- | spaces on the line, each could stretch to four times its natural | + | |
- | width. | + | |
- | treated with a degree of caution. | + | |
- | More subtle (but more tricky to manage) are the microtypographic | + | ----- |
- | extensions provided by pdfTeX. | + | |
- | " | + | |
- | nowadays, the extensions are available to all. There are two | + | |
- | extensions, margin kerning and font expansion; margin kerning only | + | |
- | affects the visual effect of the typeset page, and has little effect | + | |
- | on the ability of the paragraph setter to "get things right" | + | |
- | Font expansion works like a subtler version of the trick that | + | |
- | `\emergencystretch` plays: pdfTeX " | + | |
- | may be stretched (or shrunk) to a certain extent, and will do that | + | |
- | "on the fly" to optimise the setting of a paragraph. | + | |
- | powerful tool in the armoury of the typesetter. | + | |
- | As mentioned above, the microtypographic extensions are tricky beasts | + | //Source:// [[faquk> |
- | to control; however, the [`microtype`](https: | + | |
- | of the tedious work of specifying how to perform margin adjustments | + | |
- | and how much to scale each font& | + | |
- | knows about; it's a good tool, and users who can take on the | + | |
- | specification of adjustments for yet more fonts are always welcome. | + | |
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||