Emacs and Pandoc: can't create a pdf

有些话、适合烂在心里 提交于 2019-12-11 06:12:52

问题


I use GNU Emacs in a Mac. After installing the last version of Pandoc I can't create pdf files. Pandoc works well when I use the Terminal. I think that the problem has to do with the fact that Emacs doesn't find the template default.latex. This template is in my ~/.pandoc/templates.

This is the error message I receive when trying to create a pdf: pandoc: /usr/local/share/pandoc-1.10.1/data/templates/default.latex: openBinaryFile: does not exist (No such file or directory)

I don't understand why Emacs is trying to find default.latex here.


回答1:


(setq pandoc-binary "/usr/local/bin/pandoc")

This answer assumes you do not have a folder named pandoc inside of /usr/local/bin/ and that the actual executable has an absolute path of /usr/local/bin/pandoc. If the executable is buried deeper in another folder or more, then adjust the path in this example accordingly. The code at the top of this answer goes in your .emacs file.

You may also wish to modify this variable depending upon your preferred setup:

(setq pandoc-data-dir "~/.emacs.d/pandoc-mode/")



回答2:


You could achieve a more general solution using exec-path-from-shell:

A GNU Emacs library to ensure environment variables inside Emacs look the same as in the user's shell.

Just install it, require it (only if your aren't using MELPA) in your .emacs file and add this line to it:

(exec-path-from-shell-initialize)

For more information see the usage section in the README.



来源:https://stackoverflow.com/questions/21791097/emacs-and-pandoc-cant-create-a-pdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!