Sphinx 文档:从生成的 PDF 中删除空白页? [英] Sphinx docs: Remove blank pages from generated PDFs?

查看:31
本文介绍了Sphinx 文档:从生成的 PDF 中删除空白页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,Sphinx 文档会输出格式化为双面打印的 PDF.所以在扉页和TOC、TOC和引言、引言和第一节等之间有一个空白页.

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.

我的用户总是会在线查看 PDF.所以我想删除这些空白页.

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

这似乎是 Sphinx 中的一个棘手问题.查看此电子邮件主题.

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',
}

给我!包 babel 错误:你没有指定语言选项.

第二个选项:

latex_font_size = '10pt,oneside'

运行,但生成的 PDF 仅包含我文档的奇数页.唉.

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

有人知道如何制作没有这些空白页的 PDF 吗?

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

推荐答案

把这个放在你的 source/conf.py 配置文件的LaTeX 输出选项"部分:

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

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

这篇关于Sphinx 文档:从生成的 PDF 中删除空白页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