[tex4ht] [bug #488] \over does not give the same result as equivalent \frac
Michal Hoftich
puszcza-hackers at gnu.org.ua
Tue Oct 27 21:24:36 CET 2020
Follow-up Comment #3, bug #488 (project tex4ht):
I've modified the CSS code to produce a better result - the fractions are now
vertically aligned and font sizes are better:
------
\Preamble{xhtml}
\catcode`\:=11
\def\IgnoreRule{\ht:special{t4ht@\string_}}
\def\EndIgnoreRule{\ht:special{t4ht@\string_\string_}}
\def\a:mathml{}
% \Configure{over}
% {\Send{GROUP}{0}
% {<\a:mathml mfrac><\a:mathml mrow>}\HCode{</\a:mathml mrow>}}
% {\HCode{<\a:mathml mrow>}\Send{EndGROUP}{0}
% {</\a:mathml mrow></\a:mathml mfrac>}}
\Configure{over}
{\Send{GROUP}{0}{<span class="fraction"><span
class="top">}\IgnoreRule\HCode{</span>}}
{\HCode{<span
class="bottom">}\EndIgnoreRule\Send{EndGROUP}{0}{</span></span>}}
\Css{
.fraction {
display: inline-flex;
flex-direction: column;
padding: 0 2px;
align-items: center;
font-size:70\%; % to get correct box size
vertical-align: 50\%;
}}
% reset font size, it will be downsized to 70% by HT fonts
\Css{.fraction span{font-size:1rem;}}
\Css{.top {
border-bottom: 2px solid grey;
}}
\Configure{$}{\HCode{<span
class="math-inline">}\DviMath}{\EndDviMath\HCode{</span>}}{}
\catcode`\:=12
\begin{document}
\EndPreamble
-----------
We will definitely add this to TeX4ht sources once we find a good CSS that
works in all cases. We may use this method also for \frac and other more
complicated formatting that uses images at the moment. It should result in
much better inline math than in the current state, where text and images are
used. We may even try to use it for display math, where we use images by
default.
_______________________________________________________
Reply to this item at:
<http://puszcza.gnu.org.ua/bugs/?488>
_______________________________________________
Message sent via/by Puszcza
http://puszcza.gnu.org.ua/
More information about the tex4ht
mailing list.