首页 > 解决方案 > 如何在 Markdown 方程中写案例

问题描述

我怎样才能在markdown中写出这样的东西?

在此处输入图像描述

以下是我不知道该怎么做的具体事情:

如果我知道正确的语法,我会这样做:

$$
CE(p, y) = \curlytwo{-\log(p) \tab \text{if }y=1}{-\log(1-p) \tab \text{otherwise.}}
$$

我发明的地方\curlytwo\tab

标签: markdownmathjax

解决方案


您可以使用该cases环境编写MathJax 支持的案例:

$$
\mathrm{CE}(p, y) = \begin{cases}
    -\log(p) & \text{if } y = 1 \\ % & is your "\tab"-like command (it's a tab alignment character)
    -\log(1-p) & \text{otherwise.}
\end{cases}
$$

推荐阅读