Tue Aug 9 17:59:13 2016, comment #1:
The problem is clearly this definition from latex.4ht:
\NewConfigure{textundescore}[1]{\expandafter
\def\csname ?\string\textunderscore\endcsname{\leavevmode#1}}
\Configure{textundescore}{\HChar{95}}
\HChar includes special instruction for tex4ht DVI processor to replace next character (which is X) with character with value 95. As math is converted to image by other DVI processor (DVIPS or DVIPNG), which doesn't understand this instruction, the character which should be removed, X, remains here instead of _. we need to disable the use of \HChar in mathmode, use \mathunderscore instead.
As a workaround, you can try the following:
\documentclass[11pt]{article}
\ifdefined\HCode
\usepackage[utf8]{luainputenc}
% \usepackage[T1]{fontenc} %do not use. Make tex4ht \verb not accept different fonts
\else
\usepackage{fontspec}
\fi
\usepackage{amsmath,mathtools}
\begin{document}
\def\myunderscore{\ifmmode \mathunderscore\else\HChar{95}\fi}
\let\_=\myunderscore
\[
y = \_C1
\]
hello \_C1
\end{document}
|