oat
oat

Reputation: 484

math notation written in Markdown in Jupyter Notebook not rendered consistently on GitHub

I have the following text with math notation written in Markdown in a Jupyter Notebook:

* (linear regression model prediction) : y = $\theta_0$ + $\theta_1$$x_1$ + $\theta_2$$x_2$ + $\theta_n$$x_n$
* (...in vectorized form) ------------ : y = $h_\theta$(x) = $\Theta$.x

Somehow when this notebook was uploaded to GitHub, the first part was not rendered correctly, whereas the second part was rendered correctly, as shown in the image below:

problematic rendering of math notation on GitHub

The same markdown text was rendered correctly when this notebook was open in VSCode:

correctly rendered math notation in notebook opened in VSCode

May I ask how to solve this inconsistency in rendering math notations via Markdown in Jupyter Notebook?

The problematic jupyter notebook mentioned above is show here.

Upvotes: 1

Views: 1547

Answers (1)

mb21
mb21

Reputation: 39383

If you look at the raw file, you can see that it simply contains a markdown cell with that math. So GitHub's Jupyter rendering doesn't recognize this as math (apparently they use an old nbconvert version under the hood).

But probably you can avoid the problem by not using double dollars $$. Usually, you would write this in markdown like this:

* linear regression model prediction: $y = \theta_0 + \theta_1x_1 + \theta_2x_2 + \theta_nx_n$
* in vectorized form: $y = h_\theta(x) = \Theta.x$

Upvotes: 1

Related Questions