AP257
AP257

Reputation: 93993

Sphinx docs: Remove blank pages from generated PDFs?

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?

Upvotes: 50

Views: 13920

Answers (1)

Noah Heldman
Noah Heldman

Reputation: 6874

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

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

Upvotes: 78

Related Questions