This MWE compiles OK with lualatex but fails in tex4ht once hyperref is added.



\caption{Phase plot $y^{\prime \prime}\left(t \right)+9 y \left(t \right)-\left(\left\{\begin{array}{cc}
8 \sin \left(t \right) & 0<t <\pi  
 0 & \pi <t  
\end{array}\right.\right) = 0$}


And now

 make4ht -ulm default -a debug  foo.tex "mathjax,htm"


(./foo.aux) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/ts1cmr.fd)
[1] [2]
l.9 --- TeX4ht warning --- File `"example-image-a.xbb"' not found ---
l.9 --- TeX4ht warning --- Cannot determine size of graphic in "example-image-a
.xbb" (no BoundingBox) ---
! Undefined control sequence.
<argument> \EndPicture 
l.14 \end{array}\right.\right) = 0$}

Removing hyperref it compiles clean. (ps. I used test image above so it can compile as is). Same error is generated with a real image file.

Is there a workaround for this?

TL 2022 on Linux

Fyi, link to ticket add.

  • Just out of curiosity: Why do you write y^{\prime \prime}, when y'' is both simpler and clearer? What is the purpose of writing \left(t \right) instead of (t)?
    – Mico
    Dec 25, 2022 at 3:43
  • @Mico the math is auto-generated by Maple. I just put the Latex translation of the equation there. This is how all CAS systems generate Latex. Same for left and right.
    – Nasser
    Dec 25, 2022 at 4:14
  • Hope \caption[]{...} also will works, but not yet tested
    – GowriSaro
    Dec 26, 2022 at 14:49

1 Answer 1


This is caused by the fact that \begin and \end are redefined by TeX4ht, but not as robust commands. When you load Hyperref, expanded contents of \caption are saved in a macro for further processing, which leads to this error. The fix is to declare \begin and \end as robust commands. The fixed latex.4ht is too huge to be posted here, but you can use this config file:



\DeclareRobustCommand\begin[1]{\csname @begin:#1\endcsname
    {\let\choose:begin\@firstoftwo \ifx \EndPicture\:Undef
   \PushStack\envn:list\n:list  \SaveEverypar
\ifx \EndPicture\:UnDef  \list:save
\let\after:end\empty   \csname before:begin#1\endcsname   \fi
  {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
          \ifx \EndPicture\:UnDef
   \ifx \this:listConfigure\empty
       \null:listConfigure  \csname on#1:list\endcsname \fi
          \csname #1\endcsname

  \ifvmode \ifx \EndPicture\:UnDef
     \ifx \:tempa\hline \expandafter\\\else\fi
\csname end#1\endcsname%
  \ifx \chk:pic\:UnDef
     \csname after:end\endcsname
\expandafter\let\csname after:end\endcsname\:UnDef
\ifnum \:tempb=\n:list \else
   \def\:temp{#1}\def\:tempa{thebibliography}\ifx \:temp\:tempa
   \else\:warning{\string\SaveEverypar's: \:tempb\space at
          \string\begin{#1} and \n:list\space \string\end{#1}}%
\fi \fi

I will also fix it in the TeX4ht sources, so it will be unnecessary after TeX Live update soon.

This is the result:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .