latex 书写分段公式总结

example

\documentclass{article}
\usepackage{amsmath}
\usepackage{xeCJK}

\begin{document}

$$ 
    P_{r - j} =
       \begin{cases}
          0123   &  \text{if $r - j$ is odd,} \\
          a! \, (-1)^{(r - j)/2}
           &  \text{if $r - j$ is even.}
       \end{cases}                
$$


\begin{equation}   
 P_{r - j} =
    \begin{cases}
       0   &  \text{if $r - j$ is odd,} \\
       r! \, (-1)^{(r - j)/2}
        &  \text{if $r - j$ is even.}
    \end{cases}                
\end{equation}
   
\begin{equation}   
f(x) =\begin{cases}
       1   &  \text{如果x为有理数,} \\
       2
           &  \text{如果x为无理数,}\\
       0   &  \text{其他.}
    \end{cases}               
 \end{equation}
   
\begin{gather}  
\raisetag{-10pt}
\text{The sign function: \ }
\mathcal{S}(x) =  \begin{cases}
                    -1   &  x < 0 \\
                        0   &  x = 0 \\
                        1   &  x > 0
                    \end{cases}
   \end{gather}

\end{document}

结果如下:
在这里插入图片描述
注意这个begin cases的使用, 我还是第一次遇到这个,可以多加学习

此外在draw.io中可以使用 b e g i n c a s e s begin cases begincases的语法,但是不能使用begin array的东西,看下面的例子

$$M(i^{v_j},k^{v_l}) =\begin{cases}1, \lnot (i,k \in \mathrm H
),\\ |Q_{ik}-S^*(i^{v_j},k^{v_l})|^\beta,  others.\end{cases}$$

这里是可以的,结果如下
在这里插入图片描述

但是这个draw.io对于复杂的公式只能手写,复制其中的代码是不行的,就很莫名其妙

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值