Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout primitives #23

Closed
kaarmu opened this issue Apr 18, 2023 · 11 comments
Closed

Layout primitives #23

kaarmu opened this issue Apr 18, 2023 · 11 comments

Comments

@kaarmu
Copy link

kaarmu commented Apr 18, 2023

Hi, love the work!

Do you have/have plans for/any thoughts on layout primitives (theme-agnostic layouts)? See the attached pdf where I imitate google slides.

main.pdf

@andreasKroepelin
Copy link
Owner

So you like this side by side content? I feel like this is covered by Typst builtins. For the title, that should be handled by the theme. Did you have anything else in mind?

@kaarmu
Copy link
Author

kaarmu commented Apr 18, 2023

It is fairly easy to build this sort of stuff with the builtins but I think side-by-side, title-body, etc. are layouts that are common for slides regardless of theme and it would be nice to have commands that you can call to just immediately get those layouts without colors, banners and more. What I find nice with PP/Google Slides is that you can very easily draft up something and group content like this. Then if I want to style it I can apply a proper theme on top of it or do the styling myself.

@andreasKroepelin
Copy link
Owner

I think what you are proposing is rather that the default theme is less "opinionated"? So it looks more like the document you linked to above? We could discuss that.

Because right now, if you do "nothing", you get some colours and decoration by the default theme.

@kaarmu
Copy link
Author

kaarmu commented Apr 18, 2023

That's one way to look at it. I do like that typst-slides have one/many opinionated themes. It's just that I want to be able to control the content layout separately as well.

@andreasKroepelin
Copy link
Owner

Maybe I don't fully understand what kind of layout controlling you want, yet. If it's "just" this side-by-side thing, then i suggest using #grid or #columns from Typst.

@kaarmu
Copy link
Author

kaarmu commented Apr 18, 2023

Yea, that's what I'm already doing. But I think there is something to be said about having slide-specific commands. The side-by-side layout is trivial but very common. So, my argument is that it's more comfortable to have something like

#let two-col(..options, left, right) = grid(columns: (1fr, 1fr),
  block(inset: .5cm, left),
  block(inset: .5cm, right),
)

where options are relevant, and have defaults, specifically for slides (but no theming with colors etc.).

There is a fine line between this and, as you said before, having the default theme less opinionated. I think what I'm looking for is something where I build my own theme on top of this. I really like #new-section and #slide but I don't want them to enforce how the content should look and flow. Same thing goes for the title page. I don't want to be forced to use a specific title page, I just want it to be a normal slide I add and then I apply a title-page layout on that.

In the end it would be cool to be able to compose layouts and build/style themes on top of these slide-specific "primitives", if you understand me better now?

@andreasKroepelin
Copy link
Owner

Would something along these lines help you?
https://andreaskroepelin.github.io/typst-slides/book/themes.html#per-slide-escape-hatch

And then we could maybe provide a "theme tool box" containing those primitives. You are right that there are many repeating elements in theme creation. A bit of thought would have to go into good abstractions there.

@kaarmu
Copy link
Author

kaarmu commented Apr 18, 2023

Oh, I didn't see that feature! But yes, I agree. Here's a slightly better example of what I'm thinking...

// some primitives like this one provided by toolbox 
#let side-by-side(body) = {
  show: block.with(height: 80%, stroke: 1pt + luma(200))
  show: columns.with(2, gutter: .5cm)
  body
}

// written by user or theme-author
#let special-slide(
  layout: side-by-side,
  ..args,
) = {
  // here `special-slide` could do more theming etc.

  // `slide` is only a non-opinionated canvas that enable
  // typst-slide features like dynamic content
  slide(layout: layout, ..args)
}

#special-slide[
  #lorem(20)

  #lorem(20)

  #lorem(20)

  #lorem(20)
]

Layout primitives could be simple show-rules, but again, specially suited for slides and ready to use from the get-go. Maybe the toolbox/package can include ways of marking the content, like your pause, for certain layout placement or similar use.

@kaarmu
Copy link
Author

kaarmu commented Apr 21, 2023

This update is mostly for history.

Here's an even more involved example. Things to take note of:

  • I've recreated some uni slides, it does not have multiple themes but there is different layouts.
  • They are mainly for exploring API design and what abstractions are suitable.
  • I've taken out some parts of typst-slides which should remain (e.g. some styling etc).
  • I'm interested in ease-of-use for two perspectives, theme author and end-user.

https://github.com/kaarmu/typst-slides/tree/dev.

@drupol
Copy link
Contributor

drupol commented Apr 21, 2023

Cool ! I've also did a theme for the university, find it here: #21

I tried to create it as modular as possible, feel free to pick ideas and/or suggest improvements!

@kaarmu
Copy link
Author

kaarmu commented Apr 22, 2023

Nice theme @drupol, looks very beamer-esque! It would be cool to collect a few more official templates and recreate them (like I did for my university).

Do you have any thoughts after implementing it? In this issue I wanted to hear thoughts on the things I listed before. I haven't made very many or very complicated slides in Typst, yet, so if you have any insights I'd love to hear more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants