3

Following the code used both here and here, using \hyphenrules should inform polyglossia about breaking points within a word. The following code does not break the word in question. Why not? What can I do? I'm using version 1.43 of polyglossia.

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}

\begin{hyphenrules}{english}
\hyphenation{de-ri-va-tio-nal}
\hyphenation{non-de-ri-va-tio-nal}
\end{hyphenrules}

\begin{document}

\parbox{0pt}{\hspace{0pt}non-derivational}

\end{document}

enter image description here

1
  • 2
    Isn't this the standard 'LaTeX won't hyphenate words already containing a hyphen' issue (cf. tex.stackexchange.com/q/2706/35864)? If you try nonderivational you get all the break points you wish for.
    – moewe
    Feb 16, 2019 at 20:03

2 Answers 2

1

TeX doesn't hyphenate words that contain a hyphen (precisely the current \hyphenchar for the current font).

You can define a macro for this:

\newcommand{\hy}{-\nobreak\hspace{0pt}}

The \nobreak (that is, \penalty10000) disallows a break at the \hspace, which on the other hand allows hyphenation for the following word part.

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}

\makeatletter % babel has `allowhyphens
\providecommand{\allowhyphens}{\ifvmode\else\nobreak\hskip\z@skip\fi}
\makeatother

\newcommand{\hy}{-\allowhyphens}

\begin{document}

\parbox{0pt}{\hspace{0pt}non\hy derivational}

\end{document}

Here I use a safer definition, that does nothing if \allowhyphens happens to be found in vertical mode. It is essentially the same as in babel.

enter image description here

Note that de-ri-va-tio-nal is very wrong for English hyphenation rules.

2
  • I looked up in Bringhurst to find out about hyphenation rules in English, but he doesn't give them. What is wrong about it, by the way?
    – Sverre
    Feb 18, 2019 at 16:30
  • 1
    In AmEnglish derivation hyphenates as der-i-va-tion, according to Merriam-Webster. In BrEnglish it should be de-riv-a-tion
    – egreg
    Feb 18, 2019 at 16:50
2

In German language this is a well known problem, because german language contains a lot of concatenated words, single words divided by -. For example: Baden-Württemberg.

If you need hyphenation in the single words you need to add local hyphenations with \-.

In your case change non-derivational to non-de\-ri\-va\-tio\-nal.

Please see the following MWE

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{english}

\begin{hyphenrules}{english}
\hyphenation{de-ri-va-tio-nal}
\hyphenation{non-de-ri-va-tio-nal}
\end{hyphenrules}

\begin{document}

\parbox{0pt}{\hspace{0pt}non-derivational}

No - in word:
\parbox{0pt}{\hspace{0pt}nonderivational}

With local hyphenations \texttt{\-}:
\parbox{0pt}{\hspace{0pt}non-de\-ri\-va\-tio\-nal}

\end{document}

and its result:

resulting pdf

You must log in to answer this question.

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