How can I center the title for an 'alt' block in a sequence diagram?

0 votes
asked Jan 5, 2022 in Question / help by vab2048 (120 points)

The sequence diagram page has an example of using 'alt':

Alice -> Bob: Authentication Request

alt successful case

    Bob -> Alice: Authentication Accepted

else some kind of failure

    Bob -> Alice: Authentication Failure
    group My own label
    Alice -> Log : Log attack start
        loop 1000 times
            Alice -> Bob: DNS Attack
    Alice -> Log : Log attack end

else Another type of failure

   Bob -> Alice: Please repeat


The [some kind of failure] bit appears aligned to the left. How can I have it so it is centered? 
commented Jan 6, 2022 by Martin (8,360 points)

I don't know how to centre the text, but see my answer to on a trick for how to indent the text (by drawing the square brackets in white (the background colour) and then indenting manually with spaces and changing the font back to a colour for the actual text).


sequenceDiagram  {
  group {
    FontColor white
    FontStyle normal

A -> B
alt <color:red>[GroupText - normal = okay]</color>
C <- B
B <- C
else \t\t    <color:red>[GroupText - normal = okay]</color>
A <- B

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.