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

Figure with empty caption and cross-ref label rendered to Typst crashes main.lua #9675

Closed
iandol opened this issue May 15, 2024 · 6 comments · Fixed by #9678
Closed

Figure with empty caption and cross-ref label rendered to Typst crashes main.lua #9675

iandol opened this issue May 15, 2024 · 6 comments · Fixed by #9678
Assignees
Labels
bug Something isn't working crossref triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. typst
Milestone

Comments

@iandol
Copy link

iandol commented May 15, 2024

Bug description

With this code:

---
title: "No Caption Figure Test"
author: Jane Doe
---

Text.

![](xkcd.png){#fig-xkcd}

Text.

I get this crashlog rendering to Typst:

▷ quarto render sf.qmd -t typst -o sf.pdf
pandoc -o sf.typ
  to: typst
  standalone: true
  default-image-extension: svg
  wrap: none
  citeproc: false
  
metadata
  title: No Caption Figure Test
  author: Jane Doe
  
Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:22303: attempt to index a nil value (local 'caption')
stack traceback:
	/Applications/quarto/share/filters/main.lua:1211: in local 'filter_fn'
	/Applications/quarto/share/filters/main.lua:613: in function </Applications/quarto/share/filters/main.lua:603>
	(...tail calls...)
	[C]: in ?
	[C]: in method 'walk'
	/Applications/quarto/share/filters/main.lua:535: in function </Applications/quarto/share/filters/main.lua:524>
	(...tail calls...)
	/Applications/quarto/share/filters/main.lua:1312: in local 'callback'
	/Applications/quarto/share/filters/main.lua:1330: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:1366: in function </Applications/quarto/share/filters/main.lua:1363>
stack traceback:
	/Applications/quarto/share/filters/main.lua:535: in function </Applications/quarto/share/filters/main.lua:524>
	(...tail calls...)
	/Applications/quarto/share/filters/main.lua:1312: in local 'callback'
	/Applications/quarto/share/filters/main.lua:1330: in upvalue 'run_emulated_filter_chain'
	/Applications/quarto/share/filters/main.lua:1366: in function </Applications/quarto/share/filters/main.lua:1363>

I can stop the crash by removing the cross-ref label OR adding a caption text. Render to HTML or LaTeX and it works as is.

Steps to reproduce

No response

Expected behavior

Typst output doesn't crash main.lua

Actual behavior

No document is produced

Your environment

Quarto 1.5.35 on macOS 14.4.1

Quarto check output

▷ quarto check                           
Quarto 1.5.35
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.13: 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.35
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/ian/Library/TinyTeX/bin/universal-darwin
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.1
      Path: /Users/ian/.pyenv/versions/3.12.1/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

      There is an unactivated Python environment in micromamba. Did you forget to activate it?

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")
@iandol iandol added the bug Something isn't working label May 15, 2024
@mcanouil mcanouil added the typst label May 15, 2024
@mcanouil
Copy link
Collaborator

Thanks for the report. The inline syntax does produce a crash.

Alternatively, the fenced div syntax works.

---
title: "No Caption Figure Test"
author: Jane Doe
format: typst
---

Text.

:::{#fig-xkcd}
![](xkcd.png)
:::

Text.

@mcanouil mcanouil added crossref triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. labels May 15, 2024
@cscheid cscheid added this to the v1.5 milestone May 15, 2024
@cscheid
Copy link
Collaborator

cscheid commented May 15, 2024

Thanks for the report. (For our own sake, this is another side-effect of the Pandoc upstream fix that removed empty Plain nodes)

@jbrick55

This comment was marked as resolved.

@mcanouil

This comment was marked as resolved.

@jbrick55

This comment was marked as resolved.

@mcanouil

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossref triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. typst
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants