quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.93k stars 325 forks source link

If slide title is long, its font should be smaller by default #4530

Open mine-cetinkaya-rundel opened 1 year ago

mine-cetinkaya-rundel commented 1 year ago

Suppose you have the following slide

---
format: revealjs
---

## This is a veeeeeeeeeeeeeeeeerrrrryyyy loooooooooooooooooooooooooooonnnnngggggg title

```{r}
plot(cars, main = "Title is taking up a huge amount of space so the plot is tiny")

The result is a slide with a tiny plot and giant title:

<img width="685" alt="Screenshot 2023-02-24 at 6 45 51 PM" src="https://user-images.githubusercontent.com/5965649/221321954-1dda34d4-0375-4dd1-8461-5a9210862152.png">

Applying `.r-fit-text` to slide title solves the issue as it results in behaviour that is like PowerPoint or Keynote:

````markdown
---
format: revealjs
---

## [This is a veeeeeeeeeeeeeeeeerrrrryyyy loooooooooooooooooooooooooooonnnnngggggg title]{.r-fit-text}

```{r}
plot(cars, main = "Title is taking up a huge amount of space so the plot is tiny")


<img width="692" alt="Screenshot 2023-02-24 at 6 46 50 PM" src="https://user-images.githubusercontent.com/5965649/221322057-4555b0f6-2e8b-44b6-a3b7-76ee0851987c.png">

It would be nice if `.r-fit-text` behaviour was default, and if so, we should add something to the docs about how to disable it at https://quarto.org/docs/presentations/revealjs/advanced.html#fit-text.
mcanouil commented 1 year ago

I tend to disagree with that for styling reasons, i.e., I do not want to have inconsistent font-file in slides titles. Also, adding this by default would make it really hard to revert by the user while because it's HTML, tweaking font-size by adding css class can be done as part of a template extension for example or as you showed using Pandoc spans.

If such option should be implemented it should not be the default but an opt-in option in my opinion.

mine-cetinkaya-rundel commented 1 year ago

If reverting would be difficult, then I agree that this might not be a good default. However, I think there are good reasons for this default:

  1. It makes it easier for beginners who want to use Quarto with defaults without additional customization to have slides that prioritize content. (My original request was based on observing what students struggled with in their first presentations made with Quarto.)
  2. If the title is as long as in the above example, maybe it should be shortened anyway. I agree that font size difference looks bad, but then the slide title bad too. But for titles that just happen to wrap to the second line, the difference in font sizes is barely recognizable, while the difference plot sizes is definitely recognizable.
---
format: revealjs
---

## This is a somewhat looooooooooong title

```{r}
plot(cars)

[This is a somewhat looooooooooong title]{.r-fit-text}

plot(cars)


<img width="623" alt="Screenshot 2023-02-26 at 5 31 49 PM" src="https://user-images.githubusercontent.com/5965649/221441532-80d03b28-5774-4155-94cb-495ec1e093c3.png">

<img width="618" alt="Screenshot 2023-02-26 at 5 31 58 PM" src="https://user-images.githubusercontent.com/5965649/221441539-d46e0fd9-e73d-455c-9657-a1fd3b70d940.png">
mcanouil commented 1 year ago

My main concern is not really "reverting" but conflicts that might arise with current (or future) headers styling.

Also, would you want this default to act on level 1, 2, and 3 headers? In your example, it's only level 2, but the issue you highlighted can also occur on level 1 ("part" slide) and level 3 (slide subtitle).

Note that globally I think it would be nice to have an option to opt-in/out as for "stretch".

cscheid commented 1 year ago

I think sufficiently many people expect the r-fit-text behavior to be the default one that we should make the (admittedly breaking) change.

It should be easy to have a revealjs format option that is by default true (proposal: title-fit-text). When true, a revealjs filter applies r-fit-text to all headings. When false, we revert to 1.2 behavior.

cscheid commented 1 year ago

We have an open PR for this, but it turns out to be harder to make work well by default (r-fit-text also increases the size if the text is too small; that's not what we'd like to do!) We're going to investigate better in 1.4.

axiomtutor commented 10 months ago

I hope this is the right place and way to post this: I was hoping that in a future version of Quarto, there would be a way to make text auto-shrink as the slides go along.

I'll try to describe what I mean. Imagine you have

# Title

- Item 1
- Item 2
- Item 3

Now in practice I imagine these items actually being very long, so that if you had all three on the screen at the same time, with normal font-size, they would not all fit on the screen.

Ideally what I'd like is for "Item 1" to appear, like a normal fragment. But then when "Item 2" appears on the next frame, it would simultaneously make "Item 1" shrink to half the size. That way the previous context is still visible, but de-emphasized as I carry on talking about "Item 2".

And then on the next frame, "Item 2" shrinks and makes room for "Item 3".

(I know that currently you can make things shrink in a fragment, but the problem is that this doesn't then create extra room for the later text.)

Anyway, I was hoping this kind of converged with similar interests mentioned in the issue above.