I have this .org-file (let’s call it letter.org):

#+SENDER: hu-berlin-letter-example
#+SUBJECT: Short description
#+LANG: de
#+ADDRESSEE: my adress

#+SETUPFILE: org-setupfile.org

Thank you very much for your letter.

THIS WORKS: {{{keyword(SENDER)}}}
AUTHOR: {{{keyword(AUTHOR)}}}
THIS WORKS, TOO: \LoadLetterOption{ {{{keyword(SENDER)}}} }

My org-setupfile.org contains this:

#+begin_src emacs-lisp :results none :export none
(add-to-list 'org-latex-classes
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

#+OPTIONS: toc:nil
#+LATEX_COMPILER: lualatex
#+LATEX_CLASS: hu-berlin-letter
#+LATEX_CLASS_OPTIONS: [{{{keyword(SENDER)}}}]
#+LATEX_HEADER: \LoadLetterOption{ {{{keyword(SENDER)}}} }

When I export it to a .tex-file (using DOOM Emacs with SPC m e l l) I get this result:

           \LoadLetterOption{ {{{keyword(SENDER)}}} }
 pdfcreator={Emacs 29.0.90 (Org mode 9.6.1)}, 
.... % deleted biblatex-part

Thank you very much for your letter.

THIS WORKS: hu-berlin-letter-example
ADDRESSEE: my adress
THIS WORKS, TOO: \LoadLetterOption{ hu-berlin-letter-example }

My problem is that this documentclass depends on the .lco-file which I want to load with \LoadLetterOption (or as an option to the documentclass) - but I cannot pass the content of the keyword SENDER where I need it to be (which is #+LATEX_HEADER: \LoadLetterOption{{{{keyword(SENDER)}}}} or #+LATEX_CLASS_OPTIONS: [{{{keyword(SENDER)}}}]).

The macro {{{keyword(SENDER)}}} works fine in the main body, but not in the LaTeX header....

  • The only keywords where, on export, macros are expanded on the RHS are TITLE, DATE and AUTHOR. This is controlled by the parse setting in org-export-options-alist. You'd have to add entries to that list for the LATEX_CLASS_OPTIONS and LATEX_HEADER keywords. That would be a start, but I don't know if it would be enough. Do C-h f org-macro-replace-all and check its last argument - then check how that last argument is calculated in org-export--annotate-info.
    – NickD
    Commented May 22, 2023 at 5:13
  • Thanks for pointing that out. I didnt know about org-export-options-alist, I will check it out. Commented May 22, 2023 at 18:24

1 Answer 1


There is an Org-mode LaTeX exporter designed for letters. Read Creating letters with KOMA-Script scrlttr2 and Org-mode for more details.

With this exporter, you can customize the look of your letter by writing your own LCO files and including them with the #+LCO: keyword.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.