Yes, I also get math images in SVG with no problem with breqn with
tex4ht, but they are all long on same line. No automatic
breaking as happens in the PDF, and this defeats
the whole reason for using breqn which is automatic breaking
of long equations.

Mathjax had feature in 2.7 for automatic line breaking for displayed math:

https://docs.mathjax.org/en/v2.7-latest/output.html#automatic-linebreaking

"The CommonHTML, HTML-CSS, and SVG output processors implement (most of)
the MathML3 automatic line-breaking specification. (The NativeMML
output processor relies on the browser’s native MathML support
to handle line breaking when it is used.) Since line-breaking
takes extra processing and so can slow down the mathematical output,
it is off by default, but you can enable it by adding, e.g.,

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  CommonHTML: { linebreaks: { automatic: true } },
  "HTML-CSS": { linebreaks: { automatic: true } },
         SVG: { linebreaks: { automatic: true } }
});
</script>
"

But they removed this in V 3.0 of mathjax. I tried to go back
to V 2.7 to try it, but it broke many things in my .cfg file,
so I kept things at V 3 for now.

https://docs.mathjax.org/en/latest/output/linebreaks.html

"Automatic line breaking has not yet been implemented in MathJax
version 3, but is high on our list for inclusion in a future release."

It is strange they had it in V 2.7 but not in current mathjax
version. May be it had problems.

If Mathjax can implement automatic breaking for long equations
to fit in current web page width, then the problem is solved.

Now I set the page width to around 700px, so that
text lines are not too wide and easier to read (one is supposed
to have no more than 8-10 words per line for ease of reading),
but then the long math equations go over this limit many times
and by wide margin making the pages not good to look at.  So not
sure what the solution is for this now.

I can control the size of images and wide tables, but can't
control the long math equations really, as these are
auto-generated.

Thanks for looking at it Michal.

On 9/25/2023 3:08 AM, Michal Hoftich wrote:
Hi Nasser,

I was wondering how hard it will be to have tex4ht
support fully the breqn package directly? i.e. generate
same math as that in PDF for long equations (but in svg mode).


I've tried an older test file you sent me, and all Breqn equations
were converted to images by default. What doesn't seem to work is the
long line-breaking feature, which is a bit problematic. TeX4ht sets
long line widths by default, so I thought that this may be the
problem, but even if I set these widths to a much smaller size, the
line breaking doesn't seem to work:

\Preamble{xhtml}
\makeatletter
\AddToHook{env/dmath/before}{% test that line width is really small:
\typeout{*************** linewidth: \the\linewidth, \the\eq@linewidth,
\the\displaywidth, \the\columnwidth}
}
\begin{document}
\textwidth=6em
\linewidth=\textwidth
\columnwidth=\textwidth
\eq@linewidth=\linewidth
\makeatother
\EndPreamble

I am not sure what is going on here, maybe Breqn uses also some other
dimensions or macros overridden by TeX4ht, so the line-breaking
doesn't work.

Best regards,
Michal

Reply via email to