6

I'm using Cabin font with XeLaTeX. The apostrophe is not render properly.

As you can see on the following screenshot, there is not enough space betweend L and a.

enter image description here

On this screenshot (with the default LaTeX font), there is no problem:

enter image description here

Is it possible to fix this?

MWE (use XeLaTeX):

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Cabin}
\begin{document}
L'apostrophe
\end{document}
7

enter image description here

It seems that it is very tightly spaced to following lowercase letters (1). You can prevent the kerning with \mbox (2). I assume a word space is too much (3) or you could use the xetex inter-character token class to add an extra kern, here I set up a class for ' and a class for lower case ascii letters and inject a small kern if ' is followed immediately by a letter.

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Cabin}

\begin{document}
L'apostrophe

L\mbox{'}apostrophe

L' apostrophe

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\aposclass
\newXeTeXintercharclass\letterclass
\XeTeXcharclass`\'=\aposclass
\count0=`a
\loop
\XeTeXcharclass\count0=\letterclass
\advance\count0 1
\ifnum\count0<`z
\repeat
\count0=1

\XeTeXinterchartoks\aposclass\letterclass{\kern.1em}

L'apostrophe

\end{document}
|improve this answer|||||
  • Thanks. The solution 3 is interesting. However, there are still little differences between a apostrophe with the normal font and with cabin and your code. For example the ' is too close to the L. So a font who renders properly French should be prefered. – ppr Jun 15 '15 at 7:48
  • 1
    @ppr I think it's essentially a bug in the font and the fix was only intended to be font-specific just to be enabled where cabin is being used. – David Carlisle Jun 15 '15 at 8:14

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.