Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX/XeLaTeX Table of Contents: Page Numbers of by TOC Length #4755

Closed
patrickbucher opened this issue Jul 5, 2018 · 5 comments
Closed

Comments

@patrickbucher
Copy link

patrickbucher commented Jul 5, 2018

I have a large PDF document (60 pages) generated from Markdown using XeLaTeX.

All the numbers in the table of contents are off (too small) by two pages, and two pages is the length the table of contents needs.
In LaTeX, an additional run usually fixes that issue. How can this be achieved as a workaround? And is this a bug or am I doing something wrong?

EDIT: I'm using Pandoc Versoin 2.2.1

@mb21
Copy link
Collaborator

mb21 commented Jul 5, 2018

Pandoc should run the pdf-engine twice for TOC generation, but maybe there's a bug when using xelatex..? Can you try with the latest pandoc release? And can you try with pdflatex instead? Also, does it work when you do -o foo.tex, then run xelatex foo.tex once or twice?

@patrickbucher
Copy link
Author

patrickbucher commented Jul 5, 2018

I just created an example to reproduce the bug (Pandoc version 2.2.1).
It works with --pdf-engine=pdflatex but fails with --pdf-engine=xelatex. With --pdf-engine=xelatex I can create a .tex file, and out of that a correct PDF with xelatex (standalone). Both pdflatex and xelatex need three runs for a correct TOC.

@mb21
Copy link
Collaborator

mb21 commented Jul 6, 2018

Alternative minimal repro:

perl -E 'say "\n\n# foo\n\n lorem ipsum " x 30' | pandoc --pdf-engine=xelatex -o foo.pdf --toc --verbose

@mb21
Copy link
Collaborator

mb21 commented Jul 6, 2018

Actually, we run the engine 3 + 1 = 4 times.

But the first two times it (sometimes?) doesn't run properly with xelatex? Partial output with --verbose:

[makePDF] Run #1
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex)
 restricted \write18 enabled.
**
! End of file on the terminal... why?

[makePDF] Run #2
...
! End of file on the terminal... why?

[makePDF] Run #3
...
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

[makePDF] Run #4
...
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

Anyone any idea what's going on? Or can repro on other systems? I'm on macOS.

@jgm
Copy link
Owner

jgm commented Jul 6, 2018

This appears to be an unwelcome consequence of the fix for #4484.
When I reverted it, the ! End of file on the terminal... why? messages went away and the table of contents was correct.
I am going to revert the fix to #4484. If someone wants to show me how to bring it back again without causing this problem, I'll consider it.

@jgm jgm closed this as completed in 146555e Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants