# How to suppress the space before the colon, in French language?

I would like to suppress the space before the colon, when using [french]babel. I only want to change this locally (that is not everywhere in the document, but just at some place).

\documentclass{article}
\usepackage[french]{babel}

\begin{document}
Il est 20:20.
\end{document}


• How about 20{:}20? Not sure. Jan 20, 2014 at 12:49
• No, it prints the same. Jan 20, 2014 at 12:58
• For a similar problem when using polyglossia instead of babel see tex.stackexchange.com/questions/187864/… Dec 30, 2018 at 10:16

I'm not sure this is the usual way to denote time in French; here's a workaround:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\edef\hc{\string:} % \hc prints a normal colon

\begin{document}
Il est 20\hc20.
\end{document}


Alternatively, use datetime:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{datetime}

\newcommand\heure[2]{\formattime{#1}{#2}{00}}

\begin{document}
Il est \heure{20}{20}
\end{document}


• I think the usual way to denote time in French is 20h20. Jan 20, 2014 at 17:33
• @giordano I also suspect “20:20” is not common. Jan 20, 2014 at 17:35
• It is true, but in some contexts, 20:20 is better. For instance, if you say : "The digital alarm clock was displaying 20:20". Jan 21, 2014 at 10:56

Your problem is with the Babel shorthand for :. To disable this shorthand use \shorthandoff{:} inside your \begin{document}. It will not work when loaded in the preamble.

To re-enable the shorthand, use \shorthandon{:}.

\documentclass{article}
\usepackage[french]{babel}

\begin{document}
\shorthandoff{:}
Il est 20:20.

\shorthandon{:}
Il est 20:20.
\end{document}


• Good suggestion, but doesn't work with XeLaTeX ... the log file suggests using \NoAutoSpacing instead. Apr 27, 2016 at 20:35

As suggested by PatrickT and mentioned in French internationalisation, override babel default spacing, \NoAutoSpacing is the easiest solution in modern (post-2011) TeX distributions.

\documentclass{article}
\usepackage[french]{babel}

\begin{document}
Il est {\NoAutoSpacing 20:20}.
\end{document}

• Could you please add a MWE? Aug 12, 2016 at 10:43
• edit: added a MWE Sep 6, 2017 at 7:17
• See also the documentation of Babel French daniel.flipo.free.fr/frenchb/frenchb-doc.pdf This command is necessary for example for natbib bibliography style plainnat (and \shorthandoff does not work in that case). Sep 22, 2018 at 13:54