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

manuscript project not rendering when there is a labelled code chunck #11088

Open
jacques-shebehe opened this issue Oct 16, 2024 · 1 comment
Labels
bug Something isn't working manuscript Issues related to manuscript output

Comments

@jacques-shebehe
Copy link

Bug description

A qmd document is well rendered with figures and tables labelled. But when the document is used as manuscript project, quarto fails to render the manuscript project if there one labelled code chunck. Jupyter kernel starts and carries out the computation in the code chunck but quarto fails to render if there is at least one labelled code chunk: I have tested *| label: fig-tagand *|tbl-tag.

Steps to reproduce

---
title: Quarto Manuscript Default Project
authors:
  - name: Norah Jones
    affiliation: The University
    roles: writing
    corresponding: true
bibliography: references.bib
jupyter: nbstata
---

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

The document fails to render once the below code chunk @fig-figuretag1 is labelled with `*| label: fig-figurelabel`.


```{stata}
*| label: fig-figuretag1
*| fig-cap: From code chunck
*| echo: false

qui webuse auto, clear
scatter price mpg

The same happens if there is one table code chunk labelle with *| label: tbl-tablelabel.

@fig-figuretag1 worked well from code chunk.

and @tbl-tabletag1 embedded after being produced in a the code chunk below.

*| include: false
table foreign, stat(mean price) stat(sd price)
collect layout (foreign) (result)
collect style cell result, font("Trade Gothic Next", bold size(12))
collect export tab1, as(html) replace

Even here we refer to the same html table @tbl-tabletag1

::: {#tbl-tabletag1}

*| echo: false
*| output: asis
display "```{=html}"
type tab1.html
display "```"

Produced dynamically from formatted html table

:::

*| echo: false
*| include: false
table foreign, stat(mean price) stat(sd price)
collect layout (foreign) (result)
*collect style cell result, font("Trade Gothic Next", bold size(12))*
collect export tab2, as(md) replace

And when @tbl-tabletag2 is produced from Markdown table

::: {#tbl-tabletag2}

*| echo: false
*| output: asis
type tab2.md

Produced dynamically from md table
:::

The End

Expected behavior

The qmd document should render and add cross-reference in a single document as well as in manuscript project.

Actual behavior

In a manuscript project the same document fails to render if there is at least one labelled code chunk, be it labelle with code chuck label: tbl-, label: fig- or fenced div.

When there is a *| label: fig- in the index.qmd, there produced error is:

Rendering qmd embeds [index.qmd]
Rendering output notebook [index.qmd]
Error running filter /Applications/quarto/share/filters/main.lua:
Block, list of Blocks, or compatible element expected, got table
        while retrieving function argument content
        while retrieving arguments for function Div
stack traceback:
        /Applications/quarto/share/filters/main.lua:22368: in field 'render'
        /Applications/quarto/share/filters/main.lua:1233: in local 'filter_fn'
        /Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
        (...tail calls...)
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>

When using ::: {#tbl-tabletag1} in the index.qmd, the error is:

Rendering qmd embeds [index.qmd]
Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:22378: attempt to index a nil value (field 'content')
stack traceback:
        /Applications/quarto/share/filters/main.lua:1233: in local 'filter_fn'
        /Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
        (...tail calls...)
        [C]: in ?
        [C]: in method 'walk'
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
        /Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
        (...tail calls...)
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>

Your environment

  • IDE: VSCode 1.94.2
  • MacOS Sequoia 15.0.1

Quarto check output

(base) m1pro14@MacBookPro q_ms % quarto check
Quarto 1.5.57
[✓] 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.5.57
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.5 (Conda)
      Path: /Users/m1pro14/anaconda3/bin/python
      Jupyter: 5.3.0
      Kernels: nbstata, python3

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

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.48
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
@jacques-shebehe jacques-shebehe added the bug Something isn't working label Oct 16, 2024
@mcanouil
Copy link
Collaborator

Could you properly format your post using code blocks for code and terminal outputs? Thanks.
If your code contains code blocks, you need to enclose it using more backticks, i.e., usually four ````.
See https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us.


Could you try without a proprietary software such as Stata?
This seems to be an issue with the Jupyter kernel you are using rather than Quarto itself.

@cscheid cscheid added the manuscript Issues related to manuscript output label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manuscript Issues related to manuscript output
Projects
None yet
Development

No branches or pull requests

3 participants