10

I am using QGIS 2.18. I want to make PART of a legend label/heading italic within print composer when creating a map layout (for example make part of my label italic if its a botanical name and keep the non botanical part normal text). I know it is possible to format entire text for Titles, Subgroups Groups and Items but this apply the style to the entire label. Is label expressions like ArcGIS implemented for legend text and headings to bold/italic/superscript part of a legend text?

I tried applying HTML formatting to the legend labels, without any success in the style properties and the print composer legend properties because I know it can be used for text boxes in Print Composer.

I can go back to ArcGIS but this will defeats my purpose.

Note: A similar question was asked in 2015. Is it possible to print one item legend item in italic in print composer? but it does not cover the issue that I need only a part of the label in italics.

3
  • You are labeling using one attribute field?
    – Techie_Gus
    Commented May 24, 2017 at 12:57
  • The explanatory label for each symbol in the Legend is in one Attribute. I want to apply like a VBScript to a symbol text so that part is italic and the rest of the symbol text in the Legend is normal. My field consist of a scientific name and a part that is not part of the scientific name. Similar concept apply what can a user do if part of a legend needs to be in subscript like for a chemical compound?
    – Umgwenya
    Commented May 25, 2017 at 13:11
  • I am coming back to this question because I have the same problem. Have there been any improvements in QGIS 3.x? I suspect this can be done using python but my knowledge of python is nonexisting. I am currently using QGIS3.22.
    – Umgwenya
    Commented Mar 3, 2023 at 6:06

4 Answers 4

5

I'm reasonably certain there's not a good way to do this. Here's a terrible, terrible workaround.

Cover the legend text that you want italicized with a label with the same text in italics. Select the legend and the label and Group Items so you don't accidentally move one without the other.

enter image description here enter image description here Ta DA!

Sadly, this isn't a joke. I used to do this a lot. Then I decided to just live with un-italicized botanical names, and hope that my former Plant Systematics professor never sees one of my maps. At least the genus is capitalized and the specific epithet is lower case.

3

This can be done for headings etc..., not sure about legend labels. For headings tick the 'Render as HTML' box and then use an HTML expression to define which bit you want in italics/bold etc.... <i> where you want the italics to start and </i> where you want them to finish.
So 'Map of <i>Vipera berus</i> sightings' becomes 'Map of Vipera berus sightings'

1

QGis 3.12. allows easily to use italics in all parts of the legend.

Producing legend labels with italic police is possible using the item properties panel, Font and text formatting menu. Every legend part font may be modified with its specific drop-down menu.

Italic has to be selected in the police style list. As italic is not proposed for every police, select a police that allows italic to see it appear in the police style list (e.g. Times New Roman).

0

I know this is an older thread, but I thought I'd answer anyway. It should work if you use the tags <ITA> and </ITA> around the portion of the text in the legend label that you want to italicize.

Symbol label example: <ITA>Washingtonia robusta</ITA> (Mexican fan palm)

Resulting legend class item appearance:

Screenshot of legend class label with "Washingtonia robusta" italicized and "(Mexican fan palm)" not italicized.

2
  • 1
    For me it's a solution for ArcGIS and not QGIS. Commented Jan 9, 2023 at 7:00
  • Oh man, you’re right. I must have mixed up the posts I was looking at. Apologies! Commented Jan 10, 2023 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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