Albert Einstein

# A Simple LaTeX MathML Example

Posted by Ed Leaver on
In this example we first include a short LaTeX document directly, and allow the LaTeXMathML.js JavaScript to make the translation to MathML. Here LaTeXMathML.js is used to translate the entire LaTeX document; usually one asks it just to translate LaTeX equation environments embedded in otherwise-html. The LaTeXMathML-translated LaTeX document follows:
% % % \documentclass[letterpaper, 11pt]{article} \begin{document} \title{Curious Facts} \author{Ed Leaver} \date{July 4 1776} \maketitle %\setcounter{section}{-2} \section{Albert Einstein} $$\label{e1} E = mc^2$$ $$\label{e2} E_e + E_{\phi} = h\nu$$ Equation \ref{e1} is arguably Einsteins most famous result. But it is his use of Planck's equation in the form \ref{e2} for which he received the Nobel Prize, explaining the photo-electric effect. Here is an inline math example: $E\Psi = H\Psi$ --- all else is bunk! % % % %\setcounter{section}{-2} \section{Einstein and Planck} % resets all counters to zero, except for section which is incremented %\subsection{Simple LaTeX Tests} %\subsubsection{sub-scripts and super-scripts} \begin{verbatim} verbatim: E = mc^2 \end{verbatim} $$\label{e3} E = mc^2$$ \begin{verbatim} verbatim: E_{electron} + E_{\phi} = h\nu \end{verbatim} $$\label{e4} E_{electron} + E_{\phi} = h\nu$$ Equation \ref{e3} is arguably Einsteins most famous result. But it is his interpretation of Planck's equation \ref{e4} for which he received the Nobel Prize, explaining the photo-electric effect. % % \end{document} % %

Here LaTeXMathML did not properly translate the second verbatim environment. Compare the same file pre-translated by latex2html. The equation images in the latex2html output were converted back to their (appropriated tagged) original LaTeX math environments, so that only the tagged math environments would be translated to MathML by LaTeXMathML. The process is automated by Perl script latex2mathml.