forked from xuyuan/pgf-umlsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgf-umlsd-manual.tex
199 lines (161 loc) · 5.53 KB
/
pgf-umlsd-manual.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
% Manual of pgf-umlsd.sty, a convenient set of macros for drawing UML
% sequence diagrams.
% Written by Xu Yuan <[email protected]> from
% Southeast University, China.
% This file is part of pgf-umlsd
% you may get it at http://code.google.com/p/pgf-umlsd/
\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
\usepackage[underline=true,rounded corners=false]{pgf-umlsd}
\usetikzlibrary{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\usepackage{color}
\definecolor{listinggray}{gray}{0.92}
\lstset{ %
language=[LaTeX]TeX,
breaklines=true,
frame=single,
% frameround=tttt,
basicstyle=\footnotesize\ttfamily,
backgroundcolor=\color{listinggray},
keywordstyle=\color{blue}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hypersetup{
colorlinks=true,
linkcolor=blue,
anchorcolor=black,
citecolor=olive,
filecolor=magenta,
menucolor=red,
urlcolor=blue
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\demo}[2][1]{
\begin{center}
\begin{tabular}{cc}
\begin{minipage}{.49\linewidth}
\centering
\resizebox{#1\linewidth}{!}{
\input{demo/#2}
}
\end{minipage}
&
\begin{minipage}{.45\linewidth}
\lstinputlisting{demo/#2}
\end{minipage}
\end{tabular}
\end{center}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\example}[2][1]{
\begin{center}
\resizebox{#1\linewidth}{!}{
\input{demo/#2}
}
\end{center}
\lstinputlisting{demo/#2}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Drawing UML Sequence Diagram by using \texttt{pgf-umlsd}}
\author{\href{mailto:[email protected]}{Yuan Xu}}
\date{\today{}~(v0.7)}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
\texttt{pgf-umlsd} is a LaTeX package for drawing UML Sequence
Diagrams. As stated by its name, it is based on a very popular
graphic package \texttt{PGF/TikZ}. This document presents the usage
of \texttt{pgf-umlsd} and collects some UML sequence diagrams as
examples. \texttt{pgf-umlsd} can be downloaded from
\href{http://code.google.com/p/pgf-umlsd/}{http://code.google.com/p/pgf-umlsd/}.
\end{abstract}
\tableofcontents
\section{The Essentials}
\subsection{Basic graphics objects}
\subsubsection{empty diagram}
\demo{empty}
\subsubsection{thread}
\demo[0.3]{thread}
\subsubsection{instance}
\demo[0.3]{instance}
\subsubsection{distance between threads and instances}
\demo{distance}
\subsubsection{customization}
The package has two options for customization: \texttt{underline} and
\texttt{rounded corners}, further customization see the example below:
\demo{customize}
\subsection{Call}
\subsubsection{call}
\demo[0.6]{call}
\subsubsection{call self}
\demo[0.6]{callself}
\subsubsection{message call}
\demo[0.6]{messcall}
\subsubsection{nested call}
\demo[0.6]{nested-call}
\subsubsection{call from outside}
\demo[0.6]{call-from-outside}
\subsection{Message}
\demo[0.6]{message}
Sometimes however, it takes a considerable amount of time to reach the
receiver (relatively speaking of course) . For example, a message
across a network. Such a non-instantaneous message is drawn as a
slanted arrow.
\demo[0.6]{non-instantaneous-message}
\subsection{Block}
\demo[0.6]{block}
\section{Manually adjustment}
The idea of \texttt{pgf-umlsd} is users only have to write the logic
of diagram, the program generates figure automatically. However, the
package can not handle all the use case, it still needs to be adjusted
manually.
\subsection{Level}
If the text on the arrows is more than one line (large function name
for example) it will overlap other things. \texttt{postlevel} can be
used to make the time (level) later.
\demo[0.6]{postlevel}
In the situation of multi-threads, some events happen at the same
time. \texttt{prelevel} can make the call earlier.
\demo[0.6]{prelevel}
\subsection{Bias of thread line}
In the situation of multi-threads, the instance can be accessed at the
same time (e.g. two threads reading data at the same time). Currently,
we have to adjust the bias of thread line manually for this. Possible
parameters for \texttt{setthreadbias} are: \texttt{center},
\texttt{west} and \texttt{east}.
\demo[0.8]{threadbias}
\section{Examples}
\subsection{Single thread}
\example[0.8]{single-thread-example}
\subsection{Multi-threads}
\example[0.8]{multi-threads-example}
\subsection{Annotation}
\example[0.5]{sync-clock}
\subsection{Protocol Message Diagram}
\example[0.8]{protocol-message-diagram}
\subsection{Known Issue}
\texttt{pgf-umlsd} conflicts with tikz \texttt{backgrounds} library.
\section{Acknowledgements}
Many people contributed to \texttt{pgf-umlsd} by reporting problems,
suggesting various improvements or submitting code. Here is a list of
these people:
\href{mailto:[email protected]}{Nobel Huang},
\href{mailto:[email protected]}{Dr. Ludger Humbert},
\href{mailto:[email protected]}{MathStuf},
\href{mailto:[email protected]}{Vlado Handziski},
\href{mailto:[email protected]}{Frank Morgner},
\href{mailto:[email protected]}{Dirk Petrautzki},
and \href{mailto:[email protected]}{Christian Klos}.
\end{document}
%%% Local Variables:
%%% mode: Tex-PDF
%%% TeX-master: t
%%% End: