created on Nov. 13, 2012, 6:03 p.m. by Hevok & updated on Nov. 13, 2012, 6:03 p.m. by Hevok
A data entry can be rendered in various forms, like html and pdf.
Specifically for pdf outputs rst2pdf
is used.
This renders a data entry output as a legal size, serif document with code in murphy style::
$ rst2pdf article.rst -o article.pdf -s serif,murphy,legal
(perldoc looks better though)
Code syntax highlighting works via the code-block directive
::
.. code-block:: python
import this
# Test
for something in here:
print something, "more"
.. code-block:: python
import this
# Test
for something in here:
print something, "more"
ReStructuredText can highlight itself::
.. code-block:: rest
reST Test
=========
.. class:: test
.. code-block:: rest
reST Test =========
.. class:: test
The linenos
option can be used to display line numbers
.. code-block:: python
:linenos:
def func(x,y):
"""Adds up x and y."""
print(x+y) # Do heavy calculation.
.. code-block:: python :linenos:
def func(x,y):
"""Adds up x and y."""
print(x+y) # Do heavy calculation.
Python in console
.. code-block:: pycon
print("Console online") Console online
Python traceback
.. code-block:: pytb
Code can also be included into a document::
.. code-block:: python
:include: setup.py
:start-at: string Will start here
raw pdf can be used to control the page count::
.. raw:: pdf
SetPageCounter 1 lowerroman
SetPageCounter By default sets the counter to 0 and the style to arabic numerals
SetPageCounter number style Used to specifically start a page number with the specific style
Possible styles are:
romans start at 1. Arabic can start at 0, and alphas cannot go beyond 26 (of course).
PageBreak
, EvenPageBreak
or OddPageBreak
can be used to break a page. Each of these can take an additional arguments which os the name of next page template::
.. raw:: pdf
PageBreak oneColumn
TwoColumn
would create a two columned page in the following.
For formula and equation use the math directive::
.. math::
\frac{2 \pm \sqrt{7}}{3}
.. math::
\frac{2 \pm \sqrt{7}}{3}
For mathematical symbols use the math role or directive::
:math:\pi
:math:\pi
Comment on This Data Unit