Open eipi10 opened 5 months ago
I just reran the reproducible example above and now the global fig-asp
works in all slides, but the global fig-align
is still ignored in the first slide. I have no explanation for why the result is different (I haven't made any changes to my system), but I thought I should report it here.
I don't think all of this is revealjs specific
How do you check this is not taken into account everywhere ? Just so that we look at the same thing. It seems it is working now, and from plot size I see I think this is respected too
Not that in HTML output, Image are dynamically resize if you do not set auto-stretch: false
. This is part of default behavior to have image stretched.
When no label with fig-
prefix, Quarto does not consider it a figure, and we have a regression for applying fig-align
- related to this
and maybe others
So the first slide won't be centered because of this currently
but adds an undesired Figure 1 caption below figure.
I don't think we still add this if no caption. You should check
@cderv, thanks for your reply.
Yes, global fig-asp
seems to be working as expected (even though it didn't work when I first ran my reproducible example--not sure what was going on there).
Global fig-align
doesn't work unless a code chunk includes a label
option. However, when the label
option is included, the plot is rendered with the caption Figure ...
below the plot (even when no fig-cap
is included), which I don't want (see example below). Ideally, global fig-align
would work without having to add a label
option to each individual chunk. Indeed, the whole point of using global fig-align
(and other global figure options) is to avoid having to add special options to each individual chunk.
Here's an example showing that quarto revealjs adds a Figure 1
caption to a plot when the chunk includes a label
, even if there's no fig-cap
option included:
---
title: "Presentation Title"
format:
revealjs: default
fig-align: center
fig-asp: 1
fig-dpi: 600
---
```{r include=FALSE}
library(tidyverse)
p = iris %>%
ggplot(aes(Petal.Length, Petal.Width, colour=Species)) +
geom_line() +
geom_point() +
theme_bw(base_size=20)
#| label: fig-1
p
Output:
![Screenshot 2024-05-31 at 9 16 17 AM](https://github.com/quarto-dev/quarto-cli/assets/436817/573a2b60-ff80-47a9-9562-f6bbe402abb0)
However, when the label option is included, the plot is rendered with the caption Figure ... below the plot (even when no fig-cap is included), which I don't want (see example below)
Can you try with 1.5 pre-release ?
Ideally, global fig-align would work without having to add a label option to each individual chunk. Indeed, the whole point of using global fig-align (and other global figure options) is to avoid having to add special options to each individual chunk.
Yes this is a about
When it will be handled, it should fix also for this case.
If you don't want "Figure X" then don't make it a cross-referenceable figure using a label with fig-
as prefix. (In 1.5, I believe there is nothing unless you set a caption).
I just installed Quarto 1.5.39 and setting the label
option no longer adds the Figure 1
caption.
---
title: "Presentation Title"
format:
revealjs: default
fig-align: center
fig-asp: 1
fig-dpi: 600
---
```{r include=FALSE}
library(tidyverse)
p = iris %>%
ggplot(aes(Petal.Length, Petal.Width, colour=Species)) +
geom_line() +
geom_point() +
theme_bw(base_size=20)
label
#| label: fig-1
p
label
p
![Screenshot 2024-05-31 at 9 32 02 AM](https://github.com/quarto-dev/quarto-cli/assets/436817/803cf713-7835-467b-83f0-ced2fa259c5b)
![Screenshot 2024-05-31 at 9 32 19 AM](https://github.com/quarto-dev/quarto-cli/assets/436817/35ecc9f5-7d58-44ae-afd8-d66412e4c746)
So that leaves us with the fig-align
issue, which is directly related to the other one IMO.
Bug description
I'm trying to set global values for
fig-align
andfig-asp
in a revealjs presentation, but quarto is ignoring them. I've tried setting them in the top level yaml (as in the example below), withinexecute:
and withinformat: revealjs:
, but the behavior is the same in each case. Unlikefig-asp
andfig-align
, quarto does respect a global setting offig-dpi
.Steps to reproduce
Title
Ignores
fig-asp
andfig-align
, regardless of whether these are in top-level yaml, withinexecute:
or withinrevealjs:
.Title
With a
label
added to chunk options: Respectsfig-align
, but ignoresfig-asp
. But now there's an unwantedFigure 1
added as a caption.Title
Respects local
fig-asp
andfig-align
.