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

--pdf-engine full path of the engine not working #4681

Closed
priiduonu opened this issue Jun 1, 2018 · 14 comments · Fixed by #4682
Closed

--pdf-engine full path of the engine not working #4681

priiduonu opened this issue Jun 1, 2018 · 14 comments · Fixed by #4682

Comments

@priiduonu
Copy link
Contributor

According to the documentation:

--pdf-engine=pdflatex|lualatex|xelatex|wkhtmltopdf|weasyprint|prince|context|pdfroff

If the engine is not in your PATH, the full path of the engine may be specified here.

pandoc README.md -o out.pdf --pdf-engine=/usr/bin/xelatex
pdf-engine /usr/bin/xelatex not known

without full path it works:

pandoc README.md -o out.pdf --pdf-engine=xelatex

pandoc version used:

pandoc -v
pandoc 2.2.1
Compiled with pandoc-types 1.17.4.2, texmath 0.11, skylighting 0.7.0.2

It was working (with and without full path) in version 1.19.1
/usr/bin/xelatex exists and is executable.

@mb21
Copy link
Collaborator

mb21 commented Jun 1, 2018

Indeed, I believe this was introduces by 582cb4b, specifically the deletion of takeBaseName...

mb21 added a commit to mb21/pandoc that referenced this issue Jun 1, 2018
mb21 added a commit to mb21/pandoc that referenced this issue Jun 1, 2018
mb21 added a commit to mb21/pandoc that referenced this issue Jun 2, 2018
mb21 added a commit to mb21/pandoc that referenced this issue Jun 3, 2018
@jgm jgm closed this as completed in #4682 Jun 3, 2018
@gandalfsaxe
Copy link

gandalfsaxe commented Jul 9, 2018

I'm also having this issue.

On Windows 10, pandoc 2.2.1:

pandoc --pdf-engine=L:\portable\miktex-portable-2.9.6753\texmfs\install\miktex\bin\pdflatex.exe test.tex -o test.pdf

Gives me:

pdf-engine L:\portable\miktex-portable-2.9.6753\texmfs\install\miktex\bin\pdflatex.exe not known

However just launching L:\portable\miktex-portable-2.9.6753\texmfs\install\miktex\bin\pdflatex.exe works fine. Any suggestions?

@gandalfsaxe
Copy link

gandalfsaxe commented Jul 9, 2018

Could be because the fix is not in latest release (2.2.1) yet?

EDIT: I assume it is. Will try and compile the source myself.

EDIT2: Can confirm latest source works 👍

@jgm
Copy link
Owner

jgm commented Jul 12, 2018 via email

@pciavald
Copy link

I'm still having the issue with pandoc 2.3.1 on macOS 10.13 with spaces in paths.

not working :

$ pandoc --pdf-engine=/Users/user/Library/Application\ Support/app/xelatex
$ pandoc --pdf-engine="/Users/user/Library/Application Support/app/xelatex"

working :

$ pandoc --pdf-engine=/Users/user/Desktop/xelatex
$ /Users/user/Library/Application\ Support/app/xelatex

@jgm
Copy link
Owner

jgm commented Oct 12, 2018 via email

@pciavald
Copy link

pciavald commented Oct 12, 2018

I've just tried that again, it does not work. I noticed that adding " around the path makes the engine unrecognizable to pandoc (pdf-engine must be one of ...), so for instance

$ pandoc --pdf-engine="/Users/user/Desktop/xelatex"

doesn't work either, while it works without quotes.

@mb21
Copy link
Collaborator

mb21 commented Oct 12, 2018

@pciavald what pandoc version are you on? works for me on pandoc 2.3

@pciavald
Copy link

pciavald commented Oct 13, 2018

My bad, my path problem is actually not lying in pandoc but in nodejs' child_process.spawn which did not handle arguments as I expected, and also seemingly a problem in XeLaTeX/TeXLive. If anyone comes here experiencing a problem to spawn pandoc with a full-path pdf engine, this did it the trick for me :

let child = spawn(`"${pandoc}"`, [
            `"${contentPath}"`,
            `--output="${outputPath}"`,
            `--template="${headerPath}"`,
            `--pdf-engine="${pdfEngine}"`,
          ], { shell: true })

the shell: true option launches pandoc with sh -c '"path/to/pandoc" "path/to/content.md" --output="path/to/output.pdf" --pdf-engine="path/to/engine"' instead of separating arguments and somewhat changing the quotes / escape sequences.

I'm building a text editor around pandoc, everything works on linux but on Mac it's a bit more complex seemingly due to spaces in paths. In this log you can see that pandoc successfully launches XeLaTeX but there's a path problem somewhere, accessing the "Application Support" folder :

sh: /Users/pciavald/Library/Application: No such file or directory
sh: /Users/pciavald/Library/Application: No such file or directory
Error producing PDF.
This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018) (preloaded format=xelatex 2018.10.12)  12 OCT 2018 22:25

Here's the TeXLive installation profile used, where we can see that paths have a space. I tried "/quoting/the path/" but it ends up installing "path/to the/folder"/resource and I tried escaping the paths without quotes and it results in /creating\\\ wrong/folders.

Trying XeLaTeX standalone also does not work with the same error, which confirms pandoc is not the cause. At this stage i had linked "Application Support" to "Application" in the same directory to try and trick the software into the right path, resulting in

sh: /Users/pciavald/Library/Application: is a directory

If you have any idea why this may be happening, i'd be glad to hear. Tried IRC freenode#latex without luck for now. Sorry for wrong issue digging, and thank you for maintaining Pandoc it's a wonderful tool.

@jgm
Copy link
Owner

jgm commented Oct 13, 2018

@pciavald you may need to both double-quote and escape spaces:

--output="/path/with\ spaces/myfile\ with\ spaces.txt"

@archonic
Copy link
Contributor

archonic commented Jun 20, 2019

Is this fix still unreleased? I'm running pandoc 2.7.2 and getting pdf-engine must be one of wkhtmltopdf, weasyprint, prince, pdflatex, lualatex, xelatex, latexmk, tectonic, pdfroff, context when specifying a valid path.

If I'm unable to specify the path without building from source, then I'm wondering what engine I could use with the pandoc/latex docker image. I have a multistage build and the path ends up being /usr/bin/texlive/bin/x86_64-linuxmusl/latex. Is it possible to just alias that path as one of the engine names?

Update: Figured it out. Added RUN ln -s /usr/bin/texlive/bin/x86_64-linuxmusl/latex /usr/bin/pdflatex to my Dockerfile and all is well.

@wizpresso-steve-cy-fan
Copy link

Please reopen this issue, which is exist in the following version:

pandoc.exe 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
User data directory: C:\Users\SteveFan\AppData\Roaming\pandoc
Copyright (C) 2006-2022 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.

@wizpresso-steve-cy-fan
Copy link

wizpresso-steve-cy-fan commented Oct 5, 2022

This issue happens if you want to use MikTex in Windows, but they renamed everything to have miktex- prefix (so I need to use miktex-pdftex, but it is not accepted

@tarleb
Copy link
Collaborator

tarleb commented Oct 5, 2022

@wizpresso-steve-cy-fan that should best go into a separate issue. Please open a new one for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants