jgm / pandoc

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

Regression: Wrong page numbering of multi-page TOC #10308

Open sicikh opened 2 days ago

sicikh commented 2 days ago

Reproducible steps:

  1. Create test.md file with the following contents:
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
# Test
  1. Compile with:
pandoc "--from=markdown" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside -o test.pdf test.md
  1. Open with any PDF viewer, that can display custom page numbers (e. g. Evince):

Output:

Real page number / Document page number / Displayed page number in PDF viewer (TOC) 1 / i / i 2 / ii / 1 3 / iii / 2 (Mainmatter) 4 / 1 / 3 5 / 2 / 4 ...

image

Expected output:

Real page number / Document page number / Displayed page number in PDF viewer (TOC) 1 / i / i 2 / ii / ii 3 / iii / iii (Mainmatter) 4 / 1 / 1 5 / 2 / 2 ...

-V classoption=oneside can be omitted from the compilation command — the issue will still be here, but in another form:

Real page number / Document page number / Displayed page number in PDF viewer (TOC) 1 / i / i 2 / ii / ii 3 / iii / 1 (Blank page) 4 / _ / 2 (Mainmatter) 5 / 1 / 3 ...

Expected output:

Real page number / Document page number / Displayed page number in PDF viewer (TOC) 1 / i / i 2 / ii / ii 3 / iii / iii (Blank page) 4 / _ / (not sure what should be here, but it is not in the scope of the issue) (Mainmatter) 5 / 1 / 1 ...

Pandoc version:

pandoc 3.5
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/bezkonca/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

OS:

Manjaro Linux

Regression:

This was not an issue in Pandoc 3.1.9 — the document page numbers and displayed ones were in match.

Comments:

When upgrading from 3.1.9 to 3.5, I discovered this problem and at first thought it was an error in the Eisvogel template — but after a day of debugging, it turned out that the TOC seemed to consist of one page for Pandoc — otherwise I do not know how to interpret the resulting document. Later, it was possible to reproduce the problem on a standard template.

jgm commented 2 days ago

Hm. All of the pagination work is done by pdflatex. Pandoc contributes nothing but a single tex command to create the table of contents. So I'm not sure what to do to fix this.

jgm commented 2 days ago

I also don't have any PDF reader that handles page numbers this way, to test with.

sicikh commented 2 days ago

I also don't have any PDF reader that handles page numbers this way, to test with.

You can try using this online PDF viewer, that can display "logical" page numbers.

sicikh commented 2 days ago

Hm. All of the pagination work is done by pdflatex. Pandoc contributes nothing but a single tex command to create the table of contents. So I'm not sure what to do to fix this.

I also don't even suspect the cause of the problem — if so, then it's most likely a problem in the template and the LaTeX libraries used.

I tried using the pandoc 3.1.9 executable and the template used at that time (see commit c9fe8b8, default.latex file) — the displayed page numbers match the logical ones. To help in some way, I will attach the template files used during compilation and the results themselves below.

(github does not allow to upload .latex files, so I changed the extension to .txt)

Command for pandoc 3.1.9:

pandoc 3.1.9
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/bezkonca/.local/share/pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
./pandoc "--from=markdown" --template="./template_3.1.9.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside -o test_3.1.9.pdf test.md

template_3.1.9.txt

Output:

test_3.1.9.pdf

Command for pandoc 3.5:

pandoc 3.5
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/bezkonca/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside -o test_3.5.pdf test.md

template_3.5.txt

Output:

test_3.5.pdf

Tomorrow I will try to understand which specific version the regression occurred from — of course, the jump from 3.1.9 to 3.5 should have had some effect :)

sicikh commented 2 days ago

So, everything is a little weirder. I tried to compile the document via pandoc 3.1.9, but using a template from pandoc 3.5. It took adding several files (since pandoc 3.1.9 does not see the imported templates), but there is no problem with page numbers mismatch. I attach the files below.

So the problem is definitely in pandoc, not in the templates or else. Why this is happening is not clear at all. I will find out tomorrow which version the regression occurred from.

Command:

./pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside -o test_3.1.9_with_3.5_template.pdf test.md

after-header-includes.txt common.txt fonts.txt hypersetup.txt passoptions.txt template_3.5.txt (note, that adding these files and recompiling example with pandoc 3.5 does not resolve the issue)

Output:

test_3.1.9_with_3.5_template.pdf

jgm commented 1 day ago

I will find out tomorrow which version the regression occurred from.

That would be most helpful. Also, try generating a standalone latex file (-t latex -s) and compiling it separately. If you can reproduce the issue there, then a diff of the working latex file and the nonworking one would be extremely helpful.

sicikh commented 21 hours ago

I will find out tomorrow which version the regression occurred from.

That would be most helpful. Also, try generating a standalone latex file (-t latex -s) and compiling it separately. If you can reproduce the issue there, then a diff of the working latex file and the nonworking one would be extremely helpful.

I found the version of pandoc with which regression occurs — this is 3.1.11.

3.1.10 works correctly on templates from versions 3.5 and 3.1.9, but 3.1.11 on both templates produces the behavior I specified above. Pandoc versions higher than 3.1.11 also do not work. I can't say for every version, but I tested specifically 3.1.13, 3.2 and 3.3.

As you indicated, I will try to reproduce the problem by compiling the standalone LaTeX files.

jgm commented 20 hours ago

Changelog for 3.1.11 has:

Text.Pandoc.PDF:

It's possible that this is the culprit. Perhaps this change in logic caused latex not to be run enough times? Can you use --verbose when producing a PDF and check the output to see how many times pandoc calls pdflatex?

sicikh commented 20 hours ago

Oh, i found the cause of the issue!

Reproducible steps:

  1. Create a test.md file with the data specified in the issue.

  2. Compile to LaTeX with the command:

./pandoc-3.1.10-linux-amd64/pandoc-3.1.10/bin/pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside -t latex -s -o test_3.1.10_with_3.5_template.latex test.md

Note, that the pandoc version — 3.1.10 or 3.1.11 — does not matter here. The contents of LaTeX files are identical between these versions. As does not matter template version — issue reproduces on both.

  1. Compile LaTeX file with xelatex:
xelatex test_3.1.10_with_3.5_template.latex

On the first run TOC is not here — xelatex asks us to run compilation again. This is normal. There is also no "logical" page numbers, only real ones.

Run xelatex again. TOC appears, the document is normal at first glance, there is no warnings from xelatex. But if you look closely at the logical page numbers, there is the problem that I mentioned at the very beginning of the issue.

Run xelatex again. The problem dissapears — the displayed page numbers in PDF viewer is in match with the logical ones.

So I can conclude that starting from version 3.1.11 pandoc does not run 'xelatex` for the third time.

I hope I helped in some way. Is there anything else I can do to help with finding the cause of the issue?

sicikh commented 20 hours ago

Changelog for 3.1.11 has:

