6.9 amsmath

<..configure html4-math amsmath..>+
 \Configure{equation}
   {\ifmmode\else\par \IgnorePar\fi \EndP
            \HCode{<table\Hnewline class="equation"><tr><td>}\IgnorePar
   }
   {\ifvmode \IgnorePar\fi\EndP\HCode{</td><td class="equation-label">}}
   {\end:TTT\ifmmode\else <.try inline par.>\fi}
 \Configure{equation*}
   {\ifmmode\else\par \IgnorePar\fi \EndP
            \HCode{<table\Hnewline class="equation-star"><tr><td>}\IgnorePar
   }
   {\end:TTT\ifmmode\else <.try inline par.>\fi}
 \Css{.equation td{text-align:center; }}
 \Css{.equation-star td{text-align:center; }}
 \Css{table.equation-star { width:100\%; }}
 \Css{table.equation { width:100\%; }}
-_-_-

<..configure html4-math amsmath..>+
 \Configure{equation*}
   {\ifmmode\else\par \IgnorePar\fi \EndP
            \HCode{<table\Hnewline class="equation-star"><tr><td>}\IgnorePar
   }
   {\end:TTT\ifmmode\else <.try inline par.>\fi}
-_-_-

Equations in amsmath.sty are defined in term of gather, and gather is a one parameter macro. Unlike laktex where the body is read within the environment, in gather it is read at the \begin{equation} point under the conditions that exist there.

<..configure html4-math amsmath..>+
 \Configure{substack}{\Picture+{}}{\EndPicture}
-_-_-

<..configure html4-math amsmath..>+
 <.amsmath / amstex1 m:env.>
-_-_-

<..configure html4-math amsmath..>+
 \:CheckOption{pic-align}  \if:Option
    <.amsmath pic-align css.>
 \else
     <.amsmath align css.>
 \fi
 \:tempc{align}{align}
 \:tempc{alignat}{alignat}
 \:tempc{xalignat}{xalignat}
 \:tempc{xxalignat}{xxalignat}
 \:tempc{flalign}{flalign}
 \:tempc{align*}{align-star}
 \:tempc{alignat*}{alignat-star}
 \:tempc{xalignat*}{xalignat-star}
 \:tempc{flalign*}{flalign-star}
-_-_-

