Perhaps you could set \doublehyphendemerits
to a high value. It will discourage LaTeX from hyphenating words at the ends of two consecutive lines. For instance:
\doublehyphendemerits=1000000
Edit: (La)TeX associates "demerits" to lines when breaking them (i.e. how undesirable is the line), and tries to minimize the total demerits within a paragraph. Demerits are calculated based on the square values of the badness of the line and of the penalties associated with it (e.g. with things like \hyphenpenalty
which discourages the use of hyphenation). Because it uses square values, you must set any demerits
to a high value in order for them to have any effect, which is why the default is \doublehyphendemerits=10000
(whereas penalties are usually set in the hundreds by default and have a maximum value of ±10000). The exact algorithm is explained in the TeXbook and in most books on the subject.
No, it's not possible with XeTeX, but something can be done with LuaTeX.
When (Xe)TeX decides for a possible hyphenation point it basically adds \discretionary{-}{}{}
, while in the case of "äggula" you want
ägg\discretionary{-}{g}{}ula
and this is usually solved by something like
\providecommand{\allowhyphens}{\nobreak\hskip0pt\relax}
\newcommand{\ggg}{gg\discretionary{-}{\allowhyphens g}{}}
and inputting the word as
ä\ggg ula
(\allowhyphens
allows TeX to break also the remainder of the composite word).
Cases like "glasstrut" where semantics is involved are best solved by not allowing hyphenation, resorting to manual insertion of \discretionary
(maybe hidden in a macro) in cases splitting the word becomes necessary. See exercise 14.8 in the TeXbook (page 96).
With LuaTeX the situation is very different; you can specify
\hyphenation{ägg{-}{g}{}ula}
(there's no point in adding a new hyphenation point "äggu-la", I believe). Minimal example:
\documentclass{article}
\usepackage{fontspec}
\hyphenation{ägg{-}{g}{}ula}
\begin{document}
äggula
\parbox[t]{1pt}{äggula}
\end{document}
The three pairs of braces specify what's in the "pre-break", "post-break" and "no-break" parts just like the arguments to \discretionary
.
Best Answer
Some time ago, I wanted to deactivate hyphenation completely (without switching to
\raggedright
).I found out that setting
\pretolerance=10000
turns off the complete hyphenation mechanism: it tells TeX to not even look for hyphenation positions.In addition, there is the parameter
\hyphenpenalty
. For example,\hyphenpenalty=10000
will (probably) also suppress hyphenation.Naturally, forbidding hyphenation might cause underfull/overfull lines. That's why I added
\tolerance=2000 \emergencystretch=10pt
. The\tolerance
parameter controls how much white space TeX considers to be "acceptable"; and the\emergencystretch
configures TeX to use at most10pt
of additional white space per line in order to avoid underfull/overfull lines.My solution to suppress hyphenation completely was
Now, I am aware that you expressed doubts on "tuning complicated parameters". But I encourage you to experiment with
\pretolerance
and/or\hyphenpenalty
in combination with my suggestions for\tolerance
and\emergencystretch
.The value
10000
is special in TeX, it means "disable this feature" - it is kind of "black or white". I would expect that any value between0
and10000
(exclusive) will "reduce" the number of hyphenations (i.e. a "grayshade").According to my notes, I stumbled over the details on the mentioned parameters in Knuth, D.: Computers & Typesetting – The TEXbook. AddisonWesley, 1986 on page 96.