Current problem is typesetting with the chemical packages. As would be expected, the PDF is produced without any problems but distinct issues arise with the html production using tex4ht.
The HTML file compiles fine without any red flags to me (except when trying to load the chemmacros package) however the expected and desired sub and super text scripts aren't successfully typeset.
Document is being compiled from a BAT file using the following, even though the entire "..." portion can be omitted and the same result obtained...
htlatex html_chem_textScripts.tex "html,mathplayer,early^,early_"
Contents of html_chem_textScripts.tex:
\documentclass{report}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage{siunitx}
\usepackage[version=3]{mhchem} % Package for chemical equation typesetting - needs to be before math loads
\DeclareSIUnit{\Co}{Co^{2+}}
\DeclareSIUnit{\Coe}{\ce{Co^{2+}}}
\ifdefined\HCode
% no alternative known at this point
\else
\usepackage{chemmacros}
\fi
\newcommand{\degC}{$\,^{\circ}\mathrm{C}$ }
\begin{document}
Investigating superscripts in html via htlatex. Problems observed siunitx packages (only pacakges tested so far other than math mode and chemmacros)
\begin{itemize}[noitemsep] % sets no itemsep for just this list
\item \si{\Co} using siunitx unit to typset
\item \si{\Coe} using siunnitx to typset with the ce command embedded.
\item $Co^{2+}$ produced in math mode
\item \ce{Co^{2+}} mhchem package
\item \ce{Co^2+} mhchem package without extra curly braces to group exponential
\end{itemize}
Bigger problem with chemmacros package \medskip
\ifdefined\HCode
\begin{verbatim}
chemmacros pacakge can't compile a \ch{Co2+} string in htlatex. Note. Package can't even be loaded...
Error produced:
! Undefined control sequence.
\pgfsys@svg@newline ->\Hnewline
l.190 \pgfusepathqfill}
?
\end{verbatim}
\else
Using chemmacros package, a nicely formated chemical equation can be produced in pdf mode, \ch{Co^2+} but throws a pdf error in html mode.
\fi
\end{document}
As can be seen from the HTML code below, the sub- and super- script instructions are even present when \ce{} was called from the mhchem package, but the 2+ is outside the code braces indicating to me that this time, it is not a browser or math script library problem but a compilation approach that might benefit if there was a config file or package option to get this working with tex4ht.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title></title><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script>
<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,mathplayer,early,early_ -->
<meta name="src" content="html_chem_textScripts.tex">
<meta name="date" content="2015-01-14 18:01:00">
<link rel="stylesheet" type="text/css" href="html_chem_textScripts.css">
</head><body
>
<!--l. 23--><p class="noindent" >Investigating superscripts in html via htlatex. Problems observed siunitx packages
(only pacakges tested so far other than math mode and chemmacros)
<ul class="itemize1">
<li class="itemize">Co<sup class="textsuperscript"><span
class="cmr-9">2+</span></sup> using siunitx unit to typset
</li>
<li class="itemize">Co<sub></sub>2+ using siunnitx to typset with the ce command embedded.
</li>
<li class="itemize"><span
class="cmmi-10">Co</span><sup><span
class="cmr-7">2+</span></sup> produced in math mode
</li>
<li class="itemize">Co<sub></sub>2+ mhchem package
</li>
<li class="itemize">Co<sub></sub>2+ mhchem package without extra curly braces to group exponential</li></ul>
<!--l. 33--><p class="indent" > Bigger problem with chemmacros package
<div class="verbatim" id="verbatim-1">
chemmacros pacakge can’t compile a \ch{Co2+} string in htlatex.  Note.  Package can’t even be loaded...
 <br />
 <br />
 <br />Error produced:
 <br />
 <br />! Undefined control sequence.
 <br />\pgfsys@svg@newline ->\Hnewline
 <br />
 <br />l.190   \pgfusepathqfill}
 <br />
 <br />?
</div>
<!--l. 48--><p class="nopar" >
</body></html>
Have I missed in the documentation of these packages (siunitx, mhchem, and chemmacros) an option to configure/specify when loading the package specifically for TeX4ht to apply/fix known HTML requirements? I have seen this in xcolor, graphicx, and hyperref to name a few.
Note: I also presume I am doing something not quite right with htlatex options such as early^ because it makes no difference whether it is used or not.
\pgfsys@svg@newline ->\Hnewlineis well known, see http://sourceforge.net/p/pgf/discussion/477362/thread/63c6fd79 – michal.h21 Dec 30 '14 at 20:24mhchemactually prints sub and super scripts, maybe it uses some non-standard way, it seems – michal.h21 Dec 30 '14 at 20:31pgf, maybe some comment in the bug tracker might caught some attention. Until it is fixed, modifying of the file seems to be the only solution, aschemmacrosfail immediately as soon as it is included. no patching can help in this case – michal.h21 Dec 30 '14 at 20:51htlatex xhtml,mathml. This creates mathml output for math, which doesn't work in all browsers, but you can use mathjax for support in all browsers: http://tex.stackexchange.com/a/68962/2891 – michal.h21 Dec 31 '14 at 20:54mhchem's author and he got subscripts and superscripts to work. He said he wants to do more changes in order to fully support html, so I suppose that some future version ofmhchemwill have fulltex4htsupport – michal.h21 Jan 15 '15 at 10:12tex4htoutput is feasible, correct and maintainable. – mhchem Mar 25 '15 at 21:59