使用LaTex写数学公式

  • 行内公式(inline formula)和块级公式(displayed formula)

行内公式,使用 $$包裹(enclose),块级公式,使用$$$$

键入$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$显示, x = b ± b 2 4 a c 2 a
键入$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$显示,

x = b ± b 2 4 a c 2 a

  • 希腊字母(Greek letters)

\alpha, \beta, ... \omega α ,   β ,   ,   ω
\Gamma, \Delta, ... \Omega Γ ,   Δ ,   ,   Ω

  • 上标(superscripts)和下标(subscripts)

上标^,下标_,例如:
x_i^2 x i 2
\log_x 2 log i 2

  • 分组(groups)

上标和下标作用于分组,使用花括号(curly braces)。
x^y^z x^y^z (错误,非预期),10^10 10 1 0 (错误,非预期)。
x^{y^z} x y z {x^y}^z x y z ,注意后面的z比较低。

  • 括号(parentheses)

圆括号(parentheses)(2+3) ( 2 + 3 ) ,方括号(brackets)[2+3] [ 2 + 3 ] ,花括号(curly braces){2+3} { 2 + 3 } ,尖括号(angle brackets)\langle x \rangle x

绝对值(垂直线,vertical)\vert x \vert | x | ,双垂直线\Vert x \Vert x \lceil x \rceil x \lfloor x \rfloor x

可以使用隐藏括号.\lelft. a^\frac{1}{2}/b\right} x = a 1 2 / b }
使用\middle 使除号更合适, = \left. a^\frac{1}{2}\middle/b \right. x = a 1 2 / b

括号默认不会随着formula的内容缩放,(\frac{\sqrt x}{y^3}) ( x y 3 ) ,使用\left(...\right)可以让括号随内容缩放,\left(\frac{\sqrt x}{y^3}\right) ( x y 3 )
或者使用\bigl \Bigl \biggl \Biggl ...,括号不要求必须同类型、成对出现:\lfloor x \rceil x
\Biggl( \biggl( \Bigl( \bigl( (x) \bigr) \Bigr) \biggr) \Biggr) ( ( ( ( ( x ) ) ) ) )
\Bigl{ \bigl\vert (\left(\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\right)) \bigr} \Bigr] { | ( ( b ± b 2 4 a c 2 a ) ) } ]

  • 聚合(sums)和积分(integrals)

\sum_{i=0}^\infty i^2 i = 0 i 2
\prod \int \iint \iiint \bigcup \bigcap

  • 分数(fractions)

\frac作用于接下来的两个分组(next two groups),\frac {a+1}{b+1} a + 1 b + 1
分子(numerator)和分母(denominator)复杂时,{a+1}\over{b+1} a + 1 b + 1

  • 字体(fonts)

blackboard bold 字体,\mathbb {CSDN} C S D N
boldface 字体,\mathbf {CSDN} C S D N
typewriter 字体,\mathtt {CSDN} C S D N
roman 字体,\mathrm {CSDN} C S D N
sans-serif 字体,\mathsf {CSDN} C S D N
calligraphic 字体,\mathcal {CSDN} C S D N
script 字体,\mathscr {CSDN} C S D N
Fraktur 字体,\mathfrak {CSDN} C S D N

  • 开方(radical signs)

\sqrt {x^3} x 3 \sqrt[4]{\frac xy} x y 4
\left(\frac xy \right)^{1/4} ( x y ) 1 / 4

  • 特殊函数(special functions)

\lim \sin \max \ln
\lim_{x\to 0} lim x 0
注意区别:\sin x sin x (正确),sinx s i n x

  • 特殊符号和注记(special symbols and notions)

转义字符(escape character)\,反斜线\backslash ,换行使用\\
\lt \gt \le \leq \leqq \ge \geq \geqq \neq < >

加\not会添加斜线,\not \gt, \not \leqq ≦̸

\times \div \pm \mp \cdot × ÷ ± x y
\cup \cap \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing \setminus

\to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto

\land \lor \lnot \forall \exists \top \bot \vdash \vDash ¬
\star \ast \oplus \circ \bullet
\approx \sim \simeq \cong \equiv \prec \lhd
\infty

1, 2, \ldots,n 1 , 2 , , n 1 + 2 + \cdots + n 1 + 2 + + n

  • 空格(spaces)

短空格a\ b a   b ,宽空格a\quad b a b ,长空格a\qquad b a b

  • 发音符号(accents and diacritical marks)

\hat \widehat \bar \overline \vec \overrightarrow \overleftrightarrow \dot \ddot
x ^ x y ^ x ¯ x y ¯ x x y x y x ˙ x ¨

参考:
https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference

猜你喜欢

转载自blog.csdn.net/u014711094/article/details/80645327