make4ht
make4ht copied to clipboard
'mathml'-option produces large division sign
LaTeX:
\begin{gather*}
\left|y_n-x_n\right| = \left[\left|y_n-x_n\right|^2\right]^{1/2} \leq \left[\sum_{i=1}^\infty (y_i-x_i)^2\right]^{1/2} < e/2 \,.
\end{gather*}
Compilation command:
make4ht markup.tex 'mathml,mathjax'
Correct output:
Erroneous output:
Problem summary: Division sign is too big when other large objects appear in the equation.
It seems that math table requires it's contents to be displayed in the inline style, it needs explicit displaystyle="true"
parameter to prevent it.
Try this configuration file:
\Preamble{xhtml}
\catcode`\:=11
\Configure{gather*}
{\HCode{<\a:mathml mtable\Hnewline \a:mathml displaystyle="true" \mml:class="gather-star">}}
{\HCode{</\a:mathml mtable>}}
{\HCode{<\a:mathml mtr>}} {\HCode{</\a:mathml mtr>}}
{\HCode{\Hnewline<\a:mathml mtd>}} {\HCode{</\a:mathml mtd>}}
\catcode`\:=12
\begin{document}
\EndPreamble
Did not work, strange. Did it work on your machine? I ran it with
make4ht -c $HOME/conf.cfg markup.tex 'mathml,mathjax'
Here is my configuration file:
\Preamble{xhtml,mathml,mathjax}
% Table fix last row (in the meantime)
\Css{.hline + .vspace:last-child{display:none;}}
\Css{.hline:first-child, .array-hline:first-child{border-bottom:1px solid black;border-top:none;}}
% \includegraphics relative width (will be included as an option in compile command)
\makeatletter
\ExplSyntaxOn
\Configure{Gin-dim}{style="width:\fp_eval:n{round(\Gin@req@width/\textwidth*100,2)}\char_generate:nn { `\% } { 12 }"}
\ExplSyntaxOff
\makeatother
% \implies, \impliedby, \iff (in the meantime)
\MathSymbol\mathrel{Longleftarrow}
\Configure{Longrightarrow} {\expandafter\csname x:unicode\endcsname{27F9}}
\Configure{Longleftarrow} {\expandafter\csname x:unicode\endcsname{27F8}}
%% \boxed command (in the meantime)
\catcode`\:=11
\Configure{boxed}
{\ifmathml \Tg<\a:mathml menclose \a:mathml notation="box">\Tg<\a:mathml mrow>%
\else \HCode{<span class="boxed">}\IgnorePar\fi}
{\ifmathml \Tg</\a:mathml mrow>\Tg</\a:mathml menclose>%
\else \HCode{</span>}\fi}
\catcode`\:=12
%% Font: \mathcal characters
\catcode`\:=11
\renewcommand\mathcal[1]{\bgroup\HCode{<\a:mathml mi\Hnewline data-mjx-variant="-tex-calligraphic" mathvariant="script">}#1\HCode{</\a:mathml mi>}\egroup}
\catcode`\:=12
%% Font change: {\bf E} (in the meantime)
\catcode`\:=11
\makeatletter
\def\:closemi{\HCode{</\a:mathml mi>}\EndPauseMathClass}
\def\bf{\ifmmode\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{\PauseMathClass\HCode{<\a:mathml mi mathvariant="bold">}\aftergroup\:closemi}{\bfseries}}
\makeatother
\catcode`\:=12
%% Long division sign
\catcode`\:=11
\Configure{gather*}
{\HCode{<\a:mathml mtable\Hnewline \a:mathml displaystyle="true" \mml:class="gather-star">}}
{\HCode{</\a:mathml mtable>}}
{\HCode{<\a:mathml mtr>}} {\HCode{</\a:mathml mtr>}}
{\HCode{\Hnewline<\a:mathml mtd>}} {\HCode{</\a:mathml mtd>}}
\catcode`\:=12
\begin{document}
\EndPreamble
You are right, I missed that. It seems to be again caused by the missing stretchy
parameter on the <mo>
element. This should fix that:
\Preamble{xhtml}
\Configure{MathClass}{2}{*}{<mo class="MathClass-bin" stretchy="false">}{</mo>}{}
\Configure{MathClass}{3}{*}{<mo class="MathClass-rel" stretchy="false">}{</mo>}{}
\begin{document}
\EndPreamble
There was still an error in the configuration for gather*
, but the fix is already included in TeX Live.
Yes, this worked. Hope to see this solution as default in the next update.
It should be already included in TeX Live, I've added it when I wrote my previous comment.