# [tex4ht] Bizarre bug - \def\sp{...}

William F Hammond gellmu at gmail.com
Tue Nov 1 16:53:22 CET 2016

On Tue, Nov 1, 2016 at 6:10 AM, Hans Georg Schaathun <
georg+tex at schaathun.net> wrote:

> I tried to define an \sp macro in LaTeX, to do something like this:
>    \def\sp{\mathsf{span}}
>    $\sp\{x\}$
>    $x^2$
> There is no problem with pdflatex, but evidently tex4ht uses \sp for
> something special.  The first formula gives a parser error in firefox,
> and the second is not the simple power that it should be.
>

Unfortunately, latex.ltx (in the latex base) contains:  \let\sp=^

(Aside: I object to any markup that preempts one or two letter names
thereby blocking user convenience usage of such names.)

In this case replacing \sp with \Sp works around the problem.

In principle, with LaTeX \newcommand should be used instead of \def and
that should trap the prior usage.  But \renewcommand could then elude the
prior usage and does so with pdflatex.  But, alas, \renewcommand does not
get beyond this issue with tex4ht, which I think must be a bug.

-- Bill

---
William F Hammond
Email: gellmu at gmail.com