Open Kreijstal opened 12 months ago
I do not quite understand how this should work. Do you mean that plotters should be usable from typst code or that typst code should be usable from plotters?
well, in matplotlib you can have a latexified
title, here you should be able to do the same, to put equations in your plots
If typst could be integrated with this package, it would be a very elegant writing tool. Of course, typst itself supports math modes in latex, so naturally you can write latexed text to graphs.
Having read this comment
well, in matplotlib you can have a
latexified
title, here you should be able to do the same, to put equations in your plots
my understanding is that we would like to generate code which when imported in a typst document is rendered to display the image which was drawn by plotters
. This would mean to write a new backend which can export to the .typ
format just like svg or the bitmap backend.
I like the idea but it is not simple at all but have some thoughts on this.
Typst has a very simple and powerful syntax to style even basic building blocks such as rectangles, circles, lines etc. While this is a great tool for writers to quickly change layout and theming of their document, this makes it really hard when generating code. It is possible to overwrite the "general" styling arguments for each geometric shape (circle, line, rectangle, etc.) but this would mean that when generating code which can be rendered inside typst documents, we would have to specify every (even optional) argument of these functions to obtain repeatable builds which display identical even in different documents.
Typst is a very fast moving language and features are being added constantly. I have only partially played around with it and have not seen many breaking changes
matplotlib
and pgf
Let's compare this feature to the option of matplotlib
to generate pgf
files which can be included in LaTeX documents. It is not very easy to generate nice plots from inside of a LaTeX document without the use of other tools (such as lualatex etc.). matplotlib
offers a vast choice of plotting options. The reason to generate pgf
files from matplotlib is to match the style of the LaTeX document as closely as possible. This means (although often not true in practice) that for example fonts should be invariant of scaling of the overall figure and thus always match the font-style and size of the text even when we resize the overall figure.
However, typst is much more flexible than LaTeX when it comes to scripting. This means (and people are already doing this) that we can generate (some) plots by writing pure typst code. While performance may be an issue in the future, it is clear that the flexibility of typst does not exhibit the same kind of problems which LaTeX does. Thus I find it questionable if this desired feature will really have a meaningful impact and be used at all.
What is the feature ?
This is a pure rust alternative of LaTeX
(Optional) Why this feature is useful and how people would use the feature ?
You can write code that contains mathematical syntax and fonts