Skip to content

Custom Typst snippets for use in Sublime Text

License

Notifications You must be signed in to change notification settings

ckunte/typst-snippets-st

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Typst snippets for use in Sublime Text

Typesetting documents, letters, reports, or even books in Typst is not as verbose as LaTeX, but certainly error-prone, given the need for strict syntax. A handful of Sublime Text snippets provided in this repository try to reduce this tedium to as low as practicable.

This repository contains the following custom snippets:

Snippet Inserts
apdx + tab appendix block
bib + tab BibTeX entry
cod + tab python code file
fig + tab figure block
file + tab file
hd + tab set heading no.s
letter + tab letter block
lnk + tab url and link label
ltmpl + tab letter template
lscape + tab set page to landscape
note + tab note block
ntmpl + tab note template
pb + tab page break
ref + tab reference block
tbl + tab table block

These snippets work when the file under edit is set as a Typst file from the pull-up menu in the status bar. (Suggest installing Typst package.)

What are snippets and how do they work?

The concept of a snippet is simple. Think of a block of pre-formatted text (i.e., a template) that one needs to use often. One can of-course type or copy-paste such blocks of text repeatedly the hard way, or one could instead assign such common blocks of text with an abbreviated keyword, which in turn calls the entire block of text. To ensure such blocks do not accidentally appear while typing the actual content of the note, paper, or report, a trigger is required. The trigger in this case is a tab key.

How to add these snippets to Sublime Text

This is done in two steps, viz., (a) add a repository and then (b) activate it. The how to is described below.

  1. From Tools > Command Palette... type Add Repository, and in the input box, enter https://github.com/ckunte/typst-snippets-st
  2. From Tools > Command Palette... type Install Package, and in the result list, type typst-snippets-st and select the thus found package.

How to upgrade

From Tools > Command Palette... type Upgrade Package, and select one of the two options presented (i.e., Package Control: Upgrade Package or Package Control: Upgrade/Overwrite All Packages).

Custom build

A custom build file (e.g. like below: Typst-Cyg.sublime-build) can be added under Settings > Browse packages > User, with file path edited to suit:

{
    "shell_cmd" : "typst compile \"$file_name\"",
    "selector" : "source.typ",
    "path" : "C:\\Users\\ckun\\misc\\cyg\\bin;$path",
    "working_dir" : "$file_path"
}

Then From Tools > Build system, select Typst-Cyg. This will enable building (with Ctrl+B) from source to output (i.e. from .typ to .pdf file) from within Sublime Text.

Releases

No releases published

Packages

No packages published