I’ve recently started exploring VSCodium and Typst at the same time. VSCodium is an interesting take on an IDE after using JetBrains tools for many years. Typst, however, is really easy to get started with and such a breath of fresh air having spent the last year fighting with Latex. I thought it would be useful to document how I’ve set up my first non-trivial Typst project. I don’t know if this is the recommended method but it works for me (for now at least) and it feels like it’ll scale well.
Initial Setup
Create a directory with a sensible name for your project. In that directory create an empty file called main.typ
. Start VSCodium and open the folder, this will close other open windows. VSCodium will ask you if you trust the author of the files in this folder, presumably you do. The explorer tab will open on the left side of the window showing all the files in your project folder.
Click on main.typ
to open it. Enter the text = Introduction
and click Preview. You should see a preview PDF open in a window on the right with just a title.
Images
In the explorer tab right click and create a new folder called images
. Copy an image into the this folder, it should appear in the file list in the explorer tab.
In the main.typ
file enter the following lines:
#figure( image( "images/picture.jpg" ) )
Where picture.jpg
is the name of the image you want to insert. Note that I’m using a relative path so moving main.typ
to a different folder could be painful in the future. VSCodium can take some of the tedium out of typing relative paths. If you right click on the image you want to insert in the explorer tab one of the context menu entries is Copy Relative Path
, it also has a shortcut.
Fonts
Typst CLI comes with the following font’s built in:
- Libertinus Serif
- New Computer Modern
- New Computer Modern Math
- DejaVu Sans Mono
This is good enough to get started but if you want more control of your typography you can use any of the fonts installed on your system. To see a list of the fonts that Typst can access open a command prompt and enter the command typst fonts
. An example of setting a different default font for the who document would look something like this (add this at the top of main.typ
)
#set text( font: "Noto Serif", size: 11pt )
I have selected one of the Google provided Noto fonts in this example as they are widely available and free to redistribute (see here)
References
Compared to Latex adding a bibliography and references is absolutely painless. As soon as you add a bibliography section to your Typst document, as shown below, you can start referencing entries with @refrence_key
. The style setting is optional, I was checking out various styles.
#bibliography( "bibliography.bib", style: "ieee" )
Typst has it’s own bibliography format called Hayagriva which is stored in YAML. This looks like a nice enough format but it’s not supported as a library format by JabRef which is what I use to manage my references. JabRef can export in Hayagriva format but there’s really no point to doing that as Typst can read Biblatex format just fine and JabRef can only store it’s library in BibTex or Biblatex format. I should note that if you can you should use Biblatex format as it handles UTF-8 better.
Conclusion
For me at leas the items above really cover the basics to get me going. There’s plenty more to cover such as numbering and including additional files (e.g. chapters) but this all seems to be well covered by the official documentation.