Skip to content

Commit 11e5fea

Browse files
committed
Added cols. Minor changes
1 parent e49dbb5 commit 11e5fea

File tree

8 files changed

+1070
-755
lines changed

8 files changed

+1070
-755
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Available <strong>themes</strong>:
2626
This is a simple usage example:
2727

2828
```typst
29-
#import "@preview/typslides:1.2.4": *
29+
#import "@preview/typslides:1.2.5": *
3030
3131
// Project configuration
3232
#show: typslides.with(
@@ -89,11 +89,23 @@ This is a simple usage example:
8989
2. `#bibliography-slide(bib)`
9090
]
9191
92+
// Columns
93+
#slide(title: "Columns")[
94+
#cols(columns: (2fr, 1fr, 2fr), gutter: 2em)[
95+
#grayed[Columns can be included using `#cols[...][...]`]
96+
][
97+
#grayed[And this is]
98+
][
99+
#grayed[an example.]
100+
]
101+
- Custom spacing: `#cols(columns: (2fr, 1fr, 2fr), gutter: 2em)[...]`
102+
]
103+
92104
// Bibliography
93105
#let bib = bibliography("bibliography.bib")
94106
#bibliography-slide(bib)
95107
```
96108

97109
# Sample slides
98110

99-
<kbd><img src="img/slide-1.svg" width="300"></kbd> <kbd><img src="img/slide-2.svg" width="300"></kbd> <kbd><img src="img/slide-3.svg" width="300"></kbd> <kbd><img src="img/slide-4.svg" width="300"></kbd> <kbd><img src="img/slide-5.svg" width="300"></kbd> <kbd><img src="img/slide-6.svg" width="300"></kbd> <kbd><img src="img/slide-7.svg" width="300"></kbd> <kbd><img src="img/slide-8.svg" width="300"></kbd>
111+
<kbd><img src="img/slide-1.svg" width="300"></kbd> <kbd><img src="img/slide-2.svg" width="300"></kbd> <kbd><img src="img/slide-3.svg" width="300"></kbd> <kbd><img src="img/slide-4.svg" width="300"></kbd> <kbd><img src="img/slide-5.svg" width="300"></kbd> <kbd><img src="img/slide-6.svg" width="300"></kbd> <kbd><img src="img/slide-7.svg" width="300"></kbd> <kbd><img src="img/slide-8.svg" width="300"></kbd> <kbd><img src="img/slide-9.svg" width="300"></kbd>

img/slide-7.svg

Lines changed: 239 additions & 435 deletions
Loading

img/slide-8.svg

Lines changed: 458 additions & 240 deletions
Loading

img/slide-9.svg

Lines changed: 294 additions & 0 deletions
Loading

lib.typ

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
front-slide,
44
table-of-contents,
55
title-slide,
6+
cols,
67
slide,
78
focus-slide,
89
blank-slide,
@@ -16,4 +17,4 @@
1617
yelly,
1718
purply,
1819
dusky,
19-
)
20+
)

template/main.typ

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "@preview/typslides:1.2.4": *
1+
#import "@preview/typslides:1.2.5": *
22

33
// Project configuration
44
#show: typslides.with(
@@ -56,6 +56,20 @@
5656
```
5757
]
5858

59+
// Columns
60+
#slide(title: "Columns")[
61+
62+
#cols(columns: (2fr, 1fr, 2fr), gutter: 2em)[
63+
#grayed[Columns can be included using `#cols[...][...]`]
64+
][
65+
#grayed[And this is]
66+
][
67+
#grayed[an example.]
68+
]
69+
70+
- Custom spacing: `#cols(columns: (2fr, 1fr, 2fr), gutter: 2em)[...]`
71+
]
72+
5973
// Slide with title
6074
#slide(title: "This is the slide title")[
6175
#grayed([This is a `#grayed` text. Useful for equations.])

typslides.typ

Lines changed: 47 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
theme-color.update(_theme-colors.at(theme))
1212

1313
set text(font: "Fira Sans")
14-
1514
set page(paper: "presentation-" + ratio, fill: white)
1615

