How to display a fraction in a Markdown cell?

I’d like to obtain this in a Markdown cell:

image

I have found this for a markdown cell but it doesn’t work:

## Set up a proportion:
/frac{n1}{d1} = /frac{n2}{d2}

thank you!

Try:

Set up a proportion:

$$
\frac{n1}{d1} = \frac{n2}{d2}
$$

Notice the backslash instead of the forwardslash for \frac, and the $$ markers for a LaTeX block.

3 Likes

So cool ! thanks @matthew.brett ! :slight_smile:
Anyway I can have it justified to the left instead of centered?


thanks!

Did you try in-line? For me, this results in what you asked about in your original post:

## Set up a proportion:
$\Large\frac{n1}{d1} = \frac{n2}{d2}$

There’s a good summary of in-line vs. Math Block here. That’s for Jupyter Book but the basics are the same for in-line math vs. match blocks in regards to the symbols.
Read about the tags for the sizes of fonts here.

hey @fomightez, thanks for chiming in!
I’m getting this:


I’m gonna have a look at your links, thanks

If you look at the image in your own post, you’ll observe you are running that in a code cell instead of a markdown cell? (Hint: Markdown cells don’t have ‘Input’ symbols with numbers next to them after hitting shift+Enter.)
It is meant to be run as a markdown cell as noted in your own original post’s title.

Yes! my bad! went too fast on that one… :slight_smile:
thanks a lot @fomightez much appreciated :+1:

1 Like