I have read several posts in which LaTex ticks can be added to Makie manually, by specifying the ticks with a command, for instance here.
Close to publication, I would like that by default every text in my figure be a LaTeX string. This should include numerical values of the ticks, and all other strings. Is this possible with a single command?
I think we have to clarify what is meant by “LaTeX String” here. There are a few different interpretations.
The first and simplest one refers to the fonts used. If you render a LaTeXString type in Makie, it will layout the glyphs using MathTeXEngine.jl which will use Computer Modern fonts for that. So your question could relate to how you can adjust the fonts of all other non-LaTeXString text items to match. The easiest would be to pass different default fonts. That can be done using the fonts attribute like fonts = (; regular = x, bold = y) as described here Fonts · Makie
Another interpretation would be that you want all text to go through MathTeXEngine layouting. This doesn’t really make sense for non latex expressions but at least for ticks you could get there by replacing xtickformat and ytickformat in the theme with functions returning LaTeXStrings.
The third interpretation is that you want real latex, but currently MakieTeX.jl is not functional so this isn’t possible right now.
Thank you @jules for your response. I agree the question was not clear. I would like having plots in which any text displayed in the figure (including axis title, axis labels, legends, numbers annotations that I may write, and numbers displayed in the ticks) be displayed using in Computer Modern Roman.
Ideally, I would like to be able to change fonts if I want, but let’s say that for the time being I stick with Computer Modern Roman which is by far my go-to font for publications.
The examples presented in the documentation get me only so far, because the numbers in the ticks are not in the correct font.
The example you indicate makes me override the current figure defaults. I would like to call some command at the beginning of the following minimal example so that all non-LaTeX strings are Computer Modern Roman. Is there such a command?
module TestLaTeXFigure
using CairoMakie
x = LinRange(-pi,pi,100)
f, ax = lines(x,cos.(x),label=L"The function $y(x)=\sin(x)$")
axislegend()
ax.xlabel = L"x"
ax.ylabel = L"y"
ax.title = "This is a test title"
display(f)
end