Fri Oct 2 03:59:00 2020, original submission:
Screen shots at:
https://tex.stackexchange.com/questions/565039/tex4htdoesnothandleifdefinedhcodeinmathjaxmode
This is the first time I found where tex4ht does not process \ifdefined\HCode.
I put \ifdefined\HCode inside an equation, since I need different code for HTML vs. pdf mode.
tex4ht does not process the ifdefined and leave it there. When mathjax sees it, it complains since mathjax offcourse does not know anything about ifdefined\HCode.
When the code is compiled not using mathjax it works OK. But I need to use mathjax.
Here is MWE
=================
\documentclass[12pt]{article}
\usepackage{array}
\begin{document}
\[
\ifdefined\HCode
\left[
\begin{array}{ccc}
\else
\left[
\begin{array}{@{}ccc@{}}
\fi
3 i&3 &0\\
3 &3 i &0
\end{array}
\right]
\]
test
\end{document}
=======================
The above compiled OK using lualatex foo3.tex and gives
[PIC]
This is the raw HTML. it shows the \ifdefined\HCode was not processed and left in there
=================
<!DOCTYPE html>
<html lang="enUS" xml:lang="enUS" >
<head><title></title>
<meta charset="utf8" />
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)" />
<meta name="viewport" content="width=devicewidth,initialscale=1" />
<link rel="stylesheet" type="text/css" href="foo3.css" />
<meta name="src" content="foo3.tex" />
<script>window.MathJax = { tex: { tags: "ams", inlineMath: [ ["\\\(","\\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true, processEnvironments: true, packages: ['base', 'color', 'ams'] }, loader: { load: ['[tex]/color', '[tex]/ams'] } }; </script>
<script type="text/javascript" async="async" id="MathJaxscript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/texchtmlfull.js"></script>
</head><body
>
<!l. 23><p class="noindent" >\[ \ifdefined \HCode \left [ \begin{array}{ccc} \else \left [ \begin{array}{@{}ccc@{}} \fi 3 i&3 &0\\ 3 &3 i &0 \end{array} \right ] \]
</p><!l. 25><p class="indent" > test
</p>
</body>
</html>
===========================
Compiled using make4ht ulm default a debug foo3.tex "htm" works with no problem
The problems seems that tex4ht does not look inside the equation to see that there is something to do, and just passes the whole thing to mathjax.
TL 2020
