Windows – How to create PDF documentation with Sphinx in Windows

pdfpython-sphinxwindows

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?

Best Answer

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"

Add the bin directory to your path

SET Path=%Path%;%CD%\miktex\miktex\bin

Run Sphinx's "make.bat" to generate the .tex file.

SET SPHINXOPTS=-W -E
make.bat latex

Invoke MiKTeX's pdflatex:

cd build/latex
pdflatex.exe YOUR_PROJECT_NAME.tex

The resultant PDF will be in your build/latex directory