Text.Pandoc.PDF:

  • Ensure that we find all the LaTeX warnings requiring a rerun (#9284). This should fix a regression from 3.1.9 that led to incorrect alignments in tables (and possibly other issues).

It's possible that this is the culprit. Perhaps this change in logic caused latex not to be run enough times? Can you use --verbose when producing a PDF and check the output to see how many times pandoc calls pdflatex?

I'm sorry, I didn't refresh the page to see your new message before I sent mine. I'll do it in a minute.

sicikh commented 20 hours ago

Changelog for 3.1.11 has:

Text.Pandoc.PDF:

  • Ensure that we find all the LaTeX warnings requiring a rerun (#9284). This should fix a regression from 3.1.9 that led to incorrect alignments in tables (and possibly other issues).

It's possible that this is the culprit. Perhaps this change in logic caused latex not to be run enough times? Can you use --verbose when producing a PDF and check the output to see how many times pandoc calls pdflatex?

Here it is:

Pandoc 3.11.1 command:

./pandoc-3.1.11-linux-amd64/pandoc-3.1.11/bin/pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside --verbose -o test_3.1.11_with_3.5_template.pdf test.md &> 3.1.11.log

Output:

Long output ``` [INFO] Loaded ./template_3.5.latex from ./template_3.5.latex [INFO] Loaded ./passoptions.latex from ./passoptions.latex [INFO] Loaded ./fonts.latex from ./fonts.latex [INFO] Loaded ./common.latex from ./common.latex [INFO] Loaded ./after-header-includes.latex from ./after-header-includes.latex [INFO] Loaded ./hypersetup.latex from ./hypersetup.latex [INFO] [makePDF] Temp dir: /tmp/tex2pdf.-4840245c4a56a7ee [INFO] [makePDF] Command line: xelatex "-halt-on-error" "-interaction" "nonstopmode" "-output-directory" "/tmp/tex2pdf.-4840245c4a56a7ee" "/tmp/tex2pdf.-4840245c4a56a7ee/input.tex" [INFO] [makePDF] Relevant environment variables: ("TEXINPUTS","/tmp/tex2pdf.-4840245c4a56a7ee:") ("TEXMFOUTPUT","/tmp/tex2pdf.-4840245c4a56a7ee") ("HOME","/home/bezkonca") ("LANG","ru_RU.UTF-8") ("PATH","/run/user/1000/fnm_multishells/3306195_1729515671938/bin:/home/bezkonca/.local/share/fnm:/home/bezkonca/.opam/default/bin:/usr/local/texlive/2024/bin/x86_64-linux:/home/bezkonca/.bun/bin:/home/bezkonca/.sdkman/candidates/scala/current/bin:/home/bezkonca/.sdkman/candidates/sbt/current/bin:/home/bezkonca/.sdkman/candidates/kotlin/current/bin:/home/bezkonca/.sdkman/candidates/java/current/bin:/run/user/1000/fnm_multishells/3303310_1729515667508/bin:/home/bezkonca/.local/share/fnm:/home/bezkonca/.opam/default/bin:/usr/local/texlive/2024/bin/x86_64-linux:/home/bezkonca/.bun/bin:/home/bezkonca/.cargo/bin:/home/bezkonca/.local/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/bezkonca/.local/share/JetBrains/Toolbox/scripts:/home/bezkonca/.cabal/bin:/home/bezkonca/.ghcup/bin:/home/bezkonca/.dotnet:/home/bezkonca/.dotnet/tools:/home/bezkonca/.python3.12/bin:/home/bezkonca/.spoofdpi/bin:/home/bezkonca/.dotnet:/home/bezkonca/.dotnet/tools:/home/bezkonca/.python3.12/bin:/home/bezkonca/.spoofdpi/bin") ("PWD","/home/bezkonca/storm/rr-2/tmp") ("SHELL","/bin/zsh") [INFO] [makePDF] Source: % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \documentclass[ oneside]{scrbook} \usepackage{xcolor} \usepackage{amsmath,amssymb} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi \usepackage{lmodern} \ifPDFTeX\else % xetex/luatex font selection \fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available \usepackage[]{microtype} \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}\makeatletter \@ifundefined{KOMAClassName}{% if non-KOMA class \IfFileExists{parskip.sty}{% \usepackage{parskip} }{% else \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}} }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \usepackage{bookmark} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{same} % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \author{} \date{} \makeatletter \renewcommand\frontmatter{% \cleardoublepage% \@mainmatterfalse% \pagenumbering{roman}% } \renewcommand\mainmatter{% \cleardoublepage% \@mainmattertrue% \pagenumbering{arabic}% } \makeatother \begin{document} \frontmatter { \setcounter{tocdepth}{2} \tableofcontents } \mainmatter \chapter{Test}\label{test} \chapter{Test}\label{test-1} \chapter{Test}\label{test-2} \chapter{Test}\label{test-3} \chapter{Test}\label{test-4} \chapter{Test}\label{test-5} \chapter{Test}\label{test-6} \chapter{Test}\label{test-7} \chapter{Test}\label{test-8} \chapter{Test}\label{test-9} \chapter{Test}\label{test-10} \chapter{Test}\label{test-11} \chapter{Test}\label{test-12} \chapter{Test}\label{test-13} \chapter{Test}\label{test-14} \chapter{Test}\label{test-15} \chapter{Test}\label{test-16} \chapter{Test}\label{test-17} \chapter{Test}\label{test-18} \chapter{Test}\label{test-19} \chapter{Test}\label{test-20} \chapter{Test}\label{test-21} \chapter{Test}\label{test-22} \chapter{Test}\label{test-23} \chapter{Test}\label{test-24} \chapter{Test}\label{test-25} \chapter{Test}\label{test-26} \chapter{Test}\label{test-27} \chapter{Test}\label{test-28} \chapter{Test}\label{test-29} \chapter{Test}\label{test-30} \chapter{Test}\label{test-31} \chapter{Test}\label{test-32} \chapter{Test}\label{test-33} \chapter{Test}\label{test-34} \chapter{Test}\label{test-35} \chapter{Test}\label{test-36} \chapter{Test}\label{test-37} \chapter{Test}\label{test-38} \chapter{Test}\label{test-39} \chapter{Test}\label{test-40} \chapter{Test}\label{test-41} \chapter{Test}\label{test-42} \chapter{Test}\label{test-43} \chapter{Test}\label{test-44} \chapter{Test}\label{test-45} \chapter{Test}\label{test-46} \chapter{Test}\label{test-47} \backmatter \end{document} [INFO] [makePDF] LaTeX run number 1 [INFO] [makePDF] LaTeX output This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (/tmp/tex2pdf.-4840245c4a56a7ee/input.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.t ex))) (/usr/local/texlive/2024/texmf-dist/tex/latex/lm/lmodern.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/upquote/upquote.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bookmark.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/local/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty ))) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bkm-dvipdfm.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xurl/xurl.sty) No file input.aux. (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg ) Package hyperref Warning: Rerun to get /PageLabels entry. No file input.toc. [1] chapter without number [1] chapter without number [2] chapter without number [3] chapter without number [4] chapter without number [5] chapter without number [6] chapter without number [7] chapter without number [8] chapter without number [9] chapter without number [10] chapter without number [11] chapter without number [12] chapter without number [13] chapter without number [14] chapter without number [15] chapter without number [16] chapter without number [17] chapter without number [18] chapter without number [19] chapter without number [20] chapter without number [21] chapter without number [22] chapter without number [23] chapter without number [24] chapter without number [25] chapter without number [26] chapter without number [27] chapter without number [28] chapter without number [29] chapter without number [30] chapter without number [31] chapter without number [32] chapter without number [33] chapter without number [34] chapter without number [35] chapter without number [36] chapter without number [37] chapter without number [38] chapter without number [39] chapter without number [40] chapter without number [41] chapter without number [42] chapter without number [43] chapter without number [44] chapter without number [45] chapter without number [46] chapter without number [47] chapter without number [48] (/tmp/tex2pdf.-4840245c4a56a7ee/input.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) Output written on /tmp/tex2pdf.-4840245c4a56a7ee/input.pdf (49 pages). Transcript written on /tmp/tex2pdf.-4840245c4a56a7ee/input.log. [INFO] [makePDF] LaTeX run number 2 [INFO] [makePDF] LaTeX output This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (/tmp/tex2pdf.-4840245c4a56a7ee/input.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.t ex))) (/usr/local/texlive/2024/texmf-dist/tex/latex/lm/lmodern.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/upquote/upquote.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bookmark.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/local/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty ))) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bkm-dvipdfm.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xurl/xurl.sty) (/tmp/tex2pdf.-4840245c4a56a7ee/input.aux) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg ) (/tmp/tex2pdf.-4840245c4a56a7ee/input.toc [1] [2]) [3] chapter without number [1] chapter without number [2] chapter without number [3] chapter without number [4] chapter without number [5] chapter without number [6] chapter without number [7] chapter without number [8] chapter without number [9] chapter without number [10] chapter without number [11] chapter without number [12] chapter without number [13] chapter without number [14] chapter without number [15] chapter without number [16] chapter without number [17] chapter without number [18] chapter without number [19] chapter without number [20] chapter without number [21] chapter without number [22] chapter without number [23] chapter without number [24] chapter without number [25] chapter without number [26] chapter without number [27] chapter without number [28] chapter without number [29] chapter without number [30] chapter without number [31] chapter without number [32] chapter without number [33] chapter without number [34] chapter without number [35] chapter without number [36] chapter without number [37] chapter without number [38] chapter without number [39] chapter without number [40] chapter without number [41] chapter without number [42] chapter without number [43] chapter without number [44] chapter without number [45] chapter without number [46] chapter without number [47] chapter without number [48] (/tmp/tex2pdf.-4840245c4a56a7ee/input.aux) ) Output written on /tmp/tex2pdf.-4840245c4a56a7ee/input.pdf (51 pages). Transcript written on /tmp/tex2pdf.-4840245c4a56a7ee/input.log. ```

Pandoc 3.1.10 command:

./pandoc-3.1.10-linux-amd64/pandoc-3.1.10/bin/pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside --verbose -o test_3.1.10_with_3.5_template.pdf test.md &> 3.1.10.log

Output:

Long output ``` [INFO] Loaded ./template_3.5.latex from ./template_3.5.latex [INFO] Loaded ./passoptions.latex from ./passoptions.latex [INFO] Loaded ./fonts.latex from ./fonts.latex [INFO] Loaded ./common.latex from ./common.latex [INFO] Loaded ./after-header-includes.latex from ./after-header-includes.latex [INFO] Loaded ./hypersetup.latex from ./hypersetup.latex [makePDF] temp dir: /tmp/tex2pdf.-22cb7461c0c43873 [makePDF] Command line: xelatex "-halt-on-error" "-interaction" "nonstopmode" "-output-directory" "/tmp/tex2pdf.-22cb7461c0c43873" "/tmp/tex2pdf.-22cb7461c0c43873/input.tex" [makePDF] Relevant environment variables: ("TEXINPUTS","/tmp/tex2pdf.-22cb7461c0c43873:") ("TEXMFOUTPUT","/tmp/tex2pdf.-22cb7461c0c43873") ("HOME","/home/bezkonca") ("LANG","ru_RU.UTF-8") ("PATH","/run/user/1000/fnm_multishells/3306195_1729515671938/bin:/home/bezkonca/.local/share/fnm:/home/bezkonca/.opam/default/bin:/usr/local/texlive/2024/bin/x86_64-linux:/home/bezkonca/.bun/bin:/home/bezkonca/.sdkman/candidates/scala/current/bin:/home/bezkonca/.sdkman/candidates/sbt/current/bin:/home/bezkonca/.sdkman/candidates/kotlin/current/bin:/home/bezkonca/.sdkman/candidates/java/current/bin:/run/user/1000/fnm_multishells/3303310_1729515667508/bin:/home/bezkonca/.local/share/fnm:/home/bezkonca/.opam/default/bin:/usr/local/texlive/2024/bin/x86_64-linux:/home/bezkonca/.bun/bin:/home/bezkonca/.cargo/bin:/home/bezkonca/.local/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/bezkonca/.local/share/JetBrains/Toolbox/scripts:/home/bezkonca/.cabal/bin:/home/bezkonca/.ghcup/bin:/home/bezkonca/.dotnet:/home/bezkonca/.dotnet/tools:/home/bezkonca/.python3.12/bin:/home/bezkonca/.spoofdpi/bin:/home/bezkonca/.dotnet:/home/bezkonca/.dotnet/tools:/home/bezkonca/.python3.12/bin:/home/bezkonca/.spoofdpi/bin") ("PWD","/home/bezkonca/storm/rr-2/tmp") ("SHELL","/bin/zsh") [makePDF] Source: % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \documentclass[ oneside]{scrbook} \usepackage{xcolor} \usepackage{amsmath,amssymb} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex \usepackage{unicode-math} % this also loads fontspec \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi \usepackage{lmodern} \ifPDFTeX\else % xetex/luatex font selection \fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available \usepackage[]{microtype} \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}\makeatletter \@ifundefined{KOMAClassName}{% if non-KOMA class \IfFileExists{parskip.sty}{% \usepackage{parskip} }{% else \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}} }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \usepackage{bookmark} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{same} % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \author{} \date{} \makeatletter \renewcommand\frontmatter{% \cleardoublepage% \@mainmatterfalse% \pagenumbering{roman}% } \renewcommand\mainmatter{% \cleardoublepage% \@mainmattertrue% \pagenumbering{arabic}% } \makeatother \begin{document} \frontmatter { \setcounter{tocdepth}{2} \tableofcontents } \mainmatter \chapter{Test}\label{test} \chapter{Test}\label{test-1} \chapter{Test}\label{test-2} \chapter{Test}\label{test-3} \chapter{Test}\label{test-4} \chapter{Test}\label{test-5} \chapter{Test}\label{test-6} \chapter{Test}\label{test-7} \chapter{Test}\label{test-8} \chapter{Test}\label{test-9} \chapter{Test}\label{test-10} \chapter{Test}\label{test-11} \chapter{Test}\label{test-12} \chapter{Test}\label{test-13} \chapter{Test}\label{test-14} \chapter{Test}\label{test-15} \chapter{Test}\label{test-16} \chapter{Test}\label{test-17} \chapter{Test}\label{test-18} \chapter{Test}\label{test-19} \chapter{Test}\label{test-20} \chapter{Test}\label{test-21} \chapter{Test}\label{test-22} \chapter{Test}\label{test-23} \chapter{Test}\label{test-24} \chapter{Test}\label{test-25} \chapter{Test}\label{test-26} \chapter{Test}\label{test-27} \chapter{Test}\label{test-28} \chapter{Test}\label{test-29} \chapter{Test}\label{test-30} \chapter{Test}\label{test-31} \chapter{Test}\label{test-32} \chapter{Test}\label{test-33} \chapter{Test}\label{test-34} \chapter{Test}\label{test-35} \chapter{Test}\label{test-36} \chapter{Test}\label{test-37} \chapter{Test}\label{test-38} \chapter{Test}\label{test-39} \chapter{Test}\label{test-40} \chapter{Test}\label{test-41} \chapter{Test}\label{test-42} \chapter{Test}\label{test-43} \chapter{Test}\label{test-44} \chapter{Test}\label{test-45} \chapter{Test}\label{test-46} \chapter{Test}\label{test-47} \backmatter \end{document} [makePDF] Run #1 This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (/tmp/tex2pdf.-22cb7461c0c43873/input.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.t ex))) (/usr/local/texlive/2024/texmf-dist/tex/latex/lm/lmodern.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/upquote/upquote.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bookmark.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/local/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty ))) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bkm-dvipdfm.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xurl/xurl.sty) No file input.aux. (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg ) Package hyperref Warning: Rerun to get /PageLabels entry. No file input.toc. [1] chapter without number [1] chapter without number [2] chapter without number [3] chapter without number [4] chapter without number [5] chapter without number [6] chapter without number [7] chapter without number [8] chapter without number [9] chapter without number [10] chapter without number [11] chapter without number [12] chapter without number [13] chapter without number [14] chapter without number [15] chapter without number [16] chapter without number [17] chapter without number [18] chapter without number [19] chapter without number [20] chapter without number [21] chapter without number [22] chapter without number [23] chapter without number [24] chapter without number [25] chapter without number [26] chapter without number [27] chapter without number [28] chapter without number [29] chapter without number [30] chapter without number [31] chapter without number [32] chapter without number [33] chapter without number [34] chapter without number [35] chapter without number [36] chapter without number [37] chapter without number [38] chapter without number [39] chapter without number [40] chapter without number [41] chapter without number [42] chapter without number [43] chapter without number [44] chapter without number [45] chapter without number [46] chapter without number [47] chapter without number [48] (/tmp/tex2pdf.-22cb7461c0c43873/input.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) Output written on /tmp/tex2pdf.-22cb7461c0c43873/input.pdf (49 pages). Transcript written on /tmp/tex2pdf.-22cb7461c0c43873/input.log. [makePDF] Run #2 This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (/tmp/tex2pdf.-22cb7461c0c43873/input.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.t ex))) (/usr/local/texlive/2024/texmf-dist/tex/latex/lm/lmodern.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/upquote/upquote.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bookmark.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/local/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty ))) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bkm-dvipdfm.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xurl/xurl.sty) (/tmp/tex2pdf.-22cb7461c0c43873/input.aux) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg ) (/tmp/tex2pdf.-22cb7461c0c43873/input.toc [1] [2]) [3] chapter without number [1] chapter without number [2] chapter without number [3] chapter without number [4] chapter without number [5] chapter without number [6] chapter without number [7] chapter without number [8] chapter without number [9] chapter without number [10] chapter without number [11] chapter without number [12] chapter without number [13] chapter without number [14] chapter without number [15] chapter without number [16] chapter without number [17] chapter without number [18] chapter without number [19] chapter without number [20] chapter without number [21] chapter without number [22] chapter without number [23] chapter without number [24] chapter without number [25] chapter without number [26] chapter without number [27] chapter without number [28] chapter without number [29] chapter without number [30] chapter without number [31] chapter without number [32] chapter without number [33] chapter without number [34] chapter without number [35] chapter without number [36] chapter without number [37] chapter without number [38] chapter without number [39] chapter without number [40] chapter without number [41] chapter without number [42] chapter without number [43] chapter without number [44] chapter without number [45] chapter without number [46] chapter without number [47] chapter without number [48] (/tmp/tex2pdf.-22cb7461c0c43873/input.aux) ) Output written on /tmp/tex2pdf.-22cb7461c0c43873/input.pdf (51 pages). Transcript written on /tmp/tex2pdf.-22cb7461c0c43873/input.log. [makePDF] Run #3 This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode (/tmp/tex2pdf.-22cb7461c0c43873/input.tex LaTeX2e <2023-11-01> patch level 1 L3 programming layer <2024-03-14> (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbook.cls Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/tocbasic.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrsize11pt.clo) (/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-xetex.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/fix-cm.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1enc.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/unicode-math/unicode-math-table.t ex))) (/usr/local/texlive/2024/texmf-dist/tex/latex/lm/lmodern.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/upquote/upquote.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/textcomp.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bookmark.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.s ty (/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty))) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def) (/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty (/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/local/texlive/2024/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty ))) (/usr/local/texlive/2024/texmf-dist/tex/latex/bookmark/bkm-dvipdfm.def)) (/usr/local/texlive/2024/texmf-dist/tex/latex/xurl/xurl.sty) (/tmp/tex2pdf.-22cb7461c0c43873/input.aux) (/usr/local/texlive/2024/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg ) (/tmp/tex2pdf.-22cb7461c0c43873/input.toc [1] [2]) [3] chapter without number [1] chapter without number [2] chapter without number [3] chapter without number [4] chapter without number [5] chapter without number [6] chapter without number [7] chapter without number [8] chapter without number [9] chapter without number [10] chapter without number [11] chapter without number [12] chapter without number [13] chapter without number [14] chapter without number [15] chapter without number [16] chapter without number [17] chapter without number [18] chapter without number [19] chapter without number [20] chapter without number [21] chapter without number [22] chapter without number [23] chapter without number [24] chapter without number [25] chapter without number [26] chapter without number [27] chapter without number [28] chapter without number [29] chapter without number [30] chapter without number [31] chapter without number [32] chapter without number [33] chapter without number [34] chapter without number [35] chapter without number [36] chapter without number [37] chapter without number [38] chapter without number [39] chapter without number [40] chapter without number [41] chapter without number [42] chapter without number [43] chapter without number [44] chapter without number [45] chapter without number [46] chapter without number [47] chapter without number [48] (/tmp/tex2pdf.-22cb7461c0c43873/input.aux) ) Output written on /tmp/tex2pdf.-22cb7461c0c43873/input.pdf (51 pages). Transcript written on /tmp/tex2pdf.-22cb7461c0c43873/input.log. ```
sicikh commented 20 hours ago

Changelog for 3.1.11 has: Text.Pandoc.PDF:

  • Ensure that we find all the LaTeX warnings requiring a rerun (#9284). This should fix a regression from 3.1.9 that led to incorrect alignments in tables (and possibly other issues).

It's possible that this is the culprit. Perhaps this change in logic caused latex not to be run enough times? Can you use --verbose when producing a PDF and check the output to see how many times pandoc calls pdflatex?

Here it is:

Pandoc 3.11.1 command:

./pandoc-3.1.11-linux-amd64/pandoc-3.1.11/bin/pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside --verbose -o test_3.1.11_with_3.5_template.pdf test.md &> 3.1.11.log

Output:

Long output Pandoc 3.1.10 command:

./pandoc-3.1.10-linux-amd64/pandoc-3.1.10/bin/pandoc "--from=markdown" --template="./template_3.5.latex" --pdf-engine "xelatex" --toc -V documentclass=scrbook -V has-frontmatter -V classoption=oneside --verbose -o test_3.1.10_with_3.5_template.pdf test.md &> 3.1.10.log

Output:

Long output

As far as I can see from the logs, pandoc 3.1.11 does not run xelatex for the third time — because xelatex does not issue any errors or warnings about the need to rerun, which is why the whole problem occurs... But pandoc 3.1.10 runs xelatex three times, which is what is needed to display the logical pages correctly.

jgm commented 20 hours ago

Okay, so we have gotten to the bottom of it -- thank you for your help. The issue is that xelatex doesn't issue any errors or warnings about the need to rerun, but actually one does need to rerun. This should be fixable. As a crude measure, we could simply set runs=3 whenever a table of contents is used.

sicikh commented 19 hours ago

Okay, so we have gotten to the bottom of it -- thank you for your help. The issue is that xelatex doesn't issue any errors or warnings about the need to rerun, but actually one does need to rerun. This should be fixable. As a crude measure, we could simply set runs=3 whenever a table of contents is used.

If the LaTeX file contains \frontmatter, \mainmatter or \backmatter, which are often used to reset the page counter, then it is worth at least three runs. There may be a TOC in the LaTeX template, but there may not be a counter reset.

Moreover, there may not be a TOC, but a counter reset may be present. So I don't even know how to reduce the number of launches to the maximum so that such bugs don't occur at all...

I looked at the LaTeX compilation code (the runTeXProgram function) and yes, indeed, a few changes need to be made. The only question is how to fix the bug at all and not run the excess compilation once again...

sicikh commented 19 hours ago

Okay, so we have gotten to the bottom of it -- thank you for your help. The issue is that xelatex doesn't issue any errors or warnings about the need to rerun, but actually one does need to rerun. This should be fixable. As a crude measure, we could simply set runs=3 whenever a table of contents is used.

If the LaTeX file contains \frontmatter, \mainmatter or \backmatter, which are often used to reset the page counter, then it is worth at least three runs. There may be a TOC in the LaTeX template, but there may not be a counter reset.

Moreover, there may not be a TOC, but a counter reset may be present. So I don't even know how to reduce the number of launches to the maximum so that such bugs don't occur at all...

I looked at the LaTeX compilation code (the runTeXProgram function) and yes, indeed, a few changes need to be made. The only question is how to fix the bug at all and not run the excess compilation once again...

As I see in #9295, the problem is quite similar. A solution is proposed (https://github.com/jgm/pandoc/issues/9295#issuecomment-1879590208) to verify the diff of the toc files, but in the case I indicated, this does not help when the TOC is located on several pages.

The suggestion in issue before that (https://github.com/jgm/pandoc/issues/9295#issuecomment-1879587295) is to hardcode at least three compilation runs when using TOC (as indicated, errors will be generated in the absence of TOC, which will start the required number of compilations — maybe — I'm not very familiar with the LaTeX). Otherwise, it probably won't work out in any way...

sicikh commented 18 hours ago

Okay, so we have gotten to the bottom of it -- thank you for your help. The issue is that xelatex doesn't issue any errors or warnings about the need to rerun, but actually one does need to rerun. This should be fixable. As a crude measure, we could simply set runs=3 whenever a table of contents is used.

If the LaTeX file contains \frontmatter, \mainmatter or \backmatter, which are often used to reset the page counter, then it is worth at least three runs. There may be a TOC in the LaTeX template, but there may not be a counter reset.

Moreover, there may not be a TOC, but a counter reset may be present. So I don't even know how to reduce the number of launches to the maximum so that such bugs don't occur at all...

I looked at the LaTeX compilation code (the runTeXProgram function) and yes, indeed, a few changes need to be made. The only question is how to fix the bug at all and not run the excess compilation once again...

My assumption was wrong, this only happens with the presence of \tableofcontents.

You can return the check that was before 3.1.11 (53fbce09bee57f60754673485e513d42e2808589):

(3ff206cc4be8642e6c7f02c873707f8c5185321c):

tex2pdf program args tmpDir source = do
  let numruns | takeBaseName program == "latexmk"        = 1
              | "\\tableofcontents" `T.isInfixOf` source = 3  -- to get page numbers
              | otherwise                                = 2  -- 1 run won't give you PDF bookmarks
jgm commented 13 hours ago

So maybe we should revert https://github.com/jgm/pandoc/commit/2dd98b967b8615d4d67ec9c62d7a33d16012241b#diff-0f4c4a28aca69bc0cf6b381fb7412ab5a46a4ffd513d0fd86773956e14883e87R442 which is pointless if we just always do 3 runs when there is a table of contents?

Or should we keep this and always do one additional run after the toc has stabilized? (Are there ever cases where > 3 runs are needed?)