Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Emacs for writing, not for coding. Is there an easy way, in Emacs or Emacs org-mode, to define a text string as a variable so that I can use it repeatedly?

Example: I created a template It would be cool to put a variable like $CLIENTNAME in the headers, in the table, on the cover page, in #+TITLE:, and in the thank you, use that as a template, and then quickly generate a new PDF for each new client by just adding a line at the beginning like let $CLIENTNAME="Jane Doe".

How do I do this?

share|improve this question
up vote 5 down vote accepted

You want to use Macros (see the manual)

You can define them by using

#+MACRO: clientname Jane Doe

and then call them by inserting {{{clientname}}} in the document where desired.

On export {{{clientname}}} will expand to Jane Doe.

share|improve this answer
That only works within Org-Mode. – Jonathan Leech-Pepin May 17 '13 at 20:21
Thanks that works perfectly! – incandescentman May 17 '13 at 20:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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