Created
August 10, 2024 22:18
-
-
Save mohe2015/b5cb7933e268773d49deb7476228c5c1 to your computer and use it in GitHub Desktop.
typst tuda-beamer-2023
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "@preview/touying:0.4.2": * | |
#import "tuda-beamer-2023-theme.typ" | |
#let s = tuda-beamer-2023-theme.register(aspect-ratio: "16-9") | |
#let s = (s.methods.info)( | |
self: s, | |
title: [Abc], | |
short-title: [Titel], | |
subtitle: [Subtitle], | |
short-subtitle: [test], | |
author: [Autor], | |
short-author: [Autor], | |
date: datetime( | |
year: 2023, | |
month: 10, | |
day: 2, | |
), | |
department: [Faculty], | |
institute: [Institute], | |
) | |
#let (init, slides) = utils.methods(s) | |
#show: init | |
#let (slide, title-slide) = utils.slides(s) | |
#show: slides | |
= Apple | |
== First Slide | |
- First point | |
- Second Point | |
== Second Slide | |
Hello, Touying! | |
= Banana | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Chocolate | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Donut | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Egg | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Fruit | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Grapefruit | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Honey | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Ice | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! | |
= Juice | |
== First Slide | |
Hello, Touying! | |
== Second Slide | |
Hello, Touying! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://download.hrz.tu-darmstadt.de/protected/DezIF/Corporate_Design/Logo%20der%20TU%20Darmstadt/tuda_logos_2023.zip | |
#import "@preview/touying:0.4.2": * | |
#let header-font(..args) = { | |
text(font: "roboto", fallback: false, weight: "black", tracking: 2pt, size: 10pt, ..args) | |
} | |
#let footer-font(..args) = { | |
text(font: "roboto", fallback: false, fill: rgb("#898989"), size: 9pt, ..args) | |
} | |
#let title-font(..args) = { | |
text(font: "roboto", fallback: false, weight: "black", size: 42pt, bottom-edge: "descender", ..args) | |
} | |
#let subtitle-font(..args) = { | |
text(font: "roboto", fallback: false, size: 18pt, ..args) | |
} | |
#let slide(self: none, title: none, ..args) = { | |
(self.methods.touying-slide)(self: self, title: title, setting: body => { | |
block( | |
height: 1.18in, | |
below: 0.24in, | |
width: 100%, | |
align(bottom)[#heading(level: 2, upper(title))] | |
) | |
body | |
}, ..args) | |
} | |
#let title-slide(self: none, ..args) = { | |
self.enable-header = false | |
let info = self.info + args.named() | |
(self.methods.touying-slide)(self: self, repeat: none, grid( | |
columns: 100%, | |
rows: ( | |
2.76in - self.page-args.margin.top, | |
1.18in, | |
1.6in | |
), | |
gutter: (0in, 0.2in), | |
grid.cell([]), | |
grid.cell(align: bottom + center, title-font(upper(info.title))), | |
grid.cell(align: top + center, subtitle-font(info.subtitle)), | |
)) | |
} | |
#let new-section-slide(self: none, section) = { | |
(self.methods.touying-slide)(self: self, repeat: none, section: section, grid( | |
columns: 100%, | |
rows: ( | |
4.32in - self.page-args.margin.top, | |
1.18in, | |
1.18in | |
), | |
gutter: (0in, 0.05in), | |
grid.cell([]), | |
grid.cell(align: bottom, heading(level: 2, upper(states.current-section-with-numbering(self)))), | |
grid.cell(align: top, subtitle-font([Subtitle]), | |
))) | |
} | |
#let outline-slide(self: none, leading: 50pt) = { | |
(self.methods.slide)(self: self, repeat: none, title: "Contents", (self.methods.touying-outline)(self: self)) | |
} | |
#let d-outline(self: none, enum-args: (:), list-args: (:), cover: true) = states.touying-progress-with-sections(dict => { | |
let (current-sections, final-sections) = dict | |
current-sections = current-sections.filter(section => section.loc != none) | |
final-sections = final-sections.filter(section => section.loc != none) | |
let current-index = current-sections.len() - 1 | |
set enum(..enum-args) | |
set enum(numbering: n => title-font[#n], spacing: 0.22in, body-indent: 0.25in) | |
show enum : set align(horizon) | |
v(2.91in-1.18in-self.page-args.margin.top) | |
columns(2, | |
for (i, section) in final-sections.enumerate() { | |
{ | |
enum.item(i + 1, [#link(section.loc, section.title)<touying-link>]) | |
} | |
parbreak() | |
}) | |
}) | |
#let slides(self: none, slide-level: 1, ..args) = { | |
(self.methods.title-slide)(self: self) | |
(self.methods.outline-slide)(self: self) | |
(self.methods.touying-slides)(self: self, slide-level: slide-level, ..args) | |
} | |
#let register( | |
self: themes.default.register(), | |
..args, | |
) = { | |
self = (self.methods.datetime-format)(self: self, "[day].[month].[year]") | |
self.enable-header = true | |
let header = self => align(top)[ | |
#if self.enable-header { | |
v(0.39in) | |
header-font(upper(self.info.short-title + " / " + self.info.short-author)) | |
} | |
#place(top + right, dx: 0.34in, dy: 0.2in)[#image("tuda_logo_RGB.svg", height: 0.99in)] | |
] | |
let footer(self) = grid( | |
rows: 0.125in, | |
columns: (15%, 1fr, 15%), | |
align: (bottom + left, bottom + center, bottom + right), | |
footer-font(utils.info-date(self)), | |
footer-font(self.info.department + " | " + self.info.institute + " | " + self.info.short-author), | |
footer-font(states.slide-counter.display()), | |
) | |
self.page-args += ( | |
width: 13.33in, | |
height: 7.5in, | |
fill: self.colors.neutral-lightest, | |
header: header, | |
footer: footer, | |
footer-descent: 0in, | |
header-ascent: 0in, | |
margin: ( | |
left: 0.39in, | |
right: 0.34in, | |
top: 0.81in, | |
bottom: 0.33in | |
), | |
) | |
self.full-header = false | |
self.full-footer = false | |
self.methods.slide = slide | |
self.methods.title-slide = title-slide | |
self.methods.outline-slide = outline-slide | |
self.methods.new-section-slide = new-section-slide | |
self.methods.touying-new-section-slide = new-section-slide | |
self.methods.touying-outline = d-outline | |
self.methods.slides = slides | |
self.methods.init = (self: none, body) => { | |
set heading(outlined: false) | |
set text(font: "roboto", size: 20pt, fallback: false) | |
show heading.where( | |
level: 1 | |
): set text(font: "roboto", fallback: false, weight: "black", bottom-edge: "descender", size: 42pt) | |
show heading.where( | |
level: 2 | |
): set text(font: "roboto", fallback: false, weight: "black", bottom-edge: "descender", size: 42pt) | |
body | |
} | |
self | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment