support \l and \r in additon to \n

0 votes
asked Feb 4, 2015 in Wanted features by valexiev (1,100 points)
in additon to \n (new line, centered), dot supports \l (left aligned) and \r (right aligned).

Would be great if you support the same, at least for relation labels (but also for other labels where it makes sense)

2 Answers

+1 vote
answered Feb 4, 2015 by plantuml (257,860 points)
selected Feb 8, 2015 by valexiev
 
Best answer

Ok, thanks for the suggestion, we will have a look on this, and post a message here when this will be ready.

Note that there is a not-very-documented feature:

skinparam defaultTextAlignment left
class cl1
class cl2
cl1 -- cl2 : this is\non several\nlines

Does it fit your needs ?

+1 vote
answered Feb 4, 2015 by plantuml (257,860 points)

Please find here a beta version: https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

It supports:

@startuml
class cl1
class cl2
class cl3
class cl4
cl1 -- cl2 : this is\non several\nlines
cl2 -- cl3 : this is\lon several\llines
cl3 -- cl4 : this is\ron several\rlines
@enduml

 

Mixing \r \n and \l on the same label is not possible (yet). This is more difficult to implement, so please to use if you need to mix such alignment in the same label.

Thanks again for your suggestion!

commented Sep 20, 2019 by valexiev (1,100 points)

This works as a charm, for both class and link labels!

A minor addition: I like to leave a space after \l etc to improve readability, eg "class label\l left-aligned\l on several\l lines". But this messes up the alignment slightly (you can see it for "left" and "centered"). Could you remove one space around the newline indicator? Leave other spaces: I still want to use them to indent continuation lines by a small amount

...