[XeTeX] Hyphenation exceptions for German -- how?

Ross Moore ross.moore at mq.edu.au
Wed Jul 13 23:17:38 CEST 2011

Hello Arno,

On 14/07/2011, at 6:38 AM, Arno Trautmann wrote:

> Hi Thomas,
> short answer: use \hyphenation after \begin{document}, then it works.
> However, I've been wondering for a while now why this is the case – can someone explain this behaviour?

It could well be that the hyphenation patterns defined using
polyglossia are not actually loaded until the \begin{document}
by loading the appropriate commands using
  \AtBeginDocument{... whatever ...}

LaTeX has an internal macro  \@begindocumenthook
that is expanded at that time.
There can be many good reasons for delaying some commands
until LaTeX has read the complete preamble.

For example, this is a standard way to resolve conflicts due
to the order of loading packages. One package can have a piece
of coding that detects whether or not another has been loaded, 
then expands an appropriate macro to deal with the potential
conflict, only if necessary.

You can use this too, within the preamble, by doing:


> cheers
> Arno
> Thomas Fehige wrote:

>> %-----------------------------------------------------------------------
>> \documentclass[12pt]{article}
>> \usepackage{fontspec}
>> \usepackage{xltxtra}
>> \usepackage{polyglossia}
>> \setdefaultlanguage{german}
>> \hyphenation{
>> einer
>> Me-ta-ethik
>> }
>> \begin{document}
>> \showhyphens{Metaethik, einer}
>> % that gives me "Me-tae-thik" and "ei-ner",
>> % the former wrong, the latter ugly.
>> \end{document}

Hope this help,


Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the XeTeX mailing list