Skip to content

Extension for inserting typst generated formulas

Jan Winkler requested to merge jcwinkler/extensions:typst_extension into master

Intro / Context

typst is a typesetting system comparable to LaTeX. However it is based on markdown. Due to its simplicity it is a promising alternative to LaTeX and has a rapidly growing community

Hence, it would be nice to have it in Inkscape with the functionality pdflatex.py offers.

The Extensions

This merge request provides such an simple extension. It is directly derived from pdflatex.py. You type in a formula and after rendering it is inserted in the Inkscape document. Since all basic math and formatting stuff is already included in typst we do not need so many options as in pdflatex.py. Furthermore, typst is able to produce svg code directly, so it can be easily included in the Inkscape document without any further command line calls.

Request

@joneuhauser since you have been working on pdflatex.py would you also think it is worth to include this extension in the Inkscape stock extensions? If so, I would also provide the tests (At the moment, I am not familiar with the method how pdflatex.py is tested, but I figure that out).

Information for testing

You find the extension in Extensions - Text - Formula (typst).

typst must be in the system path.

Some snippets for testing:

A matrix:

$mat(1, 2, a; 3, 4, b; 5, 6, c)$

A formula:

$y(t) = A dot sin(omega dot t)$

A more complex formula:

$s_(1,2) = - frac(p,2) plus.minus sqrt((frac(p,2))^2 - q)$

Screenshots

Here you find some screenshots and also some code snippets for testing:

typst_ext2

typst_ext3

Remark: I am not a developer of typst, but I included typst in my TexText extension and, hence, got the idea to include a basic extension as well.

Checklist

  • Add improved error handling
  • Add unit tests (see remark above)
  • Changes to inkex/ are well documented (does not apply)
  • Clean merge request history
Edited by Jan Winkler

Merge request reports