fewjfipewjfw

main
Antonio De Lucreziis 11 months ago
parent 4436f141eb
commit 19c6be7357

@ -1,170 +1,5 @@
#import "@preview/touying:0.6.1": *
// #let slide(config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies) = touying-slide-wrapper(self => {
// let header(self) = {
// place(left + top, dx: 3em, grid(
// columns: (auto, 1fr),
// column-gutter: 1em,
// align: horizon,
// image("../assets/logo-unipi-top.png"),
// text(fill: self.colors.primary, utils.call-or-display(self, self.store.header)),
// ))
// // place(left + top, line(start: (40%, 0%), end: (40% - 3%, 3em + 0.5em + 0.5em), stroke: .75em + white))
// }
// let footer(self) = {
// set text(size: 0.8em)
// place(left, dx: 3em, utils.call-or-display(self, utils.call-or-display(self, self.store.footer)))
// }
// let self = utils.merge-dicts(self, config-page(header: header, footer: footer))
// touying-slide(self: self, config: config, repeat: repeat, setting: setting, composer: composer, ..bodies)
// })
// #let title-slide(config: (:), ..args) = touying-slide-wrapper(
// self => {
// self = utils.merge-dicts(
// self,
// config,
// config-common(freeze-slide-counter: true),
// config-page(background: utils.call-or-display(self, self.store.background), margin: (x: 0em, top: 30%, bottom: 0%)),
// )
// let info = self.info + args.named()
// let body = {
// set align(center)
// stack(spacing: 3em, if info.title != none {
// text(size: 48pt, weight: "bold", fill: self.colors.primary, info.title)
// }, if info.author != none {
// text(fill: self.colors.primary-light, size: 28pt, weight: "regular", info.author)
// }, if info.date != none {
// text(fill: self.colors.primary-light, size: 20pt, weight: "regular", utils.display-info-date(self))
// })
// }
// touying-slide(self: self, body)
// },
// )
// #let outline-slide(config: (:), leading: 50pt) = touying-slide-wrapper(self => {
// set text(size: 30pt, fill: self.colors.primary)
// set par(leading: leading)
// let body = {
// grid(columns: (1fr, 1fr), rows: (1fr), align(center + horizon, {
// set par(leading: 20pt)
// context {
// if text.lang == "zh" {
// text(size: 80pt, weight: "bold", [#text(size: 36pt)[CONTENTS]\ 目录])
// } else {
// text(size: 48pt, weight: "bold", [CONTENTS])
// }
// }
// }), align(left + horizon, {
// set par(leading: leading)
// set text(weight: "bold")
// components.custom-progressive-outline(level: none, depth: 1, numbered: (true,))
// }))
// }
// self = utils.merge-dicts(
// self,
// config-common(freeze-slide-counter: true),
// config-page(background: utils.call-or-display(self, self.store.background), margin: 0em),
// )
// touying-slide(self: self, config: config, body)
// })
// #let new-section-slide(config: (:), level: 1, body) = touying-slide-wrapper(
// self => {
// let slide-body = {
// stack(
// dir: ttb,
// spacing: 12%,
// align(center, text(fill: self.colors.primary, size: 166pt, utils.display-current-heading-number(level: level))),
// align(center, text(
// fill: self.colors.primary,
// size: 60pt,
// weight: "bold",
// utils.display-current-heading(level: level, numbered: false),
// )),
// )
// body
// }
// self = utils.merge-dicts(self, config-page(
// margin: (left: 0%, right: 0%, top: 20%, bottom: 0%),
// background: utils.call-or-display(self, self.store.background),
// ))
// touying-slide(self: self, config: config, slide-body)
// },
// )
// /// Focus on some content.
// ///
// /// Example: `#focus-slide[Wake up!]`
// ///
// /// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more configurations, you can use `utils.merge-dicts` to merge them.
// #let focus-slide(config: (:), body) = touying-slide-wrapper(
// self => {
// self = utils.merge-dicts(self, config-common(freeze-slide-counter: true), config-page(fill: self.colors.primary, margin: 2em))
// set text(fill: self.colors.neutral-lightest, size: 2em, weight: "bold")
// touying-slide(self: self, config: config, align(horizon + center, body))
// },
// )
// #let dm-unipi-theme(
// aspect-ratio: "16-9",
// header: self => utils.display-current-heading(depth: self.slide-level),
// footer: context utils.slide-counter.display(),
// ..args,
// body,
// ) = {
// set text(font: "Open Sans")
// set par(leading: 1em)
// set text(size: 20pt)
// set heading(numbering: "1.1")
// show heading.where(level: 1): set heading(numbering: "1")
// show: touying-slides.with(
// config-page(paper: "presentation-" + aspect-ratio, margin: (x: 3em, top: 5em, bottom: 3em)),
// config-common(slide-fn: slide, new-section-slide-fn: new-section-slide),
// config-methods(init: (self: none, body) => {
// show heading: set text(fill: self.colors.primary-light)
// body
// }, alert: utils.alert-with-primary-color),
// config-colors(
// primary: rgb("#003c71"),
// primary-light: rgb("#00213d"),
// primary-lightest: rgb("#F2F4F8"),
// neutral-lightest: rgb("#FFFFFF"),
// ),
// // save the variables for later use
// config-store(
// align: align,
// header: header,
// footer: footer,
// background: self => {
// let page-width = if self.page.paper == "presentation-16-9" { 841.89pt } else { 793.7pt }
// let r = if self.at("show-notes-on-second-screen", default: none) == none { 1.0 } else { 0.5 }
// let bias1 = - page-width * (1 - r)
// let bias2 = - page-width * 2 * (1 - r)
// place(center + horizon, dx: bias1, polygon(
// fill: self.colors.primary-lightest,
// (35% * page-width, -17%),
// (70% * page-width, 10%),
// (35% * page-width, 30%),
// (0% * page-width, 10%),
// ))
// place(center + horizon, dy: 7%, dx: bias1, ellipse(fill: white, width: r * 45%, height: 120pt))
// place(center + horizon, dy: 5%, dx: bias1, ellipse(fill: self.colors.primary-lightest, width: r * 40%, height: 80pt))
// place(center + horizon, dy: 12%, dx: bias1, rect(fill: self.colors.primary-lightest, width: r * 40%, height: 60pt))
// place(center + horizon, dy: 20%, dx: bias1, ellipse(fill: white, width: r * 40%, height: 70pt))
// },
// ),
// ..args,
// )
// body
// }
//
#let _tblock(self: none, title: none, it) = {
grid(columns: 1, row-gutter: 0pt, block(
fill: self.colors.primary-dark,
@ -185,38 +20,8 @@
))
}
/// Theorem block for the presentation.
///
/// - title (string): The title of the theorem. Default is `none`.
///
/// - it (content): The content of the theorem.
#let tblock(title: none, it) = touying-fn-wrapper(_tblock.with(title: title, it))
/// Default slide function for the presentation.
///
/// - title (string): The title of the slide. Default is `auto`.
///
/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - repeat (auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides.
///
/// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically.
///
/// - setting (dictionary): The setting of the slide. You can use it to add some set/show rules for the slide.
///
/// - composer (function): The composer of the slide. You can use it to set the layout of the slide.
///
/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide.
///
/// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function.
///
/// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns.
///
/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns.
///
/// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`.
///
/// - bodies (content): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide.
#let slide(
title: auto,
header: auto,
@ -248,22 +53,6 @@
touying-slide(self: self, config: config, repeat: repeat, setting: new-setting, composer: composer, ..bodies)
})
/// Title slide for the presentation. You should update the information in the `config-info` function. You can also pass the information directly to the `title-slide` function.
///
/// Example:
///
/// ```typst
/// #show: stargazer-theme.with(
/// config-info(
/// title: [Title],
/// logo: emoji.city,
/// ),
/// )
///
/// #title-slide(subtitle: [Subtitle])
/// ```
///
/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
#let title-slide(config: (:), ..args) = touying-slide-wrapper(self => {
self = utils.merge-dicts(self, config)
self.store.title = none
@ -311,15 +100,6 @@
touying-slide(self: self, body)
})
/// Outline slide for the presentation.
///
/// - config (dictionary): is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - title (string): is the title of the outline. Default is `utils.i18n-outline-title`.
///
/// - level (int, none): is the level of the outline. Default is `none`.
///
/// - numbered (boolean): is whether the outline is numbered. Default is `true`.
#let outline-slide(config: (:), title: utils.i18n-outline-title, numbered: true, level: none, ..args) = touying-slide-wrapper(
self => {
self.store.title = title
@ -342,28 +122,8 @@
},
)
/// New section slide for the presentation. You can update it by updating the `new-section-slide-fn` argument for `config-common` function.
///
/// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))`
///
/// - config (dictionary): is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - title (content, function): is the title of the section. The default is `utils.i18n-outline-title`.
///
/// - level (int): is the level of the heading. The default is `1`.
///
/// - numbered (boolean): is whether the heading is numbered. The default is `true`.
///
/// - body (none): is the body of the section. It will be passed by touying automatically.
#let new-section-slide(config: (:), title: utils.i18n-outline-title, level: 1, numbered: true, ..args, body) = outline-slide(config: config, title: title, level: level, numbered: numbered, ..args, body)
/// Focus on some content.
///
/// Example: `#focus-slide[Wake up!]`
///
/// - config (dictionary): is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - align (alignment): is the alignment of the content. The default is `horizon + center`.
#let focus-slide(config: (:), align: horizon + center, body) = touying-slide-wrapper(self => {
self = utils.merge-dicts(
self,
@ -374,13 +134,6 @@
touying-slide(self: self, config: config, std.align(align, body))
})
/// End slide for the presentation.
///
/// - config (dictionary): is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - title (string): is the title of the slide. The default is `none`.
///
/// - body (array): is the content of the slide.
#let ending-slide(config: (:), title: none, body) = touying-slide-wrapper(self => {
let content = {
set std.align(center + horizon)
@ -472,7 +225,6 @@
neutral-lightest: rgb("#ffffff"),
neutral-darkest: rgb("#001c35"),
),
// save the variables for later use
config-store(
align: align,
alpha: alpha,

Loading…
Cancel
Save