diff --git a/packages/preview/metropolis-polylux/0.1.0/LICENSE b/packages/preview/metropolis-polylux/0.1.0/LICENSE new file mode 100644 index 000000000..f49f96790 --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 polylux-typ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/preview/metropolis-polylux/0.1.0/README.md b/packages/preview/metropolis-polylux/0.1.0/README.md new file mode 100644 index 000000000..899c8eead --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/README.md @@ -0,0 +1,62 @@ +![Polylux logo](https://raw.githubusercontent.com/polylux-typ/polylux/ed1e70e74f2a525e80ace9144249c9537917731c/assets/polylux-logo.svg) + +# Metropolis + +A template for creating presentation slides with Typst and +[Polylux](https://github.com/polylux-typ/polylux/). + +![thumbnail](thumbnail.png) + + +Use via +```sh +typst init @preview/metropolis-polylux your-cool-project +``` + +A `slides.typ` file will be created for you that you can directly edit and get +going. + +At the top of the gnerated `slides.typ`, you will find the line +```typ +#show: metropolis.setup +``` +which you can edit to configure the template with the following options: +```typ +#show: metropolis.setup.with( + text-font: "Fira Sans", + math-font: "Fira Math", + code-font: "Fira Code", + text-size: 23pt, + footer: [My cool footer], // defaults to none +) +``` +All of them are optional and the default values are shown above. + +## Special syntax + +Most of the template should be self explanatory but two things might be a bit +surprising: + +Slide titles are created using level-one headings (`= A Slide Title`). +Headings of other levels are not affected. +A slide without such a level-one heading will not have a title. + +Emphasized text (created like `_this_`) is not shown in italics but in a bright +color (in the original LaTeX version of Metropolis, you would use `\alert` for +this). + +## Fonts + +By default, the template uses the fonts +[Fira Sans](https://bboxtype.com/typefaces/FiraSans), +[Fira Math](https://github.com/firamath/firamath/releases), +and +[Fira Code](https://github.com/tonsky/FiraCode/releases). +Either make sure you have them installed or specify other fonts in the template. + +## About + +This theme is inspired by https://github.com/matze/mtheme + +The Polylux-port was originally performed by https://github.com/Enivex + diff --git a/packages/preview/metropolis-polylux/0.1.0/lib.typ b/packages/preview/metropolis-polylux/0.1.0/lib.typ new file mode 100644 index 000000000..9319bf979 --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/lib.typ @@ -0,0 +1,86 @@ +// This theme is inspired by https://github.com/matze/mtheme +// The Polylux-port was originally performed by https://github.com/Enivex + +#import "@preview/polylux:0.4.0": * + +#let bright = rgb("#eb811b") +#let brighter = rgb("#d6c6b7") + +#let slide-title-header = toolbox.next-heading(h => { + show: toolbox.full-width-block.with(fill: text.fill, inset: 1em) + set align(horizon) + set text(fill: page.fill, size: 1.2em) + strong(h) +}) + +#let the-footer(content) = { + set text(size: 0.8em) + show: pad.with(.5em) + set align(bottom) + context text(fill: text.fill.lighten(40%), content) + h(1fr) + toolbox.slide-number +} + +#let outline = toolbox.all-sections((sections, _current) => { + enum(tight: false, ..sections) +}) + +#let progress-bar = toolbox.progress-ratio( ratio => { + set grid.cell(inset: (y: .03em)) + grid( + columns: (ratio * 100%, 1fr), + grid.cell(fill: bright)[], + grid.cell(fill: brighter)[], + ) +}) + +#let new-section(name) = slide({ + set page(header: none, footer: none) + show: pad.with(20%) + set text(size: 1.5em) + name + toolbox.register-section(name) + progress-bar +}) + +#let focus(body) = context { + set page(header: none, footer: none, fill: text.fill, margin: 2em) + set text(fill: page.fill, size: 1.5em) + set align(center) + body +} + +#let divider = line(length: 100%, stroke: .1em + bright) + +#let setup( + footer: none, + text-font: "Fira Sans", + math-font: "Fira Math", + code-font: "Fira Code", + text-size: 23pt, + body, +) = { + set page( + paper: "presentation-16-9", + fill: white.darken(2%), + margin: (top: 3em, rest: 1em), + footer: the-footer(footer), + header: slide-title-header, + ) + set text( + font: text-font, + // weight: "light", // looks nice but does not match Fira Math + size: text-size, + fill: rgb("#23373b"), // dark teal + ) + set strong(delta: 100) + show math.equation: set text(font: math-font) + show raw: set text(font: code-font) + set align(horizon) + show emph: it => text(fill: bright, it.body) + show heading.where(level: 1): _ => none + + body +} + diff --git a/packages/preview/metropolis-polylux/0.1.0/metropolis.typ b/packages/preview/metropolis-polylux/0.1.0/metropolis.typ new file mode 100644 index 000000000..032038b0a --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/metropolis.typ @@ -0,0 +1,10 @@ +#import "lib.typ": ( + bright, + brighter, + focus, + new-section, + outline, + divider, + setup, + progress-bar, +) diff --git a/packages/preview/metropolis-polylux/0.1.0/template/slides.typ b/packages/preview/metropolis-polylux/0.1.0/template/slides.typ new file mode 100644 index 000000000..886a032c4 --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/template/slides.typ @@ -0,0 +1,71 @@ +#import "@preview/polylux:0.4.0": * +#import "@preview/metropolis-polylux:0.1.0" as metropolis +#import metropolis: new-section, focus + +#show: metropolis.setup + +#slide[ + #set page(header: none, footer: none, margin: 3em) + + + #text(size: 1.3em)[ + *My presentation title* + ] + + My subtitle + + #metropolis.divider + + #set text(size: .8em, weight: "light") + The Author + + Jan 16, 2025 + + Some extra info +] + +#slide[ + = Agenda + + #metropolis.outline +] + +#new-section[My first section] + +#slide[ + = The Fundamental Theorem of Calculus + + For $f = (dif F) / (dif x)$ we _know_ that + $ + integral_a^b f(x) dif x = F(b) - F(a) + $ + + See `https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus` +] + +#slide[ + slide without a title +] + +#new-section[My second section] + +#slide[ + = Heron algorithm + + ```julia + function heron(x) + r = x + while abs(r^2 - x) > eps() + r = (r + x / r) / 2 + end + return r + end + + @test heron(42) ≈ sqrt(42) + ``` +] + +#slide[ + #show: focus + Something very important +] diff --git a/packages/preview/metropolis-polylux/0.1.0/thumbnail.png b/packages/preview/metropolis-polylux/0.1.0/thumbnail.png new file mode 100644 index 000000000..49435f903 Binary files /dev/null and b/packages/preview/metropolis-polylux/0.1.0/thumbnail.png differ diff --git a/packages/preview/metropolis-polylux/0.1.0/typst.toml b/packages/preview/metropolis-polylux/0.1.0/typst.toml new file mode 100644 index 000000000..0eb71398b --- /dev/null +++ b/packages/preview/metropolis-polylux/0.1.0/typst.toml @@ -0,0 +1,15 @@ +[package] +name = "metropolis-polylux" +version = "0.1.0" +entrypoint = "metropolis.typ" +authors = ["Andreas Kröpelin", "Enivex"] +license = "MIT" +description = "Metropolis style template for Polylux" +repository = "https://github.com/polylux-typ/metropolis" +keywords = ["metropolis", "polylux", "presentation", "slides", "slide", "talk", "lecture"] +categories = ["presentation"] + +[template] +path = "template" +entrypoint = "slides.typ" +thumbnail = "thumbnail.png"