46
votes

By default, Sphinx documentation outputs a PDF that's formatted for duplex printing. So there is a blank page between the title page and the TOC, the TOC and the introduction, the introduction and the first section, etc.

My users are always going to look at the PDF online. So I would like to remove these blank pages.

This seems to be a vexed issue in Sphinx. See this email thread.

This user suggests two solutions, but neither work for me. Curiously, the first solution:

latex_elements = {
     'classoptions': ',oneside',
}

gives me ! Package babel Error: You haven't specified a language option.

The second option:

latex_font_size = '10pt,oneside'

runs, but produces a PDF that only has the odd-numbered pages of my document. Alas.

Does anyone know how to produce a PDF without these blank pages?

1
Since your users are going to read this exclusively online, wouldn't it be more friendly to have Sphinx output, say, HTML, and save them the agony of online PDF viewing?Brent.Longborough
@Brent.Longborough, this is just not realistic. HTML was not created for page layout, but today most everybody tries to use for ... page layout, even online. With so-so results. I prefer a good looking PDF, even online, to lots of HTML. Especially what comes out of Sphinx, unless you customize it with your own CSS. I regard HTML as a (mostly) working hack. Look up Display Postscript sometime if you are not familiar with it, imagine a web with that, it would be awesome.Prof. Falken
latex_font_size didn't work for me eitherCsaba Toth

1 Answers

69
votes

Put this in your source/conf.py configuration file in the "Options for LaTeX output" section:

latex_elements = {
  'extraclassoptions': 'openany,oneside'
}