3

我正在尝试每 90 秒从降价文档生成一个 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)

这是我启动的 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>

4

1 回答 1

4

解决方法是将pdflatex的路径添加到bash脚本中,如下:

#!/bin/bash
PATH=$PATH:/usr/texbin
/usr/local/bin/pandoc -o /Users/Jon/dev/intercontinental/ddd.pdf /Users/Jon/dev/intercontinental/ddd.ddd
于 2013-04-16T01:22:38.423 回答