I'm using a memorandum specific style when I do LaTeX export of an org-mode document. It has some fields that I'd like to specify/fill in in a manner similar to the way AUTHOR, TITLE, DATE are specified.

How do I define new document options?
How can I use them in exported documents?

Right now, I'm focused on LaTeX export, but might also want to do HTML output, in which case I would want to use the new options in a customized postamble.

What I have now:

#+OPTIONS: toc:nil 
#+AUTHOR: Dave
#+TITLE: write_me
#+DATE: 22 March 2018

#+LATEX_CLASS: myMemo 
#+LATEX_HEADER: \memoto{ Alice }

* Content 

myMemo is a modified version of this memo template. The original style uses some custom macros like memoto and memofrom to setup the To: and From lines in the memorandum. So far, I've modified most of the lines in myMemo.sty so that they use the values defined in the org file:

    \ifthenelse{\equal{\@memoto}{\relax}}{}{\item [{To:}] \@memoto}
    \item [{From:}] \@author
    \item [{Subject:}] \@title
    \item [{Date:}] \@date

so that the header portion of the memo uses the values defined by #+AUTHOR: ... etc. However, I don't see a good solution for being able to do the same thing for the To: item that doesn't involve defining a new option (so that line is unchanged from the original style file, and it is specified in the org file with at LATEX_HEADER command).

so, it seems to me that I need a new variable in order to be able to specify the other features I'd like to have in the header. I'd like to have something like this:

#+OPTIONS: toc:nil 
#+AUTHOR: Dave
#+TITLE: write_me
#+DATE: 22 March 2018

#+LATEX_CLASS: myMemo   
# The class file has been modified to make use of the RECIPIENT field
# in an appropriate way; for example using a \@recipient macro
# whose value is specified via the RECIPIENT line above

* Content

How do I do it?

  • Perthaps a macro?
    – NickD
    Commented Mar 23, 2018 at 16:55

1 Answer 1


There is a pretty complete example of doing this at https://github.com/jkitchin/scimax/blob/master/ox-cmu/ox-cmu-memo.el. The gist is you use the keywords like:

#+FROM: some name, etc
#+DEPARTMENT: Good stuff

Then create a custom exporter derived from the backend you want.

(org-export-define-derived-backend 'cmu-memo 'latex
  '((:department "DEPARTMENT" nil "Department of Chemical Engineering")
    ;; the name is a committee or your name
    (:fromname "FROMNAME" nil nil)
    ;; I am leaving out proftitle, location, telephone, email, and zipcode.
    (:to "TO" nil nil)
    (:from "FROM" nil nil)
    (:subject "SUBJECT" nil nil)
    (:cc "CC" nil "")
    (:signature-lines "SIGNATURE-LINES" nil t))
  :translate-alist '((template . cmu-memo-template))
  '(?M "Export with CMU Memo"
       ((?L "As LaTeX buffer" cmu-memo-export-as-latex)
    (?l "As LaTeX file" cmu-memo-export-to-latex)
    (?p "As PDF file" cmu-memo-export-to-pdf)
    (?o "As PDF file and open"
        (lambda (a s v b)
          (if a (cmu-memo-export-to-pdf t s v b)
        (org-open-file (cmu-memo-export-to-pdf nil s v b))))))))

The :translate-alist defines a function that builds the template, and in this template you can access the file keywords you defined to build up the document. Hopefully this helps.

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.