From 742eaf8daf36f409fbcc22669de55c338449af4e Mon Sep 17 00:00:00 2001 From: Jakob Peters Date: Mon, 30 Oct 2023 13:09:31 -0700 Subject: [PATCH] Update `README.md` --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 765259e..1a3dd8a 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,25 @@ # Typstry.jl -## Introduction +A package to access the Typst command-line interface. -A package to access the `Typst` command-line interface. +See also their [website](https://typst.app/), +[documentation](https://typst.app/docs/), +and [repository](https://github.com/typst/typst). -## Showcase +## Features + +- Macros to construct Typst strings and commands +- Functions to construct and render documents + +### Planned + +- Convert Julia values to Typst strings +- Explore rendering + - Unicode in the REPL? + - Other environments? + +## Installation ```julia julia> using Pkg: add @@ -29,20 +43,41 @@ julia> using Pkg: add julia> add(url = "https://github.com/jakobjpeters/Typstry.jl") julia> using Typstry +``` -julia> file_name = "example.typ" - -julia> write(file_name, "Typst is cool") +## Showcase -julia> compile(file_name) ``` +julia> document = typst""" + #set page(width: 10cm, height: auto) + #set heading(numbering: "1.") -## Planned features + = Fibonacci sequence + The Fibonacci sequence is defined through the recurrance relation + $F_n = F_(n-1) + F_(n-2)$. It can also be expressed in _closed form:_ -- Convert Julia values to Typst strings -- Explore rendering - - Unicode in the REPL? - - Other environments? + $ F_n round(1 / sqrt(5) phi.alt^n), quad phi.alt = (1 + sqrt(5)) / 2 $ + + #let count = 8 + #let nums = range(1, count + 1) + #let fib(n) = ( + if n <= 2 { 1 } + else { fib(n - 1) + fib(n - 2) } + ) + + The first #count numbers of the sequence are: + + #align(center, table( + columns: count, + ..nums.map(n => $F_#n$), + ..nums.map(n => str(fib(n))), + )) + """; + +julia> render(document); +``` + +![Showcase document](./assets/showcase.png) ## Related Projects