Best way to align center a paragraph with RestructuredText?

梦想的初衷 提交于 2019-12-23 09:47:18

问题


What is the best way to have a paragraph align in the center of the page using restructuredText for pdf (rst2pdf)?


回答1:


You can use the following:

.. class:: center

This paragraph will be centered.



回答2:


If you want to use center tag (as described above) on rst2html.py (Docutils 0.12), you should create a css file, namely mystyle.css by adding the following line to it:

.center {text-align: center;}

For converting your rst file, namely, myrst.rst to html file, use the following command

rst2html myrst.rst myrst.html --stylesheet=mystyle.css,html4css1.css

By using this method, the following code works well.

.. class:: center

This paragraph will be centered.


来源:https://stackoverflow.com/questions/14819093/best-way-to-align-center-a-paragraph-with-restructuredtext

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