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

Embedded tables are not rendering in parent quarto document #7210

Closed
atsyplenkov opened this issue Oct 12, 2023 · 12 comments
Closed

Embedded tables are not rendering in parent quarto document #7210

atsyplenkov opened this issue Oct 12, 2023 · 12 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@atsyplenkov
Copy link

Bug description

I am attempting to embed a table from one .qmd file into another .qmd file (parent document). However, regardless of how the table is rendered (using kable, gt, or hux), the embedding process causes the rendering to fail with the following errors. Individually, each quarto document renders successfully to .html.

processing file: index.qmd
                                                                                                    
output file: index.knit.md

Rendering qmd embeds
[1/1] notebooks/inset-table.qmd


processing file: inset-table.qmd
                                                                                                    
output file: inset-table.knit.md

ERROR: The notebook notebooks/inset-table.qmd doesn't contain output to embed with the cell id, tag, or label 'tbl-two'. Please be sure to have executed any cells that you are embedding.

Stack trace:
    at file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69578:23
    at Array.map (<anonymous>)
    at notebookMarkdown (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69573:40)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async replaceNotebookPlaceholders (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69517:32)
    at async renderPandoc (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69873:28)
    at async Object.onRender (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76312:36)
    at async renderFileInternal (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76289:17)
    at async renderFiles (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76084:17)
    at async render (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:81071:21)

Steps to reproduce

There are two documents. One is the parent document, the second is the supplementary document (named inset-table.qmd).

Parent document

---
title: "Test of embedding tables"
format:
  html:
    toc: true
---

Hello world

```{r}
#| label: tbl-one
#| tbl-cap: This is normal gt table

gt::gt(head(mtcars))

```

