I saw in an article (here on page 43, note 2, in french) an intersting way to hyphenate words. I thought it would be intersting, as an exercise, to try and reproduce it using XeTeX. It looks like this:

... words words long<

>word words...

Instead of

... words words long-

word words...

Where < and > are in fact characters U+2039 and U+203A.

Using fontspec I changed HyphenChar to < with \addfontfeature. However, I would like to know, how do I add an other character at the beginning of the next line?

Changing HyphenChar created a problem, that I cannot solve. In the text I used is the word “TeXnicien” which is not hyphenated and creates an overfull box. I cannot use \hyphenation because this word contains a command. I thought I could use \-, but while it worked fine when HyphenChar was a dash, it created an “Improper discretionary list” error after I changed it (cutting the word properly but not putting any character at the line break).

Thanks in advance!

  • If you're willing to manually set all hyphenation points, then \discretionary{^^^^2039}{^^^^203a}{} will do. Automatic hyphenation uses the equivalent of \discretionary{\char\hyphenchar\font}{}{} but this is not changeable by the user in TeX/XeTeX. It may be possible in LuaTeX, of course.
    – egreg
    Sep 1 '15 at 17:06
  • Thanks! Indeed, using \discretionary solves my second problem. Not with XeLaTeX though, for a reason I can't work out yet it doesn't compile. But with LuaLaTeX it works brilliantly. Sep 1 '15 at 19:38
  • The simple document \documentclass{article} \usepackage{fontspec} \begin{document} \parbox{0pt}{xyz\discretionary{^^^^2039}{^^^^203a}{}abc} \end{document} run with XeLaTeX produces this output
    – egreg
    Sep 1 '15 at 19:42
  • I took your minimal example and loaded polyglossia with french as the main language \documentclass{article} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{french} \begin{document} \parbox{0pt}{xyz\discretionary{^^^^2039}{^^^^203a}{}abc} \end{document} and I have got the same error that the one on my “bigger” document. It says where it encounters \discretionary ! Argument of \xpg@nospace has an extra } Sep 1 '15 at 19:50
  • It's a problem with the specific characters. Do \newcommand{\mydisc}{ \begingroup\XeTeXinterchartokenstate=0 \discretionary{^^^^2039}{^^^^203a}{}\endgroup} and use \mydisc in the document.
    – egreg
    Sep 1 '15 at 19:54

The automatic hyphenation mechanism works by implicitly inserting the equivalent of


which, under normal conditions, means


The primitive \discretionary has three arguments: the pre-break text, the post-break text and the no-break text. The first two are used when a break should be taken at the discretionary, otherwise the third argument is used.

Such implicit insertion is not under user control in TeX/XeTeX (but can be modified in LuaTeX, though how to do it is beyond my knowledge). So hyphenating in the proposed way can only be done by adding manually, at every point where we want XeTeX to possibly hyphenate,


which is the same as


because in the first case the characters are just denoted by code point.

However, there's a catch using these characters when French is the current language, because they are treated specially as all punctuation characters. A workaround is to define a macro:


So the document




\parbox{0pt}{xyz\mydisc abc}

run through XeLaTeX will produce

enter image description here

As usual, the \parbox is just to force hyphenation at all feasible points.

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.