andreasKroepelin / polylux

A package for creating slides in Typst
https://polylux.dev/book
MIT License
1.18k stars 55 forks source link

Align doesn't work in university theme #148

Open vringar opened 9 months ago

vringar commented 9 months ago

Hey, when trying to use #align in the university theme like this:

#import "@preview/polylux:0.3.1": *
#import themes.university: *

#show: university-theme.with()

#slide(title: [Title])[
#align(bottom)[
Demo text
]
]

The text would continue to stick to the top of the slides like this: image

However, when using the simple theme, this would work. Unfortunately, I don't understand enough Typst to debug, why this doesn't work. Can someone help?

andreasKroepelin commented 9 months ago

That's quite strange indeed. In the meantime, maybe try putting #v(1fr) at the top of your slide's content.

Andrew-Schwartz commented 6 months ago

I've found that the cause of this bug is that, in slide, body is wrapped in pad(x, y, ...) rather than block(inset: (x, y), ...). I'm planning to figure out how to make a PR for that in a couple days, but just changing that isn't too big a deal for now.

rxt1077 commented 2 months ago

So I tried @Andrew-Schwartz's solution and it didn't seem to work for me. I changed line 106 of themes/university.typ to let body = block(inset: (x: 2em, y: .5em), body) and tested with the following slide:

#slide(
  title: [Testing],
  align(horizon, [Testing])
)

The result was that the text was still not horizontally aligned. If I remove line 106 and leave body just as it is passed to the function the text becomes horizontally aligned but the content goes right to the edges of the page (as you'd expect without padding).

I'm not quite savvy enough about the internals of Typst to know how we can apply the align function to the outside of the pad function. Any thoughts?