Sublime Forum

Building with typst

#1

Trying to build a build Latextools kind-of for typst (just playing with it)
File: Typst.sublime-build:

{
  "shell_cmd": "typst compile \"$file\" \"$file_path/$file_base_name.pdf\"",
  "file_regex": "^(.*?):([0-9]+):([0-9]+): (.*)$",
  "hide_build_panel": "no_errors",
  "selector": "source.typst"
}

How could I make it refresh in Skim (no focus)… every time I save. Thanks!!!

0 Likes

#2

This is what Latextools provides its custom build command make_pdf for, which is used instead of ST’s default exec build runner.

FWIW, "hide_build_panel":no_errors"is also a feature provided bymake_pdf`, only.

Basically, Latextools calls required command to open desired viewer and then invokes sublime.active_window().bring_to_front() to re-focus ST window afterwards.

0 Likes

#3

I have unzipped LaTeXtools to see make_pdf… It is something I couldn’t include in any normal sublime-build, is it?

0 Likes

#4

You probably don’t want to just copy it, as it contains lots of specific stuff, including support for LaTeXTools specific builder plugin infrastructure, which is most likely overkill for your concerns.

It’s basically a customized copy of an early version of ST3’s exec.py which has been tweaked to run builders via its own plugin infrastructure and finally parse and output from latex build logfile - all of which is highly specific.

You could take some inspiration, but finally would need to write your own runner.

0 Likes

#5

I use ST4 on Tahoe and it worked out of the box.

Go look for the typst module if you haven’t. And you really should look at tinymist and the corresponding LSP module for typst.

0 Likes

#6

The point is probably creating “nice” build output. You can also just run latexmk with ST’s default build system to compile latex files to pdf, but it doesn’t do all the nice extra stuff.

0 Likes