Map Typography – Formatting Tags in ArcMap
Text formatting can be controlled through the use of formatting tags. The syntax is similar to html or xml tags. Formatting tags make controlling how your type appears much more efficient that using the graphical interface in ArcMap. Instead of going through multiple windos to set the character spacing for a piece of type, you can wrap the text with an opening tag <chr spacing=”150″> and a closing tag </chr>.
I keep a text file of these formatting tags open at all times while I’m working. I use notepad++ so I can have many files open in a tabbed manner, like tabs in a browser.
I’ve uploaded the text file I created with all the ArcMap formatting tags here and one with many of the dynamic tags here.
Now I’ll take you step by step to build the following text using only formatting tags.
start by adding a text box in ArcMap and paste the following:
title name
Project name & location
< 50 miles of coast
Now add the all caps tag around the title name text so that line reads
<acp>title name</acp>
This tag is not working because there are two invalid characters. The ampersand and less than character. When using formatting tags, you must replace these characters with a coded string. To display the ampersand, replace the &
with &
and the <
character with <
.
Your code should look like this:
<acp>title name</acp>
Project name & location
< 50 miles of coast
And the text in the layout like this:
Formatting tags will also not work if the case of the tags is inconsistent, you can’t start a tag in all caps and end it lowercase. You also cannot mix cases when using more than one tag.
Now add the italics tags <ita></ita> around the word name.
<acp>title <ita>name</ita></acp>
Project name & location
< 50 miles of coast
All tags must be closed and when using more than one tag, you must ensure that the are closed in the opposite order that they were opened. The first tag opened is the last tag closed.
Add this font tag around the entire first line:
<fnt name="Franklin Gothic Demi Cond" size="18"></fnt>
Now add another font tag for both the second and third line, open the tag at the start of the second line and close it at the end of the third line. Use the following:
<fnt name="Palatino Linotype" size="14"></fnt>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp>title <ita>name</ita></acp></fnt>
<fnt name="Palatino Linotype" size="14">Project name & location
< 50 miles of coast</fnt>
Notice the Properties window for the text still shows Arial 10 but there is no Arial in the display! Now add a font tag around only the third line, this time define only the size and not the typeface.
<fnt size="10"></fnt>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp>title <ita>name</ita></acp></fnt>
<fnt name="Palatino Linotype" size="14">Project name & location
<fnt size="10">< 50 miles of coast</fnt></fnt>
Add a bold tag around the second and third lines.
<bol></bol>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp>title <ita>name</ita></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol>Project name & location
<fnt size="10">< 50 miles of coast</fnt></bol></fnt>
The closing bold tag has to be placed between the two closing font tags because there is one font tag opened before the bold tag and one open after the bold tag.
Add an italics tag to the second line.
<ita></ita>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp>title <ita>name</ita></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol><ita>Project name & location</ita>
<fnt size="10">< 50 miles of coast</fnt></bol></fnt>
Add an underline tag to the third line.
<und></und>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp>title <ita>name</ita></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol><ita>Project name & location</ita>
<fnt size="10"><und>< 50 miles of coast</und></fnt></bol></fnt>
Add a color tag around the first line.
<clr cyan="63" magenta="52" yellow="51" black="100"></clr>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp><clr cyan="63" magenta="52" yellow="51" black="100">title <ita>name</ita></clr></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol><ita>Project name & location</ita>
<fnt size="10"><und>< 50 miles of coast</und></fnt></bol></fnt>
Not much of a change visually but now the black will print rich black instead of plain black. Notice that the color tag is closed outside the closing italics tag for the first line.
Add a color tag for the second line. If you have zero values the parameteres can be left out.
<clr cyan="100"></clr>
is the same, but shorter, as
<clr cyan="100" magenta="0" yellow="0" black="0"></clr>
Add a color tag for the third line.
<clr magenta="100"></clr>
<fnt name="Franklin Gothic Demi Cond" size="18"><acp><clr cyan="63" magenta="52" yellow="51" black="100">title <ita>name</ita></clr></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol><ita><clr cyan="100">Project name & location</clr></ita>
<fnt size="10"><und><clr magenta="100">< 50 miles of coast</clr></und></fnt></bol></fnt>
Finally, add a line tag around the entire text block to reduce the line spacing.
<lin leading="-4"></lin>
<lin leading="-4"><fnt name="Franklin Gothic Demi Cond" size="18"><acp><clr cyan="63" magenta="52" yellow="51" black="100">title <ita>name</ita></clr></acp></fnt>
<fnt name="Palatino Linotype" size="14"><bol><ita><clr cyan="100">Project name & location</clr></ita>
<fnt size="10"><und><clr magenta="100">< 50 miles of coast</clr></und></fnt></bol></fnt></lin>
Use your imagination and some creativity. Tags can be applied to one character in a string.
tes<acp><ita>t</ita></acp>
They can also be used in the legend through the table of contents text.
Use tags!
5 Comments
Whitney
October 2, 2015Hey Brian,
Excellent tips! Question though, what if you are using an advanced labeling expression? I have a written a Advanced Python Label Expression through Label Manager, and I can’t get ArcMap to recognize that, for instance, < is not just a text string.
Here is an example…
def FindLabel(value):
a = value
if a == “55” or a== “55.0”:
a = “<” + a
return a
Brian
October 6, 2015Hey Whitney, thanks! The “<" should be replaced with "& l t ;" [remove the spaces] if formatting tags are used. I may be reading the question wrong, though. You may have to convert a to a string before passing it to the labeler? str(a) or "<" + str(a)
BestRoland
May 9, 2018I see you don’t monetize your website, don’t
waste your traffic, you can earn extra cash every
month because you’ve got hi quality content. If you want to know how to make extra bucks, search
for: Ercannou’s essential adsense alternative
andry
March 20, 2019Hi Brian
Nice tips thank,
but how to turn all case to be lowercase? if “” use for uppercase and for lowercase what tag we can use? I tried to searching on Esri community but they always talk about Field Calculator or Label expression. In this case I want to do it in Text Properties when layout-ing.
andry
March 20, 2019Hi Brian
Nice tips thanks,
but how to turn all case to be lowercase? if “ACP” use for uppercase and for lowercase what tag we can use? I tried to searching on Esri community but they always talk about Field Calculator or Label expression. In this case I want to do it in Text Properties when layout-ing.