[Tex/LaTex] Missing space after “guillemets”

babelfrenchspacing

I have a problem with the \og and \fg characters for opening and closing "guillemet". The closing guillemet is always too close to whatever follows, in other words, there is missing space between \fg and the next word that follows. I'm using TeXmaker, and a typical piece of code where the problem occurs is

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\begin{document}
Lalala \og blabla \fg lalala.
\end{document}

Best Answer

If you want to get the correct spacing between \fg and a word following it, you have to add an empty statement {} after it.

This because the definition of \fg in frenchb.ldf resorts to the definition of \FB@fg which is

\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
                           \FBguill@spacing\guillemotright\xspace}

As you can see, this command takes no arguments, so it inserts no space after it, if you don't break the command explicitly with {} (or \ which is not advisable).

The behavior is the same as if you define a new command with no arguments

\newcommand{\qqq}{qqq}

and use it as

\qqq word

MWE

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\begin{document}
Lalala \og blabla \fg{} lalala.
\end{document} 

enter image description here

You can also notice that the definition of \FB@fg contains an \xspace at its end. This means that, if you don't want to insert {} each time you use \fg, you can simply load the package xspace.

The following MWE gives the same result as in the above picture:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{xspace}
\begin{document}
Lalala \og blabla \fg lalala.
\end{document} 
Related Question