Skip to content

Instantly share code, notes, and snippets.

@sartimo
Last active August 20, 2024 15:58
Show Gist options
  • Save sartimo/75146e2f3697db722b9ec305f749a81d to your computer and use it in GitHub Desktop.
Save sartimo/75146e2f3697db722b9ec305f749a81d to your computer and use it in GitHub Desktop.
Typst for Study Note Taking
#set document(title: "title", author: "author")
#set par(justify: true)
#let today = datetime.today()
#set page(margin: (left: 2in))
#set quote(block: true)
#line(start: (0%, 5%), end: (8.5in, 5%), stroke: (thickness: 2pt))
#align(horizon + left)[
#text(size: 24pt, [StudySubject \ DocumentTitle])
Author // Change Author
your\@email.com // Change Email
Location, #today.display("[month repr:long] [day], [year]") // Change Lcoation
]
#set heading(numbering: "1.")
#set page(fill: white, margin: (auto))
#pagebreak()
#outline()
#pagebreak()
#set page(
numbering: "1",
header: context {
if counter(page).get().first() > 1 [
_DocumentTitle_
#h(1fr)
Author
]
})
#counter(page).update(1)
// Content Starts here
= First title here
== Subtitle
= Simple equation
== Potents
$ a^2 + b^2 = c^2 $
== Pi
$ d = 2r*pi $
== Division and Closures
$ x = (2pi*d) / 10 $
== Code Blocks
```rs
fn main() {
println!("Hello, world from Typst!")
}
```
== Footnotes
Check the docs for more details.
#footnote[https://typst.app/docs]
== Quotes
#quote(attribution: [Plato])[
... ἔοικα γοῦν τούτου γε σμικρῷ τινι αὐτῷ τούτῳ σοφώτερος εἶναι, ὅτι
ἃ μὴ οἶδα οὐδὲ οἴομαι εἰδέναι.
]
#lorem(200)
  1. install vscode
  2. add vscode-pdf and Typst LSP extensions
  3. modify the Typst template and split plane the PDF preview

Local Installation of Typst

winget install --id Typst.Typst

brew install typst

Produce PDF Ouput

typst compile path/to/source.typ path/to/output.pdf

Watches source files and recompiles on changes.

typst watch file.typ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment