equation
使用时如何扩展用户定义的宏htlatex
?我的 LaTeX MWE 是:
\documentclass{article}
\usepackage{amsmath,amsfonts}
\newcommand\EquationAlt[1]{#1}
\def\alp{\alpha_{zzz}^{xxx}}
\begin{document}
Sample $a$ Paragraph $a+a1$ text $a+b_{234}$ with $\alpha+\beta^{\gamma}$ Inline Equations \EquationAlt{$\frac{1}{2}$}.
\EquationAlt{\begin{equation}
\label{eq3}
\alpha + \beta = \gamma
\end{equation}
}
and Eq.~\ref{eq1}
\EquationAlt{\begin{equation*}
\Omega + \zeta = \iota
\end{equation*}
}
so $\alp$ that Equation.\ref{eq3} etc..
\EquationAlt{\begin{equation}
\label{eq1}
\Gamma + \epsilon = \varepsilon \hbox{ and } \alp
\end{equation}
}
\end{document}
我的 tex4ht 配置文件是:
\Preamble{html}
\newtoks\eqtoks
\def\EquationAlt{\afterassignment\setimg\eqtoks}
\def\setimg{\Picture*[\expandafter\HCode{\expandafter\the\eqtoks}]{}\the\eqtoks\EndPicture}
\def\SubSupOp#1{%
\edef\temp{\expandafter\gobble\string#1}%
\expandafter\let\csname old\temp\endcsname=#1
\edef\temp{\noexpand\SUBSUPOP{\expandafter\noexpand
\csname old\temp\endcsname}}%
\HLet#1=\temp
}
\def\gobble#1{}
\def\SUBSUPOP#1{\let\curOP=#1%
\let\next=\putOP \let\OPsub=\empty \let\OPsup=\empty
\futurelet\nextop\getOP}
\def\getOP{%
\ifx _\nextop \let\next=\getsub
\else\ifx ^\nextop \let\next=\getsup\fi\fi \next}
\def\getsub#1#2{\def\OPsub{#2}\let\next=\putOP
\futurelet\nextop\getOP}
\def\getsup#1#2{\def\OPsup{#2}\let\next=\putOP
\futurelet\nextop\getOP}
\def\putOP{\Picture+{ align="middle"}{\curOP_{\OPsub}^{\OPsup}}\EndPicture}
\SubSupOp\sum
\SubSupOp\int
\begin{document}
\EndPreamble
等待你的回复。