最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Sequence Diagram participantactor name with newline on PlantUML - Stack Overflow

matteradmin8PV0评论

How to use a newline in a sequence diagram participant / actor name ? It would be particularly useful when you have a long name like this:

 ┌───┐          ┌─────────────────┐
 │Bob│          │VeryLongAliceName│
 └─┬─┘          └────────┬────────┘
   │       hello         │         
   │────────────────────>│         
 ┌─┴─┐          ┌────────┴────────┐
 │Bob│          │VeryLongAliceName│
 └───┘          └─────────────────┘

I'd like to have it like this:

                ┌─────────┐
 ┌───┐          │VeryLong │
 │Bob│          │AliceName│
 └─┬─┘          └────┬────┘
   │     hello       │     
   │────────────────>│     
 ┌─┴─┐          ┌────┴────┐
 │Bob│          │VeryLong │
 └───┘          │AliceName│
                └─────────┘

How to use a newline in a sequence diagram participant / actor name ? It would be particularly useful when you have a long name like this:

 ┌───┐          ┌─────────────────┐
 │Bob│          │VeryLongAliceName│
 └─┬─┘          └────────┬────────┘
   │       hello         │         
   │────────────────────>│         
 ┌─┴─┐          ┌────────┴────────┐
 │Bob│          │VeryLongAliceName│
 └───┘          └─────────────────┘

I'd like to have it like this:

                ┌─────────┐
 ┌───┐          │VeryLong │
 │Bob│          │AliceName│
 └─┬─┘          └────┬────┘
   │     hello       │     
   │────────────────>│     
 ┌─┴─┐          ┌────┴────┐
 │Bob│          │VeryLong │
 └───┘          │AliceName│
                └─────────┘
Share Improve this question edited Nov 18, 2024 at 7:28 Geert Bellekens 13.8k3 gold badges29 silver badges55 bronze badges asked Nov 16, 2024 at 10:49 pochopsppochopsp 1,0531 gold badge10 silver badges24 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Just wrap your participant name in double quotes ", then you can use the newline escape sequence \n to break the name in two lines, like this:

@startuml
Bob -> "VeryLong\nAliceName": hello
@enduml
Post a comment

comment list (0)

  1. No comments so far