quarto-dev / quarto-dev/quarto-cli

Embedding two plots in manuscripts causes issues

Open
#10,344 8 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Jul 21, 2024.

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

Description

Bug description

I am not sure if this a bug or if manuscripts have been planned to work certain way, but here is report anyway. Hopefully it is helpful!

Steps to reproduce

I have two .qmds, the index and penguins.qmd. The index.qmd is;

---
title: Article
authors:
  - name: Norah Jones
    affiliation: The University
    roles: writing
    corresponding: true
bibliography: references.bib
---

## Section

This is a simple placeholder for the manuscript's main document [@knuth84].

```{r}
#| label: example
1 + 1
```

Embedding single plot cell 

{{< embed notebooks/penguins.qmd#fig-onefig >}}

Some other text here

{{< embed notebooks/penguins.qmd#fig-twofig >}}

and penguins.qmd

---
title: "Subfig"
---

```{r}
#| label: fig-onefig
#| fig-cap: "A plot with a single cap"
# Calculate bill ratio
plot(1)
```
```{r}
#| label: fig-twofig
#| fig-cap: |
#|  First caption
#| fig-subcap: 
#|   - "A"
#|   - "B"
plot(2)
plot(3)
```

_quarto.yml is

project:
  type: manuscript

execute:
  freeze: false

format:
  html:
    toc: true
    comments:
      hypothesis: true

Trying to embed the cell labeled fig-charts with two ggplots causes issue.

Expected behavior

The two plots are embedded into the index.qmd and rendered.

Actual behavior
Rendering qmd embeds [notebooks\penguins.qmd]
Error running filter C:/PROGRA~1/Quarto/share/filters/main.lua:
Block, list of Blocks, or compatible element expected, got Blocks
	while retrieving function argument content
	while retrieving arguments for function Div
stack traceback:
	C:/PROGRA~1/Quarto/share/filters/main.lua:23206: in field 'render'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1233: in local 'filter_fn'
	C:/PROGRA~1/Quarto/share/filters/main.lua:635: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:625>
	(...tail calls...)
	[C]: in ?
	[C]: in method 'walk'
	C:/PROGRA~1/Quarto/share/filters/main.lua:557: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:546>
	(...tail calls...)
	C:/PROGRA~1/Quarto/share/filters/main.lua:1334: in local 'callback'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1388: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:1385>
stack traceback:
	C:/PROGRA~1/Quarto/share/filters/main.lua:557: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:546>
	(...tail calls...)
	C:/PROGRA~1/Quarto/share/filters/main.lua:1334: in local 'callback'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1388: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:1385>
	
removing the layout-ncol: 2 sometimes gives

Block, list of Blocks, or compatible element expected, got table
	while retrieving function argument content
	while retrieving arguments for function Div
stack traceback:
	C:/PROGRA~1/Quarto/share/filters/main.lua:22445: in field 'render'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1233: in local 'filter_fn'
	C:/PROGRA~1/Quarto/share/filters/main.lua:635: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:625>
	(...tail calls...)
	[C]: in ?
	[C]: in method 'walk'
	C:/PROGRA~1/Quarto/share/filters/main.lua:557: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:546>
	(...tail calls...)
	C:/PROGRA~1/Quarto/share/filters/main.lua:1334: in local 'callback'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1388: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:1385>
stack traceback:
	C:/PROGRA~1/Quarto/share/filters/main.lua:557: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:546>
	(...tail calls...)
	C:/PROGRA~1/Quarto/share/filters/main.lua:1334: in local 'callback'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
	C:/PROGRA~1/Quarto/share/filters/main.lua:1388: in function <C:/PROGRA~1/Quarto/share/filters/main.lua:1385>
Your environment

RStudio "Chocolate Cosmos" Release (e4392fc9, 2024-06-05) for windows
Quarto Quarto 1.6.3, also tested with 1.5 and could repo the issue

Quarto check output
Quarto 1.6.3
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.3
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

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

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\X\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2024

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

[>] Checking Python 3 installation....OK
      Version: 3.11.2
      Path: C:/Users/X/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: 5.7.2
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.4.1
      Path: C:/PROGRA~1/R/R-44~1.1
      LibPaths:
        - C:/Users/X/AppData/Local/R/win-library/4.4
        - C:/Program Files/R/R-4.4.1/library
      knitr: 1.48
      rmarkdown: 2.27

[>] Checking Knitr engine render......OK

```
also gives the warning WARN: Error removing file and more spefically (os error 32) about removing a file because it used by another process, the message is in system language so didnt include it here

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.