michal-h21 / make4ht

Build system for tex4ht
131 stars 15 forks source link

Configuration file causes weird tilde $y$-characters #125

Closed togrul-topal closed 12 months ago

togrul-topal commented 12 months ago

Weird \tilde{y} in the following LaTeX

\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}

\begin{document}
Numbers $(\tilde{x},\tilde{y})$ satisfy
$$\tilde{x}=x, \quad \tilde{y} = y + x^3.$$
\end{document}

image

when running together with make4ht.cfg

\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
michal-h21 commented 12 months ago

It seems that there a different configuration for \tilde{y} is picked from somewhere. This configuration should fix it:

\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>}}

\Configure{accent}\tilde\tilde{{}{}}
  {}
  {\HCode{<\a:mathml mover\Hnewline accent="false"><\a:mathml mrow\Hnewline>}#2\HCode{</\a:mathml mrow>}%
    \:tilde:over  \HCode{</\a:mathml mover>}}
\catcode`\:=12

\begin{document}

\EndPreamble