Any explanation for the following problem? The native LaTeX compiler has no problem with examples 1 and 2. On example 3 it complains: ‘Argument of \xhalign has an extra }’. When compiled in isolation, examples 2 and 3 produce the same tracing until \xhalign is invoked.
  \tracingcommands=2 
  \tracingmacros=2 
\documentclass{article} 
\begin{document} 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\catcode‘\@=11 
 
\def\eqnarray{% 
   \stepcounter{equation}% 
   \def\@currentlabel{\p@equation\theequation}% 
   \global\@eqnswtrue 
   \m@th 
   \global\@eqcnt\z@ 
   \tabskip\@centering 
   \let\\\@eqncr 
   $$\everycr{}\xhalign  \cr 
} 
 
\def\xhalign#1\cr{% 
   \halign to\displaywidth\bgroup 
       \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel 
      &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil 
      &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep 
         $\displaystyle{##}$\hfil\tabskip\@centering 
      &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup 
         \tabskip\z@skip 
      \cr 
} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
  \vbox\bgroup                                      %% example 1 %% 
    \begin{eqnarray}  x \end{eqnarray}% 
  \egroup 
 
  \begin{tabular}{c}                                %% example 2 %% 
    \vbox{% 
      \begin{eqnarray}  x \end{eqnarray}% 
    }% 
  \end{tabular} 
 
  \begin{tabular}{c}                                %% example 3 %% 
    \vbox\bgroup 
      \begin{eqnarray}  x \end{eqnarray}% 
    \egroup 
  \end{tabular} 
 
\end{document} 

Generated August 24, 2020 - tex4ht home page