# [tex4ht] spaces in math

Michal Hoftich michal.h21 at gmail.com
Mon Feb 15 13:30:10 CET 2021

Dear Tomáš,

the "~" character produces different outputs depending on whether it
is used in math or not. You can try  the following configuration that
doesn't make any checks:

\Preamble{xhtml}

\Configure{ }{\csname :nbsp\endcsname}
\begin{document}
\EndPreamble

It may produce new errors in your real document, but it seems to work
with the test file you provided.

Best regards,
Michal

On Wed, Feb 10, 2021 at 10:25 PM Tomas Davidek <Tomas.Davidek at cern.ch> wrote:
>
> Dear all,
>
>      I noticed a strange feature. Sometimes, the math spacing does not
> work well. A typical case
>
> =====
>
> \newcommand{\mev}{\ifmmode \mathrm{MeV}\else MeV\fi}
>
> Svislými čarami jsou označeny dopplerovské meze $E_1 = (53{,}6\pm > 2{,}8)~\mev$.
>
> =====
>
> Of course in pdflatex everything works well, but in some cases the
> tex4ht results in no space between the number and the unit. I very often
> use the form $X = 88~\mev$. In most cases the expression is translated
> correctly to HTML, but sometimes it fails.
>
> I picked some cases from my large document and entered affected
> sentences in the attached document. If I compile it now with make4ht,
> everything displays correctly.
>
> Does anyone have an idea what could be wrong and how to systematically
> avoid this kind of problem, please? Of course it may help to
> systematically write $X = 88\ \mev$ or $X = 8$~{\mev}, but this would
> requite quite a lot of manual work....
>
> Thanks a lot for any hint.
>
> Cheers,
>
>                     Tomas
>