6

Polyglossia systematically ignores my custom \hyphenation, and generates overfull hboxes all over the place as a consequence.

Here’s an example:

\documentclass{article}

\usepackage{polyglossia}

\setmainlanguage[variant=uk]{english}

\hyphenation{a-bun-dance}

\begin{document}
A
abundance abundance abundance abundance abundance abundance abundance abundance
abundance abundance abundance abundance abundance abundance abundance abundance
\end{document}

Renders as (via xelatex example):

screenshot

This seems to happen for many/all words. The documentation doesn’t contain any hint at how to fix this. Is it a bug or am I doing something wrong?

This is using an up-to-date TeX Live 2014 with XeTeX 3.14159265-2.6-0.99991.

  • english has \lefthyphenmin=2 so the break after the first a will never be taken automatically. – David Carlisle Feb 24 '15 at 16:13
  • @David Okay, good to know (and actually reassuring, I don’t actually want that break, I was just trying to be extra permissive here). But in any case the relevant break would be the other, so this doesn’t solve my problem. – Konrad Rudolph Feb 24 '15 at 16:14
7

It appears the main language is set up at begin document, it is still US English in the preamble, it works if you delay the setting:

\documentclass{article}

\usepackage{polyglossia}

\setmainlanguage[variant=uk]{english}



\begin{document}
\hyphenation{a-bun-dance}

A
abundance abundance abundance abundance abundance abundance abundance abundance
abundance abundance abundance abundance abundance abundance abundance abundance
\end{document}
3

This is a problem similar to Set hyphenation with polyglossia but it requires a different approach, because English is treated differently: only one set of patterns for English is used by Polyglossia and it's set at begin document.

\documentclass{article}

\usepackage{polyglossia}

\setmainlanguage[variant=uk]{english}

\newcommand{\sethyphenation}[2]{%
  \AtBeginDocument{%
    \begin{otherlanguage*}{#1}\hyphenation{#2}\end{otherlanguage*}%
  }%
}

\sethyphenation{english}{a-bun-dance}

\begin{document}
\parbox{0pt}{A abundance}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.