Skip to content

Commit c4f2e9d

Browse files
authored
Merge pull request #1 from ee-unr/test-typst
Agrego slides en typst
2 parents 8a0dfc7 + 3277923 commit c4f2e9d

7 files changed

Lines changed: 808 additions & 0 deletions

File tree

slides/demos/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# README
2+
3+
Copied here from quick reference.
4+
5+
The original source is: https://github.com/polylux-typ/polylux.
6+
7+
Thanks to Polylux developers!

slides/demos/demo-polylux.typ

Lines changed: 381 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,381 @@
1+
#import "@preview/polylux:0.4.0": *
2+
3+
#show link: set text(blue)
4+
#set text(font: "Andika", size: 20pt)
5+
#show raw: set text(font: "Fantasque Sans Mono")
6+
#show math.equation: set text(font: "Lete Sans Math")
7+
8+
#let my-stroke = stroke(
9+
thickness: 2pt,
10+
paint: blue.lighten(50%),
11+
cap: "round",
12+
)
13+
14+
#set page(
15+
paper: "presentation-16-9",
16+
margin: 2cm,
17+
footer: [
18+
#set text(size: .6em)
19+
#set align(horizon)
20+
21+
Andreas Kröpelin, January 2025 #h(1fr) #toolbox.slide-number
22+
],
23+
header: box(stroke: (bottom: my-stroke), inset: 8pt)[
24+
#set text(size: .6em)
25+
#set align(horizon)
26+
// #box(image("../assets/polylux-logo.svg", height: 2em))
27+
#h(1fr)
28+
Polylux demo | #toolbox.current-section
29+
]
30+
)
31+
32+
#show heading: set block(below: 2em)
33+
34+
#let new-section-slide(title) = slide[
35+
#set page(footer: none, header: none)
36+
#set align(horizon)
37+
#set text(size: 1.5em)
38+
#strong(title)
39+
#line(stroke: my-stroke, length: 50%)
40+
#toolbox.register-section(title)
41+
]
42+
43+
#slide[
44+
#set page(footer: none, header: none)
45+
#set align(horizon)
46+
#text(size: 2em, weight: "bold")[
47+
#toolbox.side-by-side(columns: (auto, 1fr))[
48+
#image("polylux-logo.svg", height: 2em)
49+
][
50+
Polylux \ Easily creating slides in Typst
51+
]
52+
]
53+
54+
#line(stroke: my-stroke, length: 100%)
55+
56+
An overview over all the features
57+
58+
Andreas Kröpelin, January 2025
59+
]
60+
61+
#new-section-slide("Introduction")
62+
63+
#slide[
64+
= About this presentation
65+
This presentation is supposed to briefly showcase what you can do with this
66+
package.
67+
68+
For a full documentation, read the
69+
#link("https://polylux.dev/book/")[online book].
70+
]
71+
72+
#slide[
73+
= A title
74+
Let's explore what we have here.
75+
76+
On the top of this slide, you can see the slide title.
77+
78+
We used a simple level-one heading for that.
79+
]
80+
81+
#slide[
82+
Titles are not mandatory, this slide doesn't have one.
83+
84+
But did you notice that the current section name is displayed above that top
85+
line?
86+
87+
We defined it using
88+
#raw("#toolbox.register-section(\"Introduction\")", lang: "typst", block: false).
89+
90+
This helps our audience with not getting lost after a microsleep.
91+
92+
You can also spot a short title next to that.
93+
]
94+
95+
#slide[
96+
= The bottom of the slide
97+
Now, look down!
98+
99+
There we have some general info for the audience about what talk they are
100+
actually attending right now.
101+
102+
You can also see the slide number there.
103+
]
104+
105+
106+
#new-section-slide("Dynamic content")
107+
108+
109+
#slide[
110+
= A dynamic slide with `#show: later`
111+
Sometimes we don't want to display everything at once.
112+
#show: later
113+
114+
That's what the `#show: later` feature is there for!
115+
#show: later
116+
117+
It makes everything after it appear at the next subslide.
118+
119+
#set text(size: .6em)
120+
(Also note that the slide number does not change while we are here.)
121+
]
122+
123+
#slide[
124+
= Fine-grained control
125+
 When `#show: later` does not suffice, you can use more advanced commands to
126+
show or hide content.
127+
128+
These are some of your options:
129+
- `#uncover`
130+
- `#only`
131+
- `#alternatives`
132+
- `#one-by-one`
133+
- `#item-by-item`
134+
135+
Let's explore them in more detail!
136+
]
137+
138+
#let example(body) = block(
139+
width: 100%,
140+
inset: .5em,
141+
fill: aqua.lighten(80%),
142+
radius: .5em,
143+
text(size: .8em, body)
144+
)
145+
146+
#slide[
147+
= `#uncover`: Reserving space
148+
With `#uncover`, content still occupies space, even when it is not displayed.
149+
150+
For example, #uncover(2)[these words] are only visible on the second
151+
"subslide".
152+
153+
In `()` behind `#uncover`, you specify _when_ to show the content, and in
154+
`[]` you then say _what_ to show:
155+
#example[
156+
```typ
157+
#uncover(3)[Only visible on the third "subslide"]
158+
```
159+
#uncover(3)[Only visible on the third "subslide"]
160+
]
161+
]
162+
163+
#slide[
164+
= Complex display rules
165+
So far, we only used single subslide indices to define when to show something.
166+
167+
We can also use arrays of numbers...
168+
#example[
169+
```typ
170+
#uncover((1, 3, 4))[Visible on subslides 1, 3, and 4]
171+
```
172+
#uncover((1, 3, 4))[Visible on subslides 1, 3, and 4]
173+
]
174+
175+
...or a dictionary with `beginning` and/or `until` keys:
176+
#example[
177+
```typ
178+
#uncover((beginning: 2, until: 4))[Visible on subslides 2, 3, and 4]
179+
```
180+
#uncover((beginning: 2, until: 4))[Visible on subslides 2, 3, and 4]
181+
]
182+
]
183+
184+
#slide[
185+
= Convenient rules as strings
186+
As as short hand option, you can also specify rules as strings in a special
187+
syntax.
188+
Comma separated, you can use rules of the form
189+
#table(
190+
columns: (auto, auto),
191+
column-gutter: 1em,
192+
stroke: none,
193+
align: (x, y) => (right, left).at(x),
194+
[`1-3`], [from subslide 1 to 3 (inclusive)],
195+
[`-4`], [all the time until subslide 4 (inclusive)],
196+
[`2-`], [from subslide 2 onwards],
197+
[`3`], [only on subslide 3],
198+
)
199+
#example[
200+
```typ
201+
#uncover("-2, 4-6, 8-")[Visible on subslides 1, 2, 4, 5, 6, and from 8 onwards]
202+
```
203+
#uncover("-2, 4-6, 8-")[Visible on subslides 1, 2, 4, 5, 6, and from 8 onwards]
204+
]
205+
]
206+
207+
#slide[
208+
= `#only`: Reserving no space
209+
Everything that works with `#uncover` also works with `#only`.
210+
211+
However, content is completely gone when it is not displayed.
212+
213+
For example, #only(2)[#text(red)[see how]] the rest of this sentence moves.
214+
215+
Again, you can use complex string rules, if you want.
216+
#example[
217+
```typ
218+
#only("2-4, 6")[Visible on subslides 2, 3, 4, and 6]
219+
```
220+
#only("2-4, 6")[Visible on subslides 2, 3, 4, and 6]
221+
]
222+
]
223+
224+
#slide[
225+
= `#alternatives`: Substituting content
226+
You might be tempted to try
227+
#example[
228+
```typ
229+
#only(1)[Ann] #only(2)[Bob] #only(3)[Christopher] likes #only(1)[chocolate] #only(2)[strawberry] #only(3)[vanilla] ice cream.
230+
```
231+
#only(1)[Ann] #only(2)[Bob] #only(3)[Christopher]
232+
likes
233+
#only(1)[chocolate] #only(2)[strawberry] #only(3)[vanilla]
234+
ice cream.
235+
]
236+
237+
But it is hard to see what piece of text actually changes because everything
238+
moves around.
239+
Better:
240+
#example[
241+
```typ
242+
#alternatives[Ann][Bob][Christopher] likes #alternatives[chocolate][strawberry][vanilla] ice cream.
243+
```
244+
#alternatives[Ann][Bob][Christopher] likes #alternatives[chocolate][strawberry][vanilla] ice cream.
245+
]
246+
]
247+
248+
#slide[
249+
= `#one-by-one`: An alternative for `#show: later`
250+
#set text(size: .9em)
251+
`#alternatives` is to `#only` what `#one-by-one` is to `#uncover`.
252+
253+
`#one-by-one` behaves similar to using `#show: later` but you can additionally
254+
state when uncovering should start.
255+
#example[
256+
```typ
257+
#one-by-one(start: 2)[one ][by ][one]
258+
```
259+
#one-by-one(start: 2)[one ][by ][one]
260+
]
261+
262+
`start` can also be omitted, then it starts with the first subside:
263+
#example[
264+
```typ
265+
#one-by-one[one ][by ][one]
266+
```
267+
#one-by-one[one ][by ][one]
268+
]
269+
]
270+
271+
#slide[
272+
= `#item-by-item` for lists
273+
Sometimes it is convenient to write the different contents to uncover one
274+
at a time in subsequent lines.
275+
276+
This comes in especially handy for bullet lists, enumerations, and term lists.
277+
#example[
278+
#toolbox.side-by-side(
279+
```typ
280+
#item-by-item(start: 2)[
281+
- first
282+
- second
283+
- third
284+
]
285+
```,
286+
item-by-item(start: 2)[
287+
- first
288+
- second
289+
- third
290+
]
291+
)
292+
]
293+
294+
`start` is again optional and defaults to `1`.
295+
]
296+
297+
#slide[
298+
= Reveal code
299+
300+
You can use the function `#reveal-code` to slowly guide your audience through
301+
some code.
302+
303+
#example[
304+
#toolbox.side-by-side[
305+
````typ
306+
#reveal-code(lines: (1, 3))[```rs
307+
pub fn main() {
308+
let x = 42;
309+
let y = 6;
310+
dbg!(x / y);
311+
}
312+
```]
313+
````
314+
][
315+
#reveal-code(lines: (1, 3, 5))[```rs
316+
pub fn main() {
317+
let x = 42;
318+
let y = 6;
319+
dbg!(x / y);
320+
}
321+
```]
322+
]
323+
]
324+
]
325+
326+
#new-section-slide[Toolbox #emoji.wrench]
327+
328+
#slide[
329+
= The `toolbox` module
330+
Polylux ships a `toolbox` module with solutions for common tasks in slide
331+
building.
332+
]
333+
334+
#slide[
335+
= Big
336+
You can scale content such that it fills the remaining space using
337+
`#toolbox.big`:
338+
339+
#toolbox.big[Wow!]
340+
]
341+
342+
#slide[
343+
= Side by side content
344+
Often you want to put different content next to each other.
345+
We have the function `#toolbox.side-by-side` for that:
346+
347+
#toolbox.side-by-side(lorem(10), lorem(20), lorem(15))
348+
]
349+
350+
#slide[
351+
= Overview over sections
352+
Why not include an outline?
353+
#toolbox.all-sections((sections, current) => enum(tight: false, ..sections))
354+
]
355+
356+
#new-section-slide("Typst features")
357+
358+
#slide[
359+
= Use Typst!
360+
Typst gives us so many cool things #footnote[For example footnotes!].
361+
Use them!
362+
]
363+
364+
#slide[
365+
= Bibliography
366+
Let us cite something so we can have a bibliography: @A @B @C
367+
#bibliography(title: none, "literature.bib")
368+
]
369+
370+
#new-section-slide("Conclusion")
371+
372+
#slide[
373+
= That's it!
374+
Hopefully you now have some kind of idea what you can do with this package.
375+
376+
Consider giving it
377+
#link("https://github.com/andreasKroepelin/polylux")[
378+
a GitHub star #text(font: "OpenMoji")[#emoji.star]
379+
]
380+
or open an issue if you run into bugs or have feature requests.
381+
]

0 commit comments

Comments
 (0)