<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
可以通过上面的从MathJax分布式服务器上获取最新的MathJax.js文件。而且加上TeX-AMS-MML_HTMLorMML
使得我们可以支持Tex和MathML公式,如果浏览器支持MathML解析,那么就使用它,否则会使用HTML-with-CSS来显示数学公式。而且config=TeX-AMS-MML_HTMLorMML
是最常用的,更多的config可以去参加官方文档(http://docs.mathjax.org/en/latest/start.html
)。
下面使用TeX和LaTeX进行说明
TeX 和 LaTeX 格式的公式使用主要有两种形式,(1)、包含在段落之中的;(2)、独立于其他文字的。TeX 和 LaTeX 格式的默认分隔符是$$...$$
和 \[ ...\]
,这个是独立于其他文字的,其实如果想要在段落之中显示TeX 和 LaTeX 格式的公式使,需要使用\(...\)
。比如显示行内公式\(\alpha+\beta=\gamma\)可以使用:
\(\alpha+\beta=\gamma\)
\[
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\x}{\mathbf{x}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\wv}{\mathbf{w}}
\newcommand{\av}{\mathbf{\alpha}}
\newcommand{\bv}{\mathbf{b}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\id}{\mathbf{I}}
\newcommand{\ind}{\mathbf{1}}
\newcommand{\0}{\mathbf{0}}
\newcommand{\unit}{\mathbf{e}}
\newcommand{\one}{\mathbf{1}}
\newcommand{\zero}{\mathbf{0}}
\]
独立于其他文字的
$$\alpha+\beta=\gamma$$
或者
\[\alpha+\beta=\gamma\]
可以使用
$$\alpha+\beta=\gamma$$ 或者 \[\alpha+\beta=\gamma\]
更复杂的公式显示:
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
更多关于数学公式的使用可以参照http://docs.mathjax.org/en/latest/start.html
文档。
Latex 有不少宏包,在MathJax上面怎么使用这些宏包?
博主,我公司最近在使用LaTex显示公式,我发现公司给我的文本中有些公式不识别,是我配置错了还是说这个公式的文本有问题啊?
下面的 \hfill 、 \upepsilon 、 \uplambda 、 \upeta 这些在显示的时候都报红,
最后面那个直接显示公式文本
$$ \large XX大学,数学与应用数学 \hfill 2009年至今\\ $$
$$ \left[-\frac{\mathrm{SW}\;\mathrm{periods}}{\upepsilon_1}\right] $$
$$ {{\uplambda}} = \frac{2\,\sin \,\phi }{{\sqrt 3 \,\left( {3 - \sin \,\phi } \right)}} $$
$$ \mathrm{\mathcal{B}}\left({\Lambda}_{\mathrm{b}}^0\to \Lambda \upeta^{\prime}\right) $$
$$ \large XX大学,数学与应用数学 \hfill 2009年至今 $$
你看看我文章上面显示的是不是你需要的?变成红色说明是你写的有问题,你可以参考:http://docs.mathjax.org/en/latest/tex.html,里面显示了很多用法。