Menu

#65 Idea: consider typst as a backend

v1.0_(example)
open
nobody
None
5
2025-12-08
2025-12-02
No

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.

Discussion

  • Roland Baudin

    Roland Baudin - 2025-12-07

    Ticket moved from /p/texmaths/bugs/207/

     
  • Roland Baudin

    Roland Baudin - 2025-12-07

    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...

     
  • Sergio Callegari

    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:

    1. Also the location of the binary of typst (and possibly pdf2svg) would need to be configurable and stored;
    2. Both a typst and a latex preamble would need to be available either at the global or at the document level;
    3. At the first creation of an equation, when the author picks the "engine", with the equation it should also be stored if the "language" is typst or latex. From this moment on, editing the equation would only allow to switch the engine among those suitable for the syntax (latex, xelatex or lualatex for latex and only typst for typst);
    4. According to the previous choices, compiling the equation would either call a latex engine or the typist engine.

    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).

     
    • Roland Baudin

      Roland Baudin - 2025-12-08

      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
      • Sergio Callegari

        100% understandable!

        Sorry for the noise

        On 08/12/2025 10:19, Roland Baudin wrote:

        Supporting typst would imply a huge rewriting of TexMaths. The
        expected benefit is not very appealing to me.


        [feature-requests:#65] Idea: consider typst as a backend

        Status: open
        Group: v1.0_(example)
        Created: Tue Dec 02, 2025 10:15 AM UTC by Sergio Callegari
        Last Updated: Mon Dec 08, 2025 07:42 AM UTC
        Owner: nobody

        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.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/texmaths/feature-requests/65/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

Log in to post a comment.