asciidoctor-web-pdf icon indicating copy to clipboard operation
asciidoctor-web-pdf copied to clipboard

Math lines at the end of a page: breaks Page.checkUnderflowAfterResize

Open jhannwong opened this issue 2 years ago • 3 comments

An uncaught exception happened within the HTML page: Error: TypeError: Cannot read properties of undefined (reading 'ref')
    at validNode (file:///.../test.html:3388:39)
    at Layout.findEndToken (file:///.../test.html:4205:17)
    at Page.checkUnderflowAfterResize (file:///.../test.html:4587:37)
    at file:///.../test.html:4559:13

The AsciiDoc just needs to happen to have a math line at the end of a page. Try this:

= Some Document
:stem: latexmath

== Just 1 chapter

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

stem:[\displaystyle \frac{1}{2}]

// A line of text here will help the next math line go to the next page.

stem:[\displaystyle \frac{1}{2}]

== Next chapter

Some text.

jhannwong avatar Jun 10 '22 09:06 jhannwong

I cannot reproduce this issue on the main branch. Here's the PDF produced: test.pdf

ggrossetie avatar Jun 18 '22 14:06 ggrossetie

Your test.pdf has enough math lines to just about fill up the 1st page. Try adding more so that they overflow to the 2nd page?

jhannwong avatar Aug 14 '22 03:08 jhannwong

It also works test.pdf Do you use a custom style? Could you please try with the latest version?

ggrossetie avatar Sep 03 '22 14:09 ggrossetie