tut: Text Multi-Line

(return to Cartography Tutorials page)

Creating Multi-Line Labels using VBScript

By default, Labels created in ArcMap are on a single line. Labels can be broken into multiple lines using Label Expressions. By default, Expressions are created using VBScript (Visual Basic). See below for notes on using Python.

Using Expressions

In the Layer Properties dialog box, choose the Labels tab and click the Expression... button

Properties dialog highlighting labels tab and expression button

First we'll build a simple expression using two fields (joined with the & symbol)

Example expression: [STATE_NAME] & [POP2000]|  

Graphical map of northwest states with numbers attached without spacing

Note that the results lack a space between the two fields...

This can be corrected by adding a string of text between the two fields. Text strings need to have double (full) quotes around them: i.e., "some text"

Adding Custom Text to a Label Expression

Dialog with expression including two quotation marks between two ampersands

Graphical map of pacific northwest showing state names and numbers with proper spacing

Alternatively, we can add a Line Feed (or Carriage Return) between the two fields.

Breaking a Label into Multiple Lines

Text "VBNewline" between two ampersands in Expression dialog box

VBnewline is short for Visual Basic New Line (note that VBLF also works, short for VB Line Feed, as does VBCR, short for VB Carriage Return)

Graphical map of northwest showing state names on first line and numbers on second line

 

Stacking labels and custom text additions can be combined:

Text "VBNewline & Population: 2000" between ampersands in Expression dialog

Graphical map of northwest with state name, population, and string of numbers

 

Note that the above examples have been using VBScript (Visual Basic Script). You can accomplish similar results using Python or JScript. 

 

Multi-Line Labels Using Python

To use Python, choose Python from the Parser drop-down menu at the bottom  of the Label Expression dialog box (the default is VBScript)

To combine multiple labels, use the + symbol (instead of the &):      
                                                [STATE_NAME] + [POP2000] 

To add custom text use the + and a text string (note text string is in double quotes) :                                   
                                                [STATE_NAME] + " " + [POP2000] 

                                                 "The name of this state is " + [STATE_NAME]

To add a line feed use '\n' (note the single quotes):
                                                [STATE_NAME] + '\n' + [POP2000]                                                                            

 

(return to Cartography Tutorials page)