LaTeXMATHml: ...HAVE A LOOK AT THE SOURCE OF THIS EXAMPLE TO SEE HOW IT DOES IT!
Including MACROS!
For more on macros see also Jipsen's original work here.

(More useful links etc at Knisely's possibly more regularly maintained page here.) The main thing for LaTeXMathML is the invocation of a script: LaTeXMathML.js (older version LaTeXMathML.js -- by the way, here is what this page looks like with the older script -- look at the mathbb rendering below to spot an interesting difference!). This script is updated from time to time (by Knisely I guess) but one typically holds a local copy, so this is a snapshot from when it was downloaded. The upshot is that differences in behaviour of LaTeXMathML from page to page (see below for example) may be due to different local versions at the host site. \section{Torture tests etc} We can do \[ \sqrt{\sqrt{\sqrt{2}}} = \int_{b}^{a} f(x) dx \] But: There do appear to be some anomalies in certain font renderings at present. For example in mathbb: $\mathbb{M,N,L,P,R,Z}$ Interestingly the successes in rendering mathbb on Knisely's page (above) and on the present page seem to be the complement of those on Jipsen's page (and the alt version of the present page)! (As far as my Firefox browser is concerned, of course.) That is, neither of them works fully at the moment. I use the more recent one by default since it handles label-ref structures better... \subsection{On splitting/folding long LaTeX docs} We can use an (unrelated but compatible) javascript to reveal/conceal certain "div"s. (See the source of this for details.) We can use another script to replace setcounter{subsection}{99} etc., so that section numbering starts again correctly if we do have to split the document. (See the source of this for details.)

< script >
sectionCntr="2";
LaTeXCounter["subsection"]++;
< /script >

Obviously this is not dynamic renumbering, so there is still work to be done here. \section{More tests} \subsection{Notation, macros etc} Here $S$ is a set. $\Gamma(S)$ is the set of loop-free undirected graphs on $S$. %\newcommand{\EE}{{\mathbf E}} $\EE(S)$ is the set of partitions on $S$ (in natural bijection with the set of equivalence relations on $S$). \begin{proposition} $$ 2 \nle 1 $$ \end{proposition} \begin{lemma} To do. \end{lemma} \begin{lemma} To do. \end{lemma}