MATLAB: How to publish a MATLAB file that contains LaTex code in the same line as the text to HTML

htmlinline()latexMATLABpublish

I want to publish a mathematical equation using the LaTeX format. The equation is in a line that includes some other text as well. For example I want to publish something similar to the following:
\alpha is a variable.

Best Answer

This enhancement has been incorporated in MATLAB 7.6 (R2008b) with the addition of the markup symbol "$" for inline math, similar to "*" for bold.
For previous releases of MATLAB, the ability to publish an MATLAB file to HTML format with LaTeX code inline with the text is not available. Prior to R2008b, LaTeX code must be in a seperate paragraph in order to be able to publish it.
An alternative workaround is to publish to LaTeX (rather than HTML) and then removing the following lines from private/mxdom2latex.xsl:
<xsl:template match="text()">
<!-- Escape special characters in text -->
<xsl:call-template name="replace">
<xsl:with-param name="string" select="."/>
</xsl:call-template>
</xsl:template>