[Tex/LaTex] XeLaTeX and pdfLaTeX ignore \hyphenation

hyphenationpdftexxetex

I'm trying to get all hyphenations that the LaTeX-algorithm gives out. So I'm trying this:

echo "\\\documentclass{standalone}
\\\hyphenation{Py-ra-mi-de}
\\\showhyphens{Pyramide}" | xelatex

This does not give me any errors, so that the output contains

\TU/lmr/m/n/10 Py-ra-mide

which I can parse for. But the hyphenation that it gives me is not Py-ra-mi-de, but Py-ra-mide. What do I do wrong here?

Best Answer

The default language (American English) sets \lefthyphenmin=2 and \righthyphenmin=3. Thus no TeX engine will hyphenate past the m, whatever hyphenation points you define.

If you try

\documentclass{article}
\usepackage[italian,english]{babel}

\begin{document}

\hyphenation{Py-ra-mi-de}

\showhyphens{Pyramide}

\selectlanguage{italian}

\hyphenation{Py-ra-mi-de}

\showhyphens{Pyramide}

\end{document}

you get

Underfull \hbox (badness 10000) in paragraph at lines 8--8
\TU/lmr/m/n/10 Py-ra-mide

Underfull \hbox (badness 10000) in paragraph at lines 14--14
\TU/lmr/m/n/10 Py-ra-mi-de

It wouldn't be necessary to set the hyphenation points again, actually, because the hyphenation you want fits into the patterns for Italian. The settings for this language have \lefthyphenmin=2 and \righthyphenmin=2.

Related Question