Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to align center a paragraph with RestructuredText?

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

like image 597
psic Avatar asked Feb 11 '13 19:02

psic


People also ask

How do you centrally align a paragraph?

Select the text that you want to center. in the Page Setup group, and then click the Layout tab. In the Vertical alignment box, click Center. In the Apply to box, click Selected text, and then click OK.

How do I center align text with margin?

Center Align Elements To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container.

How do you align a paragraph in the middle in HTML?

To set text alignment in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property text-align for the center, left and right alignment.

How do I center a paragraph in CSS?

To center text in CSS, use the text-align property and define it with the value 'center.


2 Answers

You can use the following:

.. class:: center

This paragraph will be centered.
like image 198
Roberto Alsina Avatar answered Oct 14 '22 06:10

Roberto Alsina


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.
like image 41
Ahmad Yoosofan Avatar answered Oct 14 '22 06:10

Ahmad Yoosofan