17

I wonder if there is any way to make a plantuml two sequence diagram in single page side by side. I want to keep the same actor names in both diagram. Currently if I do something like below, it automatically combined into single sequence diagram.

@startuml
Bob -> Alice : hello
@enduml

@startuml
Bob -> Mark : Hi
@enduml

sample

But expected two sequence side by side

Fuhrmanator
  • 11,459
  • 6
  • 62
  • 111
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256

2 Answers2

23

newpage: The newpage keyword is used to split a diagram into several images.

@startuml

header SayHello
footer Page %page% of %lastpage%

Bob -> Alice : hello

newpage last page

Bob -> Mark : Hi

@enduml

Result:

enter image description here

Reference

You also could define a variable like "PAGE_SETTING" to decide whether on or off it.

@startuml

' seton demo
!define PAGE_SETTING newpage

header SayHello
footer Page %page% of %lastpage%

Bob -> Alice : hello

PAGE_SETTING

Bob -> Mark : Hi

@enduml

Result:

enter image description here

Reference:Macro definition

Carson
  • 6,105
  • 2
  • 37
  • 45
  • Wow thats exactly what I wanted. Thanks Carson Arucard. – Sazzad Hissain Khan Feb 13 '19 at 13:36
  • dont know if something has changed, but it is not working anymore.. – Michał Margiel Mar 25 '21 at 11:43
  • Hi @MichałMargiel , This post has been up for a while. You said it suddenly didn't work, so I thought there might be some changes in the new version, and after I updated all the packages ( [plantuml.1.2021.3.jar](https://plantuml.com/en/download) | [Graphviz 2.47.0](https://graphviz.org/download/) ) and tried again, it still worked. hope you can solve the problem successfully! – Carson Mar 26 '21 at 02:17
  • @Carson, maybe its because i am trying onhttp://www.plantuml.com/ and I dont see any way how to display all pages. – Michał Margiel Mar 29 '21 at 06:01
  • 2
    @MichałMargiel it seems that `newpage` does not work, when using the default start/end state `[*]` in state diagrams. There might also be other generated objects, that break `newpage`. – Shoggomo Jan 28 '22 at 19:45
3

if you just want to mark "newpage" you can try something like this

@startuml

    ' define
        !define NEW_PAGE_1 == newpage ==

        !definelong NEW_PAGE_2(obj)
            note over obj: newpage
        !enddefinelong

    ' main
        Bob -> Alice : hello
        NEW_PAGE_1
        Bob -> Mark : Hi
        NEW_PAGE_2(Bob)
        Bob -> Carson

@enduml

enter image description here

Carson
  • 6,105
  • 2
  • 37
  • 45