2011-04-12

I've discussed the wonderful org-mode here a number of times already. It has
become a pretty important part of my overall workflow. One thing I am using
org-mode for, is to produce all kinds of PDF-documents that I can share with
other people.

org-mode & LaTeX

In the past, I often used straight LaTeX for such things; I wrote my thesis
with it, but also many other documents. There are many things I like about
LaTeX, one of them being that I can use emacs for writing. Still, there are
also a few things I do not particularly like. First, I think LaTeX is quite
heavy with formatting directives, which hinder my writing flow (e.g., when I
want to include an image, a table or a source code snippet). Another thing is
that I find the default LaTeX styles a bit boring. Nothing wrong with it,
but there just too many documents with the exact same lay-out.

Now, back to org-mode. One way to use org-mode is as a friendly way to
generate LaTeX (and, consequently, PDFs). This is a big improvement! Much
more than LaTeX itself, org-mode allows to focus on the contents of the
document, rather than instructing LaTeX what to do. This comes at the price
of small bit of flexibility, but, if needed org-mode allows you include
straight LaTeX when needed – so while keeping easy things easy, hard things
are still possible. The latter does require a bit of experience with LaTeX a
though.

setting up XeTeX

Now, for the second issue, the way documents look, there are other
solutions, and they live on the LaTeX side of things. I'm sure many have seen
The Beauty of LaTeX. Using the XeTeX implementation of LaTeX and the
fontspec package, you can create LaTeX documents with a bit 'refreshed'
look.

So, the steps to get this working with org-mode:

install the texlive-xetex packages on Ubuntu and Debian (this installs a
huge set of packages)

install the SIL fonts (I'm using ttf-sil-gentium and ttf-sil-charis, but
there are more)

I'm also using DejaVu Mono (ttf-dejavu)

teaching org-mode about the new XeTeX stuff

We now need to define some LaTeX document class for org-mode that uses
XeTeX and some of these new fonts. Let's call the document class
djcb-org-article (as I often use the djcb- prefix for my own stuff), it
could be something like the following (add to your org-setup – e.g., in
your .emacs, make sure there is a (require 'org) before this:

We can export this to a PDF using C-c C-e p (or C-c C-e d to
automatically open the PDF in a PDF-viewer). This should all work nicely; if
it doesn't, note that when exporting, say, test.org, org-mode will create
a file called test.tex, and visit in a buffer. There's also a buffer with
the output from various commands, but sometimes it can be useful to run LaTeX
(xelatex in this case) on the file by hand, to find any problems. The
wonderful org-documentation about exporting to LaTeX has more information.

I think the result is pretty nice – it stays true to the class LaTeX article
class, but freshens it up a bit with some news font. If you can make
something better – which is not unlikely – you are of course invited to
contribute your own!

Concluding

org-mode is a pretty convenient way to write nice-looking PDFs. Combined
with xelatex, they don't have to look too plain :). However, I'm aware of
my limitations when it comes to the coolness/aesthetic aspects, but I hope
others can show the way here.

Maybe org-mode could ship with a number of ready-made templates to make
it easy to make nice-looking documents, resumes, reference cards, reports,
meeting notes and so on.

The Linux Libertine is a very, very nice font indeed! However, I find Minion Pro (which can be borrowed from the Adobe Reader distribution) a lot nicer, especially with the package "microtype" using pdftex.

@Anonymous: well, it's about balancing ease of editing with flexibility. I find typing org much more convenient than typeing LaTeX. But if I hadn't work with LaTex before, maybe it would feel a bit too 'magic'.

You know you could just write your own documentclass file? Then all you'll need is begin your document with \documentclass{yourclass}, and you can also have customisations to it, like the \author and \maketitle in the article-class.

I am having the same error as John J. Camilleri. Previously I've been using this to format my pdfs for schoolwork, and it really makes beautiful pdfs. I haven't updated my system just to insure this continued to work. Recently I had to install a fresh version of Linux Mint 15.

What should be done to fix this error? I would really love to have this working again.