markdown - 如何在 Markdown 方程中写案例
问题描述
我怎样才能在markdown中写出这样的东西?
以下是我不知道该怎么做的具体事情:
- 有两条线的大花括号
- 如果我知道以上内容后需要,则两行内的制表符分隔
如果我知道正确的语法,我会这样做:
$$
CE(p, y) = \curlytwo{-\log(p) \tab \text{if }y=1}{-\log(1-p) \tab \text{otherwise.}}
$$
我发明的地方\curlytwo
和\tab
。
解决方案
您可以使用该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}
$$
推荐阅读
- html - 不透明的 CSS 形状非矩形
- amazon-web-services - AWS ec2 对我这种类型的项目的成本是多少
- c - atan2 用于任意相移的两个正弦曲线?
- sql - 适当的 IF ELSE 用于特定情况
- angularjs - 为什么在使用带有 AngularJS 的 Typescript 时需要“声明 var angular”?
- verilog - 这个循环如何在 SystemVerilog 语言中工作?
- java - 如何在不使用 xml 的 Java 类中格式化 Java 字符串
- java - 为什么我的类构造函数被重复调用?
- c# - 按期间分割忽略少数情况
- git - 如何浏览(cd ..)到父级直到找到特定文件夹?