pandoc:无法使用rst编写器生成pdf输出

pandoc:无法使用rst编写器生成pdf输出,pandoc,Pandoc,我试图用这个命令将一个rst文件转换成pdf文件 pandoc -V geometry:a4paper -t rst test.rst --toc -s -o test.pdf ,但我得到了以下错误: pandoc: cannot produce pdf output with rst writer 如何使用pandoc将rst转换为pdf?这是从rst转换为pdf的热门解决方案:我遇到了同样的问题,在C:\Program文件中使用默认的pandoc Windows安装程序,并在驱动器D中安

我试图用这个命令将一个rst文件转换成pdf文件

pandoc -V geometry:a4paper -t rst test.rst --toc -s -o test.pdf
,但我得到了以下错误:

pandoc: cannot produce pdf output with rst writer

如何使用pandoc将rst转换为pdf?

这是从rst转换为pdf的热门解决方案:

我遇到了同样的问题,在C:\Program文件中使用默认的pandoc Windows安装程序,并在驱动器D中安装了texlive:。。。然后我通常从MSYS2 shell调用pandoc,它的路径中包含上述两条路径,并且我通常成功地从markdown转换为pdf

因此,这些是我尝试过的命令,但失败了:

$pandoc-s-t rst-toc rest_syntax.rst-o rest_syntax.pdf 无法从rst生成pdf输出 然后,本页指出:

。。。[*对于pdf输出,请使用latex或beamer和-o FILENAME.pdf]

所以基本上format=pdf是无效的,您应该使用pandoctmp.Rmd,format=latex,ext=pdf

好的,然后我记得我在大多数调用中都使用-pdf引擎参数,当我将markdown转换为pdf时,我尝试:

$pandoc-s-t rst-toc rest_syntax.rst-pdf engine=pdflatex-o rest_syntax.pdf pdf引擎pdflatex与输出格式rst不兼容 $pandoc-s-t rst-toc rest_syntax.rst-pdf engine=xelatex-o rest_syntax.pdf pdf引擎xelatex与输出格式rst不兼容 $pandoc-s-t rst-toc rest_syntax.rst-pdf engine=lualatex-o rest_syntax.pdf pdf引擎lualatex与输出格式rst不兼容 。。。我觉得很奇怪。。。但后来我注意到输出格式是rst——而且,我不希望将rst作为输出格式!所以我看了pandoc-help,结果是,-t是-to,也就是说,它确实指定了输出格式

所以,一旦我删除了它,最终它起了作用:

$ pandoc -s --toc rest_syntax.rst --pdf-engine=lualatex -o rest_syntax.pdf
[WARNING] Reference not found for 'Key "today"' at chunk line 1 column 8
[WARNING] Reference not found for 'python' at line 726 column 118
[WARNING] Reference not found for '#name' at line 811 column 30
[WARNING] Reference not found for '1' at line 822 column 53
[WARNING] Reference not found for '#' at line 823 column 32
最后,这似乎奏效了;请注意,rest_syntax.rst文件实际上是这样的:-并不是所有内容都在PDF中进行了很好的格式化,但是有一个toc,基本的格式和公式似乎可以工作