michal-h21 / make4ht

Build system for tex4ht
137 stars 15 forks source link

'mathml'-option messing up sub- and superscripts in specific situations #134

Open yalguzaq opened 1 year ago

yalguzaq commented 1 year ago

LaTeX

Example 1:

\documentclass[10pt]{article}
\usepackage{mathtools}

\begin{document}
\begin{equation*}
  \bigcap E_n^c
\end{equation*}
\end{document}

Example 2:

This works:
\begin{equation*}
  \begin{bmatrix}
    X_1^{1}\\
    \vdots\\
    X_1^{n}
  \end{bmatrix}
\end{equation*}
This does not:
\begin{equation*}
  \det\begin{bmatrix}
        X_1^{1}\\
        \vdots\\
        X_1^{n}
      \end{bmatrix}
    \end{equation*}

make4ht

make4ht file.tex 'mathml,mathjax'

Desired output

via make4ht file.tex 'mathjax' image

Erroneous output

image image

michal-h21 commented 1 year ago

This issue is a bit complicated because it is also related, for example, to \sum or \int, which use a similar mechanism, and I don't know how to differentiate these cases:

\documentclass[10pt]{article}
%\usepackage{mathtools}
\usepackage{amsmath}

\begin{document}
\begin{equation*}
  \bigcap E_n^c\\
  \bigcup E_n^c\\
  \bigodot E_n^c\\
  \bigoplus E_n^c\\
  \bigotimes E_n^c\\
  \bigsqcup E_n^c\\
\biguplus E_n^c\\
\bigvee E_n^c\\
\bigwedge E_n^c\\
\coprod E_n^c\\
\intop E_n^c\\
\ointop E_n^c\\
\prod E_n^c\\
\sum E_n^c\\
\end{equation*}

$
  \bigcap E_n^c\\
  \bigcup E_n^c\\
  \bigodot E_n^c\\
  \bigoplus E_n^c\\
  \bigotimes E_n^c\\
  \bigsqcup E_n^c\\
$

\begin{equation*}
  E_n^c
\end{equation*}

This works:
\begin{equation*}
  \begin{bmatrix}
    X_1^{1}\\
    \vdots\\
    X_1^{n}
  \end{bmatrix}
\end{equation*}
This does not:
\begin{equation*}
  \det\begin{bmatrix}
    X_1^{1}\\
    \vdots\\
    X_1^{n}
  \end{bmatrix}
\end{equation*}

$\det_{\rm sub}$

Integral \(\int_{a}^{b} x^2 \,dx\) inside text

\[ \int_{a}^{b} x^2 \,dx \]

\[
  \oint_V f(s) \,ds
\]

Sum $\sum_{n=1}^{\infty} 2^{-n} = 1$ inside text  Example of sum expression inside text

\[ \sum_{n=1}^{\infty} 2^{-n} = 1 \]

Product $\prod_{i=a}^{b} f(i)$ inside text

\[ \bigwedge_{i=a}^{b} f(i) \]

\end{document}