[tex4ht] [bug #585] Math problems when using tikzpicture and forest with tex4ht

Nasser M. Abbasi puszcza-hackers at gnu.org.ua
Mon Nov 28 03:45:40 CET 2022


URL:
  <http://puszcza.gnu.org.ua/bugs/?585>

                 Summary: Math problems when using tikzpicture and forest with
tex4ht
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Mon Nov 28 02:45:40 2022
                Category: None
                Priority: 5 - Normal
                Severity: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:


There seems to be still problems using math with tex4ht and tikz when in
mathjax mode.

Here are two questions I posted for reference

https://tex.stackexchange.com/questions/666134/no-math-is-generated-when-using-tikz-forest-with-tex4ht-in-mathjax-mode


https://tex.stackexchange.com/questions/666705/no-math-is-generated-when-using-tikz-tikzpicture-with-tex4ht-in-mathjax-mode

The second one above is new and has screen shots of the problems. Basically
some math still does not display correctly using forest package in tikz and
when using tikzpicture all the math is missing.


Here is the problem. With the fix given in the above question now math shows
up when using forest but when using tikzpicture all the math is missing.

In addition, when using \left or \right even in forest it does not render
correctly in HTML.


---------------
Here is MWE

\documentclass[11pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz,tikzpagenodes}
\usepackage{etoolbox}
\usepackage{hyperref}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning,fit}    
\usepackage[edges]{forest}
\begin{document}

\begin{forest}
for tree={
    draw, rounded corners, fill=blue!20,
    minimum height=1.5cm, minimum width=2cm,
    align=center, base=b,
    s sep=1cm, l sep=.5cm,
    if level<=2{edge=-latex}{edge=red},
}
[\begin{minipage}{2cm}     
first order
{\begin{align*} 
       f(x,y,(y')^n)&=0\\
       y'&=\left(a + b x + y\right)^{\frac{1}{n}}
\end{align*} 
}
\end{minipage}
,calign=last
]
\end{forest}
------------------------------

Screen shots of output are at the above link

When compiled with make4ht (need to use .cfg below)

make4ht  -ulm default -a debug -c mycfg.cfg foo.tex "mathjax,htm" "-cunihtf
-utf8"

Here is the .cfg file thanks to michal.h21 from the above link

----------------------
\Preamble{xhtml}
\makeatletter
\AddToHook{env/forest/begin}{%
  \renewenvironment{align*}
  {\start at align \@ne \st at rredtrue \m at ne}
  {\math at cr \black@ \totwidth@ \egroup \ifingather@ \restorealignstate@
\egroup \nonumber \ifnum 0=`{\fi \iffalse }\fi \else $$\fi
\ignorespacesafterend}
}
\makeatother
\begin{document}
\EndPreamble
--------------------------

Using TL 2022 on Linux

>which tex4ht
/usr/local/texlive/2022/bin/x86_64-linux/tex4ht
>make4ht -v
make4ht version v0.3l
>

I might to change my setup to compile each tikz pic to separate pdf and
include those as images using \includegraphics if it is hard to fix these with
mathjax.

--Nasser








    _______________________________________________________

Reply to this item at:

  <http://puszcza.gnu.org.ua/bugs/?585>

_______________________________________________
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



More information about the tex4ht mailing list.