Why does Typst produce the wrong caption?

Hi all,

Typst compiler produces the wrong caption “Listing 2: Elements classification” for the following figure. How to make it simply “Figure 2: Elements classification”. Another question, how to change the dimension (width and height) of the figure below. It is possible to do it for image function. But I have no idea how to do it for figure.

Thank you for your support

#figure(
```pintora
mindmap
@param layoutDirection TB
+ A
++ B
+++ C
+++ D
++ E
+++ G
+++ H
++ I
+++ J
+++ K
```,
caption: [Elements classification]
)

I assume you are using the pintorita package – please make sure you mention packages next time.

The “listing” supplement comes from the type of content. It seems that Typst sees there is code in the figure, but not that the code is replaced by an image by a show rule. You can get around this by manually specifying kind: image.

I think this is ultimately a bug, and I think the source of it is basically known, but I’ll look for it so this is tracked. (EDIT: same issue with a different show rule is mentioned here: Figure kind auto-detection fails when content is contextual · Issue #6290 · typst/typst · GitHub)

2 Likes

Hi SillyFreak,

Sorry I did not mention I am using Pintorita package. Could you please give me more hints how to include your work-around solution in order to solve my problem before the bug is fixed.

Thank you.

Thank you SillyFreak. Your worn-around has worked for me.

1 Like

It’s not a bug, as the initial elements do not disappear, so the raw element is still somewhere in the limbo, just isn’t present in the output. And you do pass listing, so it makes sense. I don’t know if this behavior will be changed.