quarto-dev / quarto-dev/quarto-cli

Quarto revealjs ignores global fig-align and fig-asp settings when rendering plots.

Open
#9,800 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug crossref figures revealjs
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

I'm trying to set global values for fig-align and fig-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), within execute: and within format: revealjs:, but the behavior is the same in each case. Unlike fig-asp and fig-align, quarto does respect a global setting of fig-dpi.

Steps to reproduce
---
title: "Presentation Title"
format: 
  revealjs:
    width: 1500
    height: 900
    margin: 0.1
fig-align: center
fig-asp: 1
fig-dpi: 600
editor: source
---

```{r include=FALSE}
library(tidyverse)
```

```{r}
p = iris %>% 
  ggplot(aes(Petal.Length, Petal.Width, colour=Species)) + 
  geom_line() +
  geom_point()
```

## Title

Ignores `fig-asp` and `fig-align`, regardless of whether these are in top-level yaml, within `execute:` or within `revealjs:`. 

```{r}
p
```

## Title

With a `label` added to chunk options: Respects `fig-align`, but ignores `fig-asp`. But now there's an unwanted `Figure 1` added as a caption.

```{r}
#| label: fig-1
p
```

## Title

Respects local `fig-asp` and `fig-align`.

```{r}
#| fig-asp: !expr 9/10
#| fig-align: center
p
```

Output:

Screenshot 2024-05-29 at 3 04 15 PM

Expected behavior

All plots should be rendered using the global fig-align and fig-asp values set in the yaml, unless overridden by local settings in a given chunk.

Actual behavior
  • In a chunk without a label, quarto ignores global fig-align and fig-asp.
  • In a chunk with a label, quarto respects global fig-align and ignores global fig-asp, but adds an undesired Figure 1 caption below figure.
  • quarto respects fig-align and fig-asp when set locally within a chunk.
Your environment
  • IDE: RStudio 2024.04.1+748
  • R: 4.4.0
  • OS: Windows Server 2016
Quarto check output
Quarto 1.4.554
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.4.554
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Tex:  (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the supplied R revealjs presentation as the reproduction case, checking the output for global fig-align and fig-asp settings with and without a chunk label. Trace the revealjs rendering path for these global figure options; done means both settings apply globally without requiring local chunk options or adding an unwanted Figure caption.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.