I am using the tex4ht config file here to leave math unchanged. However, I am getting a spurious space after commands such as \text{A} which get compiled as \text {A}. How to get rid of such spaces? Here's a MWE:
.tex
%Minimal example about extra spurious space
\documentclass[12pt]{article}
\usepackage[latin9]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[english]{babel}
\begin{document}
Next, some weird font stuff: $\mathbb{A}$, $\mathrm{A}$, $\text{A}$.
\end{document}
.cfg
\Preamble{xhtml,-css,NoFonts}
\newtoks\eqtoks
\def\AltMath#1${\eqtoks{$#1$}%
\HCode{\the\eqtoks}$}
\Configure{$}{}{}{\expandafter\AltMath}
\begin{document}
\EndPreamble
output:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- html,xhtml,-css,NoFonts -->
<meta name="src" content="test.tex" />
<meta name="date" content="2018-05-01 11:27:00" />
</head><body
>
<!--l. 11--><p class="noindent" >Next, some weird font stuff: $\mathbb {A}$, $\mathrm {A}$, $\text {A}$. </p>
</body></html>