Skip To Content

Text formatting tags

ArcGIS Pro text formatting tags allow you to modify the formatting for a portion of text. This allows you to 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. 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, dynamic text, and the values of fields used to label features. Tags aren't resolved by the Contents pane or table view, or in pop-ups, so tags added to field values will be visible as tags in those areas.

View a table of the available text formatting tags

Dynamic text is another type of formatting tag, which changes graphic text dynamically based on the current value of its respective property. Dynamic text tags can be used together with text formatting tags to create dynamic mixed-format text on the page layout.

Learn more about working with dynamic text

Formatting tag syntax

Formatting tags have different syntax depending on whether they are used in annotation or in a label expression. In annotation, the tags are concatenated to the text string with no special characters:

Annotation
<BOL>Text</BOL>

In label expressions, the formatting tags must be surrounded by double quotation marks and concatenated to other parts of the expression using the ampersand (&) operator:

Label Expression
"<BOL>" & "Text" & "</BOL>"
"<BOL>" & [LABELFIELD] & "</BOL>"

You can use values from a field to populate the formatting tag values:

Label Expression
"<FNT size= '" & [Size] & "'>" & "Text" & "</FNT>"
"<FNT size= '" & [Size] & "'>" & [LABELFIELD] & "</FNT>"

Learn more about building label expressions

The following syntax rules apply to formatting tags in ArcGIS Pro:

  • The ArcGIS Pro 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.
    Annotation
    <BOL><UND>Text</UND></BOL>
    Label Expression
    "<BOL><UND>" & [LABELFIELD] & "</UND></BOL>"
  • Tag attributes may be surrounded by either single or double quotation marks. The following statements are equivalent:
    Annotation
    <FNT name='Arial' size='18'>My text</FNT>
    <FNT name="Arial" size="18">My text</FNT>
    Label Expression
    "<FNT name=""Arial"" size=""18"">" & [LABELFIELD] & "</FNT>"
    "<FNT name='Arial' size='18'>" & [LABELFIELD] & "</FNT>"
  • The case of tag pairs must match exactly. Therefore, <BOL>...</BOL> is valid, as is <bol>...</bol>, but <Bol>...</bol> is invalid.
  • Any unrecognized, balanced tag pairs are ignored by the parser. For example, even though <notag> is not a valid ArcGIS Pro formatting tag, the following string is valid and will be displayed properly:
    Annotation
    <notag><BOL>State College<BOL></notag>
    Label Expression
    "<notag><BOL>" & "State College" & "<BOL></notag>"
  • 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 &amp; and &lt; instead.

    Annotation

    Instead of <ITA>John & Paul</ITA>, use:

    <ITA>John &amp; Paul</ITA>
    Label Expression

    This expression displays the values of the label field inside < > characters:

    "<ITA>&lt;" & [LABELFIELD] & "></ITA>"
    Label Expression

    If you have special characters embedded in the values of the label field, you can replace them dynamically using a simple label script:

    Function FindLabel ([LABELFIELD])
      NewString = Replace([LABELFIELD],"&","&amp;")  
      FindLabel = "<ITA>" & NewString & "</ITA>"
    End Function

  • 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 Labeling tab and on the Label Class pane's Symbol tab 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 drop-down list on the Labeling tab does not reflect this change when the label is displayed on the map; it shows you the font of the text's base symbol.
  • 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 has no effect. Also, because tags follow the rules of XML, it would be illegal to 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.
    Annotation
    This is bold if the base text symbol is bold <_BOL>, but this is not: </_BOL>
    Label Expression
    "This is bold if the base text symbol is bold <_BOL>, but this is not: </_BOL>"

Use text formatting tags with Maplex Label Engine formatting parameters

Text formatting tags are designed to override the properties assigned to the text symbol of a label class. The Maplex Label Engine detects text formatting tags during the label placement process. Because text formatting tags dictate a label's appearance and override formatting parameters, the Maplex Label Engine switches off its formatting parameters for a label class in some cases when it detects a text formatting tag in a label string.

