How to display labels as fractions?

2182
4
10-01-2019 01:15 AM
JanisMitkovs
New Contributor

Hello!

I want to know whether it's possible to write label expression that displays fractions. I have points that contains list of tree species, height and diameter and I need to make them look like this:

My current expression displays each attribute in their own line but I need everything in single row.

def FindLabel ( [TREE], ,  ):
  if [SDS]:
     return "<FNT size = '6,5'>"+[TREE] + "</FNT>"'\n' +  "<UND><FNT size = '6,5'>"  +   +"</FNT></UND>" + '\n' +"<FNT size = '6,5'>" +  +"</FNT>"‍‍‍‍‍‍‍‍‍‍‍‍

I checked text formatting tags Formatting tags available in ArcMap—Help | ArcGIS for Desktop but none of them allows to create fractions. I also tried using placement properties and defined each class separately. Perhaps there is some other way to make it work.

I'm using ArcMap 10.3.1

Any help is appreciated.

Thanks,

Janis

0 Kudos
4 Replies
TedKowal
Occasional Contributor III

Perhaps in your label expression create an out put like this:

"<sup>"& [YourNumeratorField]& "</sup>"&"/" & "<sub>" & [YourDenominatorField]&" </sub>"

JanisMitkovs
New Contributor

Thank you!

Not exactly what I wanted but this is a lot better of what I have.

0 Kudos
TedKowal
Occasional Contributor III

The only other way to get what you want that I am aware of is to use CSS styling and HTML format to force centering of super and subscripts stacked over a horizontal line.  This would not be easy to implement in ArcMap.

html - How to display "Classic" built-up fractions with an horizontal line in CSS / JavaScript? - St... 

0 Kudos
TedKowal
Occasional Contributor III

To make my last one easier this is an idea request which you may want to vote on..

https://community.esri.com/ideas/9592