Replies: 14 comments
-
Could you please add some more context than a link |
Beta Was this translation helpful? Give feedback.
-
Just a passer-by, but I think this request comes from a mistaken assumption that Makie works in a similar way to matplotlib. While Makie does support latex style syntax for specifying formula it does not require an external latex installation. |
Beta Was this translation helpful? Give feedback.
-
This feature could be facilitated by the recently released |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm the author of Typstry.jl! I'd love to help out with bringing Typst to Makie, what is a high-level overview of what this requires? |
Beta Was this translation helpful? Give feedback.
-
MakieTeX.jl just went through a pretty big refactor and now supports all kinds of vector formats (PDF, SVG, and of course TEX). Adding Typst support (through Typstry.jl in the same way as it supports LaTeXStrings) would be pretty straightforward to me. The final step to integration in Makie would be to add a scatter plot to the text layouting algorithm (it currently plots glyph collections and linesegments, so this isn't completely without precedent)! Then, it would be pretty easy to integrate LatexStrings rendered via MakieTeX, and consequently some TypstString like thing as well. |
Beta Was this translation helpful? Give feedback.
-
Awesome! Would you want it to essentially copy the LaTeX API (
I don't understand, but it seems to be located in src/basic_recipes/text.jl.
Are you saying that it would support anything already in a rendered format (such as a PDF or SVG), so LaTeX and Typst could be compiled and then handled the same way (equivalent to how LaTeX is currently handled in its |
Beta Was this translation helpful? Give feedback.
-
Exactly - loading MakieTeX would ideally redefine methods in Makie to cause LaTeXStrings to render via itself instead of MathTeXEngine.
Yes - the idea would be to define The way MakieTeX currently does rendering for TeX is in exactly this way - TeX is compiled to PDF which is stored, along with the original document, in a CachedTeX. Then, the method that renders TeX is the same method that renders PDF, since they share the same |
Beta Was this translation helpful? Give feedback.
-
Ideally, MakieTeX won't redefine Makie methods which will change behaviour permanently just by loading it :D |
Beta Was this translation helpful? Give feedback.
-
That's also doable - we could offer e.g. |
Beta Was this translation helpful? Give feedback.
-
Since MakieTeX.jl users already need to wrap their objects in things like |
Beta Was this translation helpful? Give feedback.
-
This is more for the external usecase. The idea is that we shouldn't override the native Makie rendering, but we can extend it, so a different input format would indicate to use MakieTeX rather than MathTeXEngine. For example, this is already doable now if you wrap a |
Beta Was this translation helpful? Give feedback.
-
I would be interested in having an option to render all text through MakieTeX to allow for making plots with labels that exactly match the font and symbols used in the main text of a paper, for example. I think it would be a bit of a hurdle to manually have to wrap all regular strings and LaTeX strings just to switch over to another text rendering backend - I like the way how I can simply set Would it be conceivable to add a "text rendering backend" type to have alongside the individual text objects? That would allow one to define it as a part of a theme and to also configure things such as a preamble for LaTeX or Typst. I was thinking of something along the lines of the following (I hope I'm getting the syntax right here for the theming part): # tb = DefaultTextBackend() # default for the way things are currently rendered
tb = LaTeXBackend(; preamble=raw"\usepackage{newtxtext,newtxmath}")
theme = Theme(;
Axis=(
titlebackend=tb,
subtitlebackend=tb,
xlabelbackend=tb,
xticklabelbackend=tb,
ylabelbackend=tb,
yticklabelbackend=tb,
etc.
),
Text=(
textbackend=tb,
),
etc.
) I am not familiar with the Makie rendering structure, but I would guess it should then be possible to dispatch the text rendering according to the type of the text rendering backend, passing along all the necessary information on position, font, font size, etc. This would mean that packages like MakieTeX could set up custom themes (similar to the already existing |
Beta Was this translation helpful? Give feedback.
-
We could just provide a method in MakieTeX that |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's certainly true. Perhaps one single global text rendering object would be a better alternative to my suggestion, kind of like there is just one |
Beta Was this translation helpful? Give feedback.
-
The general idea is that
matplotlib
allows users to useLaTeX
syntax for rendering math equations in figure labels etc. (details here) and this functionality is heavily used for publication-quality figures. The downside is that it requires a full LaTeX distro to work, which a few GB in size normally, and is also quite slow to work with. typst is a new alternative, much smaller and much faster, and it is already used in Julia packages such as polylux. It is my understanding that due to the waymatplotlib
was designed, changing the typesetting engine is quite difficult, but sincemakie
is much newer and still under development, it would be nice to keep this in mind as a design goal.See matplotlib/matplotlib#26098 and matplotlib/matplotlib#22715
Beta Was this translation helpful? Give feedback.
All reactions