[tex4ht] two additional issues converting latex to HTML with mathjax.

Nasser M. Abbasi nma at 12000.org
Wed Sep 12 01:36:19 CEST 2018


On 9/11/2018 9:35 AM, Michal Hoftich wrote:
> Hi Nasser.
> 
>> So If  I can learn how to make one work in the .cfg file so that mathjax
>> renders it OK, I'll add the rest myself. Here is an example of two
>> such cases:
> 
> MathJax has in contrast to tex4ht extensive documentation, so I am
> sure you should be able to find some examples here.
> The tricky thing are commands with parameters, as the config file
> produces errror when #1 is uses inside the configuration.
> I've found a workaround using LaTeX3 regexes:
> 
> --------------------
> \RequirePackage{mathjax-latex-4ht}
> \Preamble{xhtml}
> \begin{document}
> \edef\mymathjaxconf{\detokenize{MathJax.Hub.Config({
>          TeX: {
>    Macros : {
> relax: "{}",
> setlength: ["{}", 2],
> RootOf: "\\mathrm{RootOf}",
> Ei: "\\mathrm{Ei}",
> Aboxed: ["\\boxed{#1}", 1]
> }},
> });}}
> 
> \ExplSyntaxOn
> \regex_replace_all:nnN{ \x{23}\x{23}}{\x{23}}{\mymathjaxconf}
> \ExplSyntaxOff
> 
> \Configure{@HEAD}{\HCode{<script
> type="text/x-mathjax-config"> \mymathjaxconf</script>}}
> \EndPreamble
> --------------
> 
> 
> I cannot find a solution for the \Aboxed command, I cannot get box at all.
> 
> Aboxed: ["\\boxed{#1}", 1]
> 
> doesn't seem to work. I am sure some MathJax people can a solution for that.
> 
> Best,
> Michal
> 

Thanks Michal.

Your fix for \DeclareMathOperator worked very well.

Not able to use \Aboxed inside align is not a big problem.
I changed my program not to generate it.

\boxed works OK in \begin{equation} or \[...\] so
I can used \boxed there even with mathjax.

So I think I will switch to using Matjax with make4ht for
now as it is much much faster.

Btw, I found another one. \allowbreak is not supported in
mathjax:

-------------------
\documentclass[11pt]{article}

\usepackage{amsmath,mathtools,amssymb}
\begin{document}

\begin{align*}
\left(  \frac{1}{1-\left(\allowbreak 3.\,574\,4\right)  ^{2}}\right)
\end{align*}
                   
\end{document}
--------------------

But fixed it by adding

    allowbreak: "{}",

To the .cfg macros you had there.

\allowbreak is autogenerated by Scientific word Latex export, and
and there is no way to disable this.

I also noticed if I use "pic-align" options, then alot of
the math do not show up on the page. So I removed "pic-align"!

The command I use now is

make4ht -ulm default -e ~/new.mk4 -c ~/nma_mathjax.cfg
    filename.tex "htm,3,notoc*,p-width,charset=utf-8" " -cunihtf -utf8"

Thanks again for all your expert help. I will write a small
document to show the layout and how to use mathjax with make4ht
and add it to my tex4ht cheat sheet soon.

--Nasser


More information about the tex4ht mailing list