ft: add initial presentation template

This commit is contained in:
2025-12-09 22:02:58 +01:00
commit 3d1fe3c968
6 changed files with 369 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
result*
*.pdf

39
README.md Normal file
View File

@@ -0,0 +1,39 @@
# Clean Touying Presentation
This is a presentation template, using the [Touying](https://touying-typ.github.io/docs/intro/) framework.
The goal was a simple, easy and fast-to-use template, which I can use, without thinking too much about the setup.
In the end, it's just:
- setting some colors for the Metropolis theme
- setting some styling (font, list marker icon, ...)
- enabling speaker notes (using [pympress](https://github.com/Cimbali/pympress))
- providing some helper functions to use common environments with default parameters (grids, ...)
Thanks to touying, we have:
- title slides
- progression bar
- slide numbering
- [dynamic slides](https://touying-typ.github.io/docs/category/dynamic-slides)
- focus slides
- [speaker notes](https://touying-typ.github.io/docs/external/pympress#speaker-notes)
- ...
If you are not using the `pympress` PDF reader, you can disable the speaker notes by commenting out the `show-notes-on-second-screen` line.
## Usage
+ Adjust title, author, date and affiliation at the top of the file.
+ Optionally adjust the colors, to match affiliation logo color
+ Start hacking the presentation after `// PRESENTATION STARTS HERE...`
Use the provided Nix-flake:
```
$ nix develop .
```
or just the Typst installation on your system:
```
$ typst watch presentation --open
```

BIN
figures/typst.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

82
flake.lock generated Normal file
View File

@@ -0,0 +1,82 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1765186076,
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"typix": "typix"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"typix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1765097185,
"narHash": "sha256-BHXeYveNQxDukwJtj9CefkwbTCxLv9kCDnD8A0lz30k=",
"owner": "loqusion",
"repo": "typix",
"rev": "36cd1360a0a2da94b1525a3340483996aaf867a3",
"type": "github"
},
"original": {
"owner": "loqusion",
"repo": "typix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

96
flake.nix Normal file
View File

@@ -0,0 +1,96 @@
{
description = "A Typst project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
typix = {
url = "github:loqusion/typix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
# Example of downloading icons from a non-flake source
# font-awesome = {
# url = "github:FortAwesome/Font-Awesome";
# flake = false;
# };
};
outputs = inputs @ {
nixpkgs,
typix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
typixLib = typix.lib.${system};
src = typixLib.cleanTypstSource ./.;
commonArgs = {
typstSource = "main.typ";
fontPaths = [
# Add paths to fonts here
# "${pkgs.roboto}/share/fonts/truetype"
];
virtualPaths = [
# Add paths that must be locally accessible to typst here
# {
# dest = "icons";
# src = "${inputs.font-awesome}/svgs/regular";
# }
];
};
# Compile a Typst project, *without* copying the result
# to the current directory
build-drv = typixLib.buildTypstProject (commonArgs
// {
inherit src;
});
# Compile a Typst project, and then copy the result
# to the current directory
build-script = typixLib.buildTypstProjectLocal (commonArgs
// {
inherit src;
});
# Watch a project and recompile on changes
watch-script = typixLib.watchTypstProject commonArgs;
in {
checks = {
inherit build-drv build-script watch-script;
};
packages.default = build-drv;
apps = rec {
default = watch;
build = flake-utils.lib.mkApp {
drv = build-script;
};
watch = flake-utils.lib.mkApp {
drv = watch-script;
};
};
devShells.default = typixLib.devShell {
inherit (commonArgs) fontPaths virtualPaths;
packages = [
# WARNING: Don't run `typst-build` directly, instead use `nix run .#build`
# See https://github.com/loqusion/typix/issues/2
# build-script
watch-script
# More packages can be added here, like typstfmt
# pkgs.typstfmt
];
};
});
}

150
presentation.typ Normal file
View File

@@ -0,0 +1,150 @@
#import "@preview/touying:0.6.1": *
#import themes.metropolis: *
#let bg = rgb("#fafafa")
#let accent = rgb("1a5fdc")
#let greytext = rgb("999999")
#show: metropolis-theme.with(
aspect-ratio: "16-9",
config-common(show-notes-on-second-screen: right),
config-colors(
primary: accent, // bold text, footer progress
primary-light: bg, // footer progress (left over)
secondary: accent, // header
neutral-dark: accent, // attention slides
neutral-lightest: bg,
),
// footer: self => text(size: 0.8em, []),
footer-right: text(size: 0.8em, [#context utils.slide-counter.display()]),
config-info(
title: [Title],
subtitle : [Subtitle],
author: "Marco Thomas",
date: [DDth MMM, YYYY],
institution: [
#grid(columns: 2, gutter: 1em,
image("figures/typst.png", width: 2em),
[Some university],
)
]
),
)
// Styling
#set text(font: "Roboto", weight: "light", size: 25pt)
#set list(marker: sym.triangle.filled.r)
#show figure.caption: c => [
#set text(size: 20pt)
#c.body
]
// Functions
#let note(body) = { text(fill: greytext, [(#body)]) }
#let grey(body) = { text(fill: greytext, body) }
#let greyoutafter(body) = {
alternatives([
#body
], [
#text(fill: greytext, [
#body
])
])
}
#let ccalign(body) = { align(horizon+center, body) }
#let dual(cleft: 50%, cright: 50%, gutter: 1%, calign: left, left, right) = {
grid(
columns: (cleft, cright),
gutter: gutter,
align(calign, left),
align(calign, right)
)
}
#let triple(cleft: 30%, ccenter: 30%, cright: 30%, gutter: 1%, row-gutter: none, calign: left, left, center, right) = {
grid(
columns: (cleft, ccenter, cright),
gutter: gutter,
row-gutter: if row-gutter == none { gutter } else { row-gutter },
align(calign, left),
align(calign, center),
align(calign, right)
)
}
// PRESENTATION STARTS HERE...
#speaker-note()[
- some introductory words...
]
#title-slide()
= Introduction
== Introduction
#ccalign(lorem(20))
== Grids
#dual(calign: center,[
#image("figures/typst.png", height: 50%)
], [
this..
#pause
#v(1em)
but also this!
]
)
---
#dual(cleft: 20%, cright: 80%, [
Also with adjustable column size
], [
- one
- another
- and another
])
#speaker-note()[
this is very important
#text(size: 0.7em, [
tip: use text function, if you need more speaker notes
])
]
---
#dual(cleft: 65%, [
#only((1,2,3))[- Typst]
#only((2,3))[- More Typst]
#only(3)[- Even more Typst!]
], [
#only(1)[#image("figures/typst.png", height: 50%)]
#only(2)[#image("figures/typst.png", height: 50%)]
#only(3)[#image("figures/typst.png", height: 50%)]
])
---
// default grids are still usefull to have :)
#grid(columns: (33%, 33%, 33%), row-gutter: 20%,
only((1,2,3))[#align(center, image("figures/typst.png", width: 60%))],
only((2,3))[#align(center, image("figures/typst.png", width: 60%))],
only(3)[#align(center, image("figures/typst.png", width: 60%))],
only((1,2,3))[#align(center, [Typst!])],
only((2,3))[#align(center, [Horizontal!])],
only(3)[#align(center, [whoaaa])],
)
---
#greyoutafter([- hello])
#greyoutafter([- im more important now!])
#greyoutafter([- nah, it's me!])
#focus-slide()[
Important!
]