# Makie will not use \`texfont()\`

**URL:** <https://discourse.julialang.org/t/makie-will-not-use-texfont/94146>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [February 6, 2023, 3:52pm UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146 "2023-02-06T15:52:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [February 6, 2023, 3:52pm UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146/1 "2023-02-06T15:52:17Z")

</div>

I am having a strange problem with using LaTeX font for the axis and labels in Makie. In `GLMakie@0.7.0`, the classic method of setting `font=texfont()` works without issue. I can not get the axes and labels to use the same font in later versions (I am comparing to 0.8.2, for specificity). I can’t get v0.8.2 to use any font other than the default seen below, even swapping out the `texfont()` for “New Computer Modern” or the full path on my system to the ttf file.

```julia
using GLMakie, MathTeXEngine

#=
	Works with GLMakie@0.7.0
=#
fig = Figure(font = texfont())
ga = fig[1,1] = GridLayout()
axs = [Axis(ga[1,1], ylabel="Label"), Axis(ga[2,1], xlabel=L"$ t $ [ms]", ylabel=L"Another Label $x$")]	
save("./old_method.png",fig)
#=
	Adapting for GLMakie@0.8.2
=#
fig = Figure(fonts = (; regular = texfont(), bold = texfont()))
ga = fig[1,1] = GridLayout()
axs = [Axis(ga[1,1], ylabel="Label"), Axis(ga[2,1], xlabel=L"$ t $ [ms]", ylabel=L"Another Label $x$")]
save("./new_method.png",fig)

```

`old_method.png`:  
 ![old_method](https://global.discourse-cdn.com/julialang/original/3X/f/7/f7c5dc593c0f4a164954df5148af7e6aaa7cf906.png)  
`new_method.png`:  
 ![new_method](https://global.discourse-cdn.com/julialang/original/3X/1/1/111b1ef97887c9be213f2cbf276d4a5da473f459.png)

I’ve tested this on multiple machines and can not get the new method to present the axes and ticks with the `texfont()` like the old method (pre-Makie 0.19’s `font` to `fonts` change). Wondering if anyone has figured out how to do so.

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [February 8, 2023, 2:52am UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146/2 "2023-02-08T02:52:48Z")

</div>

The following worked for me:  
`Makie.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic)))`

I can confirm that passing `fonts` in the figure does not work, but I’m not sure why. Will look into it.

---

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [February 8, 2023, 10:13am UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146/3 "2023-02-08T10:13:14Z")

</div>

Thank you very much, I would never have thought to set the fonts by calling `Makie.update_theme!`. Even from the docs for [theming](https://docs.makie.org/stable/documentation/theming/index.html#update_theme) and for [fonts](https://docs.makie.org/stable/documentation/fonts/index.html#symbol), it’s not clear why this should be necessary – the fonts example seems to work for them (in my case, only the xlabel font is changed by the Figure-level `fonts`).

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [February 8, 2023, 11:27am UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146/4 "2023-02-08T11:27:42Z")

</div>

Agreed - it seems like a bug to me, but I’m not 100% sure why this happens.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 8, 2023, 12:34pm UTC](https://discourse.julialang.org/t/makie-will-not-use-texfont/94146/5 "2023-02-08T12:34:42Z")

</div>

Actually it seems that the docs example is also broken, because the labels are not “Dejavu”…
