Dynamic Latex

Sorry if a silly question, but is there a way to use variables in latex equations in pluto.jl markdown so that the equations change dynamically.
Thanks,
The new guy loving this language

I have not tried it for LaTeX, but in normal strings you can write a dollar-sign and then the variable ( as in ‘“My string has $var symbols”’, where the variable ‘var’ is defined elsewhere), to insert the value of the given variable in the string. I think that should work for LaTeX as well.

It’s a bit tricky because of the stupid stupid stupid TeX notation ($$ instead of \(\)).

What you can do is use Markdown.parse("String \$x = $x\$") instead of md"String $x = ???$", that way you first build the string, and then the markdown.

3 Likes

I have tried exactly that unsure if im missing something
md"“”

\lim_{h\to $(var)}

“”"
Outputs the equation with $(var) in it

Sweet thank you il give that a shot

Oh also, iirc you can use double backtick for the math mode, instead of \$

1 Like

Yup, just tested and both work perfectly.
Thanks again,
Brian

I whipped this quick script up if anyone if interested to make life a lil easier.
BrianTipton1/LatexParser.jl (github.com)