About text formatting tags
ArcGIS text formatting tags let you modify the formatting for a portion of text. This lets you create mixed-format text where, for example, one word in a sentence is underlined. Text formatting tags can be used almost anywhere text is placed on or around the map in ArcMap. You can use the tags anywhere you can specify both a text string and a text symbol. For example, you can use tags in dynamic label expressions, annotation, legend text, map titles, and in the values of fields used to label features. Tags aren't resolved by the ArcMap table of contents, Table window, or Identify Results window, so tags added to field values will be visible as tags in those windows.
View a table of the text formatting tags available in ArcMap.
Dynamic text is another type of formatting tag, which changes graphic text dynamically based on the current value of its respective property. It is only available in layout view. Dynamic text tags can be used together with text formatting tags to create dynamic mixed-format text on the page layout.
The following syntax rules apply to formatting tags in ArcMap:
- The ArcGIS text formatting tags adhere to XML syntax rules. Each start tag must be accompanied by an end tag. Tags can be nested, but you must close the inner tag before closing an outer tag:
- The case of tag pairs must match exactly. Therefore, <BOL>...</BOL> is valid, as is <bol>...</bol>, but <Bol>...</bol> is invalid.
- Tag attributes may be surrounded by either single or double quotes. The following two statements are equivalent:
<FNT name='Arial' size='18'>My text</FNT> <FNT name="Arial" size="18">My text</FNT>
- Any unrecognized, balanced tag pairs will be ignored by the parser. For example, even though <notag> is not a valid ArcGIS formatting tag, the following string is valid and will be displayed properly:
- The ampersand (&) and angle bracket (<) are special characters and are not valid in your text if formatting tags are used. Use the equivalent character codes & and < instead. For example, instead of <ITA>John & Paul</ITA>, use <ITA>John & Paul</ITA>.
- Every piece of text on a map has a symbol that is used when it is drawn. Formatting tags work by temporarily modifying this base text symbol and drawing the specified portion of the text with the formatting specified in the tag. The buttons and commands on the Draw toolbar and in the Symbol Selector always reflect the properties of the base text symbol for the selected piece of text and do not reflect modifications made using formatting tags. For example, if you use the <FNT> tag to change the font of a piece of text, the Font menu on the Draw toolbar will not reflect this change when this text is selected on the map; it will show you the font of the text's base symbol. Text formatting tags can be used for any legend text; however, they are most useful for legend descriptions. Descriptions are extra pieces of textual information for a layer symbology class that can appear on the legend but do not appear in the table of contents.
- Tags have no effect on a piece of text if they simply repeat an existing property of the base text symbol. Generally, this behavior is intuitive; for example, if you have a <BOL> tag in your text string but the base text symbol is already bold, the <BOL> tag in your string will have no effect. Also, because tags follow the rules of XML, it would be illegal to try and use a </BOL> tag to turn off the bold property of a base text symbol. Instead, you can use the <_BOL> tag for this purpose.
- You can include formatting tags in label expressions.