### 5.4 Determining how an element is rendered

Suppose your DITA source includes element <example>, and you would like to know how this element will be rendered in RTF output. For this exercise, you will need to inspect four different configuration files:

    %omsyshome%\d2g\system\config\d2g_config.ini
    %omsyshome%\d2g\system\formats\d2rtf_formats.ini
    %omsyshome%\d2g\system\formats\d2rtf_subformats.ini
    %omsyshome%\d2g\system\lang\d2g_lang_en.ini

In each case, using your text editor to look for “example” will take you to the right place immediately.

To find out which output format is assigned to element <example>, search for “example” in the following file:

    %omsyshome%\d2g\system\config\d2g_config.ini

Here you will find “example” in a section that assigns formats to elements, according to the DITA context of each element:

    [BlockFormatMaps]
    ...
    prereq/taskbody/*=Prereq
    context/taskbody/*=Context
    example/taskbody/*=Example    <-----
    postreq/taskbody/*=Postreq
    result/taskbody/*=Result
    ...

These are all <task>-specific format assignments. If your <example> element is in a <task> topic, you now know that it will be rendered using output format Example.

If your <example> element is not in a <task> topic, you will have to add an assignment that represents the context in which the element occurs in your DITA source. In your project configuration file (_d2rtf.ini for RTF output) include a setting such as the following:

    [BlockFormatMaps]
    example/$body/*=Example

See §6.4 Mapping element paths to output formats.

(It is best to start by adding new settings to the bottom-level configuration file. Later you can move the settings to a configuration file that has a wider scope to include other projects.)

To find the definition of format Example, search for “Example” in the following format configuration file:

    %omsyshome%\d2g\system\formats\d2rtf_formats.ini

The definition is short, because Example is based on format Body, and inherits all the properties of the latter:

    [Example]
    based = Body
    runin = ExampleHead

This definition makes Example a plain body paragraph, with a run-in heading; see §6.5.4 Assigning run-in headings to format-name prefixes.

A run-in heading is a type of subformat; subformats are defined in file:

    %omsyshome%\d2g\system\formats\d2rtf_subformats.ini

In this file you will not find a separate definition of the run-in heading for format Example, because it is identical to another run-in heading, to which it is aliased:

    [FormatAliases]
    ExampleHead = ItalicHead

See §7.3 Creating aliases to existing format names.

The definition of ItalicHead makes this heading italic:

    [ItalicHead]
    form = <i><name/> <spc/></i>

See §8.6 Configuring run-in headings for text formats.

Subformat component <name/> determines the content of the run-in heading. Content of each type of run-in heading is specified in language configuration files. For English, look in the following file:

    %omsyshome%\d2g\system\lang\d2g_lang_en.ini

Here you will find text for a variety of run-in headings. For the Example format:

    [RuninHeadText]
    ExampleHead = For example:

If you want to change the content of the heading, make the change in your project configuration file. For example:

    [RuninHeadText]
    ExampleHead = [Example]

For internationalization, if you want headings and labels in French, you could make your project configuration file reference the French language configuration file instead:

    [Templates]
    Languages = %omsyshome%\d2g\system\lang\d2g_lang_fr.ini

Here the setting is a little different:

    [RuninHeadText]
    ExampleHead = Par exemple:

Previous Topic: 5.3.4 Changing the spacing

Next Topic: 6. Mapping elements to output formats

Parent Topic: 5. Modifying output appearance

Sibling Topics:

5.1 Understanding where to modify formats

5.2 Understanding how to modify formats

5.3 Changing how the output looks