This is the official manual for the latest Org-mode release.

Table of Contents

Next: , Previous: Include files, Up: Exporting

12.5 Macro replacement

You can define text snippets with

     #+MACRO: name   replacement text $1, $2 are arguments

which can be referenced {{{name(arg1, arg2)}}}1.

These references, called macros, can be inserted anywhere Org markup is recognized: paragraphs, headlines, verse blocks, tables cells and lists. They can also be used in keywords accepting Org syntax, e.g., #+CAPTION, #+TITLE, #+AUTHOR, #+DATE and some others, export back-end specific, ones.

In addition to user-defined macros, a set of predefined macros can be used:

These macros are replaced with the information available at the time of export.
This macro refers to the #+DATE keyword. FORMAT is an optional argument to the {{{date}}} macro that will be used only if #+DATE is a single timestamp. FORMAT should be a format string understood by format-time-string.
{{{modification-time(FORMAT, VC)}}}
These macros refer to the date and time when the document is exported and to the modification date and time, respectively. FORMAT should be a format string understood by format-time-string. If the second argument to the modification-time macro is non-nil, Org retrieves the information from the version control system, using vc.el, instead of the file attributes.
This macro refers to the filename of the exported file, if any.
This macro returns the value of property PROPERTY-NAME in current entry. If SEARCH-OPTION (see Search options) refers to a remote entry, it will be used instead.

The surrounding brackets can be made invisible by setting org-hide-macro-markers non-nil.

Macro expansion takes place during the very beginning of the export process.


[1] Since commas separate arguments, commas within arguments have to be escaped with a backslash character. Conversely, backslash characters before a comma, and only them, need to be escaped with another backslash character.