Overriding sequenceMessageAlign for a single message in a sequence diagram?

0 votes
asked Sep 21, 2023 in Question / help by anonymous

In a sequence diagram, is it possible to override the text alignment setting for a single message?

I generally prefer center-aligned messages created using

skinparam sequenceMessageAlign center

but for a few messages, left alignment works better.

Is it possible to override the center alignment setting in individual messages?

1 Answer

0 votes
answered Sep 22, 2023 by The-Lu (65,440 points)

Hello A., and all,

Yes, for that you can use "Align text with `\l` and `\r`" locally, (or use style) as:

@startuml
skinparam sequenceMessageAlign center
a -> b : a\na b\na b c
a -> b : \la\na b\na b c
a -> b : \ra\na b\na b c
@enduml

Ref.:

Enjoy,
Regards,
Th.

commented Sep 22, 2023 by The-Lu (65,440 points)

Here is the example using style:

@startuml
<style>
.l {
 HorizontalAlignment left
}
.r {
 HorizontalAlignment right
}
</style>
skinparam sequenceMessageAlign center
a -> b : a\na b\na b c
a -> b <<l>>: a\na b\na b c 
a -> b <<r>>: a\na b\na b c
@enduml

Enjoy,
Regards,
Th.

commented Sep 22, 2023 by anonymous
Thank you very much for the answer and the quick reply!
...