Wednesday, November 7, 2012

Sphinx make latexpdf for MS Windows

Sphinx is an amazing documentation tool. I was up and running with gorgeous html in minutes! But generating a pdf took a little longer to figure out because IMHO on Windows using any open source is always a challenge.

  1. Install Sphinx (1.1.3) - just use pip, easy_install, or setup, whatever you prefer.
    • user@user ~$ pip install sphinx
  2. This will probably also install Pygments and Jinja-2, I can't remember.
  3. Install MikTex package repository binary. This takes care of downloading and updating your LaTeX binaries. Alternately install TeX Live and Lua TeX Windows binaries. I haven't tested this so not sure how well it works, but essentially should be the same as MikTeX since it's the same source.
  4. You will need a working make binary. The easiest one is from GNUwin32, but I would recommend installing MSYS either from MinGW or MinGW-w64. Alternately you could use Cygwin, but that's a different ballgame.
  5. After you've run sphinx-quickstart from the tutorial, type make latexpdf and voila. If you used MikTeX, it will ask you to install several LaTeX packages.
Another option is to go straight to pdf with rst2pdf. First install reportlab binary from the cheese factory. Then use pip to install rst2pdf.
Fork me on GitHub