MathJax

文章来源自:CSDN-Mathjax 常用语法
参考:知乎-MathJax与LaTex的一点总结

插入公式

  1. 行内插入,用`$...$`
  2. 自成段落,用`$$ ...$$`

上标与下标

  • 上标:^,如 x^2
  • 下标:_,如 x_i \times x

分组

用大括号<{}将操作数与符号分隔开,消除二义性。{}将操作数与符号分隔开,消除二义性。

如:x^10,显示效果为x^{10};用大括号x^{10},才会显示x^{10}

语法 boldsymbol{w},可用来表示粗体向量w boldsymbol{w}w

希腊字母输入

希腊字母表前篇文章已经写过,有需要的朋友请自行查阅
希腊字母表:请查阅

markdown 希腊字母表 在公式中使用比较多,整理备用

特殊符号

符号 代码 符号 代码 符号 代码 符号 代码
infty sim land top
star simeq lor bot
\ast ng forall vdash
bullet equiv abla vDash
dot approx partial ¬ lnot
circ oplus exists prec
a   b a,b a b a{quad}b {n+1choose 2k} {n+1 choose 2k}
a    b a;b a b a{qquad}b \binom{n+1}{2k} \binom{n+1}{2k}

顶部符号

符号 代码 符号 代码 符号 代码 符号 代码
hat X hat X widehat {XY} widehat {XY} dot a dot a ddot a ddot a
overline {xyz} overline {xyz} vec {AB} vec {AB} \overrightarrow {abcd} overrightarrow {abcd} \overleftarrow {abcd} overleftarrow{abcd}

箭头符号

符号 代码 符号 代码 符号 代码 符号 代码
x \to f(x) x \to f(x) \rightarrow \rightarrow \leftarrow \leftarrow \uparrow \uparrow
\mapsto mapsto Rightarrow Rightarrow Leftarrow Leftarrow downarrow downarrow
leftrightarrow leftrightarrow Leftrightarrow Leftrightarrow

集合符号

符号 代码 符号 代码 符号 代码 符号 代码
cup cup subset subset supset supset in in
cap cap subseteq subseteq supseteq supseteq notin notin
varnothing varnothing subsetneq subsetneq supsetneq supsetneq emptyset emptyset

数学运算

关系比较符

符号 名称 代码 示例
lt 小于 lt 3lt 5
le 小于等于 le 3 le 5
gt 大于 gt 3 gt 5
ge 大于等于 ge 5 ge 5
neq 不等于 neq 3 neq 5
approx 约等于 approx 3 approx 3.1

算术运算符

符号 名称 代码 示例
+ + 5 + 3
- - 5 - 3
times times 5 times 3
div div 5 div 3
pm 加减 pm 5 pm 3
mp 减加 mp 5 mp 3
cdot 点乘 cdot 5 cdot 3
lvert x rvert 求x xx 的绝对值 lvert x rvert lvert x rvert
lVert vec a rVert 求向量的模 lVert vec a rVer lVert vec a rVert

括号

(1)小括号与方括号:使用原始的(),[]即可,如(2+3)[4+4]: (2+3)[4+4]

(2)大括号:由于大括号{}被用来分组,因此需要使用{和}表示大括号,也可以使用lbrace和rbrace来表示。如{ab},lbrace ab rbrace : $lbrace ab rbrace $

(3)尖括号:使用langle和rangle表示左尖括号和右尖括号。如langle x rangle :$langle x rangle$

(4)上取整:使用lceil和rceil表示。如lceil x rceil:$lceil x rceil$

(5)下取整:使用lfloor和rfloor表示。如lfloor x rfloor: $lfloor x rfloor$

(6)不可见括号:使用.表示

需要注意的是,原始符号并不会随着公式大小缩放,可以使用left(...right)来自适应地调整括号大小。如下:

