# LaTeX not working in Makie

**URL:** <https://discourse.julialang.org/t/latex-not-working-in-makie/66687>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [August 19, 2021, 6:27pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687 "2021-08-19T18:27:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [August 19, 2021, 6:27pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/1 "2021-08-19T18:27:33Z")

</div>

I am trying to figure out how to use Makie.  
As a simple test, I decided to run the following code snippet:

```julia
using CairoMakie, LaTeXStrings

xs = 0.0:0.01:2.0
lines(xs, sin.(π.*xs), axis=(title=L"\sin{x}",))

```

However, I get the following error:

> ArgumentError: regex matching is only available for the String type; use String(s) to convert

> Stacktrace:  
> [1] match(r::Regex, s::LaTeXString, i::Int64)  
> @ Base ./regex.jl:317  
> [2] match(r::Regex, s::LaTeXString)  
> @ Base ./regex.jl:316  
> [3] iswhitespace(str::LaTeXString)  
> @ Makie.MakieLayout ~/.julia/packages/Makie/c5WJV/src/makielayout/lineaxis.jl:412

Is it some kind of bug or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [August 20, 2021, 4:39am UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/2 "2021-08-20T04:39:08Z")

</div>

The version of Makie.jl in your environment is probably the old v0.13.14. In that case, I was able to confirm that the same error you reported occurs.

How to check the version of Makie.jl:

```julia
using Pkg
Pkg.status("Makie"; mode=PKGMODE_MANIFEST)

```

In my environment

- CairoMakie v0.6.3
- Makie v0.15.0
- LaTeXStrings v1.2.1

your code snippet works fine.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/4/e4f330804cc9ff31230ba9ef62acc9510b80f857.jpeg)

Please upgrade CairoMakie.jl and Makie.jl respectively to v0.6.3 and v0.15.0 or higher.

The actual work I did is essentially the following: Start Julia in an empty directory and run

```julia
pkg> activate .
pkg> add CairoMakie LaTeXStrings
pkg> st

```

And then, run your code snippet.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/0/c0abdf1162081771886154b8494961586f323f9b.jpeg)

See [https://github.com/genkuroki/public/tree/main/0016/Makie](https://github.com/genkuroki/public/tree/main/0016/Makie)

---

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [August 20, 2021, 12:14pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/3 "2021-08-20T12:14:48Z")

</div>

Yes, you are right, I have the older version installed.

Do you know if there is a way to force the installation of a new version in my current non-empty environment? Like, force the installation and see what dependency conflicts does it lead to.

---

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [August 20, 2021, 1:05pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/4 "2021-08-20T13:05:59Z")

</div>

Ok. I solved this. As it turns out, the culprit was [`WebIO.jl` because it bounded `Observables.jl`](https://github.com/JuliaGizmos/WebIO.jl/issues/455). I removed `WebIO`, `Interact` and `PlotlyJS` and managed to update `CairoMakie` after that.

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [August 20, 2021, 6:54pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/5 "2021-08-20T18:54:28Z")

</div>

> [@Gregstrq](#):
>
> Do you know if there is a way to force the installation of a new version in my current non-empty environment? Like, force the installation and see what dependency conflicts does it lead to.

No. I also don’t know how to do it.

Ordinarily, I have essentially the following way to register packages.

- In ~/.julia/environments/v1.6/{Project.toml, Manifest.toml} (default), register those packages that are always used and do not cause harmful version down of other packages.

- In /path/of/specific/project/{Project.toml, Manifest.toml}, only register packages that cause harmful version downs of other packages, but are necessary for the specific project.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 20, 2021, 8:47pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/6 "2021-08-20T20:47:49Z")

</div>

> [@Gregstrq](#):
>
> Do you know if there is a way to force the installation of a new version in my current non-empty environment? Like, force the installation and see what dependency conflicts does it lead to.

For instance, in `Makie.jl`’s github page, the latest version is v0.15.0.  
Believe that what you ask may be achieved by:

```julia
] add Makie@0.15.0

```

and check if there any conflicts?

---

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [August 20, 2021, 8:51pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/7 "2021-08-20T20:51:30Z")

</div>

Ok. Thank you. I did not know how to specify the version. I used `] add CairoMakie#master` instead.

---

<div class="post-metadata">

**Author:** ![Seif\_Shebl](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Post date:** [August 21, 2021, 5:04pm UTC](https://discourse.julialang.org/t/latex-not-working-in-makie/66687/8 "2021-08-21T17:04:43Z")

</div>

> [@Gregstrq](#):
>
> `sin.(π.*xs)`

Just a side note unrelated to the question, `sin(pi*x)` is better written in Julia as `sinpi(x)`, it’s more efficient and accurate. So, you could write `sinpi.(xs)` instead in your case.
