How can I avoid "Maximum PDF grouping depth exceeded" errors?

Hello, guys!

I have a problem with rendering proof trees using curryst – Typst Universe. I guess that my proof tree is too big and the compiler shows this error: “Maximum show rule depth exceeded”.
Is there any way to change max show rule depth?

UPD:
I ended up fixing the error above using some hacks and got another error: “maximum PDF grouping depth exceeding”… So my code now compiles in web compiler, but I can’t export pdf. Is there anyway to bypass these limits?

The problem is that it simply isn’t a valid PDF if the depth is exceeded. So the only way to align these things would be to reduce the allowed nesting at the Typst level.

1 Like

I couldn’t find any information online about what this pdf groupings mean, could you please show some references?
I still think that this problem might be solved. If I understand correctly pdf file contains some tree-like structure which groups objects into meaningful subtrees. Maybe this tree like structure could be flattened, if the resulting depth of a subtree is too big?
Also, I tried changing constants here and here. Somehow everything works fine when I built compiler manually and then compiled pdf. Safari, Chrome and preview open the resulting document without any errors.

It’s not unusual that PDF-readers will happily read documents that aren’t technically valid PDFs.

Yeah, flattening would indeed be possible in many cases (where no clipping etc. is involved).

I’ll move this to Questions, as per How to post in the Questions category

… and in reverse, this is looking for help and thus better suited there.

By the way here’s a related issue in curryst’s repository Is it expected that large proof trees exceed the show rule depth limit? · Issue #19 · pauladam94/curryst · GitHub

This also happened to me when writing a prooftree library and I did solve it by flattening the tree, essentially computing the position of each rule and using place to place them, as opposed to continuously nest stacks. I’m not sure if the same approach will work in curryst while preserving all the features though.