jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.35k stars 3.37k forks source link

Text containing table flows beyond bottom page margin when figure floats to next page #8526

Open chromevanadium opened 1 year ago

chromevanadium commented 1 year ago

Explain the problem.

Text that includes a table continues beyond the bottom margin when a figure is floated to the next page.

Steps to reproduce the issue

  1. Create a document containing multiple paragraphs.

  2. Insert a figure before the last paragraph of the first page. Insert two more paragraphs, then a simple table, then plenty more paragraphs

  3. Render the document. If the figure still renders on the same page, add a little paragraph before such that the figure does not anymore fit, and render again.

Expected behavior: Once the figure was floated to the next page, the continuing text (that includes the table) should flow until the bottom margin.

Observed behavior: The continuing text renders beyond the bottom margin to the bottom of the page.

Remark: This appears to be caused by the markdown table. If it is removed, or replaced by another figure, text continues to flow correctly.

Included are a sample markdown file and a small sample graphic with which the issue can be reproduced.

Pandoc version?

andoc 2.14.0.3
Compiled with pandoc-types 1.22.1, texmath 0.12.3.3, skylighting 0.10.5.2,
citeproc 0.4.0.1, ipynb 0.1.0.1

layoutissue.md (7 kb) testgraphic.png (12 kb)

jgm commented 1 year ago

I can confirm this with latest pandoc. You can see how the text extends below the margin:

Screen Shot 2023-01-05 at 10 09 39 AM
jgm commented 1 year ago

I suspect this is a longtable (LaTeX) issue and not something we can fix in pandoc. longtable used to have a bug that caused text to spill over the page; this was fixed in recent versions, but there may be similar issues still.

chromevanadium commented 1 year ago

Indeed, it looks like this. I can even reproduce the issue with the most simple tex document possible, see attachment. One can therefore argue that pandoc, for the time being, should probably revert to the Latex \table environment to render out to PDF. This issue breaks automated formatting.

testgraphic layoutissue.txt

jgm commented 1 year ago

We can't use regular table because it doesn't work for larger tables. It's a vexing issue which has come up many times. Related: #782, #1023, #4392