Side by side
To make good use of the space on a slide, you will often want to place content
next to each other.
For convenience, Polylux provides the function #side-by-side
for this purpose.
If you used
#import "@preview/polylux:0.3.1": *
you have it directly available.
Otherwise you can get if from the utils
module.
It is basically a thin wrapper around the Typst function
#grid
but tailored
towards this specific usecase.
In its simplest form, you can use it as
#side-by-side[
#lorem(7)
][
#lorem(10)
][
#lorem(5)
]
resulting in
As you can see, the content arguments you provide will be placed next to each
other with equal proportions of width.
A spacing (gutter) of 1em
will also be put between them.
The widths and gutter can be configured using the columns
and gutter
optional
arguments, respectively.
They are propagated to #grid
directly so you can look up possible values in
its documentation
(gutter
and columns
arguments).
If not specified, they fall back to these defaults:
gutter
:1em
columns
:(1fr,) * n
if you providedn
content arguments, that means an array with the value1fr
repeatedn
times.
A more complex example would therefore be:
#side-by-side(gutter: 3mm, columns: (1fr, 2fr, 1fr))[
#rect(width: 100%, stroke: none, fill: aqua)
][
#rect(width: 100%, stroke: none, fill: teal)
][
#rect(width: 100%, stroke: none, fill: eastern)
]
resulting in