Skip to content

Internal Error: Tags Not Properly Closing On Footnote In Table In Grid/Stack Near A Pagebreak #9067

Open

Description

@Joel-Singh

Description

Was working with fitch style proofs involving a lot of nested tables and grids (not the best for accessibility probably I admit) and ran into this error:

error: internal error: tags weren't properly closed (occurred at crates/typst-pdf/src/tags/tree/build.rs:190:5)
 = hint: please report this as a bug

I created a MWE by diligently eliminating bits of my spaghetti code through trial and error after awhile ending up with:

#set par(
  first-line-indent: 1em,
)

#grid()[
  #lorem(1)

  #box[
    #v(60em)

    #table(
      columns: 3,
      table.cell(
        h(32em) + $$,
      ),
      table.cell()[#footnote[]],
      table.cell()[
        #lorem(3)
      ],
    )
  ]
]

It definitely seems like the issue is with the footnote on a pagebreak. Modifying different pieces to cause the footnote to not be near the pagebreak causes the code to compile fine. The code also compiles fine when compilling with --no-pdf-tags

Also interestingly, if you replace the outer grid with stack:

error: internal error: tags weren't properly closed (occurred at crates/typst-pdf/src/tags/tree/build.rs:187:9)
  ┌─ chapter-2.typ:6:3
  │
6 │   #lorem(1)
  │    ^^^^^^^^
  │
  = hint: please report this as a bug

You get an error for a different rust line (187 vs 190) that specifically points out line 6. I also have intuited from my trial and error that line 6, #lorem(1) is more than just additional spacing that causes the footnote to fall on the pagebreak and error. It's as if the footnote is attaching to #lorem(1) somehow? And a pagebreak causes it to not be properly closed?

I believe #8626 and #8776 may be related.

Also, the MWE compiles fine on the web app. I suspect this is because the web app compiles without pdf tags?

Environment:

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Nov 13, 2026
  2. added
    pdf
    accessibility
    on Nov 13, 2026
  3. saecki commented on Nov 13, 2026

    @saecki
    Member

    This is very likely the same underlying problem as in the issues you've linked and #8890.
    I haven't investigated this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilitybugpdf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions