Adding attributes with subscript or superscript text?

2385
9
02-15-2018 06:51 AM
petegillard
New Contributor III

is there a way to add attributes in a feature class with subscript or superscript characters? It's geology 'stuff' with attributes like lsb'p'. where the 'p' is subscript. i know it can be done with labels, but am trying to add it in a feature class table.

Thanks in advance for any ideas,

Pete

9 Replies
DanPatterson_Retired
MVP Esteemed Contributor

In python 3.x... it is all Unicode, but you need to know your encoding codes

"10{}".format('\u00B2')  # superscript 2

'10²'‍‍‍

https://docs.python.org/3/howto/unicode.html

https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts

But don't get excited ... it works in scripts when printing, but I will let you do a test in featureclass tables.

You can try the ALT number on your numeric keypad approach to get some of them

petegillard
New Contributor III

Thanks very much,

but I couldn't get it to read it as 'code'. as a text field, it just calculated it verbatim.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

yes,,, it won't appear until printed... try the ALT num pad  alt key, number sequence from your numeric key pad... ie ALT 248 is the degree sign

petegillard
New Contributor III

Thank you!

Actually, turns out the <SUB> x</SUB> format worked. It hadn't occurred to me that it would label properly, though not showing up in the table that way.................(?!)

thanks!

Pete

0 Kudos
MichaelHuber
New Contributor III

I am also looking for an answer to this. <SUB> x</SUB> wont help me as it will make the whole attribute a subscript. I am looking for the attribute to retain its subscript / superscript properties. For example, I need to label points using chemical formulas that have both subscripts and superscripts... And these chemical formulas are in the attribute table of my shape/feature

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

They won't stay in the table as superscripts and subscripts.  The best you can do is produce an html-like string so that it can be printed as such

0 Kudos
MichaelHuber
New Contributor III

I was afraid of that... darn. I have far too much data to do it all manually though html or unicode.

Maybe ESRI will address that in a future version? As I know Arc is widely used among scientists and I can't be the only person with this issue. 

Thanks for getting back to me Dan!!

0 Kudos
petegillard
New Contributor III

HI Michael,

Dan helped me with this awhile back, and mine did work. If i put H <SUB>u</SUB>BP<SUB>x</SUB>, in the field

it did label as "HuBPx" in the map, just looked like code in the table. ?

0 Kudos
MichaelHuber
New Contributor III

I was able to find an answer to my question if anyone else is having this issue: https://gis.stackexchange.com/questions/289694/labeling-using-chemical-formulas-with-subscripts-and-... 

0 Kudos