Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 invoice.org. 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

1 Answer 1

up vote 2 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
1  
That only works within Org-Mode. –  Jonathan Leech-Pepin May 17 '13 at 20:21
    
Thanks that works perfectly! –  Peter Salazar May 17 '13 at 20:28

Your Answer

 
discard

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.