Sphinx PDF themes

Firstly, Sphinx doesn’t generate PDF output by itself, though there are three 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
  3. Use the rinoh Sphinx builder provided by rinohtype

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 is 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.
  3. rinohtype has extensive provisions for styling a document. See the Basic Document Styling and subsequent sections of the rinohtype manual.

Leave a Comment