仅在页面右三分之一处使用 Sphinx 和 RinohType 的代码文档

Code documentation with Sphinx and RinohType only on the right third of the page

我正在为我的代码文档的 RinohType 生成的 PDF 文档的格式设置而苦恼。下面的例子如何改变PDF文档的格式。

class 描述的所有内容都在构造函数定义的右侧。

这是由于最近更改了带有标签的对象的呈现方式所致。 Sphinx 样式 sheet 已调整以在 rinohtype 0.5.2 中修复此问题(感谢您指出此问题!)。

如果你不能升级到0.5.2,你可以通过extending the style sheet and overriding the label_max_width style property for the object description方式解决这个问题。 none 的值对标签宽度没有限制,并且始终将说明呈现在右侧。将 label_max_width 设置为尺寸将强制描述在标签下方呈现,如果它超过指定的宽度。

mystyle.rts:

[STYLESHEET]
name=MyStyle
base=sphinx

[object description]
label_max_width=10pt

要指示 rinohtype 使用此样式 sheet,您首先需要创建一个引用它的 template configuration file

mytemplate.rtt:

[TEMPLATE_CONFIGURATION]
name = my template configuration
template = book
stylesheet = mystyle.rts

最后,在您项目的 conf.py:

中引用来自 rinoh_documents 的模板配置文件
rinoh_documents = [
    dict(doc='index', target='manual', template='mytemplate.rtt'),
]