The following are situations where text formatting tags are either ignored or change the behavior of the Maplex Label Engine:

  • The character spacing text formatting tag is ignored by the Maplex Label Engine. Character spacing (letter spacing) must be set in the text symbol to be respected.
  • The word spacing text formatting tag is ignored by the Maplex Label Engine. Word spacing must be set in the text symbol to be respected.
  • Font reduction behavior in the Maplex Label Engine is turned off when a label has either a font size or leading text formatting tag.
  • Labels containing text formatting tags are not abbreviated by the Maplex Label Engine when using an abbreviation dictionary.

If some labels from a label class have text formatting tags but none of them are present in the current map extent, no text formatting tags are detected, and the text formatting tag restrictions above do not come into effect.

Additional text formatting tags supported with the Maplex Label Engine

The Maplex Label Engine offers an additional unique tag: Base

"<BSE>" & [FIELDNAME] & "</BSE>"

When multiple label fields are used to label a feature, it is necessary to designate which label is the key or base label. The base label is used for the placement strategies, and the other labels are placed in relation to the base label.

The Base tag is only supported by the Maplex Label Engine. If the Standard Label Engine encounters the <BSE> tag, the <BSE> tag is ignored and removed before the label is placed.

As an example, the label class in the following image has a placement location of East, so the label is placed due east of the point features. By associating the Base tag label with the first line in the label expression, you control how the complete label expression is placed relative to the feature.

"<BSE>" & [Name] & "</BSE>" & vbnewline & "Population: " & [Pop2000] & vbnewline & "Median Age: " & [MED_AGE]
<BSE> formatting tag

Additional tips for building label expressions

The following tips will help you build your label expressions:

  • To check the validity of label expressions containing text formatting tags, use Apply to apply your changes and view the labels on the map. In the case of invalid formatting tags or syntax, tags appear as plain text in the map labels.
  • Tags are not interpreted by Python, VBScript, or JScript. Instead, they are passed to the ArcGIS Pro framework as plain text to be dynamically formatted as they are drawn. You don't need to quote tags included inside quoted strings.
    "Current <BOL>status</BOL> of parcel: " & [LABELFIELD]
  • Formatting tags can be embedded in the values of the field you use to label a layer's features whether or not you use a label expression. In this way, you can change the format of any portion of a particular value in a label field. To embed formatting tags, the label field must be of string type. Tags and tag attributes used in field values do not need to be surrounded by quotation marks, so the following are valid values for a label field:
    <ITA>Rochester</ITA>
    <FNT size='14'>C</FNT>olorado

Available text formatting tags

The following formatting elements and tags are supported in ArcGIS Pro. The table provides syntax examples for Annotation and Labeling. The Annotation syntax applies to all text used in the data frame and in the page layout, and the values of fields used to label features and for annotation. The Labeling syntax applies to dynamic label expressions. In all of the Labeling syntax examples, the formatted text can be replaced by a label field.

Element descriptionStart tagEnd tagValid attributes/valuesNoteExample syntaxExample output

Font name and/or font size

<FNT>

</FNT>

name = {TrueType font} size = {1} scale = {1-}

Set either name, size, scale, or all of them.

Annotation

<FNT name = "Arial" size = "12">Text size = 12</FNT> <FNT name = "Arial" scale="200">Text scale = 200</FNT>

Labeling

"<FNT name = 'Arial' size = '12'>" & "Text size = 12" & "</FNT>" & "<FNT name = 'Arial' scale='200'>" & "Text scale = 200" & "</FNT>"

Font example

Color (RGB)

<CLR>

</CLR>

red, green, blue = {0–255}

alpha = {0–100}

Note:

The alpha value is opacity of the text.

Missing red, green, blue attributes assumed = 0

Missing alpha attribute assumed = 100

Annotation

<CLR red = "255">Text</CLR>

Labeling

"<CLR red = '255'>" & "Text" & "</CLR>"

Color (RGB) example

Color (CMYK)

<CLR>

</CLR>

cyan, magenta, yellow, black, alpha = {0–100}

Note:

The alpha value is opacity of the text.

Missing attributes assumed = 0

Missing alpha attribute assumed = 100

Annotation

<CLR magenta = "100">Text</CLR>

Labeling

"<CLR magenta = '100'>" & "Text" & "</CLR>"

Color (CMYK) example

Bold

<BOL>

</BOL>

none

Annotation

<BOL>Text</BOL>

Labeling

"<BOL>" & "Text" & "</BOL>"

