Leo's great for editing ReStructured? text documents. Leo's text editor is fine for editing the text in the document, but you might want to use Emacs for a couple of reasons: (a) personal preference, and (b) Table Mode. ReStructured? text tables are a hassle, but there's a table mode for emacs that makes them much easier. So here are some tips for using Leo + Emacs to edit ReStructured? text.

  1. Use the Leo's 'xemacs' plugin, which works with Emacs as well. In Linux the plugin expects the emacsclient program to be called 'emacsclient', so if you're using 'emacsclient.snapshot-22' or something make a symbolic link. The xemacs plugin requires the openWith plugin, and you use it by double clicking a node's icon box to edit its text in Emacs.

  2. In the root node of you rst tree, use the '@language plain' directive so that the text is viewed as text rather than python code by Emacs.

  3. If you want auto justification and spell as you type, add the following to your .emacs file:

    (add-hook 'text-mode-hook 'turn-on-auto-fill)
    (add-hook 'text-mode-hook 'flyspell-mode)
  4. Install the emacs package 'table' from http://table.sourceforge.net/ - this makes ascii table editing much easier. Unfortunately it's not completely compatible with fly-spell, so you might need to turn fly-spell off when using the table mode. It doesn't understand rst's table header syntax, so I just use *foo* to make header elements.

Making PDFs? from Rst

Usually you use @rst myfile.html so that when you invoke Leo's Write Rst command the HTML version is written to myfile.html. If you change it to @rst myfile.txt Leo writes the file out in reStructured Text format. If your system has rst2latex and pdflatex you can get a high quality (i.e. links work, and there's a PDF table of contents available) PDF like this:

rst2latex --documentoptions=letter --stylesheet-path=myprefs.inc \
  mydoc.txt mydoc.tex
pdflatex mydoc.tex
pdflatex mydoc.tex

where the contents of myprefs.inc is something like:

\renewcommand\sfdefault{phv}%               use helvetica for sans serif
\renewcommand\familydefault{\sfdefault}%    use sans serif by default

where the last three commands make figures appear where you want them, rather than where TeX? decides to put them. Repeating the pdflatex step isn't a mistake, latex often needs to run twice to generate cross references.

letterpaper --terry_n_brown, Mon, 16 Nov 2009 14:26:05 -0800 reply

Can't see how to edit the page, apparently modern latex wants --documentoptions=letterpaper, not --documentoptions=letter