{{< embed inset-table.qmd#tbl-two >}}

Supporting document (inset-table.qmd)

---
title: "Notebook"
---

```{r}
#| label: tbl-two
#| tbl-cap: THis is embed example

gt::gt(head(mtcars))

```

Expected behavior

There should be two tables printed using the gt package in the parent document.

Actual behavior

Quarto crashes with the following error

processing file: index.qmd
                                                                                                    
output file: index.knit.md

Rendering qmd embeds
[1/1] notebooks/inset-table.qmd


processing file: inset-table.qmd
                                                                                                    
output file: inset-table.knit.md

ERROR: The notebook notebooks/inset-table.qmd doesn't contain output to embed with the cell id, tag, or label 'tbl-two'. Please be sure to have executed any cells that you are embedding.

Stack trace:
    at file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69578:23
    at Array.map (<anonymous>)
    at notebookMarkdown (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69573:40)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async replaceNotebookPlaceholders (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69517:32)
    at async renderPandoc (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:69873:28)
    at async Object.onRender (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76312:36)
    at async renderFileInternal (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76289:17)
    at async renderFiles (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:76084:17)
    at async render (file:///C:/Users/TSYPLE~1/AppData/Local/Programs/Quarto/bin/quarto.js:81071:21)

Your environment

  • IDE: RStudio 2023.09.1+470 "Desert Sunflower" Release (ecb7e65667c9e2f54fdec9e313f24df8c7b71adc, 2023-10-04) for windows
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.09.1+470 Chrome/116.0.5845.190 Electron/26.2.4 Safari/537.36

  • OS: Windows 10 Enterprise, 22H2, OS build 19045.3570

  • R:

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: Pacific/Auckland
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] digest_0.6.33     utf8_1.2.3        R6_2.5.1          fastmap_1.1.1    
 [5] tidyselect_1.2.0  magrittr_2.0.3    glue_1.6.2        tibble_3.2.1     
 [9] htmltools_0.5.6   pkgconfig_2.0.3   gt_0.10.0         dplyr_1.1.3      
[13] generics_0.1.3    lifecycle_1.0.3   xml2_1.3.5        cli_3.6.1        
[17] fansi_1.0.4       vctrs_0.6.3       compiler_4.3.1    rstudioapi_0.15.0
[21] tools_4.3.1       pillar_1.9.0      rlang_1.1.1   

Quarto check output

Quarto 1.4.415
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.8: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.4: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.4.415
      Path: C:\Users\%username%\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

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

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

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

[>] Checking Python 3 installation....OK
      Version: 3.9.5 (Conda)
      Path: C:/Users/%username%/Miniconda3/python.exe
      Jupyter: 5.3.0
      Kernels: python3

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

[>] Checking R installation...........OK
      Version: 4.3.1
      Path: C:/PROGRA~1/R/R-43~1.1
      LibPaths:
        - C:/Users/%username%/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.1/library
      knitr: 1.44
      rmarkdown: 2.25

[>] Checking Knitr engine render......OK
@atsyplenkov atsyplenkov added the bug Something isn't working label Oct 12, 2023
@cderv
Copy link
Collaborator

cderv commented Oct 12, 2023

I believe you are trying to use a Jupyter Notebook only feature: https://quarto.org/docs/authoring/notebook-embed.html

So it won't work with engine: knitr. @dragonstyle as it change ? Otherwise we could maybe try to stop early when we detect engine knitr and embed shortcode usage ?

@cderv cderv added the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Oct 12, 2023
@atsyplenkov
Copy link
Author

atsyplenkov commented Oct 12, 2023

I believe you are trying to use a Jupyter Notebook only feature: https://quarto.org/docs/authoring/notebook-embed.html

So it won't work with engine: knitr. @dragonstyle as it change ? Otherwise we could maybe try to stop early when we detect engine knitr and embed shortcode usage ?

Thanks for the prompt response! I don't understand how than it works in manuscript projects. For example see — https://mine.quarto.pub/manuscripts-conf23/#/embedded-computations

Roughly speaking, the only difference between slides and mine reprex is that the project type wasn't specified. Could that be the reason?

@cderv
Copy link
Collaborator

cderv commented Oct 12, 2023

Oh yes new manuscript format and features. Sorry - I missed that. 🤦 Thanks for additional content !

Recent work have support for .qmd embedding indeed using intermediary files. I see there was a bug with fig- at some point (#6959) so maybe there is one with tbl-.

@dragonstyle will known more.

@atsyplenkov
Copy link
Author

Recent work have support for .qmd embedding indeed using intermediary files. I see there was a bug with fig- at some point (#6959) so maybe there is one with tbl-.

Sure it is! tbl-cap was the reason for the strange behavior. Moreover, it fully depends on the project type. For example, switching the project to the manuscript type will not throw an error, but it will not render tables (example 1). Removing tbl-cap in the manuscript type will result in rendering only the knitr::kable table (example 2). Removing the project type, i.e., reproducing my initial issue without tbl-cap options, will render only the kable table expanded to the full width (example 3). Note that the gt table failed to embed but did not throw any error, while the kable table embedded successfully but without the Table 3 heading!

It turns out that only knitr::kable tables could be embed, while kableExtra, gt and hux are not.

Example 1

original issue switched to manuscript type with tbl-cap

image

Example 2

original issue switched to manuscript type without tbl-cap

image

Example 3

original issue without tbl-cap options

image

@dragonstyle
Copy link
Collaborator

Thanks for the additional details - I am tracking down the issues and think I know how to fix... will update here soon...

@cderv cderv removed the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Oct 13, 2023
@dragonstyle dragonstyle added this to the v1.4 milestone Nov 27, 2023
@dragonstyle
Copy link
Collaborator

This is resolved in the current Quarto pre-release.

@DOH-FAA3303
Copy link

DOH-FAA3303 commented Feb 28, 2024

@dragonstyle I'm still unable to render gt tables using a manuscript project type using quarto version 1.5.22 or 1.4.358. are there plans to add gt and other tables for manuscripts in the future? Or are there ways around this problem you know of?

@mcanouil
Copy link
Collaborator

@DOH-FAA3303 please provide a reproducible example as plain text or a Git repository.
We can't work with "it does not work for me".

I suggest you open a new issue (possibly linking this one) with a reproducible example and all information requested in the template.
Thank you for your cooperation and bug report.

@DOH-FAA3303
Copy link

DOH-FAA3303 commented Feb 28, 2024

Recent work have support for .qmd embedding indeed using intermediary files. I see there was a bug with fig- at some point (#6959) so maybe there is one with tbl-.

Sure it is! tbl-cap was the reason for the strange behavior. Moreover, it fully depends on the project type. For example, switching the project to the manuscript type will not throw an error, but it will not render tables (example 1). Removing tbl-cap in the manuscript type will result in rendering only the knitr::kable table (example 2). Removing the project type, i.e., reproducing my initial issue without tbl-cap options, will render only the kable table expanded to the full width (example 3). Note that the gt table failed to embed but did not throw any error, while the kable table embedded successfully but without the Table 3 heading!

It turns out that only knitr::kable tables could be embed, while kableExtra, gt and hux are not.

Example 1

original issue switched to manuscript type with tbl-cap

image

Example 2

original issue switched to manuscript type without tbl-cap

image

Example 3

original issue without tbl-cap options

image

@mcanouil I meant i reproduced this example exactly and was unable to render the gt table. I will make a new issue

@mcanouil
Copy link
Collaborator

Thanks for the clarification.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 28, 2024

Unfortunately, using screenshots is really a pain.
@DOH-FAA3303 since you tried somehow the examples, would you mind sharing a Git repository which could be use to reproduce the issue (and possibly reopen the GitHub issue)?

@DOH-FAA3303
Copy link

Unfortunately, using screenshots is really a pain. @DOH-FAA3303 since you tried somehow the examples, would you mind sharing a Git repository which could be use to reproduce the issue (and possibly reopen the GitHub issue)?

I just submitted a new issue with the example in markdown @mcanouil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants