Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use UTF-8 encoding to type a document in French, with the following definitions for guillemets:

\DeclareUnicodeCharacter{AB}{\og}
\DeclareUnicodeCharacter{BB}{\fg\xspace}

and the Babel package:

\usepackage[francais]{babel}

However, when I type a text like ceci cela «~quoted~» ceci cela, the spacing is wrong around the opening guillemet:

enter image description here

Notice that the space before the opening guillemet is too small, and the spacing after is too large. The closing guillemet has correct spacing. How could I fix that?

share|improve this question
    
I remember sending a bug report to the (active) developer of the french babel package earlier this year, regarding this particular issue when using XeLaTeX. He issued a corrective patch within days, which is available for download here. (Note: I am unsure whether it solves your problem, but someone might be interested in this anyway.) –  ienissei Sep 11 '12 at 8:09

1 Answer 1

up vote 12 down vote accepted

The spacing is already inserted by \og and \fg, so you shouldn't type the ~. You can consider changing the definition of the Unicode character as

\DeclareUnicodeCharacter{AB}{\og\ignorespaces}
\DeclareUnicodeCharacter{BB}{\unskip\fg}

so that inputting

Ces simulations «directes» sont ainsi

Ces simulations « directes » sont ainsi

will be equivalent.

enter image description here

Notice that \xspace does nothing.

If you insist to type «~directes~», then the definition for the open guillemets character could be

\makeatletter
\DeclareUnicodeCharacter{AB}{%
  \og\@ifnextchar~{\@gobble}{}}
\makeatother

Say what you want, but I find this spacing awful. ;-)

share|improve this answer
    
The reason I type the space is that I am so used to it in all other environments that I cannot refrain from typing it when I write in TeX… And if I continue typing the ~, \ignorespaces isn't enough, I still get wrong spacing. –  F'x Sep 10 '12 at 23:26
    
@F'x With that definition just don't use ~. Since you probably use the T1 encoding, you can also write <<~directes~>> but with a slight difference in spacing (\og and \fg are designed for removing the little space in excess). –  egreg Sep 10 '12 at 23:30
    
I understand, but not using ~ isn't a solution for me. I'm sure LaTeX has a way of accomodating my particular need, rather than me having to do the extra work –  F'x Sep 10 '12 at 23:32
    
@F'x I've added an alternative definition that allows «~. –  egreg Sep 10 '12 at 23:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.