I am not really sure, what you are looking for, purpose of questions and answers you linked to is exactly not to convert macros to html, to be processed with some tool like mathjax. Try this configuration file, with definitions of your macros for mathjax:
\usepackage{verbatim}
\Preamble{xhtml}
% Configure for mathjax
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{\HCode{
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
Macros: {
\unexpanded{La : "\\Lambda",
B: "\\beta",
twosilt: "\\textrm{2-silt}",}
}
},
extensions: ["tex2jax.js"],
tex2jax: {
\unexpanded{
inlineMath: [ ['\$','\$'], ["\\\\(","\\\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],}
processEscapes: true
}
});
</script>
}}
\Configure{@HEAD}{\HCode{<script type="text/javascript"\Hnewline
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"\Hnewline
></script>\Hnewline}}
\newtoks\eqtoks
\def\AltMath#1${\eqtoks{$#1$}%
\HCode{\the\eqtoks}$}
\Configure{$}{}{}{\expandafter\AltMath}
\def\AltlMathI#1\){\eqtoks{\(#1\)}%
\HCode{\the\eqtoks}}
\Configure{()}{\AltlMathI}{}
\def\AltlDisplay#1\]{\eqtoks{\[#1\]}%
\HCode{\the\eqtoks}}
\Configure{[]}{\AltlDisplay}{}
\begin{document}
\newcommand\VerbMath[1]{%
\renewenvironment{#1}{%
\NoFonts%
\string\begin\{#1\}%
\verbatim}{\endverbatim\string\end\{#1\}\EndNoFonts}%
}
\VerbMath{equation*}
\EndPreamble
I combined definitions from "leave equations unchanged", added definitions of your macros for mathjax
and created new command, \VerbMath
. You need to use this command for every math environment, like equation*
in your case. It will leave also math environments unchanged. Name this file myconfig.cfg
.
I also slightly edited your sample file:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\newcommand{\La}{\Lambda}
\def\B{\beta}
\newcommand{\twosilt}{\mbox{\rm 2-silt}}
\begin{document}
In this section, we $\B$ recall some definitions and results.
Throughout $\alpha+\B$ this section, let ${\La}$ be a finite dimensional algebra.
\begin{equation*}
\Phi:\Lambda\longrightarrow\twosilt\Lambda,\; (X,P)\mapsto \Phi(X,P):=P_X\oplus P[1].
\end{equation*}
\end{document}
I added fontenc
package in order to correctly convert all characters and replaced \ \ \
in your equation with \;
. I suppose that you wanted bigger space, but \
seems to be not supported by mathjax.
Now you can compile your file with:
htlatex mwo myconfig
you can see the result here