# Missing <sub> tags in tex4ht output

When processing a LaTeX source with tex4ht, I can't seem to reliably convert subscripts in text mode to <sub> tags in the HTML output. My only solution so far is to switch to math mode. But for some reason, if I define the same math code as a macro with \newcommand (to avoid typos when typing long math expressions), the <sub> tags are gone again!

Example source:

\documentclass[10pt]{article}
\usepackage{subscript}
\newcommand{\tsub}{$a_b$}
\begin{document}
x\textsuperscript{n}
y\textsubscript{1}
$a_b$
\tsub{}
\end{document}


... which I process using:

htlatex example.tex 'html, charset=utf-8' ' -cunihtf -utf8'


Is there an easy way to make tex4ht honor \textsubscript or $_{}$ commands in \newcommand macros?

Thanks for any suggestion,

--Mathieu

-
Also, I don't know if there is something I should do to tag the question as solved (upvoting requires more reputation than I have)... –  Mathieu Aug 27 '12 at 9:29
yeah, version with math environment seems little bit hackish to me, in text is \textsubscipt much better –  michal.h21 Aug 27 '12 at 10:29
accepting suffices, but you can try also upvoting, I think you have enough reputation –  michal.h21 Aug 27 '12 at 10:30

It seems there is no configuration for subscript package, so you must create one. Configurations for packages are stored in files with extension .4ht, so for subscript create subscript.4ht:
\NewConfigure{textsubscript}{2}

This file will be automatically loaded by tex4ht when you call \usepackage{subscript}