Quarto possibly overwriting svg font settings in typst output? #10354
-
DescriptionI am creating a batch of reports in quarto, using the jupyter engine to process python code and typst to typset and format the text. Would appreciate any pointers on what could be going on. I am on Quarto v 1.5.54 in jupyter lab, running Ubuntu-22.04 on wsl. Here is some example code. I have included some text to check that the necessary static font files are in the system. ---
format: typst
execute:
keep-ipynb: true
keep-typ: true
echo: false
---
````{=typst}
#set text(11pt, font: "IBM Plex Sans", weight:"light") //
== Some text
#let weights = (
"thin",
"extralight",
"light",
"regular",
"medium",
"semibold",
"bold",
"extrabold",
"black",
)
#for w in weights {
[
#w
#h(1fr)
#text(weight: w, lorem(10))
]
}
````
````{python}
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.weight']='light'
plt.rcParams['axes.titleweight'] ='semibold'
plt.rcParams['svg.fonttype']='none'
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='X', ylabel='Y')
ax.grid()
plt.title('A Plot', fontsize= 24, fontweight = 'semibold')
plt.savefig('plot.svg')
plt.show()
````

````{=typst}
#figure(
image("plot.svg"),
caption: [Saved plot - typst]
)
````
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Could you properly format your post using code blocks for code and terminal outputs? Thanks. Did you check your SVG itself? |
Beta Was this translation helpful? Give feedback.
-
This isn't Quarto - take your python code cell, name it as
|
Beta Was this translation helpful? Give feedback.
-
I did a quick search and I think you may be running into this issue As a workaround, I
I think this is closer to the desired look: ![]() It looks like they have fixed this on Typst main but they haven't made a new release yet. If they do, we should pick it up our next release. Anyway as @cscheid said, it's an upstream Typst issue and not really Quarto. |
Beta Was this translation helpful? Give feedback.
I did a quick search and I think you may be running into this issue
typst/typst#3162
As a workaround, I
keep-typ:true
font
shorthand withfont-family
,font-weight
, andfont-size
(as suggested in typst/typst#3162 (comment))quarto typst compile
manuallyI think this is closer to the desired look:
It looks like they have fixed this on Typst main but they haven't made a new release yet. If they do, we should pick it up our next release.
Anyway as @cscheid said, it's an upstream Typst issue and not really Quarto.