Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the preamble to use other packages, like siunitx? #70

Open
tamasgal opened this issue Feb 4, 2025 · 3 comments
Open

Modifying the preamble to use other packages, like siunitx? #70

tamasgal opened this issue Feb 4, 2025 · 3 comments

Comments

@tamasgal
Copy link

tamasgal commented Feb 4, 2025

I am trying to use siunitx to format units in labels but I don't understand how to modify the preamble to include something like \usepackage{siunitx}. According to the readme, missing packages will be downloaded by the provided lightweight (Xe)LaTeX runtime so I thought this must be possible somehow.

One desperate try was this (not working):

using CairoMakie
using MakieTeX

some_label = TeXDocument(raw"""
	\documentclass{standalone}
    \usepackage{siunitx}
    \begin{document}
    $x$ / \si{\micro\meter}
    \end{document}
""")

f = Figure()
ax1 = Axis(f[1, 1], some_label)
f
@asinghvi17
Copy link
Member

That TeXDocument should be valid but I'm not sure what you were meaning to do with ax1 = Axis(f[1, 1], some_label)...

unfortunately, using MakieTeX things as x/ylabels doesn't work at the moment due to some changes in the text recipe, so you'd have to do it by creating labels and positioning them where you want them. To have a title, for example,

f = Figure()
ax1 = Axis(f[1, 1])
title = LTeX(f[0, 1], some_label; tellheight = true, tellwidth = false)

@tamasgal
Copy link
Author

tamasgal commented Feb 4, 2025

Sorry my snipped above should say xlabel=some_label

Oh okay, that's unfortunate.

@pkalaczynski
Copy link

Thanks for this, it's really useful to get around the problem with non-italics \mu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants