When creating a label thematic map, the superscript/subscript function can be achieved through the label expression. When the field of the label thematic map is text and superscripts or subscripts are needed in the text, by using expressions that meet specific rules and combining the 'superscript/subscript' function, the display of superscripts and subscripts can be realized.
Currently, the label thematic map types that support the superscript/subscript function are uniform label thematic maps, ranges label thematic maps, and matrix label thematic maps.
The superscript/subscript function is often used when labeling maps. For example, when labeling areas, it is necessary to label the unit of area: km2, which requires the use of superscript/subscript. To fully label the areas of various administrative regions with the unit: km2. In UDB data sources, the label expression is: Provinces_R.AREA||"km#+2" or Provinces_R.AREA||'km#+2'; if in Oracle data sources, the label expression is: Provinces_R.AREA||'km#+2'. The Provinces_R.AREA field records the area values of various administrative regions and is a double-precision field. During labeling, the numeric field is converted to text and then concatenated with the unit of area (km2) for display. Note: In UDB or Oracle data sources, the concatenation symbol for text is '||'. The effect is shown in the following figure:
Label Expression Rules
To achieve the effect of superscripts and subscripts, label expressions must be written according to certain rules:
- In a text expression containing superscripts and subscripts, #+ indicates superscript; #- indicates subscript, and #= indicates splitting a string into two superscript/subscript parts.
- For text labels that support label expressions, if they start with '#+', '#-', or '#=', the entire string is output as is.
- When encountering #+ or #-, the immediately following string is treated as superscript/subscript content. When encountering #+ or #- for the third time, a new string rule is applied.
- In a text expression containing superscripts and subscripts, two consecutive '#+' have the same effect as one '#-', and two consecutive '#-' have the same effect as one '#+'.
- Supports independent setting of italic effect for superscript/subscript text within labels.
After enabling the display of superscripts/subscripts, the label expression can use the #I marker to italicize subsequent text. Combined with superscript/subscript markers, independent italic effects for superscript/subscript text can be achieved. For example: For a polygon object label taking the area field Area, adding the unit square meters and setting the superscript text to italic, the expression is Area || 'm#+#I2'
- The italic effect of the #I marker terminates when encountering #+, #-, or #=, and does not cross these symbols. For example: In FieldName|| 'E#+#I2#-d', the subscript d is not italicized; it needs to be written as FieldName || 'E#+#I2#-#Id' to italicize d.
- If multiple #I appear between #+, #-, or #=, only the first one takes effect, and subsequent #I are treated as ordinary text.
Notes
- The alignment of labels with superscripts/subscripts can only be displayed as 'top-left' effect. The alignment of text labels without superscripts/subscripts is the same as the alignment set in the text style.
- Text labels with a rotation angle are not supported. When the rotation angle of a text label is not 0, the superscript/subscript function is invalid.
- When the map has a rotation angle, text labels set with superscripts/subscripts do not rotate with the map's rotation.
- Label along line does not support superscript/subscript.