参考:
行内公式
[mw_shl_code=html,false]
第一行:$math$或 \(math\)
第二行:$f(x) = 3x + 7$ 和 \(f(x) = 3x + 7\)
以上两种效果是一样的[/mw_shl_code]
跨行公式
[mw_shl_code=html,false]1.独立公式可以用如下方法表示:\[math\ ] 或 $$数学公式$$
2.行中公式(放在文中与其它文字混编)可以用如下方法表示:$ 数学公式 $[/mw_shl_code]
字符
普通字符在数学公式中含义一样,除了 # $ \% \& \~ _ \^ { };
若要在数学环境中表示这些符号,需要分别表示为\# \$ \% \& \_ \{ \},即在个字符前加上\。
上标和下标用 ^ 来表示上标,用 _ 来表示下标,看一简单例子: [mw_shl_code=applescript,false]
例子1:$$\sum_{i=1}^n a_i=0$$
例子2:$$f(x)=x^{x^x}$$
例子3:$$ x^{y^z}=(1+{\rm e}^x)^{-2xy^w} $$
[/mw_shl_code]
效果1:
[math]这里填写公式[/math] 效果3: [math]这里填写公式[/math] 另外,如果要在左右两边都有上下标,可以用 \sideset 命令 [mw_shl_code=html,false]$$ \sideset{^1_2}{^3_4}\bigotimes $$[/mw_shl_code] 效果:[math]这里填写公式[/math]
数学公式
1.涉及公式计算推导,按“=”换行
[mw_shl_code=applescript,false]\begin{align*}
&\forall A,B \in SL(n,F), \\
&,\mathrm{tr}([A,B]) \\
&=\sum_{i=1}^n\{AB-BA\}_{ii} \\
&=0
\end{align*}[/mw_shl_code]
效果:
[math]这里填写公式[/math]
2.涉及矩阵。注意 {cc} 中有多少个 ,矩阵就有多少列,行数是随意的,每一行最后加一个换行。
[mw_shl_code=applescript,false]\begin{equation*}
K=\left[\begin{array}{cc}
1 & 0\\
0 & -1\\
\end{array}\right],
E=\left[\begin{array}{cc}
0 & 1\\
0 & 0\\
\end{array}\right]
\end{equation*}[/mw_shl_code]
效果:
[math]这里填写公式[/math]
3.涉及多个数学公式按行依次居中显示的。
[mw_shl_code=applescript,false]\begin{gather*}
e=E\\
f=F\\
q=\exp(1)=\sum_{n=0}^{\infty}\frac{1}{n!}\\
k=\exp(K)=\sum_{n=0}^{\infty}\frac{K^n}{n!}
\end{gather*}[/mw_shl_code]
效果:
[math]这里填写公式[/math]
希腊字母
一些特殊的括号: 输入 | 显示 | 输入 | 显示 | $\alpha$ | [math]这里填写公式[/math] | $A$ | [math]这里填写公式[/math] | $\beta$ | [math]这里填写公式[/math] | $B$ | [math]这里填写公式[/math] | $\gamma$ | [math]这里填写公式[/math] | $\Gamma$ | [math]这里填写公式[/math] | $\delta$ | [math]这里填写公式[/math] | $\Delta$ | [math]这里填写公式[/math] | $\epsilon$ | [math]这里填写公式[/math] | $E$ | [math]这里填写公式[/math] | $\zeta$ | [math]这里填写公式[/math] | $Z$ | [math]这里填写公式[/math] | $\eta$ | [math]这里填写公式[/math] | $H$ | [math]这里填写公式[/math] | $\theta$ | [math]这里填写公式[/math] | $\Theta$ | [math]这里填写公式[/math] | $\iota$ | [math]这里填写公式[/math] | $I$ | $I$ | $\kappa$ | $\kappa$ | $K$ | $K$ | $\lambda$ | $\lambda$ | $\Lambda$ | $\Lambda$ | $\nu$ | $\nu$ | $N$ | $N$ | $\mu$ | $\mu$ | $M$ | $M$ | $\xi$ | $\xi$ | $\Xi$ | $\Xi$ | $o$ | $o$ | $O$ | $O$ | $\pi$ | $\pi$ | $\Pi$ | $\Pi$ | $\rho$ | $\rho$ | $P$ | $P$ | $\sigma$ | $\sigma$ | $\Sigma$ | $\Sigma$ | $\tau$ | $\tau$ | $T$ | $T$ | $\upsilon$ | $\upsilon$ | $\Upsilon$ | $\Upsilon$ | $\phi$ | $\phi$ | $\Phi$ | $\Phi$ | $\chi$ | $\chi$ | $X$ | $X$ | $\psi$ | $\psi$ | $\Psi$ | $\Psi$ | $\omega$ | $\omega$ | $\Omega$ | $\Omega$ |
分数及开方
[mw_shl_code=applescript,false]
表示分子分母:$$\frac{1}{4}$$
表示开平方:$$\sqrt{x^4}$$
表示开 n 次方: $$\sqrt[4]{(a+b)^4}$$[/mw_shl_code]
效果: 表示分子分母:[math]这里填写公式[/math] 表示开平方:[math]这里填写公式[/math]
表示开 n 次方:[math]这里填写公式[/math]
矢量
[mw_shl_code=applescript,false]
案例1:$$\vec{a} \cdot \vec{b}=0$$
[size=1em]案例2:$$\overleftarrow[size=1em]{[size=1em]xy[size=1em]}[size=1em] \quad [size=1em]and[size=1em] \quad \overleftrightarrow[size=1em]{[size=1em]xy[size=1em]}[size=1em] \quad [size=1em]and[size=1em] \quad \overrightarrow[size=1em]{[size=1em]xy[size=1em]}[size=1em]$$
[/mw_shl_code]效果1: [math]这里填写公式[/math] 效果2: [math]这里填写公式[/math] 累乘、累加
使用 \sum_{下标表达式}^{上标表达式} {累加表达式}来输入一个累加。
与之类似,使用 \prod \bigcup \bigcap来分别输入累乘、并集和交集。
此类符号在行内显示时上下标表达式将会移至右上角和右下角。
[mw_shl_code=applescript,false]
案例1:$$\prod_{i=0}^n \frac{1}{i^2}$$
案例2:$$\sum_{i=1}^n \frac{1}{i^2} \quad and \quad \prod_{i=1}^n \frac{1}{i^2} \quad and \quad \bigcup_{i=1}^{2} R$$
[/mw_shl_code]
效果1:[math]这里填写公式[/math]
效果2:[math]这里填写公式[/math]
省略号(3个点) \ldots 表示跟文本底线对齐的省略号;\cdots表示跟文本中线对齐的省略号, 比如: [mw_shl_code=applescript,false]
案例1:$$f(x\_1,x\_x,\ldots,x\_n) = x\_1^2 + x\_2^2 + \cdots + x\_n^2$$
案例2:$$f(x_1,x_2,\underbrace{\ldots}_{\rm ldots} ,x_n) = x_1^2 + x_2^2 + \underbrace{\cdots}_{\rm cdots} + x_n^2$$
[/mw_shl_code]
效果1: [math]这里填写公式[/math] 效果2:
[math]这里填写公式[/math]
括号和分隔符() 、 [] 和 | 表示符号本身,使用 \{\} 来表示 {} 。 一些特殊的括号: 输入 | 显示 | | \langle表达式\rangle | [math]这里填写公式[/math] | | \lceil表达式\rceil | [math]这里填写公式[/math] | | \lfloor表达式\rfloor | [math]这里填写公式[/math] | | \lbrace表达式\rbrace | [math]这里填写公式[/math] |
当要显示大号的括号或分隔符时,要对应用 \left 和 \right,如: [mw_shl_code=applescript,false]$$\[f(x,y,z) = 3y^2 z \left( 3 + \frac{7x+5}{1 + y^2}\right).\]$$[/mw_shl_code]
效果: [math]这里填写公式[/math]
\left. 和 \right. 只用与匹配,本身是不显示的,比如,要输出: 则用 [math]这里填写公式[/math] 使用 \left和 \right来创建自动匹配高度的 (圆括号),[方括号] 和 {花括号} 。
在每个公式末尾前使用\tag{行标}来实现行标。
[mw_shl_code=html,false]$\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$[/mw_shl_code]
效果:
$\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$
[mw_shl_code=text,false]$$
f\left(
\left[
\frac{
1+\left\{x,y\right\}
}{
\left(
\frac{x}{y}+\frac{y}{x}
\right)
\left(u+1\right)
}+a
\right]^{3/2}
\right)
\tag{行标}
$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
多行的数学公式
[mw_shl_code=applescript,false]$$
\begin{eqnarray*}
\cos 2\theta & = & \cos^2 \theta - \sin^2 \theta \\\\
& = & 2 \cos^2 \theta - 1.
\end{eqnarray*}
$$[/mw_shl_code]
效果: [math]这里填写公式[/math]
其中&是对其点,表示在此对齐。
*使latex不自动显示序号,如果想让latex自动标上序号,则把*去掉
矩阵
[mw_shl_code=applescript,false]The characteristic polynomial $\chi(\lambda)$ of the $3 \times 3$~matrix
$$
\left( \begin{array}{ccc}
a & b & c \\\\
d & e & f \\\\
g & h & i \end{array} \right)
$$
is given by the formula
$$
\chi(\lambda) = \left| \begin{array}{ccc}
\lambda - a & -b & -c \\\\
-d & \lambda - e & -f \\\\
-g & -h & \lambda - i \end{array} \right|.
$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
c表示向中对齐,l表示向左对齐,r表示向右对齐。
导数(Derivatives)
[mw_shl_code=applescript,false]$\frac{du}{dt} $ and $\frac{d^2 u}{dx^2}$[/mw_shl_code]
效果: [math]这里填写公式[/math]
[mw_shl_code=applescript,false]$$\frac{\partial u}{\partial t}
= h^2 \left( \frac{\partial^2 u}{\partial x^2}
+ \frac{\partial^2 u}{\partial y^2}
+ \frac{\partial^2 u}{\partial z^2}\right)$$[/mw_shl_code] 效果: [math]这里填写公式[/math]
极限(Limits)
[mw_shl_code=applescript,false]
$$\lim_{x \to +\infty}, \inf_{x > s} , \sup_K$$
$$ \lim_{x \to 0} \frac{3x^2 +7x^3}{x^2 +5x^4} = 3.$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
[math]这里填写公式[/math]
无限 代码: [mw_shl_code=applescript,false]\infty[/mw_shl_code] 效果:∞ [math]这里填写公式[/math]
求和(Sum)
[mw_shl_code=applescript,false]$$\sum_{i=1}^{2n}.$$
$$\sum_{k=1}^n k^2 = \frac{1}{2} n (n+1).$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
[math]这里填写公式[/math]
积分(Integrals)
[mw_shl_code=applescript,false]$$\int_a^b f(x)\,dx.$$[/mw_shl_code]
效果:[math]这里填写公式[/math]
在加几个:
[mw_shl_code=applescript,false]$$ \int_0^{+\infty} x^n e^{_x} \,dx = n!.$$
$$ \int \cos \theta \,d\theta = \sin \theta.$$
$$ \int_{x^2 + y^2 \leq R^2} f(x,y)\,dx\,dy = \int_{\theta=0}^{2\pi} \int_{r=0}^R
f(r\cos\theta,r\sin\theta) r\,dr\,d\theta.$$
$$ \int_0^R \frac{2x\,dx}{1+x^2} = \log(1+R^2).$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
[math]这里填写公式[/math]
[math]这里填写公式[/math]
[math]这里填写公式[/math]
设定表格
[mw_shl_code=html,false]$$
\begin{array}{ccc|c}
a11 & a12 & a13 & b1 \\
a21 & a22 & a23 & b2 \\
a31 & a32 & a33 & b3 \\
\end{array}
$$[/mw_shl_code]
效果:
[math]这里填写公式[/math]
字体的转换
若要对公式的某一部分字符进行字体转换,可以用 {\字体 {需转换的部分字符}} 命令,其中 \字体 部分可以参照下表选择合适的字体。一般情况下,公式默认为意大利体.
输入 | 显示 | 输入 | 1 | \rm | [math]这里填写公式[/math] | \cal | 1 | \it | [math]这里填写公式[/math] | \Bbb | 1 | \bf | [math]这里填写公式[/math] | \mit | 1 | \sf | [math]这里填写公式[/math] | \scr | 1 | \tt | [math]这里填写公式[/math] | \frak | 1 | \boldsymbol | [math]这里填写公式[/math] |
|
|
| | | |
特殊字符
名称 | 输入 | 显示 | 无穷 | \infty | [math]这里填写公式[/math] | 加减乘除 | \times \div \pm \mp | [math]这里填写公式[/math] | 点乘 | \cdot$ | $\cdot$ | 空格 | \quad$ | $\quad$ | 等号 | \lt \gt \le \leq \leqq \leqslant \ge \geq \geqq \geqslant \neq | $\lt \gt \le \leq \leqq \leqslant \ge \geq \geqq \geqslant \neq$ | 求导 | \text{d}x$ | $\text{d}x$ | 累乘 | \prod$ | $\prod$ | 积分 | \int$ | $\int$ | 积积分 | \iint$ | $\iint$ | 积积积分 | \iiint$ | $\iiint$ | 并集交集 | \cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing | $\cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing$ | 箭头 | \to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto | $\to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto$ |
| {n+1 \choose 2k}$ or $\binom{n+1}{2k} | ${n+1 \choose 2k}$ or $\binom{n+1}{2k}$ |
| \land \lor \lnot \forall \exists \top \bot \vdash \vDash | $\land \lor \lnot \forall \exists \top \bot \vdash \vDash$ |
| \star \ast \oplus \circ \bullet | $\star \ast \oplus \circ \bullet$ |
| \approx \sim \simeq \cong \equiv \prec \lhd \therefore | $\approx \sim \simeq \cong \equiv \prec \lhd \therefore$ |
| \nabla \partial | $\nabla \partial$ |
|