# [texhax] Macro problem after updating xspace

Uwe Lueck uwe.lueck at web.de
Thu Sep 21 19:44:16 CEST 2006

"KKThird at Yahoo.Com" <kkthird at yahoo.com> schrieb am 21.09.2006 12:45:07:
[look up yourself, it seems to have been a HTML mail which I can't insert
here at present]

The query is an example for quite a number of items in

http://catb.org/~esr/faqs/smart-questions.html

I find it difficult to guess what  you have updated and what not,
what you expect your version of \upsilon to do,
what works and what doesn't work (the two example files
are identical),
and how the problem is related to \bm (where do you want
to apply it?).

However in trying myself I found a problem which -- I guess --
has puzzled you. \xspace involves \protect and \futurelet\@let at token,
and \bm seems to disable the \protect and tries to expand \@let at token.
More generally, any attempt of using \protect to execute an assignment
in typesetting mode only fails within $\bm{...}$. I am preparing a
latex bug report; you find an example file below.

This has nothing to do with txfonts, and the same happens
with earlier versions of \xspace, so updating xspace can't
be responsible. If any update caused the problem, it may
have been updating the bm package. I am unable at the
moment to investigate this.

For using \xspace together with \bm, you should be aware of
the following:
\bm needs math mode, so when \xspace is involved in
\bm{...}, it has no effect anyway (unless within an \hbox or so).
Perhaps you should use some \yspace in place of \xspace
where

\newcommand{\yspace}{\relax \ifmmode \else \xspace \fi}

Hope this helps,

Uwe.

%% bmfragil.tex
\documentclass{article}
\usepackage{bm}
\makeatletter
\DeclareRobustCommand{\LettingAt}{\let\@let at token=x}
\newcommand{\FragileLettingAt}{\let\@let at token=x}
\makeatother
\DeclareRobustCommand{\LettingNoAt}{\let\mylettoken=x}
\newcommand{\ProtectingLettingNoAt}{\protect\FragileLettingNoAt}
\newcommand{\ProtectingLettingAt}{\protect\FragileLettingAt}
\newcommand{\FragileLettingNoAt}{\let\mylettoken=x}
\begin{document}
% $\bm{\LettingNoAt}$
% $\bm{\LettingAt}$
% $\bm{\ProtectingLettingNoAt}$
% $\bm{\ProtectingLettingAt}$
% $\bm{\protect\FragileLettingNoAt}$
$\bm{\protect\FragileLettingAt}$
\end{document}