我试图每 90 秒从一个 Markdown 文档生成一个 pdf 文档。我已经在 launchd 中设置了一个任务来为我处理这个问题。不幸的是,我收到一条错误消息,宣布无法找到 pdflatex,即使我可以从命令行调用它。这是 ddd_publisher.sh 的全部内容,它是 launchd 每 90 秒运行一次的文件:

/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd

该程序每 90 秒运行一次,但它会将以下行写入 stderr:
pandoc: pdflatex not found. pdflatex is needed for pdf output.

如果我在命令行输入 pdflatex -v 它会告诉我它已安装:
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)

这是我的launchd plist文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ddd.intercontinental.publisher</string>
<key>ProgramArguments</key>
<array>
    <string>/Users/Jon/dev/intercontinental/ddd_publisher.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stderr</string>
<key>StandardOutPath</key>
<string>/Users/Jon/dev/intercontinental/ddd.stdout</string>
<key>StartInterval</key>
<integer>90</integer>

最佳答案

解决办法是在bash脚本中添加pdflatex的路径,如下:

#!/bin/bash
PATH=$PATH:/usr/texbin
/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd

关于macos - pandoc via launchd - 得到错误 : "pdflatex not found. pdflatex 需要 pdf 输出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16026793/

10-16 17:02