JelteF / PyLaTeX

A Python library for creating LaTeX files
https://jeltef.github.io/PyLaTeX/
MIT License
2.24k stars 287 forks source link

total page number is ??? #334

Closed petaflot closed 3 years ago

petaflot commented 3 years ago

I've been playing with the complex report example... I noticed the total number of pages in the footer is often (but not always) set to '???' instead of an actual number.

I have not been able to figure out what causes it to work or fail.

JelteF commented 3 years ago

Install latexmk: https://jeltef.github.io/PyLaTeX/latest/faq.html#frequently-asked-questions

petaflot commented 3 years ago

works with default engine, not with xelatex or lualatex.

but default engine has very poor unicode support :-/

JelteF commented 3 years ago

You can make latexmk use luatex or xelatax under the hood by using the -luatex or -xelatex flag. See this issue for an example: https://github.com/JelteF/PyLaTeX/issues/105

On Mon, 5 Jul 2021, 00:03 Engrenage, @.***> wrote:

works with default engine, not with xelatex or lualatex.

but default engine has very poor unicode support :-/

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JelteF/PyLaTeX/issues/334#issuecomment-873671029, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3YJSBJ2QQBPSX25VMYPLTWDLEBANCNFSM47ZPOD3A .

petaflot commented 3 years ago

I have tried a few things, such as

doc.generate_pdf(destFilename, clean=True, compiler = 'latexmk -f -xelatex -interaction=nonstopmode -output-directory=' + output_dir, extra_compiler_args = "--xelatex")
doc.generate_pdf(destFilename, clean=True, compiler = 'latexmk', extra_compiler_args = "--xelatex")

and got output like

pylatex.errors.CompilerError: No LaTex compiler was found
TypeError: generate_pdf() got an unexpected keyword argument 'extra_compiler_args'

as far as I'm concerned, the issue is not resolved :-/

petaflot commented 3 years ago

since subprocess is being used and requires commands and args to be in a list, I'm not surprised. Data on #105 is obviously obsolete.

JelteF commented 3 years ago

This should do it (note compiler_args instead of extra_compiler_args, and passing in a list):

doc.generate_pdf(destFilename, clean=True, compiler = 'latexmk', compiler_args = ["--xelatex"])

This is also document here: https://jeltef.github.io/PyLaTeX/current/pylatex/pylatex.document.html#pylatex.document.Document.generate_pdf