Open yalguzaq opened 11 months ago
The problem here is that when you enclose TikZ environment in math, it won't get parsed by LaTeX and it will end verbatim in the output HTML. It is not something that can be fixed easily without modification of your source file.
What I would do is this: define a new environment which switches to the math mode by default, and then redefine it in the TeX4ht config file to start picture before switching to math. In this way, you will enforce creation of the picture.
Here is the TeX file:
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\newenvironment{pictenv}{\[}{\]}
\begin{document}
\begin{pictenv}
\begin{tikzcd}[arrows=to]
\cdots \rar & H_n(A \cap B) \rar & H_n(A) \oplus H_n(B) \rar & H_n(X) \rar & \hphantom{0}\\
\hphantom{\cdots} \rar
& H_{n-1}(A \cap B) \rar
& \makebox[\widthof{$H_n(A) \oplus H_n(B)$}][c]{$\cdots\hfill \cdots$} \rar
& H_0(X) \rar & 0
\end{tikzcd}
\end{pictenv}
\end{document}
The configuration file can look like this:
\Preamble{xhtml}
\renewenvironment{pictenv}{\Picture*{}$$}{$$\EndPicture}{}{}
\begin{document}
\EndPreamble
The \Picture*{}...\EndPicture
code should force the image creation.
LaTeX
make4ht