1.2 AMS Math

<..configure jsmath amsmath..>
 \expandafter\def\csname genfrac \endcsname#1#2#3#4{%
   \def\:tempa{#1}\ifx\:tempa\empty\else \HCode{\string\left}#1\fi
   \def\:tempa{#2}\ifx\:tempa\empty\else \def\:tempa{\HCode{\string\right}#2}\fi
   \edef\@tempb{\@nx\@genfrac\@mathstyle{#4}%
     \expandafter\noexpand\csname @@\ifx @#3@over\else above\fi
     \endcsname}%
   \@tempb{#3}}
 \def\:tempc#1#2#3#4#5{{\a:genfrac#1\b:genfrac{\c:genfrac#4#2#3\relax
    {\d:genfrac#5\e:genfrac}}\f:genfrac}\:tempa}
 \HLet\@genfrac\:tempc
-_-_-

<..configure html-jsmath amsmath..>
 \ifx \mathdisplay@@pop\:UnDef
    \ifx \emdf@La\:UnDef
       <.amsmath html-jsmath pre 2000.>
    \else
       <.amsmath html-jsmath jan 2000.>
    \fi
 \else
    <.amsmath html-jsmath july 2000.>
 \fi
-_-_-

<..configure html-jsmath amsmath..>+
 \Configure{equation$$}
   {\Configure{$$}
    {\IgnorePar \Configure{@math}{div}\EndP\DviMath}
    {\EndDviMath\EndP}
    {\DisplayMathtrue}%
   }
-_-_-

<..configure jsmath amsmath..>+
 \Configure{tmspace}
    {\HCode{\string\kern \space \textspace\space}}
 \def\lvert{\HCode{\string\vert\space}}
 \def\rvert{\HCode{\string\vert\space}}
 \def\lVert{\HCode{\string\Vert\space}}
 \def\rVert{\HCode{\string\Vert\space}}
-_-_-

Changes to fix bugs reported by Rob Beezer’s <[email protected]>: Configuration for \intertext introduced.

<..configure jsmath amsmath..>+
 \Configure{intertext}
     {\IgnorePar %\ifinalign@
       \HCode{\string\cr }%
      \AA:text{intertext}}
     {\BB:text \ifvmode \IgnorePar \fi %\EndP
         \HCode{\string\cr }}
-_-_-

<..configure jsmath amsmath..>+
 \ConfigureEnv{multline}
    {\bgroup \Configure{$$}
                {\Configure{@math}{}\IgnorePar \EndP\DviMath }
                {\EndDviMath\ShowPar\csname par\endcsname
                   {\csname HCondtrue\endcsname\noindent}}
                {\DisplayMathtrue}%
    } {\egroup}
    {}{}
 \Configure{multline}
    {\HCode{<table class="multline"><tr><td><span class="math">}}
    {\HCode{</span></td></tr></table>}}
    {\ifnum \HRow> 1\HCode{</span></td></tr>\Hnewline
                                 <tr><td><span class="math">}\fi}
    {\gdef\mult:amp{\gdef\mult:amp{\HCode{</span></td>
                        <td class="eq-no"><span class="math">}}}}
    {\csname mult:amp\endcsname \HCode{\ifnum 1<\HMultispan
 %       \string\multicolumn\l:brace\HMultispan\r:brace
         %\string\multispan
         ?span/multispan-in-jsmath?
         \space\HMultispan\space
      \fi}%
    }  {}
 \Css{table.multline td {text-align:left;
                   vertical-align:middle; padding-left: 2em; }}
 \Css{table.multline td.eq-no { text-align:center; }}
 \Css{table.multline { width:100\%; }}
-_-_-

<..configure jsmath amsmathNO..>
 \ConfigureEnv{multline}
    {\bgroup <.display math-.>} {\egroup}
    {}{}
 \Configure{multline}
    {\HCode{\string\begin\l:brace array\r:brace
               \l:brace lp{10mm}r\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\space}\qquad\fi}
    {\gdef\mult:amp{\gdef\mult:amp{\HCode{\a:math:amp}\qquad}}}
    {\csname mult:amp\endcsname \HCode{\ifnum 1<\HMultispan
 %       \string\multicolumn\l:brace\HMultispan\r:brace
         <.multi span.> \space\HMultispan\space
      \fi}%
    }  {}
-_-_-

<..configure jsmath amsmath..>+
 \ConfigureEnv{multline*}
    {\bgroup <.display math-.>} {\egroup}
    {}{}
 \Configure{multline*}
    {\HCode{\string\begin\l:brace array\r:brace
               \l:brace lr\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}
    {}
-_-_-

<..display math-..>
 \Configure{$$}
    {\Configure{@math}{div}\IgnorePar
     \EndP\DviMath }
    {\EndDviMath\ShowPar\csname par\endcsname
      {\csname HCondtrue\endcsname\noindent}}
    {\DisplayMathtrue}%
-_-_-

<..configure jsmath amsmath..>+
 \Configure{subarray}
    {\HCode{\string\begin\l:brace array\r:brace
                         \l:brace \Hlcr\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}  {}
 \Configure{smallmatrix}
    {\HCode{\string\begin\l:brace matrix\r:brace}}
    {\HCode{\string\end \l:brace matrix\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}  {}
    {\HCode{\ifnum \HCol>1 \a:math:amp\fi \scriptstyle
             \ifnum 1<\HMultispan
 %        \string\multicolumn\l:brace\HMultispan\r:brace
         <.multi span.> \space\HMultispan\space
     \fi}%
    }  {}
-_-_-

<..configure jsmath amsmath..>+
 \Configure{aligned}
    {\HCode{\string\begin\l:brace array\r:brace
                         \l:brace rlrlrl\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {}
    {\HCode{\string\cr\space}}
    {}
    {\HCode{\a:math:amp\space}}
 \Configure{alignedat}
    {\HCode{\string\begin\l:brace array\r:brace
                         \l:brace rlrl\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {}
    {\HCode{\string\cr\space}}
    {}
    {\HCode{\a:math:amp\space}}
-_-_-

<..amsmath html-jsmath july 2000..>
 \Configure{equation}
   {\ifvmode \IgnorePar\fi\EndP
    \HCode{<table class="equation"><tr><td>}%
    <.amsmath equation july 2000.>%
    <.math display in amsmath equation.>%
   }
   {\ifvmode \IgnorePar\fi\EndP
    \HCode{</td><td class="eq-no">}%
    }
   {\ifvmode \IgnorePar\fi\EndP \HCode{</td></tr></table>}%
    \ShowPar\IgnoreIndent\par}
 \Configure{equation*}
   {\ifvmode \IgnorePar\fi\EndP
    \HCode{<table class="equation-star"><tr><td>}%
    <.amsmath equation* july 2000.>%
    <.math display in amsmath equation.>%
   }
   {\ifvmode \IgnorePar\fi\EndP \HCode{</td></tr></table>}%
    \ShowPar\IgnoreIndent\par}
-_-_-

<..math display in amsmath equation..>
 \csname a:equation\string$\string$\endcsname
-_-_-

<..amsmath equation july 2000..>
 \Configure{gather}
   {\HCode{\string\begin\l:brace array\r:brace
            \l:brace lp{10mm}r\r:brace}\IgnorePar
       <.math display in equation.>}
   {\HCode{\string\end\l:brace array\r:brace}}
   {}
   {}
   {\ifnum\HCol=2 \IgnorePar
       \HCode{\a:math:amp}\fi }
   {}
-_-_-

<..amsmath equation* july 2000..>
 \Configure{gather*}
   {\HCode{\string\begin\l:brace array\r:brace
            \l:brace lp{10mm}r\r:brace}\IgnorePar
       <.math display in equation.>}
   {\HCode{\string\end\l:brace array\r:brace}}
   {}
   {}
   {\ifnum\HCol=2 \IgnorePar
       \HCode{\a:math:amp}\fi }
   {}
-_-_-

<..configure jsmath amsmath..>+
 \Configure{split}
    {\HCode{\string\begin\l:brace array\r:brace
            \l:brace rl\r:brace}}
    {\ifvmode\IgnorePar\fi
     \HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}  {}
    {<.mtd array.>}  {}
-_-_-

<..configure jsmath tex4ht..>+
 \Configure{math:amp}{\string&amp;}
-_-_-

<..mtd array..>
 \HCode{\ifnum \HCol>1 \a:math:amp\fi
   \ifnum 1<\HMultispan
 %     \string\multicolumn\l:brace\HMultispan\r:brace
      <.multi span.> \space\HMultispan\space
   \fi}%
-_-_-

<..multi span..>
 %\string\multispan
 ?span/multispan-in-jsmath?
-_-_-

<..configure jsmath amsmath..>+
 \ConfigureEnv{gather}
    {\bgroup <.display math-.>} {\egroup}
    {}{}
 \Configure{gather}
    {\HCode{\string\begin\l:brace array\r:brace
            \l:brace cl\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}  {}
    {<.mtd array.>}  {}
 \ConfigureEnv{gather*}
    {\bgroup <.display math-.>} {\egroup}
    {}{}
 \Configure{gather*}
    {\HCode{\string\begin\l:brace array\r:brace
            \l:brace cl\r:brace}}
    {\HCode{\string\end \l:brace array\r:brace}}
    {\ifnum \HRow> 1\HCode{\string\\\Hnewline}\fi}  {}
    {<.mtd array.>}  {}
-_-_-

\HtmlParOff added to \Configure{#1}. \HCode{<--tex4ht:inline-->} commented out as it interfered with parsing. \HtmlParOn added after \end:mathalign. Before cell and after cell configurations have been rewritten to solve the problems reported by Rob Beezer’s <[email protected]>.

jsMath doesn’t support hfil... hence the following

<..extra align col sep..>
 \ifodd\HCol\space\else
    \string\kern \space 2em\space
 \fi
-_-_-

Yet another venue through eqalign

<..configure jsmath amsmath..>+
 \def\:tempc#1#2{%
    \ConfigureEnv{#1}
      {\def\end:al:env{}\ifmmode\else
        \ifvmode\else \def\end:al:env{\par\ShowPar\IgnoreIndent}
      \fi\fi}
      {\end:al:env }
      {}{}%
    \Configure{#1}
    {\IgnorePar\HtmlParOff
     \ifvmode \EndP  \else \EndP \fi
     \ifmathltx
        \Tg<mrow>\def\end:mathalign{\Tg</mrow>}%
     \else
        \Configure{@math}{div}\DviMath
        \def\end:mathalign{\EndDviMath \DisplayMathfalse}%
        \DisplayMathtrue
     \fi
     \HCode{\string\eqalignno\l:brace}}
    {\HCode{\r:brace}\end:mathalign\HtmlParOn}
    {\ifnum \HRow> 1\HCode{\string\cr\Hnewline}\fi}
    {}
    {\HCode{\ifnum \HCol>1 \a:math:amp\fi
        \ifnum 1<\HMultispan
       ?span/multispan-in-jsmath?
       \space\HMultispan\space\fi}}%
    {} %
 }
 \:tempc{align}{align}
 \:tempc{alignat}{alignat}
 \:tempc{xalignat}{xalignat}
 \:tempc{xxalignat}{xxalignat}
 \:tempc{flalign}{flalign}
 \:tempc{align*}{align*}
 \:tempc{alignat*}{alignat*}
 \:tempc{xalignat*}{xalignat*}
 \:tempc{flalign*}{flalign*}
-_-_-