<..amsmath align css..>
 \def\:tempc#1#2{%
    \Configure{#1}
    {\IgnorePar\EndP  \HCode{<table\Hnewline class="#2">}}
    {\HCode{</table>}}  {\HCode{<tr>}}   {\HCode{</tr>}}
    {\HCode{<td\Hnewline
       class="align-\ifnum \HCol>\maxfields@ label\else
          \ifodd\HCol\space  odd\else     even\fi
        \fi">}}
    {\HCode{</td>}}}
 \Css{table.align, table.alignat, table.xalignat, table.xxalignat,
      table.flalign
    {width:100\%; margin-left:5\%; white-space: nowrap;}}
 \Css{table.align-star, table.alignat-star,
      table.xalignat-star,  table.flalign-star
    {margin-left:auto; margin-right:auto; white-space: nowrap;}}
 \Css{td.align-label { width:5\%; text-align:center; }}
 \Css{td.align-odd { text-align:right; padding-right:0.3em;}}
 \Css{td.align-even { text-align:left; padding-right:0.6em;}}
-_-_-

<..amsmath pic-align css..>
 \def\:tempc#1#2{%
    \ConfigureEnv{#1}
      {\par\IgnorePar\EndP\HCode{<div class="align">}\Picture*[pict]{}}
      {\EndPicture\EndP\HCode{</div>}\par}
      {} {}}
 \Css{div.align {text-align: center;}}
-_-_-

<..configure html4-math amsmath..>+
 \Configure{split}
    {\HCode{<table\Hnewline  class="split"><tr><td>}}
    {\ifvmode \IgnorePar\fi \HCode{</td></tr></table>}}
    {\HCode{<br\Hnewline class="split-tr" />}} {}
    {\HCode{<br\Hnewline class="split-td" />}} {}
 \Configure{smallmatrix}
    {\:xhtml{\IgnorePar\EndP}%
     \HCode{<table\Hnewline class="smallmatrix">}}   {\HCode{</table>}}
    {\HCode{<tr>}}                                   {\HCode{</tr>}}
    {\HCode{<td\Hnewline>}}                          {\HCode{</td>}}
-_-_-

<..configure html4-math amsmath..>+
 \ConfigureEnv{gather*}{\m:env{gather*}}{\endm:env}{}{}
 \ConfigureEnv{gathered}{\m:env{gathered}}{\endm:env}{}{}
 \ConfigureEnv{matrix}{\m:env{matrix}}{\endm:env}{}{}
 \ConfigureEnv{quotation}{\m:env{quotation}}{\endm:env}{}{}
 \Configure{equations}{*}{}
-_-_-

A ‘\begin{multline}...\end{multline} is not a standard environment in the sense that the environment as a whole is read in one piece and then processed, instead of reading it piecewise and process it as it goes. That is, we have a behavior similar to that in verbatim environments. The behavior is due to multline being implemented in terms of \gather@#1{..}. Hence, for the picture environment, we need to change early the catcodes of ‘_ and ‘^.

<..configure html4-math amsmath..>+
 \ConfigureEnv{multline}
   {\:xhtml{\IgnorePar\EndP}%
     \HCode{<table\Hnewline class="multline"><tr><td>}\Picture*{}\ExtractHLabel
   }
   {\EndPicture <.put HLabel.>\end:TTT}
   {}{}
   {}{}
 \ConfigureEnv{multline*}
   {\:xhtml{\IgnorePar\EndP}%
     \HCode{<table\Hnewline class="multline-star"><tr><td>}\Picture*{}%
   }
   {\EndPicture \end:TTT}
   {}{}
 <.extract amsmath labels.>
 \Css{table.multline, table.multline-star   {width:100\%;}}
-_-_-

<..extract amsmath labels..>
 \def\ExtractHLabel{%
    \def\tagform@##1{{%
       \ifx \:HLabel\:UnDef \let\:HLabel=\empty \fi
       \def\tagform@####1{\expandafter\let\csname ####1\endcsname\def}%
       \:HLabel
       \expandafter\ifx\csname ##1\endcsname\relax
         \let\tagform@=\relax
         \let\HCode=\relax
         \edef\:temp{\noexpand\append:def\noexpand
                         \:HLabel{\HCode{<br />}\tagform@{##1}\HCode{<br />}}}%
         \:temp
         \global\let\:HLabel=\:HLabel
       \fi
    }}}
 \def\PutHLabel{\:HLabel}
-_-_-

<..put HLabel..>
 \ifx \:HLabel\:Undef \else
    \HCode{</td><td class="equation-label">}\PutHLabel
    \global\let\:HLabel\:Undef
 \fi
-_-_-

<..configure html4-math amsmath..>+
 \ConfigureEnv{gather}
   {\:xhtml{\IgnorePar\EndP}%
     \HCode{<table\Hnewline class="gather"><tr><td
        class="gather1">}\Picture*{}\ExtractHLabel
   }
   {\EndPicture <.put HLabel.>\end:TTT}
   {}{}
 \Css{td.gather {text-align:center; }}
 \Css{table.gather   {width:100\%;}}
 \ConfigureEnv{gather*}
   {\:xhtml{\IgnorePar\EndP}%
     \HCode{<div\Hnewline class="gather-star">}\Picture*{}%
   }
   {\EndPicture \HCode{</div>}}
   {}{}
 \Css{div.gather-star {text-align:center;}}
-_-_-

<..mathml: plain, amsmath, amstex1..>
 \def\underarrow@#1#2#3{%
       \Tg<\a:mathml: munder>\Tg<\a:mathml: mrow\Hnewline>#1\Tg</\a:mathml: mrow>%
                  \Tg<\a:mathml: mrow\Hnewline>#2\Tg</\a:mathml: mrow>%
       \Tg</\a:mathml: munder>}%
 
 \def\overarrow@#1#2#3{%
       \Tg<\a:mathml: mover>\Tg<\a:mathml: mrow
            class="fill">#1\Tg</\a:mathml: mrow>%
       \Tg<\a:mathml: mrow\Hnewline>{#2#3}\Tg</\a:mathml: mrow>%
       \Tg</\a:mathml: mover>}%
-_-_-

<..mathml: plain, fontmath, amsmath, amstex1..>
 \def\overrightarrow{\mathpalette{\overarrow@\rightarrow}}
 \def\overleftarrow{\mathpalette{\overarrow@\leftarrow}}
 \def\overleftrightarrow{\mathpalette{\overarrow@\leftrightarrow}}
 
 \def\underrightarrow{\mathpalette{\underarrow@\rightarrow}}
 \def\underleftarrow{\mathpalette{\underarrow@\leftarrow}}
 \def\underleftrightarrow{\mathpalette{\underarrow@\leftrightarrow}}
-_-_-

<..mathml: plain, fontmath, amsmath, amstex1NO..>
 \def\overrightarrow{\mathpalette{\overarrow@\rightarrow}}
 \def\overleftarrow{\mathpalette{\overarrow@\leftarrow}}
 \def\overleftrightarrow{\mathpalette{\overarrow@\leftrightarrow}}
 
 \def\underrightarrow{\mathpalette{\underarrow@\rightarrow}}
 \def\underleftarrow{\mathpalette{\underarrow@\leftarrow}}
 \def\underleftrightarrow{\mathpalette{\underarrow@\leftrightarrow}}
-_-_-

The \HCode{} in \sideset is for catching superscripts and subscripts

<..32,4 picmath amsmath,amstex1..>
 <.32,4 picmath: plain, fontmath, amsmath, amstex1.>
-_-_-

<..configure html4-math amsmath..>+
 <.32,4 picmath amsmath,amstex1.>
-_-_-

<..configure html4-math amsmath..>+
 \Configure{overset} {\Picture+{ \a:@Picture{}}} {\EndPicture}
 \Configure{underset} {\Picture+{ \a:@Picture{}}} {\EndPicture}
-_-_-

<..configure html4-math amsmath..>+
 \Configure{xrightarrow} {\Picture+{ \a:@Picture{}}} {\EndPicture}
 \Configure{xleftarrow} {\Picture+{ \a:@Picture{}}} {\EndPicture}
 \Configure{genfrac}
   {\Picture+{}\bgroup} {}{}{}{}{\egroup\EndPicture}
-_-_-