【Markdown】Latex基本语法

Latex基本语法

  • 注意点:Markdown __斜杠/ __ 转义字符!

LaTeX 是大神Leslie Lamport 的杰作,该神是2013年图灵奖的获得者,感兴趣可以去瞻仰一下神人的相关著述:
http://lamport.azurewebsites.net/pubs/pubs.html

LaTeX是一种基于ΤΕΧ的排版系统,对于生成复杂表格和数学公式表现得尤为突出。LaTeX也是当今世界上最流行和使用最为广泛的TeX格式。它构筑在 PlainTeX的基础之上,并加进了很多功能以利用TeX的强大功能,更多内容可以参考一下《LaTeX Cookbook》或者国内的《LaTeX 入门》等书籍。

LaTeX 大精深,但对写博客而言,或许只需要知道凤毛麟角就勉强够用了。

  • 添加MathJax引擎
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>

对于常用的数学公式语法,以及一般遇到的场景,简要汇总如下:

1.角标和开方:

    $$c = \sqrt{a^{2}+b_{xy}^{2} +e^{x}}$$

\[c = \sqrt{a^{2}+b_{xy}^{2} +e^{x}} \]

2.分数表达:

    $$\frac{x^{2}y^{2}}{x+y}$$

\[\frac{x^{2}y^{2}}{x+y} \]

3.求和与联乘:

    $$\sum_{i=0}^{n}$$  
    $$\prod_\epsilon$$

\[\sum_{i=0}^{n} \]

\[\prod_\epsilon \]

4.微分与积分:

    $$\int_{a}^{\pi} f(x) \,dx$$  

\[\int_{a}^{\pi} f(x) \,dx \]

5.极限与偏导数

    $$ \lim_{x \to +\infty}\frac{1}{x}$$

    $$\frac{\partial^2 u}{\partial z^2}$$

\[\lim_{x \to +\infty}\frac{1}{x} \]

\[\frac{\partial^2 u}{\partial z^2} \]

6.三角函数与矩阵

$$\cos2\theta = cos^2\theta - \sin^2 \theta \\ =  2\cos^2\theta -1$$



$$\begin{equation}
A=\left[
\begin{matrix}
1&2&3&\\
2&2&3&\\
3&2&3&
\end{matrix}
\right]
\end{equation}$$

三角函数

\[\cos2\theta = cos^2\theta - \sin^2 \theta \\ = 2\cos^2\theta -1 \]

矩阵

\[\begin{equation} A=\left[ \begin{matrix} 1&2&3&\\\ 2&2&3&\\\ 3&2&3& \end{matrix} \right] \end{equation}\]

7.数学符号与运算符

那些希腊字母,关系和运算符号,建议还是查表吧。

8.上标和下标

  • 下标:(注意大括号)
A_{333}

\(A_{333}\)

  • 上标:(注意大括号)
A^{内容}

\(A^{内容}\)
Demo:信息熵

  $$H(x) = - \sum_{i=1}^{n} P_{i}  log_{2} P_{i} $$

\[H(x) = - \sum_{i=1}^{n} P_{i} log_{2} P_{i} \]

posted @ 2017-10-22 21:01  Neo007  阅读(1368)  评论(0编辑  收藏  举报