Sphinx PDF themes

araichev picture araichev · Mar 17, 2012 · Viewed 12.9k times · Source

Does the Sphinx documentation tool offer different PDF themes like it offers different HTML themes?

I Googled the issue but can't find an answer, which leads me to believe the answer is 'no'. Still, i thought i'd ask here.

Thanks.

Answer

Kevin Horn picture Kevin Horn · Mar 21, 2012

Firstly, Sphinx doesn't generate PDF output by itself, though there are two general methods to get from Sphinx source files to PDF output:

  1. Use the Latex builder, and then a separate tool like latex2pdf to generate the PDF output
  2. Use the Sphinx plugin from the rst2pdf project

That being said there is lots of potential for customizing the styling of your PDF output using either method.

  1. When using the latex->pdf method, you can customize your latex output using a number of options in your sphinx config file. See here. This method is somewhat less convenient than the HTML themes that Sphinx uses for HTML generation, though (IMO).
  2. When using rst2pdf you can define your own stylesheet, which his described in more detail in the manual (look under the "Styles" heading). rst2pdf includes a number of stylesheets, which can be combined for various results. And of course, you can also modify them or create your own (they're just JSON files). These stylesheets also support a kind of inheritance, so act more like the Sphinx HTML themes than the previous method.