5

Is it possible to prevent text overlapping in this MWE?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows}
\usepackage{pgf-umlsd}
\begin{document}
\begin{sequencediagram}
\newthread[white]{u}{User}
{\tikzset{inststyle/.append style={drop shadow={top color=gray, bottom color=white}, rounded corners=2.0ex}}
\newinst[3]{b}{Browser}%
\newinst[3]{a}{Another}%
\newinst[3]{l}{Last One}%
}%
\begin{sdblock}{Loop}{\parbox[b]{10.0cm}{Long Description here!!! Long Description here!!! Long Description here!!! Long Description here!!!}}
\begin{call}{u}{\parbox[b]{6.0cm}{\raggedright Long messages Long messages Long messages Long messages Long messageshere!!!}}{l}{}
\end{call}
\end{sdblock}
\end{sequencediagram}
\end{document}

enter image description here

2 Answers 2

4
+50

I went to the source code for pgf-umlsd and noticed that

  • The height for items in the sdblock is hard coded. So at this point you are limited to a max of three lines.

  • However the height for items in call has a height option.

So, to fix the overlap, I replaced parbox with a minipage environment and set the width as needed.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows}
\usepackage{pgf-umlsd}
\begin{document}

\begin{sequencediagram}
\newthread[white]{u}{User}
{\tikzset{inststyle/.append style={drop shadow={top color=gray, bottom color=white}, rounded corners=2.0ex}}
\newinst[3]{b}{Browser}%
\newinst[3]{a}{Another}%
\newinst[3]{l}{Last One}%
}%
\begin{sdblock}{Loop}{\begin{minipage}{3.5cm}{ Long Description here!!! Long Description here!!! Long Description here!!!}\end{minipage}}
\begin{call}[5in]{u}{}{l}{\begin{minipage}{4.2cm}{ Long messages here!!! Long messages here!!! Long messages here!!! Long messages here!!! Long messages here!!! Long messages here!!! Long messages here!!!}\end{minipage}}
\end{call}
\end{sdblock}
\end{sequencediagram}
\end{document}

The output is as follows: enter image description here

2

Another option would be use \postlevel see manual. Note it can be used repeatedly to get more vertical space.

Note that for increase horizontal space you can use \newinst[10]{a}{ARM} where 10 is a vertical space.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows}
\usepackage{pgf-umlsd}
\begin{document}
\begin{figure}
    \begin{sequencediagram}
        \newthread[white]{c}{9555}
        \newinst[10]{a}{ARM}

        \begin{call}{c}{
            \shortstack{
                looooo ooooo oooooooo oooooooooooo oooooong\\
                looooo ooooo oooooooo oooooooooooo oooooong\\
                looooo ooooo oooooooo oooooooooooo oooooong}
        }
        {a}{
            \shortstack{
                looooo ooooo oooooooo oooooooooooo oooooong\\
                looooo ooooo oooooooo oooooooooooo oooooong\\
                looooo ooooo oooooooo oooooooooooo oooooong}
        }
        \postlevel
        \postlevel
        \postlevel
        \postlevel
        \end{call}

        \begin{call}{c}{aaa}{a}{bbb}
        \end{call}
    \end{sequencediagram}

    \caption{Find Me typical use case}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.