# tex4ebook (or tex4ht) doesn't treat newcommand and sub/supscript well in math mode

I found that tex4ebook (or tex4ht) doesn't treat well with subscripts or superscripts in \newcommand. For example,

\documentclass{amsart}

\newcommand\dotimes{{\otimes}^{\mathbb L}}
\newcommand\powerab{a^b}

\begin{document}
Let's see $M\dotimes N$.

Let's see $M{\otimes}^{\mathbb L}_RN$.

Let's see $\powerab c$.
\end{document}


The \dotimes and \powerab are rendered wrongly (for example, here \powerab is rendered as ab (b seems rendered somewhat smaller, but not as a superscript), rather than a^b) without pic-m option. Is it good to replace newcommand by something else?

Sub and super scripts are bit complicated. tex4ht is being activated only after \begin{document}, so the commands defined in the preamble cannot use the configurations for sub and superscripts that are used later in the document. It is possible to use the early^ and early_ options to fix that:

tex4ebook filename.tex "early_,early^"


Better solution is to use the \sp and \sb commands, which works always:

\documentclass{amsart}

\newcommand\dotimes{{\otimes}\sp{\mathbb L}}
\newcommand\powerab{a\sp{b}}

\begin{document}
Let's see $M\dotimes N$.

Let's see $M{\otimes}^{\mathbb L}_RN$.

Let's see $\powerab c$.
\end{document}


• Can we put early^ and early_ in some way into config.cfg? Mar 29, 2019 at 11:23
• @FrankScience it seems that it is not possible, because the .cfg file is read at the end of preamble as well Mar 29, 2019 at 12:21