【发布时间】:2013-02-11 19:07:34
【问题描述】:
使用 restructuredText for pdf (rst2pdf) 使段落在页面中心对齐的最佳方法是什么?
【问题讨论】:
-
对于遇到此问题的 sphinx 用户:stackoverflow.com/q/33493589/2988730
标签: alignment restructuredtext
使用 restructuredText for pdf (rst2pdf) 使段落在页面中心对齐的最佳方法是什么?
【问题讨论】:
标签: alignment restructuredtext
您可以使用以下内容:
.. class:: center
This paragraph will be centered.
【讨论】:
如果你想在 rst2html.py (Docutils 0.12) 上使用中心标签(如上所述),你应该通过添加以下行来创建一个 css 文件,即 mystyle.css:
.center {text-align: center;}
要将您的 rst 文件,即 myrst.rst 转换为 html 文件,请使用以下命令
rst2html myrst.rst myrst.html --stylesheet=mystyle.css,html4css1.css
通过使用这种方法,下面的代码运行良好。
.. class:: center
This paragraph will be centered.
【讨论】: