How to type math in jupyterlab markdown extension?

Hey @isabela-pf and @dereklam!

This is Leo! I installed your awesome markdown extension after seeing your demo in SF at the jupyter open sessions!

Can you remind me how to type math in markdown cells? I specifically remember Derek doing that in the demo. You should also add instructions for that in the README if you get the chance! I can make a PR if you remind me how to do the math shortcut :).


The one shown in the animation on the repo page appears to be typical for a markdown cell in any Jupyter page. Maybe they have since added a way to make it easier? I couldn’t see such a thing in the Binder launched version at this time.

In the animation, it looks like the following code is used.

$s= \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2}$

Followed by hitting return after the closing dollar sign to trigger rendering it.

For inline, you want to flank the latex by dollar signs. For displayed formulas (at the center), you’d use double dollar signs to flank it. You may find this quick reference helpful.

In the rich text editor, you then have to click directly on the formula to edit it.

(I note that if you go back and forth between markdown and raw in the rich text editor, the equations can become ‘corrupt’ by doubling up the backslashes to escape the code.)

1 Like

Thanks @fomightez, that’s super helpful, especially the mathjax reference. @dereklam let us know if there’s a separate way – I forget if you were using $ and $$ or not.

Hi Leo! We are using a single $ for inline math and $$ for block math to reflect the standard syntax. When writing a piece of inline or block math for the first time, typing the closing $ or $$ should automatically render that section of math. If you click back into a section to edit it, then you have to press enter to confirm the edits and re-render.

I hope that helps! Let us know if you have more questions. It’s great to hear that you are working with the extension.


Awesome! Thanks for confirming @isabela-pf :slight_smile:

1 Like