almost finished

This commit is contained in:
Ernesto Martinez Garcia 2025-09-06 18:29:23 +02:00
commit 912b6cce2b
8 changed files with 311 additions and 316 deletions

View file

@ -1,7 +1,6 @@
#import "@preview/touying:0.6.1": *
// Project
#import "tugcolors.typ"
#import "helper.typ": *
#import "logos.typ": *
@ -14,29 +13,41 @@
// Styling Macro Imports
#import "@preview/showybox:2.0.4": showybox
// -----------------------------------------------------------------------------
// General Config
// -----------------------------------------------------------------------------
// Touying bindings for cetz
#let cetz-canvas = touying-reducer.with(
reduce: cetz.canvas,
cover: cetz.draw.hide.with(bounds: true),
)
// Touying bindings for fletcher
#let fletcher-diagram = touying-reducer.with(
reduce: fletcher.diagram,
cover: fletcher.hide,
)
// Macro for notes
#let note(text) = [
#pdfpc.speaker-note(text)
]
// -----------------------------------------------------------------------------
// Slide Types
// -----------------------------------------------------------------------------
//
// Normal Slide
//
/// Normal slide for the presentation, with title (header) and footer
///
/// Example:
///
/// ```typst
/// #slide(title: [Slide Title])[
/// #lorem(20)
/// ]
/// ```
///
/// - title (content): Title for the slide
/// - alignment (alignment): Alignment of the contents of the slide
/// - outlined (boolean): If the slide shows on the PDF ToC
///
/// -> content
#let slide(
title: auto,
alignment: none,
@ -119,9 +130,15 @@
touying-slide(self: self, ..args)
})
//
// Title Slide
//
/// Title slide for the presentation
///
/// Example:
///
/// ```typst
/// #title-slide()
/// ```
///
/// -> content
#let title-slide(..args) = touying-slide-wrapper(self => {
let info = self.info + args.named()
let body = {
@ -222,19 +239,29 @@
touying-slide(self: self, body)
})
//
// Standout Slide
//
/// Standout slide for the presentation
///
/// Example:
///
/// ```typst
/// #standout-slide(title: [Text])
/// ```
///
/// - title (content): Title for the standout slide
///
/// -> content
#let standout-slide(
title: auto,
title: none,
..args,
) = touying-slide-wrapper(self => {
let body = {
set align(center + horizon)
set text(size: 28pt)
move(dy: -2.08cm)[
#text(weight: "semibold")[#title]
]
if title != none {
move(dy: -2.08cm)[
#text(weight: "semibold")[#title]
]
}
}
let self = utils.merge-dicts(self, config-page(
@ -247,9 +274,18 @@
touying-slide(self: self, body, ..args)
})
//
// Section Slide
//
/// Section slide for the presentation
///
/// Example:
///
/// ```typst
/// #section-slide(title: [Section A], subtitle: [Subtitle])
/// ```
///
/// - title (content): Title for the section
/// - subtitle (content): Subtitle for the section
///
/// -> content
#let section-slide(
title: none,
subtitle: none,
@ -277,9 +313,17 @@
touying-slide(self: self, body, ..args)
})
//
// Blank Slide
//
/// Blank slide for free content in the presentation
///
/// Example:
///
/// ```typst
/// #blank-slide[
/// #align(center + horizon)[#lorem(5)]
/// ]
/// ```
///
/// -> content
#let blank-slide(
..args,
body,
@ -303,6 +347,43 @@
// Main Function
// -----------------------------------------------------------------------------
/// Theme cofniguration
///
/// Example:
///
/// ```typst
/// #show: definitely-not-isec-theme.with(
/// aspect-ratio: "16-9",
/// slide-alignment: top,
/// config-info(
/// title: [Long Paper Title \ with One to Three Lines],
/// subtitle: [An optional short subtitle],
/// authors: ([*First Author*], [Second Author], [Third Author]),
/// extra: [SomeConf 2025],
/// footer: [First Author, Second Author, Third Author],
/// download-qr: "",
/// ),
/// config-common(
/// handout: false,
/// ),
/// config-colors(
/// ),
/// )
/// ```
///
/// - aspect-ratio (str): Aspect ratio for the page. See typst documentatin.
/// - slide-alignemnt (alignment): Default alignment for `#slide()`
/// - config-info (dict):
/// - title (content): Title for the presentation
/// - subtitle (content): Subtitle for the presentation
/// - authors (array): Arrray of authors (content)
/// - extra (content): Extra information for the presentation
/// - footer (content): Footer for each `#slide()`
/// - download-qr (str): URL to show on `#title-slide()` with a QR
/// - config-common (dict):
/// - handout (bool): Boolean for handout mode
/// - config-colors (dict): Colors for the presentation
/// - ... see definition of `#definitely-not-isec-theme`
#let definitely-not-isec-theme(
aspect-ratio: "16-9",
header: utils.display-current-heading(level: 1),
@ -351,7 +432,60 @@
)
}
),
config-colors(primary: tugcolors.tug, footer: rgb("808080")),
config-colors( // Exported from official template
tug: rgb("e4154b"),
primary: rgb("e4154b"),
footer: rgb("808080"),
isec: rgb("272733"),
foot: rgb("e1e1e1"),
web: rgb("0c5a77"),
csbme: rgb("19b4e3"),
arch: rgb("0a98a2"),
bauw: rgb("d68e23"),
etec: rgb("68242c"),
mach: rgb("3066ba"),
chem: rgb("5e60a8"),
math: rgb("1e6934"),
crypto: rgb("a6c947"),
system: rgb("1171a8"),
formal: rgb("f7931e"),
applied: rgb("7d219e"),
page: rgb("e4154b"),
fore: rgb("0f0f0f"),
back: rgb("ffffff"),
dark: rgb("3b5a70"),
lite: rgb("eeece1"),
head: rgb("245b78"),
body: rgb("e2e9ed"),
urlA: rgb("0066d8"),
urlB: rgb("6c2f91"),
colA: rgb("e4154b"),
colB: rgb("5191c1"),
colC: rgb("a5a5a5"),
colD: rgb("285f82"),
colE: rgb("78b473"),
colF: rgb("e59352"),
tugred: rgb("e4154b"),
tuggreen: rgb("78b473"),
tugblue: rgb("285f82"),
tugyellow: rgb("e59352"),
tugcyan: rgb("19b4e3"),
tugpurple: rgb("7d219e"),
tugviolet: rgb("5e60a8"),
tugmagenta: rgb("7d219e"),
tugturquoise: rgb("0a98a2"),
tugbrown: rgb("68242c"),
tugblack: rgb("0f0f0f"),
tugwhite: rgb("ffffff"),
tuggray: rgb("a5a5a5"),
tuggrey: rgb("a5a5a5"),
tugdark: rgb("3b5a70"),
tugmid: rgb("5191c1"),
tuglite: rgb("eeece1"),
main: rgb("e4154b"),
emph: rgb("285f82"),
standout: rgb("245b78"),
),
config-methods(
cover: (self: none, body) => hide(body),
init: (
@ -361,6 +495,7 @@
// TUGraz uses Source Sans Pro, but its a licensed Adobe font
set text(size: 20pt, lang: "en", region: "US", font: font)
show emph: it => { text(self.colors.primary, it.body) }
show cite: it => { text(self.colors.primary, it) }
show strong: it => { text(weight: "bold", it.body) }
// Bibliography
@ -394,12 +529,10 @@
body-indent: 0.6cm
)
// Code blocks
show: codly-init.with()
show raw.where(block: true): set text(size: 13pt)
// Hotfixes, the messy part
// https://github.com/touying-typ/touying/issues/136
@ -414,12 +547,42 @@
}
// -----------------------------------------------------------------------------
// Styling Macros
// Macros
// -----------------------------------------------------------------------------
/// Macro for a pdfpc note
///
/// Example:
///
/// ```typst
/// #note("This will show on pdfpc speaker notes")
/// ```
///
/// - text (str): Note for pdfpc
///
/// -> content
#let note(text) = [
#pdfpc.speaker-note(text)
]
/// Quote block for phrases. Has a color.primary rectangle in the left
///
/// Example:
///
/// ```typst
/// #quote-block[
/// #lorem(10)
/// ]
/// ```
///
/// - top-pad (length): Extra height of the quote colored block
/// - color (color): Color of the quote block
/// - spacing (length): Spacing after the `#quote-block`
///
/// -> content
#let quote-block(
top-pad: 0.55cm,
color: tugcolors.tug,
color: none,
spacing: 0.3cm,
body,
) = [
@ -432,7 +595,7 @@
row-gutter: 0cm,
[
#rect(
fill: self.colors.primary,
fill: if color == none { self.colors.primary } else { color },
height: s + top-pad,
)
],
@ -450,14 +613,31 @@
])
]
// https://tabler.io/icons
/// Block with title and content
///
/// Example:
///
/// ```typst
/// #color-block(title: [Advantages])[
/// - A
/// - B
/// - C
/// ]
/// ```
///
/// - title (content): Title for the color block
/// - icon (str): Icon to show at the left of the title (Tableau Icons) https://tabler.io/icons
/// - spacing (length): Spacing before and after the color block
/// - color (color): Color for the title block
/// - color-body (color): Color for the background of the body
///
/// -> content
#let color-block(
title,
title: [],
icon: none,
spacing: 0.78em,
color: none,
color-body: tugcolors.lite,
color-body: none,
body
) = [
#import "@preview/tableau-icons:0.331.0": *
@ -477,7 +657,7 @@
thickness: 0pt,
border-color: if color == none { self.colors.primary } else { color },
title-color: if color == none { self.colors.primary } else { color },
body-color: color-body,
body-color: if color-body == none { self.colors.lite } else { color-body },
inset: (x: 0.55em, y: 0.65em),
),
above: spacing,
@ -494,4 +674,41 @@
])
]
/// Showcase the colors of the slide
///
/// Example:
///
/// ```typst
/// #showcase-colors
/// ```
///
/// -> content
#let showcase-colors = [
#touying-fn-wrapper((self: none) => [
#set rect(width: 7.4cm, height: 1.5cm)
#set text(fill: white)
#set align(center)
#grid(columns: 3, rows: 6, column-gutter: 1.8cm, row-gutter: 0.05cm, align: left,
rect(fill: self.colors.isec)[isec],
rect(fill: self.colors.tug)[tug = main],
rect(fill: self.colors.colA)[colA = tugred],
rect(fill: self.colors.csbme)[csbme = tugcyan],
rect(fill: self.colors.fore)[fore],
rect(fill: self.colors.colB)[colB = tugmid],
rect(fill: self.colors.crypto)[crypto],
rect(fill: self.colors.back)[#text(fill: black)[back]],
rect(fill: self.colors.colC)[colC = tuggray],
rect(fill: self.colors.system)[system],
rect(fill: self.colors.foot)[#text(fill: black)[foot]],
rect(fill: self.colors.colD)[colD = tugblue],
rect(fill: self.colors.formal)[formal],
rect(fill: self.colors.emph)[emph],
rect(fill: self.colors.colE)[colE = tuggreen],
rect(fill: self.colors.applied)[applied = tugpurple],
rect(fill: self.colors.lite)[#text(fill: black)[lite]],
rect(fill: self.colors.colF)[colF = tugyellow],
)
])
]
//vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab colorcolumn=81