I am preparing a document in French, using the "babel" package with option "french" and using commands that include colons and semicolons. My problem is, the French spacing before colons and semicolons disappears when the commands are printed. I do not understand why, have not been able to find an answer. Below is a MWE.

\newcommand\deuxpoints{Texte: texte}
Texte: texte

The problem

  • 2
    My guess is that when you define \deuxpoints the colon is not yet active. You can get what a space if you define \deuxpoints after \begin{document}
    – moewe
    Commented Jun 23, 2018 at 16:00
  • That is it. Very stupid of me not to have thought of that. Thanks a lot.
    – Rpy
    Commented Jun 23, 2018 at 16:03
  • 1
    By the way, this is the main reason, IIRC, why the KOMA-Script manual suggests to use the \title, \author, etc. macros after the \begin{document}. To have any active characters in the arguments behave normally, as in the rest of the document.
    – frougon
    Commented Jun 23, 2018 at 16:07

1 Answer 1


As pointed to in the previous comments, babel set the active characters :!?; only at \begin{document}, by using \AtBeginDocument.

One could keep the definition in the preamble by using the command \shorthandon{:} just before the definiion of \deuxpoints and \shorthandff{:} just after.

Another solution is to add the KeepShorthandsActive in the option passed to babel.

Surprisingly, the etoolbox hook \AfterEndPreamble would be supposed to fix the problem but does not directly work.

See this post

  • \AfterEndPreamble tokens will be executed when shorthands are not yet activated.
    – egreg
    Commented Jun 24, 2018 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .