pgf-umlsd
pgf-umlsd copied to clipboard
distance between threads
define the edge distance for threads too and not only for instances.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2011 at 5:38
[deleted comment]
% new an instance thread
% Example:
% \newthread[edge distance]{var}{thread name}
\newcommand{\newthread}[3][0.2]{
\newinst[#1]{#2}{#3}
\stepcounter{threadnum}
\node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {};
\tikzstyle{threadcolor\thethreadnum}=[fill=gray!30]
\tikzstyle{instcolor#2}=[fill=gray!30]
}
Original comment by [email protected]
on 11 Apr 2012 at 1:28
If we could choose the distance AND the color it would be perfect.
Original comment by [email protected]
on 14 Jul 2012 at 8:44
This would be great to have! :)
my workaround was this
\begin{sequencediagram}
\newthread{P1}{P1}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P1]
\newthread{P2}{P2}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P2]
\newthread{P3}{P3}
\end{sequencediagram}
which works, but isn't that great.
my workaround was this
\begin{sequencediagram} \newthread{P1}{P1} \tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P1] \newthread{P2}{P2} \tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P2] \newthread{P3}{P3} \end{sequencediagram}
which works, but isn't that great.
for everyone else wondering about Unknown operator `a' or `an'
errors: also add \usetikzlibrary{positioning}
to your document
% new an instance thread % Example: % \newthread[edge distance]{var}{thread name} \newcommand{\newthread}[3][0.2]{ \newinst[#1]{#2}{#3} \stepcounter{threadnum} \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {}; \tikzstyle{threadcolor\thethreadnum}=[fill=gray!30] \tikzstyle{instcolor#2}=[fill=gray!30] }
Original comment by
[email protected]
on 11 Apr 2012 at 1:28
Derived from this I've also added a color option:
% new command for adding a distance option for threads as well
% \newthread[color][distance]{id}{title}
\RequirePackage{xargs}
\renewcommandx{\newthread}[4][1=gray!30, 2=0.2]{
\newinst[#2]{#3}{#4}
\stepcounter{threadnum}
\node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {};
\tikzstyle{threadcolor\thethreadnum}=[fill=#1]
\tikzstyle{instcolor#3}=[fill=#1]
}
I'm also wondering why this isn't possible yet
would be great to have it!
Surely, it seems quite essential.
#33 I've tried this, and this is working, thank you :D you just made my day