jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.17k stars 3.36k forks source link

Markdown to PDF: the output-directory option of pdf-engine breaks the pandoc re-run it #10186

Closed bp0qd closed 2 weeks ago

bp0qd commented 2 weeks ago

Explain the problem. For some reasons, I use pdf-engine with the "output-directory" option to convert markdown to pdf. When I upgraded the pandoc to 3.3, it do not generate pdf with correct cross-references. I see that it output "LaTeX Warning: ..... Rerun to get ..." but it do not re-run the pdf-engine.

In PDF.sh file, I found the pandoc save the input.tex file into tmpDir and try to read the input.log and input.toc files from same directory after the pdf-engine return results. However, these files have been saved into the outDir directory, which is set by the output-directory option. so the pandoc do not read its output file and do not re-run the pdf-engine.

I think there are two soluation:

  1. the tmpDir and outDir should be same when the pdf-engine is "xelatex"
  2. pandoc should find these file from outDir.

Pandoc Command pandoc --pdf-engine=xelatex --pdf-engine-opt=-output-directory=output-document-name --from=markdown --filter=pandoc-crossref --lua-filter=path/to/minted.lua --output=document-name md-file-list

Pandoc version Pandoc 3.3 (Linux Ubuntu 20.04 x86_64)

texlive version texlive 2024

jgm commented 2 weeks ago

thanks!