asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Preserve indentation when creating column box for next page in index #2480

Closed mojavelinux closed 6 months ago

mojavelinux commented 6 months ago

When an index term is written, it is done using a hanging indent. The way hanging indent is implemented is that it indents the whole term, then unindents the first line. If a page break happens during that call to render the index term (typeset_text), then it leaves an indentation on the bounds at the page break. When the new bounds is created for the next page, that indent is not being restored. When the call the render the text completes on the next page, it removes the indent that was never restored on the bounds. As a result, the margin progressively moves to the left.

The solution is to copy the total left and right indent from the current column box to the new column box when a page is advanced in the index.

Note that this issue only arises when media=prepress. That's because only the prepress media changes the page margins at a page break, which is when the column box must be recreated.

meonkeys commented 6 months ago

Verified. 4c418b5 works with https://github.com/meonkeys/print-this/commit/67c26ffc6a4e5ba39313fa3e894e0611f9ea06ef . Your new unit test is even better / more succinct.

mojavelinux commented 6 months ago

Thanks for verifying!!