# Pluto Reactivity and eval

**URL:** <https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250>\
**Category:** Tooling\
**Tags:** pluto\
**Created:** [March 22, 2022, 2:16am UTC](https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250 "2022-03-22T02:16:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TI36XPro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ti36xpro/32/33658_2.png) [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Post date:** [March 22, 2022, 2:16am UTC](https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250/1 "2022-03-22T02:16:52Z")

</div>

I recently discovered `Latexify.jl` and really like it. I am trying to combine it with Pluto but am failing. I’d appreciate any hints.

I have a pluto notebook with a cell that contains the following.

```julia
begin
	fex = :(f(x)=sin(2π*x)+sin(5π*x));
	eval(fex)
	latexify(fex)
end

```

In the next cell I want to use the function `f` with CairoMakie to plot it.

```julia
begin
	n = 2^8
	x = LinRange(0, 1, n)
	lines(x, f.(x))
end

```

I find though that I have to re-evaluate the above cell (shift and enter) to get it to update, which is not the reactivity I was expecting. I was expecting I could change the expression to `:(f(x)=sin(2π*x)+sin(10π*x))` and it would update the plot accordingly.

Any thoughts on what I am missing here?

---

<div class="post-metadata">

**Author:** ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)\
**Post date:** [March 22, 2022, 7:50am UTC](https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250/2 "2022-03-22T07:50:51Z")

</div>

It seems that defining a function `f = eval(fex)` works. Maybe it isn’t the most elegant way to do it.

 ![fex](https://global.discourse-cdn.com/julialang/original/3X/6/d/6d2fbd49692b7bb46d0ddf0b36274f15e40ca6f3.png)

---

<div class="post-metadata">

**Author:** ![TI36XPro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ti36xpro/32/33658_2.png) [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Post date:** [March 22, 2022, 11:29pm UTC](https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250/3 "2022-03-22T23:29:06Z")

</div>

Yes - thank you. That fixes it. Still don’t know why…but at least it is fixed.

---

<div class="post-metadata">

**Author:** ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)\
**Post date:** [March 23, 2022, 8:01am UTC](https://discourse.julialang.org/t/pluto-reactivity-and-eval/78250/4 "2022-03-23T08:01:23Z")

</div>

I think that Pluto is very smart updating cells affected by a change, but not in this case `eval(fex)`. Creating this new function `f = eval(fex)` makes Pluto to update the cell.
