Skip to content

Instantly share code, notes, and snippets.

@stepbrobd
Created May 24, 2024 06:19
Show Gist options
  • Save stepbrobd/e5d0cdf11cedf738b62793f9c6a1b36a to your computer and use it in GitHub Desktop.
Save stepbrobd/e5d0cdf11cedf738b62793f9c6a1b36a to your computer and use it in GitHub Desktop.
polylux simple theme with page number
#import "@preview/polylux:0.3.1": *
#import themes.simple: *
#import logic
#let simple-footer = state("simple-footer", [])
#let simple-theme(
aspect-ratio: "16-9",
footer: [],
background: white,
foreground: black,
body
) = {
set page(
paper: "presentation-" + aspect-ratio,
margin: 2em,
header: none,
footer: none,
fill: background,
)
set text(fill: foreground, size: 25pt)
show footnote.entry: set text(size: .6em)
show heading.where(level: 2): set block(below: 2em)
set outline(target: heading.where(level: 1), title: none, fill: none)
show outline.entry: it => it.body
show outline: it => block(inset: (x: 1em), it)
simple-footer.update(footer)
body
}
#let centered-slide(body) = {
logic.polylux-slide(align(center + horizon, body))
}
#let title-slide(body) = {
set heading(outlined: false)
centered-slide(body)
}
#let focus-slide(background: aqua.darken(50%), foreground: white, body) = {
set page(fill: background)
set text(fill: foreground, size: 1.5em)
logic.polylux-slide(align(center + horizon, body))
}
#let slide(body) = {
let deco-format(it) = text(size: .6em, fill: gray, it)
set page(
header: locate( loc => {
let sections = query(heading.where(level: 1, outlined: true).before(loc), loc)
if sections == () [] else { deco-format(sections.last().body) }
}),
footer: deco-format({
simple-footer.display(); h(1fr); logic.logical-slide.display(); " / "; utils.last-slide-number
}),
footer-descent: 1em,
header-ascent: 1em,
)
logic.polylux-slide(body)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment