# LaTeXStrings deletes strings in Julia JN

**URL:** <https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105>\
**Category:** New to Julia\
**Created:** [January 5, 2022, 9:04pm UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105 "2022-01-05T21:04:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CentraCep](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/centracep/32/32454_2.png) [@CentraCep](https://discourse.julialang.org/u/CentraCep)\
**Post date:** [January 5, 2022, 9:04pm UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/1 "2022-01-05T21:04:29Z")

</div>

I am using Julia 1.7.0 in Jupyter Notebook. I am trying to print two equations in the notebook using:

```
println("Separation of variables")

L"""\dfrac{\text{d}y}{\text{d}\xi} \
    = \
    \dfrac{z}{\xi^2} \ """

L"""\dfrac{\text{d}z}{\text{d}\xi} \
    = \
    -\xi^2y^n \ """

```

However, when I run this, only the second equation is printed out. Is it overwriting the first equation?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 5, 2022, 9:26pm UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/2 "2022-01-05T21:26:26Z")

</div>

Try putting the equations in different cells as a test. The cell is likely only displaying the last line.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 5, 2022, 10:18pm UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/3 "2022-01-05T22:18:18Z")

</div>

> [@CentraCep](#):
>
> However, when I run this, only the second equation is printed out. Is it overwriting the first equation?

A Jupyter notebook only displays the result of the _last expression_ in any given cell. The other lines of code are executed, but their results are simply not displayed unless they call an explicit output function.

If you want to display both strings, you can (a) put then in separate Jupyter cells, or (b) manually call `display` (the multimedia analogue of `println`) on the things you want to show, e.g.

```julia
display(L"\sqrt{x}")
display(L"\frac{1}{x+1}")

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 5, 2022, 10:24pm UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/4 "2022-01-05T22:24:02Z")

</div>

Alternatively, if you are just trying to show some text, you don’t need to execute Julia code at all — just [change the cell type to “Markdown”](https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Working%20With%20Markdown%20Cells.html) and enter [Markdown text](https://www.markdownguide.org/basic-syntax/) with equations in `$...$`:

```nohighlight
Separation of variables:

$$    
\dfrac{\text{d}y}{\text{d}\xi} = \dfrac{z}{\xi^2} 
$$
    
$$
\dfrac{\text{d}z}{\text{d}\xi} = -\xi^2y^n
$$

```

---

<div class="post-metadata">

**Author:** ![CentraCep](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/centracep/32/32454_2.png) [@CentraCep](https://discourse.julialang.org/u/CentraCep)\
**Post date:** [January 6, 2022, 1:58am UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/5 "2022-01-06T01:58:27Z")

</div>

Thanks. When I run the code

```julia
display("Separation of variables")

display(L"\dfrac{\text{d}y}{\text{d}\xi} \
    = \
    \dfrac{z}{\xi^2} \ ")

display(L"\dfrac{\text{d}z}{\text{d}\xi} \
    = \
    -\xi^2y^n \ ")

```

The `Separation of Variables` has quotes. If I remove the quotes, nothing is displayed at all after the cell. How can I display ‘Separation of Variables’ and the equations without any quotes?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 6, 2022, 3:09am UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/6 "2022-01-06T03:09:25Z")

</div>

> [@CentraCep](#):
>
> How can I display ‘Separation of Variables’ and the equations without any quotes?

`display(Text("Separation of Variables"))`

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 6, 2022, 3:12am UTC](https://discourse.julialang.org/t/latexstrings-deletes-strings-in-julia-jn/74105/7 "2022-01-06T03:12:23Z")

</div>

Note that you can also display a block of formatted text, including equations, using the `Markdown` module. For example:

```julia
using Markdown
display(md"""
## Separation of variables:

``
\dfrac{\text{d}y}{\text{d}\xi} = \dfrac{z}{\xi^2} 
``

``
\dfrac{\text{d}z}{\text{d}\xi} = -\xi^2y^n
``
""")

```
