[XeTeX] Polyglossia and hyphenation with words containing brackets

Zdenek Wagner zdenek.wagner at gmail.com
Thu Sep 13 22:28:46 CEST 2012


2012/9/13 Benedikt Poetig <benedikt.poetig at gmail.com>:
> Hello,
>
> I am dealing with large Latin texts and so I use polyglossia to get the
> hyphenation right. In normal cases that works fine but since I am also
> working with inscriptions the texts contains a lot of brackets, e.g.
> >>Imp(erator) Caesar / [M(arcus) Au]relius Antoninu[s] / [Aug(ustus)
> p]ont(ifex) ma[x]im[us]<<. And there the problem arise. As soon as a word
> contains a bracket hyphenations stop to work. So
>
It is not a problem of polyglossia, the reason is the way how TeX
hyphenate words. A word must be composed entirely of letters. As per
definition a letter is a character with category 11 and nonzero
lccode. Brackets are characters with category 12 and zero lccode.

>   a) is there any chance to tell polyglossia to ignore brackets in words or
> even better to split a word before an opening bracket or after a closing
> one?
>
You can ignore them by setting their category to 9 but in such a case
they will be totally ignored as if you did not type them. In theory
you can use:

\catcode`\(=11
\lccode`(=`(

Now it will be a letter but such words were not used for generating
patters so the resulting hyphenation will be probably nonsense.

Splitting the word is easy, instead of ( you will type:

\discretionary{}{(}{(}

If you have many such cases it would be tedious, it is easier to
activate the bracket. However, they may be present in som e internal
definitions where category 12 is assumed. Thus in the preamble you
use:

{\catcode`\(=13
\expandafter}\expandafter\def\noexpand({\discretionary{}{(}{(}}

Inside the Lati text you just put
\catcode`\(=13

Now Imp(erator) could be split as:

Imp
(erator)

Remember that some macros as \put or \makebox in the picture
environment require ( of category 12, you will have to reset it if you
need it.

>   b) if so, what would be the starting point. (Since I am not such
> experienced in TeX and a brief look over the language definitions in
> polyglossia has failed, I would be thankful for any hint where to start best
> digging deeper.)
>
Again, it is not the case of polyglossia, you have to read the TeXbook.

> Thanks,
> Benedikt
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex
>



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list