```{ sum^0_{i=0}i^2=frac{(n^2+n)(2n+2)}{6}}    \  
\
left{ sum^0_{i=0}i^2=frac{(n^2+n)(2n+2)}{6} right.\
\

left.sum^0_{i=0}i^2=frac{(n^2+n)(2n+2)}{6} right}

\
left{sum^0_{i=0}i^2=frac{(n^2+n)(2n+2)}{6} right} 
``

可以看到,后面的公式中的括号是经过缩放的。
$$ { \sum^0_{i=0}i^2=\frac{(n^2+n)(2n+2)}{6}} \\ \left{ \sum^0_{i=0}i^2=\frac{(n^2+n)(2n+2)}{6} \right.\ \left.\sum^0_{i=0}i^2=\frac{(n^2+n)(2n+2)}{6} \right} \left{sum^0_{i=0}i^2=\frac{(n^2+n)(2n+2)}{6} \right} $$

常用表达式

分数/分式

  • 方法1:$frac{1+a}{4+b}$ Rightarrow frac{1+a}{4+b}
  • 方法2:${1+a}over{4+b}$ Rightarrow {{1+a}over{4+b}}

连分数

x = a_0+cfrac{1^2}{a_1+cfrac{2^2}{a_2+cfrac{3^2}{a_3+cfrac{4^2}{a_4+cdots}}}} tag{cfrac}
x = a_0+cfrac{1^2}{a_1+cfrac{2^2}{a_2+cfrac{3^2}{a_3+cfrac{4^2}{a_4+cdots}}}} tag{cfrac}
x = a_0+frac{1^2}{a_1+frac{2^2}{a_2+frac{3^2}{a_3+frac{4^2}{a_4+cdots}}}} tag{frac}
x = a_0+frac{1^2}{a_1+frac{2^2}{a_2+frac{3^2}{a_3+frac{4^2}{a_4+cdots}}}} tag{frac}

根号开方

  • 开平方:$sqrt{x}$ Rightarrow sqrt x
  • 开3次方:$sqrt[3]{x}$ Rightarrow sqrt x
  • 开4次方:$sqrt[4]{frac xy}$ Rightarrow sqrt[4]{frac xy}

    多行公式

    $$
    begin{align}
    D(x) &= int_{x_0}^x P(x^{prime}),mathrm{dx^{prime}}  \
    &= Cint_{x_0}^x x^{prime n},mathrm{dx^{prime}} \
    &= frac{C}{n+1}(x^{n+1}-x_0^{n+1}) \
    &equiv  y
    end{align}
    $$
    
begin{align}
D(x) &= int_{x_0}^x P(x^{prime}),mathrm{dx^{prime}}  \
&= Cint_{x_0}^x x^{prime n},mathrm{dx^{prime}} \
&= frac{C}{n+1}(x^{n+1}-x_0^{n+1}) \
&equiv  y
end{align}
运算符 代码 示例 示例代码 含义
sum sum sum_{k=0}^{infty}X(kOmega) sum_{k=0}^{infty}X(kOmega) 求和
int int int_{-T/2}^{T/2}x(t)dt int_{-T/2}^{T/2}x(t)dt 积分
oint oint f(a)={1 over {2pi i}}oint_gamma{f(z) over{z-a}}dz f(a)={1 over {2pi i}}oint_gamma{f(z) over{z-a}}dz
iint iint f(a)=frac{1}{2pi i}iint_gamma frac{f(z)}{z-a}dz f(a)=frac{1}{2pi i}iint_gamma frac{f(z)}{z-a}dz
prod prod ∏ i = 1 n i prod_{i=1}^{n}i∏*i*=1*n* prod_{i=1}^{n}i 连乘,1x2x…n
lim lim limlimits_{n to infty}{1 over n} limlimits_{n to infty}{1 over n} 求极限

表格

$$
begin{array}{c|lcr}
    n & text{Left} & text{Center} & text{Right}\
    hline
    1 & 0.24 & 1 & 125\
    2 & -1 & 189 & -8 \
    3 & 20 & 2000& 1+10i\
end{array}
$$
begin{array}{c|lcr}
    n & text{Left} & text{Center} & text{Right}\
    hline
    1 & 0.24 & 1 & 125\
    2 & -1 & 189 & -8 \
    3 & 20 & 2000& 1+10i\
end{array}

矩阵

基本用法

$$
begin{matrix}
    1&x&x^2\
    1&y&y^2\
    1&z&z^2\
end{matrix}
$$
begin{matrix}
    1&x&x^2\
    1&y&y^2\
    1&z&z^2\
end{matrix}

特殊矩阵

 
$$
begin{matrix}
    1&x&x^2\
    1&y&y^2\
    1&z&z^2\
end{matrix}
$$
    begin{pmatrix}
    1&2\
    3&4\
    end{pmatrix}
$$
    begin{bmatrix}
    1&2\
    3&4\
    end{bmatrix}
$$

    begin{bmatrix}
    1&2\
    3&4\
    end{bmatrix}
$$
    begin{Bmatrix}
    1&2\
    3&4\
    end{Bmatrix}
$$
    begin{Bmatrix}
    1&2\
    3&4\
    end{Bmatrix}
    begin{vmatrix}
    1&2\
    3&4\
    end{vmatrix}

    begin{vmatrix}
    1&2\
    3&4\
    end{vmatrix}

增广矩阵

$$
left[
    begin{array}{cc|c}
        1&2&3\
        4&5&6\
    end{array}
right]
$$

left[
    begin{array}{cc|c}
        1&2&3\
        4&5&6\
    end{array}
right]

行内矩阵

$bigl[begin{smallmatrix} a & b \ c & d end{smallmatrix}bigr]$
bigl[begin{smallmatrix} a & b \ c & d end{smallmatrix}bigr]

省略矩阵

$$
  begin{pmatrix}
    1 & a_1 & a_1^2 & cdots & a_1^n\
    1 & a_2 & a_2^2 & cdots & a_2^n \
    vdots & vdots & ddots & vdots \  
    1 & a_n & a_n^2 & cdots & a_n^n  \
    end{pmatrix}
$$
  begin{pmatrix}
    1 & a_1 & a_1^2 & cdots & a_1^n\
    1 & a_2 & a_2^2 & cdots & a_2^n \
    vdots & vdots & ddots & vdots \  
    1 & a_n & a_n^2 & cdots & a_n^n  \
    end{pmatrix}

方程组

使用begin{array}...end{array}left{...right.配合表示方程组

$$
f(n)=begin{cases}
    n/2,  & text{if n is even}\
    3n+1, & text{if n is odd}
    end{cases}
$$
f(n)=begin{cases}
    n/2,  & text{if n is even}\
    3n+1, & text{if n is odd}
    end{cases}
$$
f(n)=begin{cases}
    n/2,  & text{if $n$ is even} \[2ex]
    3n+1, & text{if $n$ is odd}
    end{cases}
$$
f(n)=begin{cases}
    n/2,  & text{if $n$ is even} \[2ex]
    3n+1, & text{if $n$ is odd}
    end{cases}
left{ begin{array}{c} a_1x+b_1y+c_1z=d_1 \ a_2x+b_2y+c_2z=d_2 \ a_3x+b_3y+c_3z=d3 end{array} right.\
\left{ begin{array}{c} a_1x+b_1y+c_1z=d_1 \ a_2x+b_2y+c_2z=d_2 \ a_3x+b_3y+c_3z=d3 end{array} right.\

对齐方程组中的=号,可以使用begin{aligned}...end{aligned},如:

left{ begin{aligned} a_1x+b_1y+c_1z & = d_1+e_1 \ a_2x+b_2y & = d_2 \ a_3x+b_3y+c_3z & = d_3 end{aligned} right.\
left{ begin{aligned} a_1x+b_1y+c_1z & = d_1+e_1 \ a_2x+b_2y & = d_2 \ a_3x+b_3y+c_3z & = d_3 end{aligned} right.\
$$
begin{align}
D(x) &= int_{x_0}^x P(x^{prime}),mathrm{dx^{prime}}  \
&= Cint_{x_0}^x x^{prime n},mathrm{dx^{prime}} \
&= frac{C}{n+1}(x^{n+1}-x_0^{n+1}) \
&equiv  y
end{align}
$$
begin{align}
D(x) &= int_{x_0}^x P(x^{prime}),mathrm{dx^{prime}}  \
&= Cint_{x_0}^x x^{prime n},mathrm{dx^{prime}} \
&= frac{C}{n+1}(x^{n+1}-x_0^{n+1}) \
&equiv  y
end{align}

高亮与框线

$$
bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{1}
}
$$
bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{1}
}
$$
bbox[border:2px solid red]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    qquad (2) 
}
$$
bbox[border:2px solid red]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    qquad (2) 
}

颜色

命名颜色是浏览器相关的,如果浏览器没有定义相关的颜色名称,则相关文本将被渲染为黑色。以下颜色是HTML4和CSS2标准中定义的一些颜色,其应该被大多数浏览器定义了。

begin{array}{|rc|} hline \ 
verb+color{black}{text}+ & color{black}{text} \
verb+color{gray}{text}+ & color{gray}{text} \
verb+color{silver}{text}+ & color{silver}{text} \
verb+color{white}{text}+ & color{white}{text} \ 
hline \
verb+color{maroon}{text}+ & color{maroon}{text} \
verb+color{red}{text}+ & color{red}{text} \
verb+color{yellow}{text}+ & color{yellow}{text} \
verb+color{lime}{text}+ & color{lime}{text} \
verb+color{olive}{text}+ & color{olive}{text} \
verb+color{green}{text}+ & color{green}{text} \
verb+color{teal}{text}+ & color{teal}{text} \
verb+color{aqua}{text}+ & color{aqua}{text} \
verb+color{blue}{text}+ & color{blue}{text} \
verb+color{navy}{text}+ & color{navy}{text} \
verb+color{purple}{text}+ & color{purple}{text} \
verb+color{fuchsia}{text}+ & color{fuchsia}{text} \
verb+color{magenta}{text}+ & color{magenta}{text} \
hline end{array}
begin{array}{|rc|} hline \ 
verb+color{black}{text}+ & color{black}{text} \
verb+color{gray}{text}+ & color{gray}{text} \
verb+color{silver}{text}+ & color{silver}{text} \
verb+color{white}{text}+ & color{white}{text} \ 
hline \
verb+color{maroon}{text}+ & color{maroon}{text} \
verb+color{red}{text}+ & color{red}{text} \
verb+color{yellow}{text}+ & color{yellow}{text} \
verb+color{lime}{text}+ & color{lime}{text} \
verb+color{olive}{text}+ & color{olive}{text} \
verb+color{green}{text}+ & color{green}{text} \
verb+color{teal}{text}+ & color{teal}{text} \
verb+color{aqua}{text}+ & color{aqua}{text} \
verb+color{blue}{text}+ & color{blue}{text} \
verb+color{navy}{text}+ & color{navy}{text} \
verb+color{purple}{text}+ & color{purple}{text} \
verb+color{fuchsia}{text}+ & color{fuchsia}{text} \
verb+color{magenta}{text}+ & color{magenta}{text} \
hline end{array}

此外,HTML5和CSS3也定义了一些颜色名称,参见 。同时,颜色也可以使用#rgb的形式来表示,如下:

begin{array}{|rrrrrrrr|} hline verb+#000+ & color{#000}{text} & & & verb+#00F+ & color{#00F}{text} & & \ & & verb+#0F0+ & color{#0F0}{text} & & & verb+#0FF+ & color{#0FF}{text} \ verb+#F00+ & color{#F00}{text} & & & verb+#F0F+ & color{#F0F}{text} & & \ & & verb+#FF0+ & color{#FF0}{text} & & & verb+#FFF+ & color{#FFF}{text} & & \ hline end{array}
begin{array}{|rrrrrrrr|} hline verb+#000+ & color{#000}{text} & & & verb+#00F+ & color{#00F}{text} & & \ & & verb+#0F0+ & color{#0F0}{text} & & & verb+#0FF+ & color{#0FF}{text} \ verb+#F00+ & color{#F00}{text} & & & verb+#F0F+ & color{#F0F}{text} & & \ & & verb+#FF0+ & color{#FF0}{text} & & & verb+#FFF+ & color{#FFF}{text} & & \ hline end{array}

TAG&标签

$$
bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{1}
}
$$
bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{1}
}
$$bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{2}label{2}
}$$
bbox[yellow]{
    e^x=lim_{ntoinfty} left( 1+frac{x}{n} right)^n
    tag{2}
}

使用tag{yourtat}来标记公式,如果想在之后引用该公式,则还需要加上label{yourlabel}在tag之后,

补充

(1)indicator function: mathbb{I} \rightarrow mathbb{|}

(2)空心的符号:mathbb{KL} rightarrow mathbb{KL}

(3)向量、矩阵:mathrm{x, y} rightarrow mathrm(x,y)

(4)实值:x x

使用 begin{align} 时,在每个式子末尾加上 nonumber 可以去掉显示式子的标号。

其他公式写法,留档记录

流图图

st=>start: User login
op=>operation: Operation
cond=>condition: Successful Yes or No?
e=>end: Into admin

st->op->cond
cond(yes)->e
cond(no)->op

删除线

代码 显示样式
$cancel{a=b+c}$ $cancel{a=b+c}$
$cancel{a}$ cancel{a}
$bcancel{a = b + c}$ bcancel{a = b + c}
$bcancel{b}$ $bcancel{b}$
$xcancel{a=b+c}$ xcancel{a=b+c}
$xcancel{a}$ xcancel{a}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
  • 本站名称:追梦人博客
  • 本站永久地址:https://www.dreamren.cn
  • 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系在线客服进行删除处理
  • 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责
  • 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
  • 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新
  • 如果您喜欢本站,♥点这儿开通会员资助本站
  • 如遇软件内有加群提示,为修改者自留,非本站信息,注意鉴别
  • 这些信息可能会帮助你了解本站:

SVIP会员 关于我们 网址导航 标签云