# Dynamic Latex

**URL:** <https://discourse.julialang.org/t/dynamic-latex/69600>\
**Category:** New to Julia\
**Tags:** question, pluto-and-latex\
**Created:** [October 12, 2021, 3:08am UTC](https://discourse.julialang.org/t/dynamic-latex/69600 "2021-10-12T03:08:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianTipton1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briantipton1/32/29859_2.png) [@BrianTipton1](https://discourse.julialang.org/u/BrianTipton1)\
**Post date:** [October 12, 2021, 3:08am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/1 "2021-10-12T03:08:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 12, 2021, 4:47am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/2 "2021-10-12T04:47:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [October 12, 2021, 5:15am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/3 "2021-10-12T05:15:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BrianTipton1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briantipton1/32/29859_2.png) [@BrianTipton1](https://discourse.julialang.org/u/BrianTipton1)\
**Post date:** [October 12, 2021, 5:16am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/4 "2021-10-12T05:16:09Z")

</div>

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

```nohighlight
\lim_{h\to $(var)}

```

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

---

<div class="post-metadata">

**Author:** ![BrianTipton1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briantipton1/32/29859_2.png) [@BrianTipton1](https://discourse.julialang.org/u/BrianTipton1)\
**Post date:** [October 12, 2021, 5:16am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/5 "2021-10-12T05:16:45Z")

</div>

Sweet thank you il give that a shot

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [October 12, 2021, 6:50am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/6 "2021-10-12T06:50:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BrianTipton1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briantipton1/32/29859_2.png) [@BrianTipton1](https://discourse.julialang.org/u/BrianTipton1)\
**Post date:** [October 12, 2021, 7:08am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/7 "2021-10-12T07:08:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BrianTipton1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briantipton1/32/29859_2.png) [@BrianTipton1](https://discourse.julialang.org/u/BrianTipton1)\
**Post date:** [October 12, 2021, 9:07am UTC](https://discourse.julialang.org/t/dynamic-latex/69600/8 "2021-10-12T09:07:54Z")

</div>

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