I would like to place the elevation-number of a point in a different front size and centred under its name:
Is that possible?
(That is my actual labeling:
label || '\n' || elevation)
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You can achieve what you want using Rule-Based Labeling, but you need to separate the labels located in one field into two fields. Rule-Based Labeling option enables you to add labels from different fields and customize them as you like by changing font name, color, size and use offset to place them above each other.
As you can see in the example below, I put the Japanese labels and English Labels into two fields and then controlled the appearance of each label as I wanted to be:
To do this:
Layer properties -> Labels
Placementfor the one of the labels so that they can be above each other. For the first label field I used the following placement settings:
For the second label field I used the following settings:
Tested on QGIS 3.0.1, But it can also applied in QGIS 2.18 because Rule-Based Labeling option is available.
Ignoring font size for the minute, you could achieve your first option by centering the label above the point, in QGIS 1.9 you have the option to center the text under the multiple lines section. If you have included a newline character in your expression you can leave the 'Wrap on character' box empty (or I put a slash in my expression instead of the '\n' and set that as the wrap-character - the wrap-character isn't shown). This will set your text centered as in your second option. For something like your first option, you could set the line height option to 2 or 3.
However, QGIS advanced labeling only has a single option for font size. So, to achieve the different font sizes, I think you will have to add your layer a second time and set the elevation font and position in there.
Unfortunately, this is not possible yet. For a related recent discussion check http://osgeo-org.1560.x6.nabble.com/HTML-tags-in-label-expresion-on-QGIS-2-0-1-td5084946.html.
There is also an existing feature request.
I used a duplicate of the same layer and labelled both with placements above and under respectively after checking 'show all labels and features for all layers' and it works!
This should be achieved using fonts symbols markers with the label background settings.
Unfortunately, there is a bug in the Characters Expressions… The fields datas are not rendered. The bug report explains in details how to proceed. https://github.com/qgis/QGIS/issues/36944