Miskatonic University Press

LaTeX letters in Org

emacs latex

When I need to send a formal (or at least not handwritten) letter, I want to do it in LaTeX, and if I do something in LaTeX, I want to do it in Org and then export it. LaTeX’s letter class is made for this purpose (see also this), but making it work in Org takes a small bit of configuration and some attention to how the letter is set up. Here’s how I made it work.

First, you need to tell Org about the letter class, because it’s not one of the defaults. Letters don’t have chapters or sections so you just specify the document class.

(with-eval-after-load 'ox-latex
  (add-to-list 'org-latex-classes '("letter" "\\documentclass{letter}"))
  )

Here’s the Org file with the sample letter I used. It’s from chapter five of Dracula by Bram Stoker. I removed some of the content of the letter to keep things shorter. It looks very plain here because there’s no syntax highlighting in this web page to fancy it up.

# #+title: Comment out, or do not use
#+date: Wednesday

#+options: toc:nil

#+latex_header: \usepackage[osf]{Baskervaldx}

#+latex_class: letter

#+latex_header: \signature{Lucy}
#+latex_header: \address{17, Chatham Street}

#+latex: \begin{letter}{[s.l.]}
#+latex: \opening{My dearest Mina,---}

I must say you tax me very unfairly with being a bad correspondent.
I wrote to you /twice/ since we parted, and your last letter was only your /second/.
Besides, I have nothing to tell you.  There is really nothing to interest you.
Town is very pleasant just now, and we go a good deal to picture-galleries
and for walks and rides in the park.  As to the tall, curly-haired man,
I suppose it was the one who was with me at the last Pop.  Some one has evidently
been telling tales.  That was Mr. Holmwood.  He often comes to see us, and he and
mamma get on very well together; they have so many things to talk about in common.
We met some time ago a man that would just /do for you/, if you were not already
engaged to Jonathan.  He is an excellent /parti/, being handsome, well off, and
of good birth.  He is a doctor and really clever.  Just fancy!
He is only nine-and-twenty, and he has an immense lunatic asylum all under his own care.

#+latex: \closing{Sincerely,}
#+latex: \ps{P.S.  I need not tell you this is a secret.  Good-night again.}
#+latex: \end{letter}

It looks like this in Emacs (the image is linked to a larger one).

Screenshot of Emacs editing this file
Screenshot of Emacs editing this file

Some notes:

  • Don’t use a title. If you want one for your own reference, comment it out.
  • The table of contents needs to be turned off.
  • I found it safest to use the #+latex: way of including LaTeX fragments. It doesn’t mess up the syntax highlight or the exporting.
  • The letter class needs some options to go in the header and some in the body, as shown here.
  • The “[s.l.]” is for sine loco, Latin for “no location.” (Library cataloguers used to use this when no place of publication was known.) This is where the recipient’s address would go; there isn’t one in this letter, but I wanted to show how to set it up.
  • The letter class has lots of other options. They work like the ones shown.

The only extra thing I’ve added is the Baskervald X typeface, which is LaTeX’s Baskerville. I really like it. The [osf] option turns on text figures: notice how the 7 in “17” descends below the 1.

When exported (C-c C-e l o, the command for “export to PDF and open the file;” C-c C-e is “export,” l is “to LaTeX,” o is “then open the PDF”) the letter looks like this.

The full letter
The full letter

This is the text block, larger so easier to see.

Close up of the text block
Close up of the text block

It looks very nice. Now I have a good template to use for formal letters.