##### 37.2.4.1 Creating a macro library

To create your own macro library:

1. Create a new text file for your macro library. Give the file extension .ini, and either place it in your project directory or specify an absolute path to its location. It is a good idea to use the same location for macro library files for all your DITA2Go projects.
2. Add macro definitions to the file, each in its own section, as described in §37.1.1 Defining macros.
3. Put a non-macro dummy section at the end of the file; for example:

   [End]

   Otherwise, the last macro in the library might cause an extra character to be included in output.

4. Make your library file reference d2rtf_macros.ini or d2htm_macros.ini, and make your project configuration file reference your library file. For example, suppose you create a text file called MyMacros.ini, and place it in D:\MacroLibs.

   In MyMacros.ini:

   [Templates]
   Macros = %OMSYSHOME%\d2g\d2htm_macro.ini

   In your project configuration file:

   [Templates]
   Macros = D:\MacroLibs\MyMacros.ini

   If you omit a path, DITA2Go looks for MyMacros.ini in your project directory.

Because MyMacros.ini is closer to your project configuration file in the chain of macro libraries, your macro definitions take precedence over any definitions of the same macros further away from your project configuration file in the chain.

Default macro library

If you do not specify a value for Macros, and you invoke a macro that is not defined in your project configuration file, DITA2Go looks in %OMSYSHOME%\d2g\macros for a file named d2htm_macros.ini or d2rtf_macros.ini.

Previous Topic: 37.2.4 Including macro definitions in your own macro library

Next Topic: 37.2.4.2 Creating a file-specific macro library

Parent Topic: 37.2.4 Including macro definitions in your own macro library

Sibling Topics:

37.2.4.2 Creating a file-specific macro library

37.2.4.3 Creating a chain of macro libraries

Table of Contents • Index