## How To Write Papers with Restructured Text

From: andrew cooke <andrew@...>

Date: Sun, 22 May 2011 01:21:58 -0400

I wrote http://www.acooke.org/pytyp.pdf as "ordinary" text.  You can see the
source at http://code.google.com/p/pytyp/source/browse/pytyp.rst#23 and I hope
you'll agree that, apart from the Latex in the header, it's as easy to read as
the final PDF.

That "natural" formatting style is called "restructured text" and is commonly
used for Python documentation.  But it can be used for general writing too.
Tools exist to convert it to various formats, including HTML and Latex (and
from Latex to PDF, of course).

There's a simple overview of how to format things at
http://sphinx.pocoo.org/rest.html (that's part of the documentation for a
larger package called Sphinx, but Sphinx uses restructured text, so it's
relevant here).  The best detailed reference is
http://docutils.sourceforge.net/docs/ref/rst/directives.html  But really, you
can pick almost everythin up just by looking at an example like the source I
gave earlier - http://code.google.com/p/pytyp/source/browse/pytyp.rst#23

To generate the PDF from that file I used the commands

rst2latex.py \
--documentoptions='10pt,paper=letter,DIV=20,headinclude=false,footinclude=false,twoside=false,twocolumn=true' \
--literal-block-env=lstlisting pytyp.rst pytyp.tex

pdflatex pytyp.tex

The first generates Latex from the source; the second converts that to PDF.

The documentoptions in the first command controls how Latex formats the
result.  The literal-block-env part is for the program listings.

You also need to install restructured text and Latex - for OpenSuse that means
installing the "docutils" and the "texlive-latex" packages from Yast.

Andrew