1716
show ref: it => (
@@ -39,11 +38,7 @@
3938

4039
//*************************************** Aux functions ***************************************\\
4140

42-
#let stress(body) = (
43-
context {
44-
text(fill: theme-color.get(), weight: "semibold")[#body]
45-
}
46-
)
41+
// Theme colors
4742

4843
#let bluey(body) = (text(fill: rgb("3059AB"))[#body])
4944
#let greeny(body) = (text(fill: rgb("BF3D3D"))[#body])
@@ -54,6 +49,14 @@
5449

5550
//***************************************************\\
5651

52+
#let stress(body) = (
53+
context {
54+
text(fill: theme-color.get(), weight: "semibold")[#body]
55+
}
56+
)
57+
58+
//***************************************************\\
59+
5760
#let framed(
5861
title: none,
5962
back-color: none,
@@ -113,6 +116,26 @@
113116

114117
//***************************************************\\
115118

119+
// Source: https://github.com/polylux-typ/polylux/blob/main/src/toolbox/toolbox-impl.typ
120+
121+
#let cols(columns: none, gutter: 1em, ..bodies) = {
122+
let bodies = bodies.pos()
123+
124+
let columns = if columns == none {
125+
(1fr,) * bodies.len()
126+
} else {
127+
columns
128+
}
129+
130+
if columns.len() != bodies.len() {
131+
panic("Number of columns must match number of content arguments")
132+
}
133+
134+
grid(columns: columns, gutter: gutter, ..bodies)
135+
}
136+
137+
//***************************************************\\
138+
116139
#let grayed(
117140
text-size: 24pt,
118141
content,
@@ -180,26 +203,7 @@
180203
show linebreak: none
181204

182205
let sections = sections.final()
183-
pad(
184-
enum(
185-
..sections.map(section => link(section.loc, section.body)),
186-
),
187-
)
188-
189-
// Using the default outline() function...
190-
//
191-
// set outline(title: none)
192-
//
193-
// show outline.entry: it => (
194-
// context {
195-
// show linebreak: none
196-
// let num = text(weight: "bold", fill: theme-color.get())[#it.body.fields().at("children").first()]
197-
// let title = text(style: "normal")[#it.body.fields().at("children").last()]
198-
// [#num #title]
199-
// }
200-
// )
201-
//
202-
// outline()
206+
pad(enum(..sections.map(section => link(section.loc, section.body))))
203207

204208
pagebreak()
205209
}
@@ -234,9 +238,7 @@
234238
body,
235239
) = (
236240
context {
237-
set page(
238-
fill: theme-color.get(),
239-
)
241+
set page(fill: theme-color.get())
240242

241243
set text(
242244
weight: "semibold",
@@ -285,14 +287,10 @@
285287
} else {
286288
(x: 1.6cm, top: 1.75cm, bottom: 1.2cm)
287289
},
288-
background: place(
289-
_slide-header(title, theme-color.get()),
290-
),
290+
background: place(_slide-header(title, theme-color.get())),
291291
)
292292

293-
set list(
294-
marker: text(theme-color.get(), [•]),
295-
)
293+
set list(marker: text(theme-color.get(), [•]))
296294

297295
set enum(numbering: (it => context text(fill: theme-color.get())[*#it.*]))
298296

@@ -314,20 +312,20 @@
314312
both: true,
315313
)
316314

317-
set page(header: [
318-
#align(right)[
319-
#text(
320-
fill: theme-color.get(),
321-
weight: "semibold",
322-
size: 12pt,
323-
)[#page-num]
324-
]
325-
])
326-
327-
set list(
328-
marker: text(theme-color.get(), [•]),
315+
set page(
316+
header: [
317+
#align(right)[
318+
#text(
319+
fill: theme-color.get(),
320+
weight: "semibold",
321+
size: 12pt,
322+
)[#page-num]
323+
]
324+
],
329325
)
330326

327+
set list(marker: text(theme-color.get(), [•]))
328+
331329
set enum(numbering: (it => context text(fill: theme-color.get())[*#it.*]))
332330

333331
set text(size: 20pt)
@@ -339,30 +337,6 @@
339337

340338
//**************************************** Bibliography ***************************************\\
341339

342-
// You can use this locally...
343-
// #let bibliography-slide(
344-
// bib-path,
345-
// title: "References",
346-
// style: "ieee",
347-
// ) = (
348-
// context {
349-
350-
// set text(size: 17pt)
351-
// set par(justify: true)
352-
353-
// bibliography(
354-
// bib-path,
355-
// title: text(size: 30pt)[
356-
// #smallcaps(title)
357-
// #v(-.85cm)
358-
// #_divider(color: theme-color.get())
359-
// #v(.5cm)],
360-
// style: style,
361-
// )
362-
// }
363-
// )
364-
//
365-
366340
#let bibliography-slide(
367341
bib-call,
368342
title: "References",
@@ -371,10 +345,8 @@
371345
set text(size: 19pt)
372346
set par(justify: true)
373347

374-
set bibliography(
375-
title: text(size: 30pt)[#smallcaps(title) #v(-.85cm) #_divider(color: theme-color.get()) #v(.5cm)],
376-
)
348+
set bibliography(title: text(size: 30pt)[#smallcaps(title) #v(-.85cm) #_divider(color: theme-color.get()) #v(.5cm)])
377349

378350
bib-call
379351
}
380-
)
352+
)

typst.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "typslides"
3-
version = "1.2.4"
3+
version = "1.2.5"
44
entrypoint = "lib.typ"
55
compiler = "0.13.0"
66
authors = ["Antonio Manjavacas <https://github.com/manjavacas>"]

0 commit comments

Comments
 (0)