I have an issue with the following (Xe)LaTeX code where I want to get proper French spacing around the punctuation.

Here goes:


% \usepackage{ucharclasses}

Ceci est un test: «avec des guillemets»

This yields a correct rendering:

correct rendering

However, if I uncomment the ucharclasses package, then the spacing gets incorrect:

incorrect rendering

I don't even need to load the Latin option of ucharclasses to get things wrong. I would love to not blame anyone and get things working, but have no idea where to start!

  • You are loading the latin option as the default is to setup all groups. If you use e.g. \usepackage[Greek]{ucharclasses} everything is fine. – Ulrike Fischer Aug 12 '15 at 15:26
  • Thank you Ulrike, I didn't know that point. As a matter of fact, in my complete document, I need to load the Latin block, otherwise the font doesn't switch back to my default font after I input characters from exotic blocks. That trick may be a workaround of a different issue I shall investigate though. However, why is that that loading Latin breaks the rules by polyglossia? – xoolive Aug 12 '15 at 16:16
  • Both uses the same xetex feature (classes). It is certainly possible to reset things, but one would need to investigate first. – Ulrike Fischer Aug 12 '15 at 16:20

The ucharclass package changes the class of the Latin characters, but polyglossia assumes this class is 0.

You can try with



    \XeTeXinterchartoks \BasicLatinClass \french@punctthin = {\nobreak\thinspace}%
    \XeTeXinterchartoks \BasicLatinClass \french@punctthick = {\nobreakspace}%
    \XeTeXinterchartoks \french@punctguillstart \BasicLatinClass = {\nobreakspace}% "«a" -> "« a"
    \XeTeXinterchartoks \BasicLatinClass \french@punctguillend = {\nobreakspace}% "a»" -> "a »"
    \XeTeXinterchartoks \LatinSupplementClass \french@punctthin = {\nobreak\thinspace}%
    \XeTeXinterchartoks \LatinSupplementClass \french@punctthick = {\nobreakspace}%
    \XeTeXinterchartoks \french@punctguillstart \LatinSupplementClass = {\nobreakspace}% "«a" -> "« a"
    \XeTeXinterchartoks \LatinSupplementClass \french@punctguillend = {\nobreakspace}% "a»" -> "a »"


Ceci est un test: «avec des guillemets»


enter image description here

  • Looks great to me <3 Just a last question @egreg : as I checked gloss-french.ldf, it seems you replaced/appended according to the \z@ -> \BasicLatinClass pattern. But if I try to imagine the case 255 \french@punctthin, how can I be sure it works well and the space is well replaced by a \nobreak\thinspace. No need to specify \BasicLatinClass anywhere? It seems to work fine on a toy example, but I don't get why it would work as is with space and not with \z@... – xoolive Aug 12 '15 at 20:19
  • @xoolive I added also the Latin Supplement class. About class 255, there should be no problem, as class 0 is not involved. There are other problems, because the punctuation characters will not be recognized as Latin ones for transitions. – egreg Aug 12 '15 at 20:25
  • As a matter of fact, after I am done with a Unicode block, I must pay attention not to use a comma (the fonts I use don't have punctuation) but use a Latin character first in order to force the switching back to Latin. So there's a way to fix this? ... Btw, I must have been confused, but what does class 255 stands for? – xoolive Aug 12 '15 at 22:17
  • @xoolive From the reference guide (texdoc xetex): “The boundary of a text string is considered class 255, wherever there is a boundary between a ‘run’ of characters and something else — glue, kern, math, box, etc.” – egreg Aug 12 '15 at 22:29

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.