使用LaTex写数学公式

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

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

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

x=b±b24ac2a x = − b ± b 2 − 4 a c 2 a

  • 希腊字母(Greek letters)

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

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

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

  • 分组(groups)

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

  • 括号(parentheses)

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

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

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

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

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

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

  • 分数(fractions)

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

  • 字体(fonts)

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

  • 开方(radical signs)

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

  • 特殊函数(special functions)

\lim \sin \max \ln
\lim_{x\to 0} limx0 lim x → 0
注意区别:\sin x sinx sin ⁡ x (正确),sinx 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 × × ÷ ÷ ± ± xy 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 , … , n 1 + 2 + \cdots + n 1+2++n 1 + 2 + ⋯ + n

  • 空格(spaces)

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

  • 发音符号(accents and diacritical marks)

\hat \widehat \bar \overline \vec \overrightarrow \overleftrightarrow \dot \ddot
x^ x ^ xyˆ x y ^ x¯ x ¯ xy¯¯¯¯¯ x y ¯ x⃗  x → xy x y → xy x y ↔ x˙ x ˙ x¨ x ¨

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值