7

Is it possible to include subscript and superscript text in the title of a legend item in QGIS ? I have tried using <sub>some text</sub> but this just appears in the title with no change to the contents.

I am looking to have layer titles such as

Annual NO2 concentration (μg/m3)

The superscript is not a big issue, as I can use the character map to get a 3, but I don't know how to get the subscript.

8

You can still use the character map to get subscript numbers in legend, as you can see below:

enter image description here

However, subscripts are supported only in some fonts. You can refer to this link to know which fonts support subscript.

Superscript are already supported in character map, so I think you already solved this issue.

To select the subscript and superscript do the following steps:

  1. Open Character Map by clicking the Start button, clicking All Programs, clicking Accessories, clicking System Tools, and then clicking Character Map.

  2. In the Font list, type or select the font you want to use (in this example I used Calibri font).

  3. Click the subscript (number 2) you want to insert into the legend.

  4. Click Select, and then click Copy.

  5. Open your QGIS go to legend item and position the cursor where you want the subscript (number 2) to appear, then paste.

In other words, you write "NO" directly in the legend, then copy the subscript number 2 from character map, and paste it directly into the legend after "NO", and do the same for superscript. You don't need to paste first into the MS Word, then copy again from MS Word to QGIS. You do everything directly in legend item in QGIS, as you can see below:

enter image description here

  1. Uncheck Auto Update
  2. Click on Legend item properties
  3. Write the desired words with special characters following the above procedures here:

enter image description here

Here is the final output which was purely created using font of legend item (HTML was not used), but you need to choose the proper font that support subscript and superscrip:

enter image description here

  • You meen, in MS word enter letters with NO₂ m⁵, and then copy it into legend. That's how I managed. – nagib May 10 '16 at 19:49
  • No, you do everything in legend item in QGIS. I added more information. – ahmadhanb May 11 '16 at 1:21
6

Maybe You can try like this.... enter image description here

  • Thanks. Is that using a new label, rather than the text in the Legend ? It should certainly work as a workaround, but it would be better if I could do something similar in the Legend text. – user3245448 May 9 '16 at 16:13
  • I think it is not possible to do in the legend. This is the html label – nagib May 9 '16 at 16:19
3

Dealing recently with this issue I have found very helpful website Tiny Text Generator - you simply write there number/text and it translates it to small caps, superscript and subscript. You can simply copy / paste into QGIS characters like ᵗʰ or ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁰ or ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₀ - if your character is one of mentioned you can actually copy it straight from this answer into QGIS.

Definitely Works in:

  • feature labels in map
  • composer legend
  • composer texts (labels)

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.