# How to leave a space after an em-dash with xspace

I wish to have a space between and after my em-dashes as I do not like the english tradition to collate them to the nearest words. xspace permits to leave spaces for macros but does not handle well the --- via its exception rules. There is an illustration on page 3 of its PDF http://mirror.ox.ac.uk/sites/ctan.org/macros/latex/required/tools/xspace.pdf to manage the -, but I cannot get it right for ---. \xspaceremoveexception{--(-)} does not seem to work because, evidently, I wish the en-dash -- to remain as it is: no space after the macro \mymacro--sometext, since by definition, these -- are used to indicate a range. Here is a MWE to illustrate with the hack commented from the PDF:

 %\RequirePackage{fix-cm}
\documentclass[twoside, a4paper, 11pt]{article}

\usepackage[T1]{fontenc}
\usepackage{xspace}

%\xspaceremoveexception{-}
%\makeatletter
%\renewcommand*\@xspace@hook{%
%\ifx\@let@token--%
%\expandafter\@xspace@dash@iii
%\fi
%}
%\def\@xspace@dash@i-{\futurelet\@let@token\@xspace@dash@ii}
%\def\@xspace@dash@ii{%
%\ifx\@let@token-%
%\else
%\unskip
%\fi
%-%
%}
%\makeatother

%\xspaceremoveexception{--}

\newcommand{\bla}{January}

\newcommand{\blaa}{{January}\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%é

\begin{document}

without xspace:\\
\bla --- ouoiuoiuou --- \bla ; \bla (\bla)

with xspace: the parenthesis improves, not the --- :\\
\blaa --- ouoiuoiuou --- \blaa ; \blaa (\blaa)

\blaa --December   \blaa--December

\blaa -December
\end{document}

%\xspaceremoveexception{-}
%\makeatletter
%\renewcommand*\@xspace@hook{%
%\ifx\@let@token-%
%\expandafter\@xspace@dash@i
%\fi
%}
%\def\@xspace@dash@i-{\futurelet\@let@token\@xspace@dash@ii}
%\def\@xspace@dash@ii{%
%\ifx\@let@token-%
%\else
%\unskip
%\fi
%-%
%}
%\makeatother

• Knuth defined somewhere a \dash macro which I have used in the past. – Mariano Suárez-Álvarez Sep 9 '13 at 3:49
• This question seems to have a better answer elsewhere, based on microtype: tex.stackexchange.com/a/109188/1340. You still write --- for an em-dash, and use microtype to give it extra kerning. – Blaisorblade Jun 28 '17 at 17:41

• Possibly adding \unskip at the front and \ignorespaces at the end to be on the safe side. – egreg Sep 9 '13 at 8:36