[tex4ht] [bug #485] tex4ht does not handle \ifdefined\HCode in mathjax mode when inside equation

Nasser M. Abbasi puszcza-hackers at gnu.org.ua
Fri Oct 2 06:00:02 CEST 2020


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

                 Summary: tex4ht does not handle \ifdefined\HCode in mathjax
mode when inside equation
                 Project: tex4ht
            Submitted by: nma123
            Submitted on: Fri 02 Oct 2020 06:59:00 AM EEST
                Category: None
                Priority: 5 - Normal
                Severity: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:


Screen shots at:

https://tex.stackexchange.com/questions/565039/tex4ht-does-not-handle-ifdefined-hcode-in-mathjax-mode

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}{@{}cc|c@{}}
\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="en-US" xml:lang="en-US" > 
<head><title></title> 
<meta  charset="utf-8" /> 
<meta name="generator" content="TeX4ht (https://tug.org/tex4ht/)" /> 
<meta name="viewport" content="width=device-width,initial-scale=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="MathJax-script"
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js"></script> 

</head><body 
>
<!--l. 23--><p class="noindent" >\[ \ifdefined \HCode \left [
\begin{array}{ccc} \else \left [ \begin{array}{@{}cc|c@{}} \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






    _______________________________________________________

Reply to this item at:

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

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


More information about the tex4ht mailing list.