I am exploring using Typst+Touying for the slide deck for a course I teach. I currently have a LaTeX/beamer version but the complexity and compile time is freaking me out.
As in beamer, I wish to structure the course in parts, sections and subsections and I would like to have an “N-1” progressive outline.
At the start of the course, I just want a full outline of all parts (non-progressive). This I can do with the #outline function using a depth of 1.
At the start of each part, I want a full outline of all the sections (depth:1), but not the subsections.
At the start of each section, I would like to have a progressive outline of all sections in that part (but not the current part name, neither the subsections).
I’ve been looking at the implementations of the different themes and I’m getting some understanding of how things work in Touying (and Typst) but I can’t figure this one out.
A nice “API” would be if one could not only give a “depth” for an outline but also a starting level. Don’t know if that’s feasible…
Well, the second point is easily achievable with suboutline. The last one however… I thought I’ve seen something like this and indeed Dewdrop Theme | Touying does have this, but it’s for a whole substructure. You can copy that theme and patch it.
Here is my version:
#import "@preview/suboutline:0.3.0": *
#set heading(numbering: "1.1.")
#let progressive-outline() = context {
let parts = query(heading.where(level: 1).before(here()))
if parts == () { return }
let current-part = parts.last()
let sections = query(heading.where(level: 2).before(here()))
if sections == () { return }
let current-section = sections.last()
let target = heading
.where(outlined: true)
.after(current-part.location(), inclusive: false)
let parts = query(heading.where(level: 1).after(here()))
if parts != () {
target = target.before(parts.first().location(), inclusive: false)
}
show outline.entry: it => {
if it.element.location() == current-section.location() { return it }
set text(gray)
it
}
outline(title: none, depth: 2, target: target)
}
#show heading.where(level: 1): it => {
if it.body == [Contents] { return it }
it
set text(11pt, weight: "regular")
suboutline(depth: 1)
}
#show heading.where(level: 2): it => {
it
set text(11pt, weight: "regular")
progressive-outline()
}
#outline(depth: 1)
= Part 1
== Section 1
#lorem(20)
=== Subsection 1
#lorem(30)
== Section 2
#lorem(20)
== Section 3
#lorem(20)
= Part 2
#lorem(40)
If you want to automate the outlines, you would have to deal with some quirks in show rules. You don’t need that if they are included manually below respective headings.
P.S. PDF don’t have “parts” or whatever, it has headings of different levels. Understanding what you mean by those terms requires knowledge of LaTeX.