Svrst

What is svrst ?

Svrst contains customized builders for converting reStructuredText to html, text and pdf. The main feature that was added is the ability to write math equation in latex, and several improvements to get a more printable pdf.

Download

svrst is available both as a Pacman package (x86_64 only), or in source form. For source or Pacman installation, please refer to the Generic download and install instructions.

Usage

svrst2html.py

This converts a rst document to html. The usage is the same as rst2html.py . See its manual for more information.

svrst2latex.py

This converts a rst document to latex. The usage is the same as rst2latex.py. See its manual for more information.

svrst2pdf.py

This converts a rst document into a pdf file. The program takes exactly two arguments: the source RST file, and the destination PDF file. The environment variable FULL_DIR_URL can be used to give a base URL to prepend to relative links.

For example, if in the rst file there is a link to test.html, then the person reading the printed PDF will not know where the link really points to if a base URL is not specified. If FULL_DIR_URL is e.g http://svasey.org, then it will be written in the PDF, and the user will know that the link really points to http://svasey.org/test.html.

The math extension

To write math, the simplest is to do something like:

.. default-role::math

Hey this is some math: `\frac{x}{x} \ne 1`

or on its own line

`\pi \approx 3.141592`

This will render as

Hey this is some math: \frac{x}{x} \ne 1

or on its own line

\pi \approx 3.141592

If you do not want to set math as a default role, you can do:

Formula on its own line

.. math::

    e^{i\pi} + 1 = 0

or even

Formula follows on the same line: :math:`2 + 2 = 5`

Except for very simple cases, the formula will be compiled into an image in html documents, and the math mode will be used in the latex document, which is then compiled to pdf.

Limitations

svrst2latex.py reprocesses the latex file after compilation by rst2latex.py . For simplicity reasons, some corner cases are not considered when doing this, and the result is that some RST directives will not work when compiled into pdf.

Admonitions

Admonitions are known not to compile to pdf at all. If you want to use them, that will have to be for html documents only.

References

The math extension was inspired by a blogpost called reStructuredText extensions.