Skip to content

Unexpected surrounding rectangles when using cetz with Typst #2371

@nofe1248

Description

@nofe1248

Describe the bug
Using cetz or any cetz-based packages with Typst will result in weird rectangles around texts.

To Reproduce
Steps to reproduce the behavior:

  1. Have a .md file with math display block
  2. Set LaTeX engine to typst
  3. View the rendered result on the browser

Expected behavior
The texts of the rendered Typst math block should be displayed normally without surrounding rectangles.

Screenshots and Source

Image

Expected result:

Source:

$$
#import "@preview/cetz:0.4.2": canvas, draw, tree

#canvas({
  import draw: *
  let encircle(i) = {
    std.box(baseline: 2pt, std.circle(stroke: .5pt, radius: .5em, std.move(dx: -.35em, dy: -.45em, [#i])))
  }

  set-style(content: (padding: 0.5em))
  tree.tree(
    ([Expression #encircle($5$)], (
        [Expression #encircle($3$)],
        ([Expression #encircle($1$)], `Int(1)`),
        `Plus`,
        ([Expression #encircle($2$)], `Int(2)`),
      ),
      `Lt`,
      ([Expression #encircle($4$)], `Int(4)`),
    ))
})
$$

Link to my own pages (which demonstrates this issue): https://nofe1248.github.io/Paper-Reading/tree-borrows

Desktop (please complete the following information):

  • Quartz Version: v4.5.2
  • node Version: v25.9.0
  • npm version: v11.12.1
  • OS: Arch Linux
  • Browser: Microsoft Edge

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions