我正在尝试在 reStructuredText 中编写文档,但目前遇到了问题。
我希望文档有一个标题,这将被居中,然后紧接着我想要一个小节。
我尝试执行以下操作
##############
Title
##############
+++++++++
Subtitle
+++++++++
content
但是当我将其转换为 PDF 时,它会使标题和副标题都居中。
最佳答案
来自重构文本 quick start guide标题和副标题指定如下(强调我的):
To indicate the document title in reStructuredText, use a unique adornment style at the beginning of the document. To indicate the document subtitle, use another unique adornment style immediately after the document title.
所以在问题的其余示例中,
Subtitle
由于 Subtitle
周围使用的装饰样式,因此被格式化为子标题而不是节标题未在文档中的任何其他地方使用。在下文中,此装饰用于两个部分标题,因此不是唯一的,也不会被视为副标题:##############
Document Title
##############
+++++++++++++++
Section 1 Title
+++++++++++++++
Section 1 content...
+++++++++++++++
Section 2 Title
+++++++++++++++
Section 2 content...
玩玩http://www.tele3.cz/jbar/rest/rest.html这使您可以快速尝试一些简单的 reStructuredText 并测试诸如副标题与部分标题之类的内容。
编辑 :或者,您可以在标题和章节标题之间放置一些文本(例如摘要)。
附言我倾向于使用标题上方和下方的装饰来指示文档标题和副标题,并在标题下方使用单个装饰来指示(子)节标题。这使得很容易看到我打算成为我的标题/副标题。例如:
==============
Document title
==============
-----------------
Document subtitle
-----------------
Section
=======
Sub-section
-----------
etc.
关于restructuredtext - reStructuredText 中的小节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9593694/