I have used xspace
for a long time to take care of adding space after usage of some macros. Usually, it is with a macro to format a word consistently, as in:
\documentclass[]{article}
\usepackage{xspace}
\begin{document}
\newcommand{\matlab}{\textsc{matlab}\xspace}
\newcommand{\enterprise}{\emph{USS Enterprise\nocorr}\xspace}
For me, \matlab is the best; I like to program in \matlab.
The \enterprise was a famous ship.
\end{document}
In a recent question, I made the comment that
The
xspace
package is very nice to avoid the need for{}
at every use of a macro defined in such a manner.
It was replied to me that
Many people say so, but the author of xspace isn't so sure: Drawbacks of xspace
The conclusion at the referenced post is "if you find it useful, fine, it's there. But personally I [David Carlisle, original author of xspace
] wouldn't recommend it."
Yet, an answer not too long after by egreg seems to use xspace
without hesitation, recommending it implicitly in the use of simple macros, e.g.:
\usepackage{xspace}
\newcommand{\Poincare}{Poincar\'e\xspace}
\newcommand{\adele}{ad\`ele\xspace}
\newcommand{\Cech}{\v{C}ech\xspace}
\newcommand{\Erdos}{Erd\H{o}s\xspace}
\makeatletter
\newcommand{\etale}{\'etal\@ifstar{\'e}{e\xspace}}
\makeatother
So, my questions come down to these three:
Are there any acceptable (non-controversial) use cases for
xspace
? (perhaps the case as shown above from egreg, similar to my original example?)What types of cases might the use of
xspace
actually cause problems? (Is it just things like the italic correction of the\enterprise
example above?)If problems in spacing are caused via a macro, will
xspace
fail in the same way with every use of that macro, or will it be dependent on the context where the macro is used?
\xspace
, but for those commands, which are likely to appear just in “quiet” places, it can be employed. The case of\emph{\Poincare}
(where\xspace
could fail to add the italic correction) might have been mentioned.