10

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?

1
  • so from the answer in summary you would need echo "\documentclass{standalone} \begin{document} \hyphenation{Py-ra-mi-de} \righthyphenmin2 \showhyphens{Pyramide} \end{document}" | XeLaTeX and get a result of .pdf
    – user170109
    Commented Apr 7, 2019 at 22:19

2 Answers 2

10

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.

8

You must set the hyphenmins correctly:

\documentclass{standalone}
\hyphenation{Py-ra-mi-de}


\begin{document}
\showhyphens{Pyramide}

\righthyphenmin1
\lefthyphenmin1

\showhyphens{Pyramide}

\end{document}

The first \showhyphens gives your output but the second now

\TU/lmr/m/n/10 Py-ra-mi-de
2
  • Thanks very much! This solves my problem. What do \righthyphenmin and \lefthyphenmin exactly do? Commented Apr 7, 2019 at 15:34
  • 1
    They set the number of minimal chars left and right of a hyphenation. Commented Apr 7, 2019 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .