[tex4ht] [bug #337] tex4ht changes \_ in math mode to X in HTML when not including \usepackage[T1]{fontenc}

Michal Hoftich michal.h21 at gmail.com
Tue Aug 9 19:59:13 CEST 2016


Follow-up Comment #1, bug #337 (project tex4ht):

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} 

    _______________________________________________________

Reply to this item at:

  <http://puszcza.gnu.org.ua/bugs/?337>

_______________________________________________
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



More information about the tex4ht mailing list