Interpolate LaTeX and function call in markdown

Hi all,

I was wondering how I can interpolate LaTeX and a function call in Pluto’s markdown.

Suppose I have one cell

θ = 1/3

And a markdown cell:

md"
$\theta =$ = $round(θ, digits=2)
"

I tried adding \ in several places, but nothing worked. Essentially, I would like to display a math symbol with a limited number of digits for its value.

Thank you.

Isn’t your problem just that you’re not interpolating correctly?

$ is eager, so you have to enclose anything more than the shortest complete statement in brackets if you want to interpolate it as a whole.

Thank you. That was exactly what I was missing. Much appreciated!

1 Like

This is an issue with TeX syntax. If Markdown (only) used LaTeX's \( x\), this would be solved.

Sometimes it helps to use Markdown.parse("string") so you can escape explicitly.

2 Likes