website: https://typst.app/
docs: https://typst.app/docs/reference
Setup
# windows
winget install Typst.Typst
# linux
paru -S typst
# mac
brew install typst
Usage
typst compile <doc-path>.typ # compile file
typst compile <doc-path>.typ <out-path>.pdf # compile file to specified path
typst watch <doc-path>.typ # track changes and recompile automatically
Report Templates
#import "@preview/charged-ieee:0.1.4": ieee
#show: ieee.with(
title: [A Typesetting System to Untangle the Scientific Writing Process],
abstract: [],
authors: (
(
name: "Name",
department: [Department],
organization: [Organization],
location: [Location],
email: "email@example.com",
),
),
index-terms: ("term1", "term2"),
bibliography: bibliography("refs.bib"),
)
#show figure: set block(breakable: true)
#show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it)
}
#outline(indent: auto)
= Introduction
= Objectives
= Design
= Results
= Conclusion
Snippets
Image
#figure(
image("assets/example.png", width: 80%),
caption: [],
) <img_example>
- reference with
@img_example
Table
Documentation
Guide <- very useful
#figure(
table(
columns: 2,
stroke: none,
[*Col 1*], [*Col 2*],
table.hline(),
[*Row 1*], [Value],
[*Row 2*], [Value],
),
caption: [],
) <tb_example>
- change text alignment
align: left + top,
Code Listing
#import "@preview/codelst:2.0.2": sourcecode, sourcefile // import code list package
#show figure.where(kind: raw): set block(breakable: true) // fix for multi-page listings
#show figure.where(kind: raw): set text(8pt) // change font size
#figure(
sourcefile(
read("file_path"),
file: "file_path",
#showrange: (1, 100)
),
caption: []
) <list_example>
Table of Contents
#show outline.entry.where(level: 1): it => {
v(12pt, weak: true)
strong(it)
}
#outline(indent: auto)
Bibliography
#bibliography("refs.bib", style: "ieee")
Skip First Page Numbering
#set page(numbering: "1/1")
#counter(page).update(1)
Equation Numbering
#set math.equation(numbering: "(1)")