Idea: consider typst as a backend
Brought to you by:
baudinr
Hi, as usual, thanks for the excellent texmaths. I would like to suggest an idea that you might have thought about already (and maybe discarded). If this message is redundant, my apology in advance.
As you surely know, there is a new contender in the typesetting arena: typst. Even if it is still young, there are already some things it does well, including math, and one of its main advantages over latex is that it is much faster (particularly if the comparison is wrt lualatex). More speed would be greately beneficial to a tool like texmaths.
So I wonder if you might have considered a typst backend.
Ticket moved from /p/texmaths/bugs/207/
You may know that typst is not a LaTeX backend, it's a different language, so you can't write LaTeX equations and compile them with typst.
So it's simply not possible to use typst as a backend in TexMaths...
Indeed typst is a typesetting engine with a totally different syntax than LaTeX. But it serves a similar purpose (going from a textual description of the layout you want to obtain to the layout in a vector image format) and it works in a similar way (tagged text + preamble in → pdf out). The output pdf is said to be convertible in svg.
So "backend" was possibly not the best term. But the idea was to adapt the texmaths code to let typst too be used as a layout engine. In detail:
The main advantage would be having an engine that is much faster than the latex ones. Quantifying the practical advantage needs knowing how much of the compilation time is currently spent in the latex engine and how much is texmaths overhead, but I would expect the first to be largely dominant and the second to be almost negligible. Being faster would be great since the best latex engine (lualatex) is really very slow for interactive use in a tool like texmaths and things get even worse when you need to do things like recompiling all the equations in a page (e.g. to change the font).
Supporting typst would imply a huge rewriting of TexMaths. The expected benefit is not very appealing to me.
I did a small benchmark on my Linux computer with a 7 pages / 129 equations document. I measured the time spent to recompile all equations:
latex => 2'42" (1.3" / equation)
xelatex => 2'44 " (1.3" / equation)
lualatex => 3'29" (1.6" / equation)
So lualatex is only 30% slower than latex and xelatex.
Last edit: Roland Baudin 2025-12-08
100% understandable!
Sorry for the noise
On 08/12/2025 10:19, Roland Baudin wrote: