Skip to content

Commit

Permalink
Start revising book
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasKroepelin committed Jan 17, 2025
1 parent ed1e70e commit 7f20973
Show file tree
Hide file tree
Showing 48 changed files with 242 additions and 187 deletions.
2 changes: 1 addition & 1 deletion book/src/IMPORT.typ
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#import "@preview/polylux:0.3.1": *
#import "@preview/polylux:0.4.0": *
2 changes: 1 addition & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [General syntax](./dynamic/syntax.md)
- [Complex rules](./dynamic/complex.md)
- [Helper functions](./dynamic/helper.md)
- [pause](./dynamic/pause.md)
- [later](./dynamic/later.md)
- [one-by-one and friends](./dynamic/obo-lbl.md)
- [alternatives](./dynamic/alternatives.md)
- [Cover mode](./dynamic/cover.md)
Expand Down
67 changes: 11 additions & 56 deletions book/src/diy/diy.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ the font size to something readable from the last row:
#set text(size: 25pt)
```
We should be ready do go to create some actual slides now.
We will use the function `polylux-slide` for this, which is kind of at the core
We will use the function `slide` for this, which is kind of at the core
of this package.
```typ
// Remember to actually import polylux before this!
#polylux-slide[
Hello, world!
]
// Remember to actually import Polylux before this!
{{#include hello-world.typ:6:8}}
```
And here is the result (the gray border is not part of the output but it makes
the slide easier to see here):
Expand All @@ -32,35 +29,22 @@ talk they are attending.
Also, let us choose a nicer font and maybe add some colour?
We modify the `#set page` and `#set text` commands for that:
```typ
#set page(paper: "presentation-16-9", fill: teal.lighten(90%))
#set text(size: 25pt, font: "Blogger Sans")
#polylux-slide[
#set align(horizon + center)
= My fabulous talk
Jane Doe
Conference on Advances in Slide Making
]
{{#include title-slide.typ:3:18}}
```
![titleslide](title-slide.png)
Not bad, right?
Another thing that is usually a good idea is to have a title on each slide.
That is also no big deal by using off-the-shelf Typst features, so let's modify
our first slide:
```typ
#polylux-slide[
== My slide title
Hello, world!
]
{{#include slide-title.typ:15:18}}
```
This is starting to look like a real presentation:
![slidetitle](slide-title.png)

## So what?
To be honest, everything we did so far would have been just as easy without
using polylux at all.
using Polylux at all.
So why should you care about it?

Consider the following situation:
Expand All @@ -69,56 +53,27 @@ of some text changes, or some other small-sized change.
Would you like to duplicate the whole slide just so to create this affect?
And then maintain multiple copies of the same content, making sure never to
forget updating all copies when your content evolves?
Of course you wouldn't and, gladly, polylux can handle this for you.
Of course you wouldn't and, gladly, Polylux can handle this for you.

This kind of feature is called **dynamic content** or **overlays** (loosely
speaking, you might also say **animations** but that might be a bit of a stretch,
nothing actually "moves" on PDF pages).

So how does that work in polylux?
So how does that work in Polylux?
As a quick example, let's add a little quiz to our slides:
```typ
#polylux-slide[
== A quiz
What is the capital of the Republic of Benin?
#uncover(2)[Porto-Novo]
]
{{#include quiz.typ:20:27}}
```
![quiz](quiz.png)
Note how two more slides have been created even though we declared only one.

The next sections will explain dynamic content in polylux in all its details.
The next sections will explain dynamic content in Polylux in all its details.

For reference, here is the full source code for the slides we developed in this
section:
```typ
{{#include ../IMPORT.typ}}
#set page(paper: "presentation-16-9", fill: teal.lighten(90%))
#set text(size: 25pt, font: "Blogger Sans")
#polylux-slide[
#set align(horizon + center)
= My fabulous talk
Jane Doe
Conference on Advances in Slide Making
]
#polylux-slide[
== My slide title
Hello, world!
]
#polylux-slide[
== A quiz
What is the capital of the Republic of Benin?
#uncover(2)[Porto-Novo]
]
{{#include quiz.typ:3:27}}
```

Binary file modified book/src/diy/hello-world.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion book/src/diy/hello-world.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#set page(paper: "presentation-16-9")
#set text(size: 25pt)

#polylux-slide[
#slide[
Hello, world!
]
4 changes: 4 additions & 0 deletions book/src/diy/previews.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
typst-compose hello-world 1 gray --root ../../..
typst-compose title-slide 2 gray --root ../../..
typst-compose slide-title 2 gray --root ../../..
typst-compose quiz 2 gray --root ../../..
Binary file modified book/src/diy/quiz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions book/src/diy/quiz.typ
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#import "../../../polylux.typ": *

#set page(paper: "presentation-16-9", fill: teal.lighten(90%))
#set text(size: 25pt, font: "Blogger Sans")
#set text(size: 25pt, font: "Lato")

#polylux-slide[
#set align(horizon + center)
#slide[
#set align(horizon)
= My fabulous talk

Jane Doe

Conference on Advances in Slide Making
]

#polylux-slide[
#slide[
== My slide title
Hello, world!
]

#polylux-slide[
#slide[
== A quiz

What is the capital of the Republic of Benin?

#uncover(2)[Porto-Novo]
#show: later
Porto-Novo
]
Binary file modified book/src/diy/slide-title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions book/src/diy/slide-title.typ
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#import "../../../polylux.typ": *

#set page(paper: "presentation-16-9", fill: teal.lighten(90%))
#set text(size: 25pt, font: "Blogger Sans")
#set text(size: 25pt, font: "Lato")

#polylux-slide[
#set align(horizon + center)
#slide[
#set align(horizon)
= My fabulous talk

Jane Doe

Conference on Advances in Slide Making
]

#polylux-slide[
#slide[
== My slide title
Hello, world!
]
Binary file modified book/src/diy/title-slide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions book/src/diy/title-slide.typ
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#import "../../../polylux.typ": *

#set page(paper: "presentation-16-9", fill: teal.lighten(90%))
#set text(size: 25pt, font: "Blogger Sans")
#set text(size: 25pt, font: "Lato")

#polylux-slide[
#set align(horizon + center)
#slide[
#set align(horizon)
= My fabulous talk

Jane Doe

Conference on Advances in Slide Making
]

#polylux-slide[
#slide[
Hello, world!
]
5 changes: 1 addition & 4 deletions book/src/dynamic/dynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ for one slide, each with slightly different content.
This enables us to have some basic dynamic elements on our slides.

In this book, we will use the term _logical slide_ for a section of content that
was created by one call to `#polylux-slide`, and _subslide_ for a resulting PDF
was created by one call to `#slide`, and _subslide_ for a resulting PDF
page.
Each logical side can have an arbitrary amount of subslides and every subslide
is part of exactly one logical slide.
Expand All @@ -29,6 +29,3 @@ This results in 6 PDF pages for this logical slide.

In the LaTeX beamer package, the functionalities described in this part are
called "overlays".

Everything discussed here works just as well when you use themes.
For simplicity, we will work through the material without them, though.
Binary file removed book/src/dynamic/enum-one-by-one.png
Binary file not shown.
7 changes: 0 additions & 7 deletions book/src/dynamic/enum-one-by-one.typ

This file was deleted.

Binary file added book/src/dynamic/item-by-item-complex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions book/src/dynamic/item-by-item-complex.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import "../../../polylux.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 35pt, font: "Atkinson Hyperlegible")

#slide[
#show: columns.with(3)

#set list(marker: sym.arrow)
#item-by-item[
- first
- second
- some
- detail
- third
]
#colbreak()

#item-by-item[
+ also
+ works
+ with `enums`
]
#colbreak()

#item-by-item(start: 2)[
/ and: with
/ terms: too
]
]
Binary file added book/src/dynamic/item-by-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#import "../../../polylux.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 50pt)
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#polylux-slide[
#line-by-line[
#slide[
#item-by-item[
- first
- second
- third
Expand Down
31 changes: 31 additions & 0 deletions book/src/dynamic/later.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# `show: later` to reveal content piece by piece
Consider some code like the following:
```typ
#uncover("1-")[first]
#uncover("2-")[second]
#uncover("3-")[third]
```
The goal here is to uncover parts of the slide one by one, so that an increasing
amount of content is shown, but we don't want to specify all subslide indices
manually, ideally.

If you have used the LaTeX beamer package before, you might be familiar with the
`\pause` command.
It makes everything after it on that slide appear on the next subslide.
Features of the kind "everything after this" are handled in Typst using the
`#show:` feature.
Namely, `#show: some-function` uses the following content as an argument to
`some-function`.
Polylux provides the `later` function that makes its argument appear on the
next subslide.
So, we can equivalently write the above code as:
```typ
{{#include later.typ:6:10}}
```
This results in

![later](later.png)

`#show: later` should mainly be used when you want to distribute a lot of code
onto different subslides.
For smaller pieces of code, consider one of the functions described next.
Binary file added book/src/dynamic/later.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions book/src/dynamic/later.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import "../../../polylux.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 50pt, font: "Atkinson Hyperlegible")

#slide[
first
#show: later
second
#show: later
third
]
Binary file removed book/src/dynamic/line-by-line.png
Binary file not shown.
Binary file removed book/src/dynamic/list-one-by-one.png
Binary file not shown.
7 changes: 0 additions & 7 deletions book/src/dynamic/list-one-by-one.typ

This file was deleted.

Loading

0 comments on commit 7f20973

Please sign in to comment.