LaTeX数学公式输入

【置顶 Tips 】

在 WinEdt 中快速添加公式字符而不必手动打出一个个letters~:

(1)针对 WinEdt 7.0版本,可如下图所示操作,或者,直接 点击工具栏“View--TeX GUI Symbols ” 

(而针对 WinEdt 10.3版本,直接 点击工具栏“View--TeX Symbols ”)

即会出现如下 GUI Page Control :

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

LaTeX最强大的功能就是显示美丽的数学公式:

1、数学公式的前后要加上 $(),比如:$f(x) = 3x + 7$(f(x) = 3x + 7) 效果是一样的;
如果用 [],或者使用 $$$$,则改公式独占一行;
如果用
egin{equation}end{equation},则公式除了独占一行还会自动被添加序号,如何公式不想编号则使用 egin{equation*}end{equation*}.

2、字符
普通字符在数学公式中含义一样,除了
# $ % & ~ _ ^ { }
若要在数学环境中表示这些符号# $ % & _ { },需要分别表示为# $ \% & \_ { },即在个字符前加上

3、大于等于号和小于等于号:

    直接在正文区的公式环境中输入下面的命令

大于号敲geq ,小于号敲leq

如:$$ 0leq mu_k leq 1 qquad and qquad sum_{k=1}^{M-1}mu_k leq 1  $$

 4、LaTeX公式换行等号对齐:

egin{equation*}
egin{aligned}
p(x|mu,sigma^2)&=frac{1}{(2pisigma^2)^{1/2}}exp{-frac{1}{2sigma^2}(x-mu)^2}\
&=frac{1}{(2pisigma^2)^{1/2}}exp{-frac{1}{2sigma^2}x^2+frac{mu}{sigma^2}x-frac{1}{2sigma^2}mu^2}\
&= h(x)g(eta)exp(eta^T u(x))
end{aligned}
end{equation*}

其中,\ 表示换行, & 表示对齐点

 5、矩阵:

对于少于 10 列的矩阵,可使用 matrix,pmatrix,bmatrix,Bmatrix,vmatrix 和 Vmatrix 等环境。

$$egin{matrix}1 & 2\3 &4end{matrix}$$
$$egin{pmatrix}1 & 2\3 &4end{pmatrix}$$
$$egin{bmatrix}1 & 2\3 &4end{bmatrix}$$
$$egin{Bmatrix}1 & 2\3 &4end{Bmatrix}$$
$$egin{vmatrix}1 & 2\3 &4end{vmatrix}$$
$$egin{Vmatrix}1 & 2\3 &4end{Vmatrix}$$

 (via :http://www.cnblogs.com/houkai/p/3399646.html

6、分段函数的表示方法:

egin{equation}
k(x-y)=
egin{cases}
1: &mbox{$|x_i-y_j| leq frac{1}{2} $(i=1,...,D)}\
0: &mbox{otherwise}
end{cases}
end{equation}

7、下括线的使用方式:underbrace{ }_{ }

 Codes:

egin{frame}{For the $mu_k$}
 Setting the derivatives of (9.14) with respect to the means $mu_k$ of the Gaussian components to zero:\
$$ 0=-sum_{n=1}^N underbrace{frac{pi_k mathcal{N}(x_n|mu_k,Sigma_k)}{sum_j pi_j mathcal{N}(x_n|mu_j,Sigma_j)}}_{gamma (z_{nk})} Sigma_k (x_n-mu_k) eqno{(9.16)} $$
end{frame}

效果如下:

Latex数学公式中的空格:

两个quad空格 a qquad b a qquad b 两个m的宽度
quad空格 a quad b a quad b 一个m的宽度
大空格 a b a b 1/3m宽度
中等空格 a;b a;b 2/7m宽度
小空格 a\,b a\,b 1/6m宽度
没有空格 ab ab\,  
紧贴 a!b a!b 缩进1/6m宽度


quad、1em、em、m代表当前字体下接近字符‘M’的宽度(approximately the width of an "M" in the current font) 

可参见:常用数学符号的 LaTeX 表示方法,,非常具体!

via:http://blog.sina.com.cn/s/blog_5e16f1770100fs38.html

原文地址:https://www.cnblogs.com/shenxiaolin/p/7126857.html