Reputation: 3267
How can I write something like this in markdown?
Here are the specific things I don't know how to do:
Here's what I would do if I knew the right syntax:
$$
CE(p, y) = \curlytwo{-\log(p) \tab \text{if }y=1}{-\log(1-p) \tab \text{otherwise.}}
$$
where I've invented \curlytwo
and \tab
.
Upvotes: 5
Views: 8352
Reputation: 21
I learned from here and used array.
$$
CE(p,y)=\left\{
\begin{array}{ll}
-\log(p) &\text{if }y=1 \\
-\log(1-p) &\text{otherwise}.
\end{array}
\right.
$$
Upvotes: 0
Reputation: 1
\begin{equation}
(p, y) =
\begin{cases}
-\log(p) & \text{if }~~ y = 1 \\
-\log(1-p) & \text{otherwise.}
\end{cases}
\end{equation}
Upvotes: 0
Reputation: 57982
You can use the cases
environment to write cases which is supported in 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}
$$
Upvotes: 10