3

I read the: "Subscript labels in QGIS legends" thread.
I would like to follow up on this for nautical notations.

One Z-value, when displayed, must be displayed in normal script and subscript.
For example: If you want to display the value 9,3 it is supposed to be displayed in the nautical notation as: normal script: 9 subscript: 3

Is there a way to format the label of the value in this manner? Note that heights above datum have an underscore under the whole digits.

how i display it now[![][1]]2

1

I solved it like this.
It's not elegant, but it works.
The label displays a value called "VALSOU"

  • Set labels to "rule based"
  • Made two labels: 1 called "whole", 1 called "decimal"
  • no expressions set as rule
  • text for label "whole":
    if(to_int( "VALSOU") > "VALSOU",(to_int( "VALSOU") -'1'),to_int("VALSOU"))
    This killed of the decimal from the whole number. I added the -1 because the [to_int(] rounds of the number. Without it 5.6 becomes 6 and then I'm off by a meter in my chart.

  • text for label "decimal":

    CASE
    WHEN to_int("VALSOU")>"VALSOU" THEN to_int(("VALSOU"-(to_int("VALSOU")-'1'))'10')
    WHEN to_int("VALSOU")< "VALSOU" THEN to_int(("VALSOU" - (to_int("VALSOU")))
    '10')
    END

This killed of the whole number and displays the decimal as a whole number.

After this it's a matter of changing the position of the label "whole" and "decimal" relative to the geometry and eachother. the end result

| improve this answer | |
0

One idea would be creating a point layer of your labels. The regular underlined value would be a label and the subscript could be a font marker. You can create an expression in Character(s) to input the desired value.

Moving your anchor points of the font marker:

enter image description here

and the quadrant placement of your label:

enter image description here

can create the effect of a subscript. The following image has been made using this method.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.