Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document
Formatting Information — An introduction to typesetting with LATEX
Chapter 7: Programmability
Section 7.1: Simple replacement macros
In its simplest form, a LATEX macro can just be a straightforward text replacement of a phrase to avoid lengthy retyping with the possibility of misspelling something each time you need it, eg
\newcommand{\EF}{European Foundation for the Improvement of Living and Working Conditions}
Put this in your Preamble, and you can then use \EF in your document and it will typeset it as the full text. Remember that after a command ending in a letter you need to leave a space to avoid the next word getting gobbled up as part of the command (see the note ‘Four rules for spacing in LATEX documents’ above). If you want to force a space to be printed after the expansion, use a backslash followed by a space, eg
The \EF\ is a member institution of the Commission of the European Union.
As you can see from this example, the \newcommand command takes two arguments: the name you want to give the new command, and the expansion to be performed when you use it, so there are always two sets of curly braces after a \newcommand. The names of new commands created like this MUST be made of the letters A–Z and a–z only, and must not be the names of existing commands.