I am using XeTeX from TeXLive-2010-Basic in OSX with plain-format.

My try was to follow the TeXbooks setup for commas et such (which I already have working nicely):

\defaulthyphenchar=`‐% it is Unicode 2010
\font\rm="TeX Gyre Pagella"
\newdimen\hyphang \setbox0=\hbox{‐} \hyphang=\wd0
\catcode`‐=\active \let‐=\hyphen

but it didn't work. TeXbook suggests to use "a special font with zero-width \hyphenchar", but I don't know how one would go about doing that.

Would you have any suggestions on how to achieve this?

  • Can you be more explicit? I don't see exactly what you are trying to achieve. Do you want the hypenchar to be a - sticking out in the right margin? Commented Jan 2, 2011 at 13:11
  • @Bruno Le Floch: I want to get the hyphenation character (whatever that may be) to protrude into the right margin.
    – morbusg
    Commented Jan 2, 2011 at 13:22
  • See Konrad's answer below. Commented Jan 2, 2011 at 14:37
  • By the way, it’s 2011 now. You should adjust your hyphen char. ;-) Commented Jan 2, 2011 at 15:17
  • @Konrad: Haha, I just knew someone would make that joke! :-D Btw, that would be "non-breaking hyphen" ;-)
    – morbusg
    Commented Jan 2, 2011 at 15:20

2 Answers 2


The example in the TeXbook is obsolete since all current engines support margin kerning without any tricks. For plain XeTeX:

\font\rm="TeX Gyre Pagella"\relax
a a a a a a a a a abbabbabb aabbabbabb abbabb

\XeTeXprotrudechars=2 activates protrusion, the \rpcode line sets the protrusion code of the glyph the hyphen character maps to.

  • Thanks! What does the \font=250 mean?
    – morbusg
    Commented Jan 2, 2011 at 16:38
  • 1
    @morbusg. \hyphenchar\font=250 means that the hyphenation character for the current font is in position 250 in that font.
    – Joseph Wright
    Commented Jan 2, 2011 at 19:53
  • 2
    Not quite; that line of code says: set the right protrusion (\rpcode) of the current font (\font) for the character used for hyphenation (\XeTeXcharglyph\hyphenchar\font) to 0.250em (=250). (I know I'm late to the party but just wanted to ensure this didn't confuse anyone down the track…) Commented Apr 25, 2014 at 9:27
  • In the question, @morbusg creates a box to ensure that the hang depth is equal to the width of the character. This answer hard codes the solution at 0.250em. If the font were to change, this value might not be correct. How would you recover the non-hard-coded size of the question? Commented Jun 15, 2015 at 16:30

You can try installing the current beta of the microtype package. Its support of XeTeX is incomplete but protrusion (and hence hanging hyphenation) already works and despite its beta status I haven’t (so far) experienced any difficulties with it.

  • 1
    Correct me if I'm wrong, but reading the documentations "getting started"-part, isn't microtype a LaTeX package?
    – morbusg
    Commented Jan 2, 2011 at 15:13
  • @morbusg: yes it is. I missed the plain-tex tag on your question and I thought you were just using a TeX solution because LaTeX has no obvious advantage here. Commented Jan 2, 2011 at 15:16
  • @morbusg. It is, but within it you will doubtless find the appropriate code (although it does seem Philipp has already done that job!)
    – Joseph Wright
    Commented Jan 2, 2011 at 19:55

You must log in to answer this question.

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