##### 37.1.1.2 Understanding where you can define named macros

You can put DITA2Go macro definitions in any of the following places:

- toward the end of a configuration file (or configuration template), before any [MacroVariables] section
- individually in separate macro files (see §37.2.3 Storing a macro definition in a separate file)
- in a macro library file (see §37.2.4 Including macro definitions in your own macro library).

Order does not matter

The relative order in which macro definitions appear is not important; what matters is the order in which they are invoked (see §37.1.2 Invoking a macro).

Do not end a file with a macro

Do not put a macro at the very end of a configuration file or library file. If you have no macro variables to define, and no [MacroVariables] section, end the file with a dummy section; for example:

    [End]

No macros in templates

Do not include macro definitions in a configuration template (see §39.5.2 Deciding what to include in a general configuration template).

Put complex macros in a separate file

If you create lengthy macros (for example, with a lot of conditional expressions), and you indent the code for readability, put the macros in a library file separate from the configuration file; or put each macro in its own macroname.txt file. That way the indentation is preserved. When DITA2Go updates the main configuration file as a consequence of changes you make to Export options, Windows rewrites the file, and deletes all leading spaces in the settings.

Previous Topic: 37.1.1.1 Understanding what a macro definition can include

Next Topic: 37.1.1.3 Escaping special characters in macro definitions

Parent Topic: 37.1.1 Defining macros

Sibling Topics:

37.1.1.1 Understanding what a macro definition can include

37.1.1.3 Escaping special characters in macro definitions

37.1.1.4 Managing line breaks in macro definitions

37.1.1.5 Including comments in macro definitions

37.1.1.6 Obtaining RTF code for macro definitions