-
Notifications
You must be signed in to change notification settings - Fork 393
Closed
Labels
Milestone
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
The documentation for Typst format says:
Typst has great support for SVG graphics, so format: typst defaults to fig-format: svg. This configuration means executable code cells that produce images will produce .svg output.
This is great, however I could not reproduce this using a simple .qmd file using matplotlib. Even setting fig-format to svg renders .png outputs.
Steps to reproduce
test.qmd:
---
keep-md: true
format:
typst:
fig-format: svg
keep-typ: true
---
# Hello World
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```# uv run quarto render test.qmd --verbose
Starting python3 kernel...Done
Executing 'test.quarto_ipynb'
Cell 1/1: 'fig-polar'...Done
pandoc --verbose
to: typst
output-file: test.typ
standalone: true
default-image-extension: svg
wrap: none
citeproc: false
variables: {}
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\template.patched from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\template.patched
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\definitions.typ from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\definitions.typ
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\typst-template.typ from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\typst-template.typ
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\typst-show.typ from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\typst-show.typ
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\notes.typ from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\notes.typ
[INFO] Loaded Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\biblio.typ from Temp\quarto-sessiond0d2adb3d650f8d6\7d36c9b38a916f72\64ede515bd6cd7bc\biblio.typ
[INFO] Running filter Programs/Quarto/share/filters/main.lua
[INFO] Completed filter Programs/Quarto/share/filters/main.lua in 31 ms
[typst]: Compiling test.typ to test.pdf...DONE
Output created: test.pdf
Actual behavior
test.typst.md contains the plot as a png file:
---
keep-md: true
format:
typst:
fig-format: svg
keep-typ: true
---
# Hello World
::: {.cell execution_count=1}
``` {.python .cell-code}
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
::: {.cell-output .cell-output-display}
{#fig-polar}
:::
:::Of course the same is true for the .typ and the .pdf file.
Expected behavior
I would expect the generated markdown to include the plot as an svg file, e.g.:
::: {.cell-output .cell-output-display}
{#fig-polar}
:::
Your environment
# uv run quarto --version
1.7.32
Quarto check output
# uv run quarto check
Quarto 1.7.32
[>] Checking environment information...
Quarto cache location: Local\quarto
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.85.1: OK
Deno version 1.46.3: OK
Typst version 0.13.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.7.32
Path: Programs\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[>] Checking LaTeX....................OK
Tex: (not detected)
[>] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: C:\Program Files\Google\Chrome\Application\chrome.exe
Source: Windows Registry
[>] 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/