Bold example

Italic

<ITA>

</ITA>

none

Annotation

<ITA>Text</ITA>

Labeling

"<ITA>" & "Text" & "</ITA>"

Italic example

Underline

<UND>

</UND>

none

Annotation

<UND>Text</UND>

Labeling

"<UND>" & "Text" & "</UND>"

Underline example

All capitals

<ACP>

</ACP>

none

Annotation

<ACP>Text</ACP>

Labeling

"<ACP>" & "Text" & "</ACP>"

All capitals example

Small capitals

<SCP>

</SCP>

none

Annotation

<SCP>Text</SCP>

Labeling

"<SCP>" & "Text" & "</SCP>"

Small capitals example

Superscript

<SUP>

</SUP>

none

Annotation

E = mc<SUP>2</SUP>

Labeling

"E = mc" & "<SUP>" & "2" & "</SUP>"

Superscript example

Subscript

<SUB>

</SUB>

none

Annotation

H<SUB>2</SUB>O

Labeling

"H" & "<SUB>" & "2</SUB>" & "O"

Subscript example

Character/Letter spacing

<CHR>

</CHR>

spacing = {1-}

Expressed as the percentage adjustment to regular character/letter spacing; 0% means no adjustment.

Annotation

<CHR spacing = "200">Text</CHR>

Labeling

"<CHR spacing = '200'>" & "Text" & "</CHR>"

Character/Letter spacing example

Character/Letter width

<CHR>

</CHR>

Expressed as the percentage adjustment to regular character/letter width; 0% means no adjustment.

Annotation

<CHR width="150">Text</CHR>

Labeling

"<CHR width='150'>" & "Text" & "</CHR>"

Character/Letter width example

Word spacing

<WRD>

</WRD>

spacing = {1-}

Expressed as the percentage of spacing between words; 100% means regular spacing.

Annotation

<WRD spacing = "200">Extra Word Spacing</WRD>

Labeling

"<WRD spacing = '200'>" & "Extra Word Spacing" & "</WRD>"

Word spacing example

Line leading

<LIN>

</LIN>

leading = {1-}

Expressed as the adjustment to regular line spacing (in points); 0 points means no adjustment.

Annotation

<LIN leading = "25">Text with a leading value of 25 points</LIN>

Labeling

"<LIN leading = '25'>" & "Text with a leading value of 25 points" & "</LIN>"

Line leading example

Un-Bold

<_BOL>

</_BOL>

none

Annotation

The base text symbol is bold, <_BOL> but this part is not.</_BOL>

Labeling

"The base text symbol is bold, " & "<_BOL>" & " but this part is not." & "</_BOL>"

Un-Bold example

Un-Italic

<_ITA>

</_ITA>

none

Annotation

The base text symbol is italic, <_ITA> but this part is not.</_ITA>

Labeling

"The base text symbol is italic, " & "<_ITA>" & " but this part is not." & "</_ITA>"

Un-Italic example

Un-Underlined

<_UND>

</_UND>

none

Annotation

The base text symbol is underlined, <_UND> but this part is not.</_UND>

Labeling

"The base text symbol is underlined, " & "<_UND>" & " but this part is not." & "</_UND>"

Un-Underline example

Un-Superscript

<_SUP>

</_SUP>

none

Annotation

<SUP><_SUP> This text is regular, but </_SUP> this text is superscript.</SUP>

Labeling

"<SUP><_SUP>" & "This text is regular, but" & "</_SUP>" & " this text is superscript." & "</SUP>"

Un-Superscript example

Un-Subscript

<_SUB>

</_SUB>

none

Annotation

<SUB><_SUB>This text is regular, but </_SUB> this text is subscript.</SUB>

Labeling

"<SUB><_SUB>" & "This text is regular, but" & "</_SUB>" & " this text is subscript." & "</SUB>"

Un-Subscript example

Base

<BSE>

</BSE>

none

Marks base text string used for primary label placement (Maplex Label Engine only).

Annotation

<BSE>College Station</BSE>Population: 67890 Median Age: 21.9

Labeling

"<BSE>" & "College Station" & "</BSE>" & vbnewline & "Population: 67890" & vbnewline & "Median Age: 21.9"

Base example

Available formatting tags