美文网首页
Latex编辑

Latex编辑

作者: 黑白格_0ca6 | 来源:发表于2019-10-22 09:41 被阅读0次

    常用命令汇总

    最好是打印出来看,所以直接上链接: https://pan.baidu.com/s/1487ZWoWLG106vl2SL7jIJw&shfl=shareset 提取码: qyhb

    大矩阵/大括号

    $$\left( \begin{array}{cc} 
    2\tau & 7\phi-\frac5{12} \\ 
    3\psi & \frac{\pi}8 \end{array} \right) 
    \mbox{and}
    \left[ \begin{array}{cc|r} 
    3 & 4 & 5 \\ 
    6 & 7 & 8 \\
    9 & 10 & 11 \end{array} \right]$$
    

    \left( \begin{array}{cc} 2\tau & 7\phi-\frac5{12} \\ 3\psi & \frac{\pi}8 \end{array} \right) \mbox{and} \left[ \begin{array}{cc|r} 3 & 4 & 5 \\ 6 & 7 & 8 \\ 9 & 10 & 11 \end{array} \right]

    • 解释
      \left( \right)表示最外面的大括号,同理,\left[ \right]表示矩阵;
      \begin{array} \end{array}标记数组的起始位置;
      {rcl}表示对齐方式,r:右对齐,c:中心对齐,l:左对齐;
      {cc|r}中的|用于表示矩阵中的竖线;
      &用于连接一行内的相邻元素,为了显示清晰,左右空格;
      \\用于表示元素的换行,为了显示清晰,左右空格;
      \mbox{and}输入公式内文字。

    多个公式

    $$
    f(z)=\left\{ \begin{array}{rcl} 
    \cos z & \mbox{for} & z<3 \\ 
    0 & \mbox{for} & 3\leq z\leq 5 \\ 
    5 & \mbox{for} & z>5 
    \end{array} \right.
    $$
    

    f(z)=\left\{ \begin{array}{rcl} \cos z & \mbox{for} & z<3 \\ 0 & \mbox{for} & 3\leq z\leq 5 \\ 5 & \mbox{for} & z>5 \end{array} \right.

    • 解释
      \right.在只有单边括号的时候,一定不要忘记加.
      \leq 5中间一定要有空格;

    • 其他示例

    $$ f(x)=\left\{
    \begin{aligned}
    x & = & \cos(t) \\
    y & = & \sin(t) \\
    z & = & \frac xy
    \end{aligned}
    \right.$$
    

    f(x)=\left\{ \begin{aligned} x & = & \cos(t) \\ y & = & \sin(t) \\ z & = & \frac xy \end{aligned} \right.

    $$ F^{HLLC}=\left\{
    \begin{array}{rcl}
    F_L       &      & {0      <      S_L}\\
    F^*_L     &      & {S_L \leq 0 < S_M}\\
    F^*_R     &      & {S_M \leq 0 < S_R}\\
    F_R       &      & {S_R \leq 0}
    \end{array} \right. $$
    

    F^{HLLC}=\left\{ \begin{array}{rcl} F_L & & {0 < S_L}\\ F^*_L & & {S_L \leq 0 < S_M}\\ F^*_R & & {S_M \leq 0 < S_R}\\ F_R & & {S_R \leq 0} \end{array} \right.

    $$f(x)=
    \begin{cases}
    0& \text{x=0}\\
    1& \text{x!=0}
    \end{cases}$$
    

    f(x)= \begin{cases} 0& \text{x=0}\\ 1& \text{x!=0} \end{cases}

    多行公式等号对齐

    $$
    \begin{aligned}
    (F-\mu_F)(F-\mu_F)^{T}
    &=\left[ \begin{array}{cccc} \lambda_1 &  &  &  \\
     & \lambda_2 & & \\
     & & ... &\\
     & & & \lambda_4
    \end{array} \right] \\
    &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U \\
    &=U^{T}\Sigma_XU
    \end{aligned}
    $$
    

    \begin{align} (F-\mu_F)(F-\mu_F)^{T} &=\left[ \begin{array}{cccc} \lambda_1 & & & \\ & \lambda_2 & & \\ & & ... &\\ & & & \lambda_4 \end{array} \right] \\ &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U \\ &=U^{T}\Sigma_XU \end{align}

    • 解释
      align的中文意思就是排整齐,在需要对齐的地方前面做标记&
      无论是使用aligned还是align,保持前后一致才可以;

    公式编号

    $$
    \begin{align}
    (F-\mu_F)(F-\mu_F)^{T}
    &=\left[ \begin{array}{cccc} \lambda_1 &  &  &  \\
    & \lambda_2 & & \\
    & & ... &\\
    & & & \lambda_4
    \end{array} \right]\tag{1} \\
    &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U\tag{2} \\
    &=U^{T}\Sigma_XU\tag{3}
    \end{align}
    $$
    

    \begin{align} (F-\mu_F)(F-\mu_F)^{T} &=\left[ \begin{array}{cccc} \lambda_1 & & & \\ & \lambda_2 & & \\ & & ... &\\ & & & \lambda_4 \end{array} \right]\tag{1} \\ &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U\tag{2} \\ &=U^{T}\Sigma_XU\tag{3} \end{align}

    $$
    \begin{align}
    (F-\mu_F)(F-\mu_F)^{T}
    &=\left[ \begin{array}{cccc} \lambda_1 &  &  &  \\
    & \lambda_2 & & \\
    & & ... &\\
    & & & \lambda_4
    \end{array} \right] \\
    &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U \\
    &=U^{T}\Sigma_XU
    \end{align}\tag{4}
    $$
    

    \begin{align} (F-\mu_F)(F-\mu_F)^{T} &=\left[ \begin{array}{cccc} \lambda_1 & & & \\ & \lambda_2 & & \\ & & ... &\\ & & & \lambda_4 \end{array} \right] \\ &=U^{T}(X-\mu_X)(X-\mu_X)^{T}U \\ &=U^{T}\Sigma_XU \end{align}\tag{4}

    • 解释
      \tag{}用于给某一行添加公式编号,其位置的不同决定编号位置的不同,注意行间公式与整个公式的区别;

    参考文献

    1. 在CSDN-Markdown中书写多行大括号公式
    2. [CSDN_Markdown] 数学公式对齐

    相关文章

      网友评论

          本文标题:Latex编辑

          本文链接:https://www.haomeiwen.com/subject/sdvfvctx.html