如何在Windows中使用Sphinx创建PDF文档 [英] How to create PDF documentation with Sphinx in Windows
问题描述
我正在使用Sphinx为Windows中的Python项目创建文档.我需要生成PDF文档.我在Linux上找到了很多解释,但是在Windows中却找不到很好的解释.据我了解,我需要使用Sphinx创建Latex格式,然后使用Texworks将Latex转换为PDF.假设我创建了Latex格式的文档并安装了Texworks,有人可以提供逐步的说明,怎么做?
I am using Sphinx to create documentation for my Python project in Windows. I need to generate PDF documentation. I found many explanation how to do this in Linux, but no good explanation how to do this in Windows. As far as i understand I need to create Latex format with Sphinx, and than use Texworks to convert Latex to PDF. Can someone provide step by step explanation how can I do this, assuming I created documentation in Latex format and installed Texworks?
推荐答案
安装MiKTeX(< 200mb)
Install MiKTeX (< 200mb)
wget -nv -N http://mirrors.ctan.org/systems/win32/miktex/setup/miktex-portable-2.9.4757.exe
7z.exe x -y miktex-portable-2.9.4757.exe -o"miktex"
将bin目录添加到您的路径
Add the bin directory to your path
SET Path=%Path%;%CD%\miktex\miktex\bin
运行Sphinx的"make.bat"以生成.tex文件.
Run Sphinx's "make.bat" to generate the .tex file.
SET SPHINXOPTS=-W -E
make.bat latex
调用MiKTeX的pdflatex:
Invoke MiKTeX's pdflatex:
cd build/latex
pdflatex.exe YOUR_PROJECT_NAME.tex
生成的PDF将在您的build/latex目录中
The resultant PDF will be in your build/latex directory
这篇关于如何在Windows中使用Sphinx创建PDF文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!