u/dudeski_robinson

▲ 137 r/typst

Mosaic: Create beautiful slides in Typst

Hi everyone!

I'm excited to announce the release of Mosaic, a new package to create slide shows in Typst.

Check out the documentation website. It hosts a ton of examples and tutorials: https://vincentarelbundock.github.io/mosaic

Here are some of the reasons you might want to try Mosaic:

  • Several polished, modern themes.
  • A simpler, more consistent API with very few functions to learn.
  • Every part of a slide is a native Typst layer with a stable label, so you style slides with ordinary set and show rules instead of learning a ton of framework-specific styling functions and arguments.
  • Every slide is a grid. Cells split horizontally or vertically and nest as deep as you need. This gives you a ton of control over layout.
  • Modular themes: A theme is a plain dictionary of independent parts which can be customized independently (layouts, colors, typography, etc.)
  • Batteries included: incremental reveals, callouts, cards, quotes, progress indicators, galleries, etc.

Please let me know if you try it, find bugs, or have feature requests. I'm very eager to improve the package!

A complete deck

#import "@preview/mosaic:0.0.1"

// Pick a theme by importing its facade. Every theme exposes the same API:
// swap `default` for `editorial`, `metropolis`, `manifesto`, or `mono`.
#import mosaic.themes.default as m

// `setup` is the only configuration call. It declares the deck and turns the
// rest of the document into slides.
#show: m.setup.with(title: [A short talk], authors: [Ada Lovelace])

// Styling is plain Typst: these rules apply to the whole deck.
#set text(font: "New Computer Modern", size: 26pt)
#show heading.where(depth: 1): set text(weight: "black")

// Every region of every slide carries a label, so an ordinary `show` rule can
// target one region. No Mosaic-specific styling function involved.
#show label("mosaic-cell-header"): set text(fill: red)

// An explicit slide, using the built-in title layout.
#m.slide(layout: "title")

// A level-one heading opens a section slide.
= Methods

// A slide defined implicitly by a level-two heading: everything until the next
// heading is its content.
== Data

+ One slide.
+ With stuff on it.

// Slides with more structure are explicit. Here we use the "content" layout
// preset and ask for two columns, then fill in the cells: header, then each
// column.
#m.slide(layout: m.layouts.content(variant: "header-body", columns: 2))[
  == Two columns
][
  Left column.
][
  Right column.
]

// A slide can also be an arbitrary tree of splits. Read it from the outside
// inward: three rows named "banner", a middle band, and "status"; the middle
// band splits into a "sidebar" column and a right column; that column splits
// into "chart" over "legend" and "notes".
#let custom = m.grids.rows(
  "banner",
  m.grids.columns("sidebar", m.grids.rows(
    "chart",
    m.grids.columns("legend", "notes"),
  )),
  "status",
)

// Cells are filled in tree order, and each one carries a label of its own.
#m.slide(layout: custom)[Banner][Sidebar][Chart][Legend][Notes][Status]
u/dudeski_robinson — 10 days ago
▲ 59 r/rstats

Calepin: R + Typst -> notebooks, websites, and slides

Hi everyone!

I'm excited to announce the release of Calepin, a Typst-based tool for technical publishing with executable code.

Why Typst? Because it's amazing! Typst is a clean, modern, and ultra-flexible typesetting system. Think: LaTeX with millisecond rendering.

As an R user, I wanted to embed code directly in my Typst documents, have it executed, and see the results in the final document. No special file format; just a standard `.typ` document. No need to mix different languages (ex: markdown + typst). No need to "declare" markup as Typst using special "fences." Just R + Typst.

Calepin has three main use cases:

  • Computational notebooks with R chunks, inline values, plots, etc.
  • Static websites with navigation, search, galleries, blog listings, etc.
  • Slides using typst-native tools like Touying.

The Calepin website itself was written in Typst. It includes a bunch of notebook, website, and slide examples to get you started:

https://vincentarelbundock.github.io/calepin/

Note: Calepin comes with an extension in VS Code & Positron for live preview

Here's a simple example, which highlights the great debt that Calepin owes to Rmarkdown and Quarto (I'm a big fan!):

#import ".calepin/calepin.typ" as calepin
#calepin.setup(echo: true, eval: true)

= R in Typst

```r
fit <- lm(mpg ~ hp + wt, data = mtcars)
summary(fit)
```

```r
#| fig-width: 70%
plot(mpg ~ hp, data = mtcars)
```
u/dudeski_robinson — 2 months ago
▲ 144 r/typst

Calepin: Website builder for Typst

Hi all!

Two weeks ago, I released Calepin, a tool that could turn a standard Typst file into a computation notebook, in the spirit of Quarto or Jupyter.

https://vincentarelbundock.github.io/calepin/

Today, I am pleased to introduce the second major feature of _Calepin_: static website generation. Think Hugo, Jekyll or Astro, but in Typst.

This means that _Calepin_ can now take a directory of ordinary `.typ` files and turn it into a complete website: HTML pages, optional PDF versions, navigation, feeds, search, assets, and all the small files that you need to share your site.

(Note: the website linked above was entirely written in Typst!)

The websites that _Calepin_ generates are "static," so they don't require complex server-side infrastructure. You can just upload the files to Github, Netlify, an S3 bucket, or a simple web server. It should just work.

Notable features include:

  • Pure Typst authoring
  • Navigation
  • Search
  • Local server for live preview
  • Incremental builds for fast render
  • Themes: Built-in or customized with Jinja partials
  • Blog-friendly metadata and feeds
  • Multilingual websites
  • Light and dark modes
  • Web components: Cards, galleries, lightboxes, code blocks, margin notes, etc.
  • Minification for html and css

I like Typst because it is a coherent and powerful writing system. The notebook feature made Typst useful for computation-heavy and reproducible documents and reports. Static website generation extends the same idea to publishing. A _Calepin_ project can now be a research note, a report, a course website, a software manual, a blog, a slide deck, and a computational notebook, all with the same source language and the same command-line tool.

Please submit bug reports and feature requests on the Github repository. And I'd love to review Pull Requests if you are interested in contributing!

u/dudeski_robinson — 2 months ago
▲ 156 r/typst

Calepin: Computational notebooks in Typst

Hi everyone!

I just published Calepin, a new app for computational notebooks and literate programming in Typst.

I would absolutely love it if you could take a look and share thoughts and bug reports.

https://vincentarelbundock.github.io/calepin/

Calepin scans the .typ file for code to execute: raw blocks or inline code. It runs each chunk through language-appropriate engines, and injects the evaluated output back at its original call site during compile time.

Calepin now supports Python, R, Julia, Bash, Mermaid, Dot, TikZ, and D2 chunks.

It also comes with IDE extensions for VS Code and for the VSX marketplace (Cursor, Positron, etc.).

Since notebooks are just plain .typ files, they look very familiar:

#import ".calepin/calepin.typ"
#let py = calepin.inline.with("python")

A raw python code block gets executed and rendered:

```python
x = 41
print(x + 1)
```

And some inline computation too: #py[`print(40 + 2)`].

Please let me know what you think!

u/dudeski_robinson — 3 months ago