Ceci est une ancienne révision du document !


Comment désactiver complètement la coupure des mots?

Cela peut sembler une drôle d'idée (après tout, la qualité de son algorithme de césure est l'une des forces de TeX) mais c'est parfois nécessaire.

Si vous utilisez couramment TeX, vous avez dû vous habituer à obtenir automatiquement des blocs de texte plutôt esthétiques. Or ceci est largement dépendant de l'utilisation de la césure… Si vous abandonnez la césure, vous risquez d'être déçu par le résultat.

TeX offre quatre façons différentes de supprimer la césure (il n'y en avait que deux jusqu'à la version 3 de TeX).

Par les pénalités de coupure de mots

Tout d'abord, on peut donner aux pénalités de césure \hyphenpenalty et \exhyphenpenalty des valeurs « infinies » (c'est-à-dire 10000, pour TeX). Cela signifie que toute césure pénalisera suffisamment la ligne qui la contiendrait pour qu'elle n'ait pas lieu. L'inconvénient de cette méthode est que le moteur TeX recalculera tout paragraphe pour lequel les césures pourraient être utiles, ce qui le ralentira.

Césure standard:

%
%

\documentclass[11pt]{article}
  \usepackage[T1]{fontenc}
  \usepackage[width=5.65cm,height=6cm]{geometry}
  \usepackage{lmodern}
  \usepackage[french]{babel}
  \pagestyle{empty}
  
\begin{document}
Longtemps, je me suis couché de bonne heure. Parfois, à peine ma bougie éteinte, mes yeux se fermaient si vite que je n'avais pas le temps de me dire : \og{}Je m'endors.\fg{} Et, une demi-heure après, la pensée qu'il était temps de chercher le sommeil m'éveillait; je voulais poser le volume que je croyais avoir encore dans les mains et souffler ma lumière.
\end{document}

Sans césure:

\hyphenpenalty=10000
\exhyphenpenalty=10000

\documentclass[11pt]{article}
  \usepackage[T1]{fontenc}
  \usepackage[width=5.65cm,height=6cm]{geometry}
  \usepackage{lmodern}
  \usepackage[french]{babel}
  \pagestyle{empty}

\hyphenpenalty=10000
\exhyphenpenalty=10000

\begin{document}
Longtemps, je me suis couché de bonne heure. Parfois, à peine ma bougie éteinte, mes yeux se fermaient si vite que je n'avais pas le temps de me dire : \og{}Je m'endors.\fg{} Et, une demi-heure après, la pensée qu'il était temps de chercher le sommeil m'éveillait; je voulais poser le volume que je croyais avoir encore dans les mains et souffler ma lumière.
\end{document}

En utilisant une langue sans motifs de césure

Second, one can select a language for which no hyphenation patterns exist. Some distributions create a language nohyphenation, and the hyphenat package uses this technique for its \nohyphens command which sets its argument without any hyphenation. You can load hyphenat with the command

\usepackage[none]{hyphenat}

to prevent any hyphenation in a single-language document. The technique cannot work in a document in which babel controls language selection, since babel incorporates hyphenation change into its language change facilities.

En jouant sur les longueurs minimales des fragments coupés

Third, one can set \left- and/or \righthyphenmin to a sufficiently large value that no hyphenation could possibly succeed, since the minimum is larger than the length of the longest word TeX is willing to hyphenate (the appropriate value is 62).

Par la méthode utilisée par LaTeX en interne

Fourth, one can suppress hyphenation for all text using the current font by the command

\hyphenchar\font=-1

This isn't a particularly practical way for users to suppress hyphenation — the command has to be issued for every font the document uses — but it's how LaTeX itself suppresses hyphenation in tt and other fixed-width fonts.

Comment choisir?

Which of the techniques you should use depends on what you actually want to do. If the text whose hyphenation is to be suppressed runs for less than a paragraph, your only choice is the no-hyphens language: the language value is preserved along with the text (in the same way that the current font is); the values for penalties and hyphen minima active at the end of a paragraph are used when hyphenation is calculated.

Contrariwise, if you are writing a multilanguage document using the babel package, you cannot suppress hyphenation throughout using either the no-hyphens language or the hyphen minima: all those values get changed at a babel language switch: use the penalties instead.

If you simply switch off hyphenation for a good bit of text, the output will have a jagged edge (with many lines seriously overfull), and your (La)TeX run will bombard you with warnings about overfull and underfull boxes (that is, really, lines). To avoid this you have two options.

The simplest route is to use \sloppy (or its environment version sloppypar), and have TeX stretch what would otherwise be underfull lines to fill the space offered, while prematurely wrapping overfull lines and stretching the remainder.

The better bet is to set the text ragged right, and at least get rid of the overfull lines; this technique is “traditional” (in the sense that typists have always done it) and may be expected to appeal to the specifiers of eccentric document layouts (such as those for dissertations), but for once their sense conforms with typographic style. (Or at least, style constrained in this curious way.)


Source: Stopping all hyphenation

3_composition/langues/cesure/desactiver_completement_la_cesure.1629815568.txt.gz · Dernière modification : 2021/08/24 14:32 de jejust
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0