Sphinx docs: Remove blank pages from generated PDFs?

江枫思渺然 提交于 2020-01-11 15:13:32

问题


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:


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

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


来源:https://stackoverflow.com/questions/5422997/sphinx-docs-remove-blank-pages-from-generated-pdfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!