How to get "+" text into the label

0 votes
asked Apr 2, 2020 in Question / help by bhwj (120 points)
How I do get a "+abc" as label text in a class diagram relations label name? If I use + it ends up as "o" in the label text.
commented Apr 3, 2020 by albert (3,520 points)
- Which version of plantuml are you using?

- Can you publish the source code you used?

- Can you publish the image you got?
commented Apr 3, 2020 by bhwj (120 points)

Hi,

- I'm using planttext editor, cant seem to find which version it is using.Do you have suggestions for any other editor ?

-

@startuml
allow_mixing
title General

class A
class B
A *-- B: +parameter

@enduml

-

commented Apr 3, 2020 by albert (3,520 points)

You will probably be able to get the version by means of

@startuml
version
@enduml
commented Apr 3, 2020 by plantuml (294,960 points)
As workaround, you can use the unicode notation :

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhCoSalZy_DhCZCI-SgoIp9ILLmJyrBBKhCuU9ApaaiBbPmXD9EN8uAMhgw2avM2ZQXsWO6Habs1Ob5YRcf9Qb5N0wfUIb0um00

It should also work with planttext.

Does it help you ?
commented Apr 3, 2020 by albert (3,520 points)

Looks like that in the original diagram the '+' is replaced by the "Icon for field" of a class diagram (see https://plantuml.com/class-diagram).

I don't know if this is the intention of the UML definition / this is the intention (probably it is).

I tried also to set:

skinparam classAttributeIconSize 0


but at that moment the '+' was completely gone!

The closest I could get is (not nice):

A *-- B: '+parameter'

commented Apr 3, 2020 by bhwj (120 points)
Thanks, using the unicode works..

Strange though, is + to Icon conversion intentional ?
commented Apr 3, 2020 by plantuml (294,960 points)

Strange though, is + to Icon conversion intentional ?

No, I'm not sure this is really intentional. The intention is theorically for class/object attributes. Not for labels.

It looks like a bug in that case : we are going to investigate anyway.

1 Answer

0 votes
answered Apr 5, 2020 by plantuml (294,960 points)
It looks like this bug is a feature :-)

See https://forum.plantuml.net/8294/support-visibility-on-compositions-and-aggregations

So right now, we are going to keep it like this.

I think the suggested workaround are useful enough.

Tell us if you do not agree !
commented Jan 27, 2021 by asm

Is this also supposed to happen on state diagrams?  This:

@startuml

[*] --> foo: -diff

[*] --> bar: +diff

@enduml


results in a state diagram with [box]diff and [circle]diff on the transitions.

...