# soul for text highlighting, microtype for letterspacing, and xspace: incompatibility

I am trying to use soul for highlighting text and microtype for letter spacing (and other things). But I cannot get the two to work together nicely when I include xspace (I use this mainly for abbreviations).

\documentclass{scrartcl}

\usepackage{xcolor}
\usepackage{xspace}
\usepackage{textcase}
\usepackage{soulutf8}
\usepackage{microtype}

\newcommand\myabbrev[1]{\MakeTextLowercase{\textsc{\textls{#1}}}\xspace}

\def\XSPACE{\myabbrev{xspace}}
\def\HIGHLIGHT{\myabbrev{highlight}}
\soulregister{\XSPACE}{7}% breaks \xspace
\soulregister{\HIGHLIGHT}{0}% breaks \texthl

% \def\TEST/{\myabbrev{TEST}}
% \soulregister{\TEST}{7}% does not work

\begin{document}

\texthl{Now \XSPACE does not work}. \\ \bigskip

\texthl{Now \HIGHLIGHT does not work}.

\end{document}


If I use \soulregister ... {7} then xspace has no effect. If I use \soulregister ... {0} then xspace works, but the highlighting does not work.

Is it possible to fix this? If not, I would also be happy to use the "delimited macro" approach (i.e. \def\TEST/{\myabbrev{text}) so that I do not forget the space. But this does not appear to work with soulregister, i.e \soulregister{\TEST/}{7} does not work.

• I'm not at all surprised. ;-) – egreg Feb 6 '15 at 15:04
• @egreg Well, knowing most of the discussions on xspace and soul, I hesitated to ask the question. But this has been nagging me for some time... – Jörg Feb 6 '15 at 15:28
• What's the reason for using \xspace in a command with an argument? The only one I can think to is “trying to shoot at one's own foot”. – egreg Feb 6 '15 at 18:31
• @egreg Okay, I forget about using \xspace. Any idea regarding \soulregister{\TEST/}{7}? – Jörg Feb 11 '15 at 16:23