Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render formula #31

Open
sstorey-nephila opened this issue Jul 25, 2019 · 2 comments
Open

Unable to render formula #31

sstorey-nephila opened this issue Jul 25, 2019 · 2 comments

Comments

@sstorey-nephila
Copy link

sstorey-nephila commented Jul 25, 2019

This latex is correct

$$
\underbrace{E[Y_i|D_i=1]- E[Y_i|D_i=0]}_\text{Observed difference in average health} = 
\underbrace{E[Y_{1i}|D_i=1]- E[Y_{0i}|D_i=1]}_\text{Average treatment effect on the treated} + 
\underbrace{E[Y_{0i}|D_i=1]- E[Y_{0i}|D_i=0]}_\text{Selection Bias}
$$

Yet to make it work here in github, I must escape _\ to \_\

$$
\underbrace{E[Y_i|D_i=1]- E[Y_i|D_i=0]}\_\text{Observed difference in average health} = 
\underbrace{E[Y_{1i}|D_i=1]- E[Y_{0i}|D_i=1]}\_\text{Average treatment effect on the treated} +
\underbrace{E[Y_{0i}|D_i=1]- E[Y_{0i}|D_i=0]}\_\text{Selection Bias}
$$

After escaping the underscores it does work
$$
\underbrace{E[Y_i|D_i=1]- E[Y_i|D_i=0]}_\text{Observed difference in average health} = \underbrace{E[Y_{1i}|D_i=1]- E[Y_{0i}|D_i=1]}_\text{Average treatment effect on the treated} + \underbrace{E[Y_{0i}|_i=1]- E[_{0i}|_i=0]}_\text{Selection Bias}
$$

Any idea if this can be resolved as it appears to be similar in root cause to the issue when trying to render this

$$
\begin{aligned}
Y_i &= \left \{
\begin{array}{ll}
Y_{1i} & \text{if } D_i = 1 \\  
Y_{0i} & \text{if } D_i = 0 \\   
\end{array} 
\right. \\
&= Y_{0i} + (Y_{1i} - Y_{0i})D_{i*}
\end{aligned}
$$

Resulting in this error
$$
\begin{aligned}
Y_i &= \left {
\begin{array}{ll}
Y_{1i} & \text{if } D_i = 1 \
Y_{0i} & \text{if } D_i = 0 \
\end{array}
\right. \
&= Y_{0i} + (Y_{1i} - Y_{0i})D_{i*}
\end{aligned}
$$

Change the latex like this

$$
\begin{align}
Y_i &= \left \\{
\begin{array}{ll}
Y_{1i} & \text{if } D_i = 1 \\\\
Y_{0i} & \text{if } D_i = 0 \\\\
\end{array} 
\right. \\\\
&= Y_{0i} + (Y_{1i} - Y_{0i})D_{i*}
\end{align}
$$

Amending the original \{ to \\{ and the \\ to \\\\ resolves the issue

$$ \begin{align} Y_i &= \left \{ \begin{array}{ll} Y_{1i} & \text{if } D_i = 1 \\\ Y_{0i} & \text{if } D_i = 0 \\\ \end{array} \right. \\\ &= Y_{0i} + (Y_{1i} - Y_{0i})D_{i*} \end{align} $$

Mathjax correctly renders the latex and I can extract it for use elsewhere.

With thanks

@muzimuzhi
Copy link

Duplicate of #16 . And, I am afraid that this cannot be resolved.

@zzqxaut
Copy link

zzqxaut commented Oct 3, 2022

why the latex on typora is different from the latex on github?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants