# Redefine apostrophes to prevent bad kerning

The apostrophe in Adobe’s Minion Pro font has a kerning that is much too tight for typesetting French, where sequences of letters like l’a or d’e or j'a are common.

One solution I found is to wrap the apostrophe in a box, which prevents kerning with surrounding elements and gives a much nicer result:

(regular kerning is at the top, with my workaround below). I can redefine the “nice apostrophe”, a.k.a. U+2019, a.k.a. right single quotation mark, by the following command:

\DeclareUnicodeCharacter{2019}{\mbox{'}}


However, this doesn't work for the regular ASCII apostrophe, U+0027. So, how do you suggest I change that (in a way that doesn't affect the working of ' as a prime in math mode)? It would be an added bonus if the solution could avoid breaking hyphenation…

-
No, what the regular form does, is kerning (without “bad”!). What you do, is preventing kerning at all! As far as I know, it would by the way enough to put the apostrophe into an own group – means put it in braces {'}. –  Speravir Sep 13 '12 at 1:28
I also suspect, with your approach you break the hyphenation algorithms of babel and polyglossia. –  Speravir Sep 13 '12 at 1:30
See also tex.stackexchange.com/questions/61759/… . You might even want to switch your font. –  brian-ammon Sep 13 '12 at 7:30
Well, beauty is in the eye of the beholder but I find the first (default) version much more beautiful than the second. –  cgnieder Dec 15 '12 at 20:25
@cgnieder So do I but the French have a general fondness for spaces around punctuation. For example : like so ! –  Christian Jun 16 '13 at 12:28

The package minionpro has the optional argument loosequotes that may be to your help. See page 4 in the manual where the option is described:

The quote signs of MinionPro are set rather tight. This can lead to undesirable spacing for apostrophes. The loosequotes option slightly increases the side bearings of quotes. This option requires pdfTEX 1.40 and microtype 2.0. Beware that this option prevents hyphenation of words containing apostrophes. Such words will require explicit hyphenation commands \-

Another possible solution is to use the package microtype and the possibility to defined parameters for the \SetExtraKerning-command. Have a look at section 5.4 in the manual, where the author has defined a configuration for extra kerning to be used in French text.

\SetExtraKerning
[ name     = frenchdefault,
context  = french,
unit     = space   ]
{ encoding = {OT1,T1,LY1} }
{
:  = {1000,}, % = \fontdimen2
;  = {500, }, % ~ \thinspace
!  = {500, },
?  = {500, }
}


See also page 22 (section 6) for the use of it, and especially at page 23, where the use of the command \DeclareMicrotypeBabelHook is described.

-
I already have the loosequotes option turned on, and it doesn't do enough… I'll try your microtype solution, though, which seems nice! –  F'x Sep 13 '12 at 11:22

I think that the best approach is to use the "real apostrophe" ’ in text, so the definition as \mbox{'} can coexist peacefully with the usage of ' in math. Saying

\DeclareUnicodeCharacter{2019}{\mbox{'}\hskip 0pt \nobreak}


will allow hyphenation of the word following the apostrophe. However you'll miss the '' ligature for closing double quotes.

Here's a code I wrote for a similar problem (see this discussion on the GuIT forum):

\makeatletter
\edef\qu@te{\string'} % save a copy of the ordinary apostrophe
\catcode'=\active    % make ' active

%%% Update \@resetactivechars (that shouldn't act on ' any more)
\begingroup
\obeylines\obeyspaces%
\gdef\@resetactivechars{%
\def^^M{\@activechar@info{EOL}\space}%
\def {\@activechar@info{space}\space}%
}%
\endgroup

%%% In case hyperref is not used
\providecommand\texorpdfstring[2]{#1}

%%% Define the active '
\protected\def'{\texorpdfstring{\texqu@te}{\string'}}

\@ifpackagewith{inputenc}{utf8}
{\DeclareUnicodeCharacter{2019}{\texqu@te}}{}

\def\texqu@te{\relax
\ifmmode
\expandafter^\expandafter\bgroup\expandafter\prim@s
\else
\expandafter\futurelet\expandafter\@let@token\expandafter\qu@t@
\fi}
\def\qu@t@{%
\ifx'\@let@token
\qu@te\qu@te\expandafter\@gobble
\else
{}\qu@te{}\penalty\@M\hskip\expandafter\z@skip
\fi}
\scantokens\expandafter{%
\expandafter\def\expandafter\pr@m@s\expandafter{\pr@m@s}}
\makeatother


In math mode ' should have the same meaning as the math active, that is, \active@math@prime which means ^\bgroup\prim@s; in text mode we have to check whether another apostrophe follows. I use \futurelet directly in order not to swallow spaces with \@ifnextchar.

If the apostrophe has to be set, I use {}'{} to defeat the kerning.

The final \scantokens is just to redefine \pr@m@s under the current catcode settings without copying its definition from the LaTeX kernel.

-

Using XeTeX with Minion Pro and Kepler Std, I find more satisfying the space obtained replacing a line, in the above code, with the following one (with a different kerning, note the two \kern statements):

\def\qu@t@{%
\ifx'\@let@token
\qu@te\qu@te\expandafter\@gobble
\else
{\kern0.08em}\qu@te{\kern0.01em}\penalty\@M\hskip\expandafter\z@skip
\fi}
`

(of course, your mileage may vary).

-
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  texenthusiast Aug 11 '13 at 13:34
Nice to see you here! Ciao! –  egreg Aug 11 '13 at 19:47