Debian Codegraph @

texmf-dist/source/latex/smartdiagram/smartdiagram.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \iffalse
4 %</internal>
5 %<*readme>
6 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7 smartdiagram --- Automatic creation of smart diagrams with LaTeX
8
9 E-mail: claudio <dot> fiandrino <at> gmail <dot> com
10
11 Released under the LaTeX Project Public License v1.3c or later
12 See http://www.latex-project.org/lppl.txt
13 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
14
15 The package allows to create smart diagrams from lists of items for
16 simple documents and for presentations.
17
18 The package is composed and necessitates of the core libraries:
19 - core.definitions,
20 - core.styles,
21 - core.commands
22 and of the external library:
23 - additions.
24 %</readme>
25 %<*internal>
26 \fi
27 \def\nameofplainTeX{plain}
28 \ifx\fmtname\nameofplainTeX\else
29 \expandafter\begingroup
30 \fi
31 %</internal>
32 %<*install>
33 \input docstrip.tex
34 \keepsilent
35 \askforoverwritefalse
36 \preamble
37 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
38 smartdiagram --- Automatic creation of smart diagrams from lists of items.
39
40 E-mail: claudio <dot> fiandrino <at> gmail <dot> com
41
42 Released under the LaTeX Project Public License v1.3c or later
43 See http://www.latex-project.org/lppl.txt
44 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
45
46 \endpreamble
47 \postamble
48
49 Copyright (C) 2012-2013 by Claudio Fiandrino
50 E-mail: <claudio <dot> fiandrino <at> gmail <dot> com>
51
52 This work may be distributed and/or modified under the
53 conditions of the LaTeX Project Public License (LPPL), either
54 version 1.3c of this license or (at your option) any later
55 version. The latest version of this license is in the file:
56
57 http://www.latex-project.org/lppl.txt
58
59 This work is "maintained" (as per LPPL maintenance status) by
60 Claudio Fiandrino.
61
62 This work consists of the file smartdiagram.dtx
63 and the derived files smartdiagram.ins,
64 smartdiagram.pdf,
65 smartdiagramlibrarycore.definitions.code.tex,
66 smartdiagramlibrarycore.styles.code.tex,
67 smartdiagramlibrarycore.commands.code.tex
68 smartdiagramlibraryadditions.code.tex and
69 smartdiagram.sty.
70
71 \endpostamble
72 \usedir{tex/latex/smartdiagram}
73 \generate{
74 \file{\jobname.sty}{\from{\jobname.dtx}{package}}
75 }
76 \generate{
77 \file{smartdiagramlibrarycore.definitions.code.tex}{\from{\jobname.dtx}{definitions}}
78 }
79 \generate{
80 \file{smartdiagramlibrarycore.styles.code.tex}{\from{\jobname.dtx}{styles}}
81 }
82 \generate{
83 \file{smartdiagramlibrarycore.commands.code.tex}{\from{\jobname.dtx}{commands}}
84 }
85 \generate{
86 \file{smartdiagramlibraryadditions.code.tex}{\from{\jobname.dtx}{additions}}
87 }
88 %</install>
89 %<install>\endbatchfile
90 %<*internal>
91 \usedir{source/latex/smartdiagram}
92 \generate{
93 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
94 }
95 \nopreamble\nopostamble
96 \usedir{doc/latex/demopkg}
97 \generate{
98 \file{README.txt}{\from{\jobname.dtx}{readme}}
99 }
100 \ifx\fmtname\nameofplainTeX
101 \expandafter\endbatchfile
102 \else
103 \expandafter\endgroup
104 \fi
105 %</internal>
106 %<*package>
107 \NeedsTeXFormat{LaTeX2e}
108 \ProvidesPackage{smartdiagram}[2016/12/23 v0.3b Automatic creation of smart diagrams from lists of items.]
109 %</package>
110 %<*driver>
111 \documentclass{ltxdoc}
112 \usepackage[T1]{fontenc}
113 \usepackage[utf8]{inputenc}
114 \usepackage{amssymb}
115 \usepackage{charter}
116 \usepackage{microtype}
117 \usepackage{xcolor}
118 \usepackage{\jobname}
119 \usesmartdiagramlibrary{additions}
120 \usetikzlibrary{shapes.geometric,decorations.pathmorphing,arrows}
121 \usepackage{hypdoc}
122 \newcommand{\library}[1]{\textcolor{red!80!black}{\texttt{#1}}}
123 \newcommand{\packoption}[2]{\textcolor{blue!60!cyan}{\texttt{#1}} \texttt{(initial:~#2)}}
124 \newcommand{\smkey}[1]{\textcolor{blue!60!cyan}{\texttt{#1}}}
125 \newcommand{\smnumeration}[1]{\textcolor{green!70!blue}{\texttt{#1}}}
126 \newcommand{\diagram}[1]{\textcolor{orange!30!red}{\texttt{#1}}}
127 \newcommand{\mbrarg}[1]{\texttt{\{}\small\meta{#1}\texttt{\}}}
128 \newcommand{\mqbarg}[1]{\texttt{[}\small\meta{#1}\texttt{]}}
129 \newcommand{\colsmartbox}[1]{#1~\tikz[baseline=-0.5ex] \node[fill=#1,rectangle,draw=black,thick,minimum width=5mm,minimum height=3mm,rounded corners]{};}
130 \EnableCrossrefs
131 \CodelineIndex
132 \RecordChanges
133 \begin{document}
134 \DocInput{\jobname.dtx}
135 \PrintChanges
136 \end{document}
137 %</driver>
138 % \fi
139 %
140 % \CheckSum{1368}
141 %
142 % \CharacterTable
143 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
144 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
145 % Digits \0\1\2\3\4\5\6\7\8\9
146 % Exclamation \! Double quote \" Hash (number) \#
147 % Dollar \$ Percent \% Ampersand \&
148 % Acute accent \' Left paren \( Right paren \)
149 % Asterisk \* Plus \+ Comma \,
150 % Minus \- Point \. Solidus \/
151 % Colon \: Semicolon \; Less than \<
152 % Equals \= Greater than \> Question mark \?
153 % Commercial at \@ Left bracket \[ Backslash \\
154 % Right bracket \] Circumflex \^ Underscore \_
155 % Grave accent \` Left brace \{ Vertical bar \|
156 % Right brace \} Tilde \~}
157 %
158 %
159 % \changes{v0.1}{2012/10/28}{Initial version}
160 % \changes{v0.2}{2013/03/09}{Clockwise order circular diagram/horizontal order flow diagram/Uniform colors/Sequence diagram}
161 % \changes{v0.3}{2013/03/26}{Fix color arrow problem in circular diagram animated, add possibility uniform color list,
162 % added initial null space to items to hypenate first word,libraries, additions, arrows styles
163 % }
164 % \changes{v0.3a}{2013/04/19}{Fix bug in circular diagram animated: last arrow appearence, added key "back arrow distance"}
165 % \changes{v0.3b}{2016/12/23}{Fix bug uniform color list}
166 %
167 % \GetFileInfo{smartdiagram.sty}
168 % \title{The \textsf{smartdiagram} package\thanks{This document
169 % corresponds to \textsf{smartdiagram}~\fileversion,
170 % dated \filedate; it is released under and subject to the \href{http://www.latex-project.org/lppl/}{\LaTeX\ Project Public License (LPPL)}.}}
171 % \author{Claudio Fiandrino \\ \footnotesize\href{mailto:[email protected]}{[email protected]}}
172 % \maketitle
173 % \begin{abstract}
174 % This package provides a way to easily draw diagrams in documents and presentations from a list of items thanks to Ti\textit{k}Z.
175 % The idea originated from \href{http://tex.stackexchange.com/questions/78310/powerpoints-smart-art-for-tikz}{this question} on \href{http://tex.stackexchange.com}{TeX.StackExchange}.
176 %
177 % \end{abstract}
178 %
179 % \tableofcontents
180 % \section{Introduction and requirements}
181 % The aim of the package is to provide a way to draw diagrams starting from a list of items colored automatically. The diagrams created could be used in a simple document or in a presentation: in the latter case, while using the Beamer class, the user could decide if diagrams should be overlay-awared or not.
182 %
183 % Automatically, the \textsf{smartdiagram} package loads:
184 % \begin{itemize}
185 % \item Ti\textit{k}Z;
186 % \item \textsf{etoolbox};
187 % \item \textsf{xparse};
188 % \item \textsf{xstring} (from version 0.2).
189 % \end{itemize}
190 % Moreover, the package loads the following Ti\textit{k}Z libraries:
191 % \begin{itemize}
192 % \item \library{backgrounds};
193 % \item \library{calc};
194 % \item \library{fadings};
195 % \item \library{shadows};
196 % \item \library{shapes.arrows};
197 % \item \library{shapes.symbols} (from version 0.2).
198 % \end{itemize}
199 % and it sets a new layer called \verb|smart diagram arrow back|. From version 0.3, the package is composed of three core libraries:
200 % \begin{itemize}
201 % \item \library{core.definitions},
202 % \item \library{core.styles},
203 % \item \library{core.commands}
204 % \end{itemize}
205 % which actually form the package \library{smartdiagram.sty} and of the external library:
206 % \begin{itemize}
207 % \item \library{additions}
208 % \end{itemize}
209 % which can be loaded separately by the user. By loading this library:
210 % \begin{flushleft}
211 % \texttt{\textbackslash usesmartdiagramlibrary\{}\library{additions}\texttt{\}}
212 % \end{flushleft}
213 % forces the Ti\textit{k}Z library \library{positioning} to be loaded as well.
214 %
215 % The package could be loaded by means of \cs{usepackage}\texttt{\{smartdiagram\}}.
216 %
217 % \section{Basic Usage}
218 % \DescribeMacro{\smartdiagram} The basic command is \cs{smartdiagram}\mqbarg{type of diagram}\mbrarg{list of items}. The \mbrarg{list of items} should be comma-delimited: to insert, for example, a comma as part of the item label use \verb|\smartdiagram[..]{elem1,{elem2,text},elem3}|.
219 %
220 % The possible diagrams that could be created are:
221 % \begin{itemize}
222 % \item \diagram{circular diagram}: the items in the list are diplayed around a circle typically in counterclockwise order;
223 % \item \diagram{circular diagram:clockwise}: same as before, but now items are placed in clockwise order (no space between names and \diagram{:});
224 % \item \diagram{flow diagram}: the items in the list are diplayed as a flow chart;
225 % \item \diagram{flow diagram:horizontal}: the items in the list are diplayed as an horizontal flow chart (no space between names and \diagram{:});
226 % \item \diagram{descriptive diagram}: a diagram in which are displayed concepts and their description;
227 % \item \diagram{priority descriptive diagram}: a diagram in which the items are deployted based on their relevance;
228 % \item \diagram{bubble diagram}: each item is a bubble deployted around a bubble center, which is the first element in the list;
229 % \item \diagram{constellation diagram}: each item is a circle connected to the center, the first element in the list again;
230 % \item \diagram{connected constellation diagram}: each item is a circle and, a part from the first element in the list, the other ones are connected toghether;
231 % \item \diagram{sequence diagram}: the items in the list are diplayed in sequence and each item points to the subsequent.
232 % \end{itemize}
233 %
234 % For example:
235 % \begin{verbatim}
236 % \begin{center}
237 % \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
238 % \end{center}
239 % \end{verbatim}
240 % produces:
241 % \begin{center}
242 % \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
243 % \end{center}
244 %
245 % All diagrams could be customized in various ways, from the selection of the background colors to the font size, from the size of the items to the shape of the border. The keys necessary for this task will be analysed in detail in section \ref{sec:options}.
246 %
247 % For what concern the \diagram{bubble diagram}, the \diagram{constellation diagram} and the \diagram{connected constellation diagram}, they are a bit different from the rest of the diagrams, in the sense that the first item in the \mbrarg{list of items} is particular: called \emph{bubble center} and \emph{planet}, respectively, its aspect is different and it could be customized with dedicated keys.
248 %
249 % From version 0.2 there is availble also the \diagram{sequence diagram} which displays the \mbrarg{list of items} with a particular shape.
250 %
251 % \DescribeMacro{\smartdiagramanimated} Inside presentations, the user could select if the diagram should be displayed in a \emph{persistent} way, or with an animation. The \emph{persistent} way is achieved by exploiting, again, \cs{smartdiagram}, while to have the diagram \emph{overlay-aware} the command is \cs{smartdiagramanimated}\mqbarg{type of diagram}\marg{list of items}.
252
253 % For diagrams like the \diagram{circular diagram} and the \diagram{flow diagram} the animation runs as follows: at the beginning the first item of the list is displayed, then each time appears an arrow connecting the previous element with the new one; at the end it is displayed the arrow connecting the last element with the first one. Considering instead the \diagram{descriptive diagram}, per couple description title-description, first it is shown the description title and subsequently the description. In the \diagram{priority descriptive diagram}, very simply, the list of items is deployted starting from the bottom, that is the less relevant item, to the top to progressively show much relevant items.
254 % For what concern the \diagram{bubble diagram}, the \diagram{constellation diagram} and the \diagram{connected constellation diagram}, at first it is always shown the \emph{bubble center} and \emph{planet}, respectively and later all the items subsequently.
255 % Finally, in the \diagram{sequence} diagram, the items are presented one at a time starting from the left one ending with the right one.
256 %
257 % \section{Additions}
258 % \DescribeMacro{\usesmartdiagramlibrary} From version 0.3, it is possible to load a separate library called \library{additions} which allows to create annotations over a smart diagram. Load the library through:
259 % \begin{flushleft}
260 % \texttt{\textbackslash usesmartdiagramlibrary\{}\library{additions}\texttt{\}}
261 % \end{flushleft}
262 % in the preamble. \DescribeMacro{\smartdiagramadd} The basic command introduced by the library is \cs{smartdiagramadd}\mqbarg{type of diagram}\mbrarg{list of items}\mbrarg{list of additions}. The \mbrarg{list of additions} have a special syntax:
263 % \begin{flushleft}
264 % \meta{position of module/Annotation text}
265 % \end{flushleft}
266 % where:
267 % \begin{itemize}
268 % \item \textit{position} is an anchor of Ti\textit{k}Z (i.e \texttt{above}, \texttt{below right} and so on);
269 % \item \textit{module} is the name of a module in the smart diagram;
270 % \item \textit{position} and \textit{module} should be separated by the string \texttt{of}: spaces before and after the string are \emph{mandatory}.
271 % \end{itemize}
272 % \textsf{Smartdiagram} defines as names:
273 % \begin{itemize}
274 % \item for the diagrams \diagram{circular diagram} and \diagram{circular diagram:clockwise}:\\ \smkey{module}\smnumeration{progressive-number} (no space or other symbols in between); example: \texttt{module1};
275 % \item for the diagrams \diagram{flow diagram} and \diagram{flow diagram:horizontal}:\\ \smkey{module}\smnumeration{progressive-number}; example: \texttt{module3};
276 % \item for the diagram \diagram{descriptive diagram}: \smkey{module-title}\smnumeration{progressive-number} for titles and \smkey{module}\smnumeration{progressive-number} for descriptions; example: \texttt{module-title1} and \texttt{module1};
277 % \item for the diagram \diagram{bubble diagram}: \smkey{center bubble} for the center module and \smkey{module}\smnumeration{progressive-number} for the other modules; example: \texttt{center bubble} and \texttt{module2};
278 % \item for the diagrams \diagram{constallation diagram} and \diagram{connected constellation diagram}: \smkey{planet} for the center module and \smkey{satellite}\smnumeration{progressive-number} for the other modules; example: \texttt{planet} and \texttt{satellite3};
279 % \item for the diagram \diagram{priority descriptive diagram}: \smkey{module}\smnumeration{progressive-number};
280 % \item for the diagram \diagram{sequence diagram}: \smkey{sequence-item}\smnumeration{progressive-number}; example: \texttt{sequence-item1}.
281 % \end{itemize}
282 % The use of the library \library{additions} in a document requires two compilation runs at least because of the Ti\textit{k}Z options \texttt{remember picture} and \texttt{overlay}.
283 %
284 % An example:
285 % \begin{verbatim}
286 % \begin{minipage}[t][3.5cm]{\textwidth}
287 % \begin{center}
288 % \smartdiagramset{
289 % uniform color list=gray!60!black for 3 items,
290 % back arrow disabled=true,
291 % additions={
292 % additional item offset=0.85cm,
293 % additional item border color=red,
294 % additional connections disabled=false,
295 % additional arrow color=red,
296 % additional arrow tip=stealth,
297 % additional arrow line width=1pt,
298 % additional arrow style=]-latex',
299 % }
300 % }
301 % \smartdiagramadd[flow diagram:horizontal]{%
302 % PGF,Ti\textit{k}Z,Smartdiagram%
303 % }{%
304 % below of module1/Low Level, below of module3/High level%
305 % }
306 % \end{center}
307 % \end{minipage}
308 % \end{verbatim}
309 % The result:
310 % \medskip
311 %
312 % \begin{minipage}[t][3.5cm]{\textwidth}
313 % \begin{center}
314 % \smartdiagramset{
315 % uniform color list=gray!60!black for 3 items,
316 % back arrow disabled=true,
317 % additions={
318 % additional item offset=0.85cm,
319 % additional item border color=red,
320 % additional connections disabled=false,
321 % additional arrow color=red,
322 % additional arrow tip=stealth,
323 % additional arrow line width=1pt,
324 % additional arrow style=]-latex',
325 % }
326 % }
327 % \smartdiagramadd[flow diagram:horizontal]{%
328 % PGF,Ti\textit{k}Z,Smartdiagram%
329 % }{%
330 % below of module1/Low Level, below of module3/High level%
331 % }
332 % \end{center}
333 % \end{minipage}
334 %
335 % \DescribeMacro{\smartdiagramconnect} Notice that with the \cs{smartdiagramadd} facility it is not possible to fine customize the direction of the arrow tips. Since each additional module has as name\\ \smkey{additional-module}\smnumeration{progressive-number}, then by means of the specific command\\ \cs{smartdiagramconnect}\mbrarg{arrow options}\mbrarg{start module/end module} one could do better. For example:
336 % \begin{verbatim}
337 % \begin{minipage}[t][3.5cm]{\textwidth}
338 % \begin{center}
339 % \smartdiagramset{
340 % uniform color list=gray!60!black for 3 items,
341 % back arrow disabled=true,
342 % additions={
343 % additional item offset=0.85cm,
344 % additional item border color=red,
345 % additional arrow color=red,
346 % additional arrow tip=stealth,
347 % additional arrow line width=1pt,
348 % additional arrow style=]-latex',
349 % }
350 % }
351 % \smartdiagramadd[flow diagram:horizontal]{%
352 % PGF,Ti\textit{k}Z,Smartdiagram%
353 % }{%
354 % below of module1/Low Level, below of module3/High level%
355 % }
356 % \smartdiagramconnect{{]-latex'}}{additional-module1/module1}
357 % \smartdiagramconnect{{latex'-[}}{additional-module2/module3}
358 % \end{center}
359 % \end{minipage}
360 % \end{verbatim}
361 % gives:
362 % \medskip
363 %
364 % \begin{minipage}[t][3.5cm]{\textwidth}
365 % \begin{center}
366 % \smartdiagramset{
367 % uniform color list=gray!60!black for 3 items,
368 % back arrow disabled=true,
369 % additions={
370 % additional item offset=0.85cm,
371 % additional item border color=red,
372 % additional arrow color=red,
373 % additional arrow tip=stealth,
374 % additional arrow line width=1pt,
375 % additional arrow style=]-latex',
376 % }
377 % }
378 % \smartdiagramadd[flow diagram:horizontal]{%
379 % PGF,Ti\textit{k}Z,Smartdiagram%
380 % }{%
381 % below of module1/Low Level, below of module3/High level%
382 % }
383 % \smartdiagramconnect{{]-latex'}}{additional-module1/module1}
384 % \smartdiagramconnect{{latex'-[}}{additional-module2/module3}
385 % \end{center}
386 % \end{minipage}
387 % Because of the option \texttt{overlay}, it is better to protect within a \texttt{minipage} the diagram: in this way the missing bounding box update would not affect the subsequent/precedent text.
388 %
389 % By default, the arrows are customized by the keys which start with \smkey{additional} (explained more in detail in the subsubsection \ref{subsubsect:options}), but it is possible to override locally this definition, for example with:
390 % \begin{verbatim}
391 % \smartdiagramconnect{{latex'-[},green}{additional-module2/module3}
392 % \end{verbatim}
393 % For the moment, the library \library{additions} \emph{does not work} in the animated mode.
394 %
395 % \section{The options}
396 % \label{sec:options}
397 % \subsection{Setting the options}
398 % \DescribeMacro{\smartdiagramset} The options should be introduced similarly to what happens with \cs{tikzset} in Ti\textit{k}Z: \cs{smartdiagramset}\mbrarg{list of options}. As well as in Ti\textit{k}Z, it is possible to collect options within styles: see for more details subsection \ref{subsec:stylesdef}. Examples in which the options are used are shown in section \ref{sec:gallery}.
399 % \subsection{Available options}
400 % Here follows the list of general available options: these options are related to generic aspects as color lists or arrows.
401 % \subsubsection{General options}
402 % \begin{itemize}
403 % \item \packoption{set color list}{none}: this option allows the user to define the list of colors usable in the diagram;
404 %
405 % \item \packoption{uniform color list}{none}: this option allows the user to set one single color for the whole list of colors usable in the diagram;
406 %
407 % \item \packoption{use predefined color list}{none}: this option allows the user to reuse the pre-defined colors whenever in a previous diagram they have been changed;
408 %
409 % \item \packoption{insert decoration}{none}: this option allows to decorate the border of the module; the user should declare properly a decoration style and load manually the libraries required, e.g. \library{decorations.pathmorphing}; some more hints are given in section \ref{sec:recommendations};
410 %
411 % \item \packoption{arrow line width}{0.1cm}: this option sets the width of the connection arrows within two modules;
412 %
413 % \item \packoption{arrow tip}{stealth}: this option allows to select the single arrow tip; possible choices are described in the pgfmanual and for particular types it is recommended to load the library \library{arrows};
414 %
415 % \item \packoption{arrow style}{<-}: this option allows the user to define a new style for the arrow; as well as the key \smkey{arrow tip}, see the pgfmanual to see a list of possible arrow styles;
416 %
417 % \item \packoption{uniform arrow color}{false}: this option, set to true, activates the possibility to use one single arrow color for all the connections;
418 %
419 % \item \packoption{arrow color}{gray}: this option, when the key \smkey{uniform arrow color} is set to true, allows to select the uniform arrow color.
420 %
421 % \end{itemize}
422 % \subsubsection{Specific options}
423 % Here follows the list of specific available options per type of diagram.
424 %
425 % For what concern the \diagram{circular diagram}, \diagram{circular diagram:clockwise}, the \diagram{flow diagram} and the \diagram{flow diagram:horizontal}:
426 % \begin{itemize}
427 % \item \packoption{module minimum width}{2cm}: this option sets the minimum width of the module;
428 %
429 % \item \packoption{module minimum height}{1cm}: this option sets the minimum height of the module;
430 %
431 % \item \packoption{module y sep}{1.65}: this option sets a vertical distance factor among the modules in a \diagram{flow diagram};
432 %
433 % \item \packoption{module x sep}{2.75}: this option sets an horizontal distance factor among the modules in a \diagram{flow diagram:horizontal};
434 %
435 % \item \packoption{module shape}{rectangle,rounded corners}: this option should be used to change the shape of the module, but the user should load manually the proper Ti\textit{k}Z library; for example, to user an \verb|ellipse|, load \library{shapes.geometric} in the preamble;
436 %
437 % \item \packoption{text width}{1.75cm}: this option sets the text width inside the module;
438 %
439 % \item \packoption{font}{\textbackslash small}: this option sets the module font;
440 %
441 % \item \packoption{border color}{gray}: this option sets the border color of the module;
442 %
443 % \item \packoption{text color}{black}: this option sets the text color of the module;
444 %
445 % \item \packoption{circular distance}{2.75cm}: this option sets the radius of cirle around which the modules in a \diagram{circular diagram};
446 %
447 % \end{itemize}
448 %
449 % Considering just the \diagram{flow diagram} and the \diagram{flow diagram:horizontal}, there is a specific option to disable the back arrow going from the final module to the first one and to set its distance from the modules:
450 % \begin{itemize}
451 % \item \packoption{back arrow distance}{0.5}: the option sets the distance (it hold for both types);
452 % \item \packoption{back arrow disabled}{false}: the option, set to \texttt{true} disables the back arrow.
453 % \end{itemize}
454 %
455 % Similarly, in the \diagram{circular diagram} and in the \diagram{circular diagram:clockwise}, there is a specific option to disable the back arrow going from the final module to the first one:
456 % \begin{itemize}
457 % \item \packoption{circular final arrow disabled}{false}: the option, set to \texttt{true} disables the final connection.
458 % \end{itemize}
459 %
460 % For what concern the \diagram{descriptive diagram} and the \diagram{priority descriptive diagram}:
461 % \begin{itemize}
462 % \item \packoption{descriptive items y sep}{1.75}: this option sets a vertical distance factor among the descriptive items;
463 %
464 % \item \packoption{description title width}{1.5cm}: this option sets the minimum width of the description-title;
465 %
466 % \item \packoption{description title text width}{1.25cm}: this option sets the text width of the description-title;
467 %
468 % \item \packoption{description text width}{5cm}: this option sets the text width of the description;
469 %
470 % \item \packoption{description title font}{\textbackslash small}: this option sets the font size of the description-title;
471 %
472 % \item \packoption{description font}{\textbackslash small}: this option sets the font size of the description;
473 %
474 % \item \packoption{description width}{5.5cm}: this option sets the minimum width of the description;
475 %
476 % \item \packoption{priority arrow width}{1.5cm}: this option sets the width of the vertical arrow;
477 %
478 % \item \packoption{priority arrow head extend}{0.15cm}: this option sets the width of the arrow head extend;
479 %
480 % \item \packoption{priority tick size}{5pt}: this option sets the size of the line denoting the relevance position of items in the vertical arrow;
481 %
482 % \item \packoption{priority arrow height advance}{2cm}: this option specifies how much the vertical arrow is vertically extended above the most relevant item.
483 % \end{itemize}
484 %
485 % For what concern the \diagram{bubble diagram}, the \diagram{constellation diagram} and the \diagram{connected constellation diagram}:
486 % \begin{itemize}
487 %
488 % \item \packoption{bubble center node size}{4cm}: the option specifies the minimum size of the bubble center node;
489 %
490 % \item \packoption{bubble center node font}{\textbackslash large}: this option sets the font size of the bubble center node;
491 %
492 % \item \packoption{bubble center node color}{lightgray!60}: this option allows to customize the background color of the bubble center node;
493 %
494 % \item \packoption{distance center/other bubbles}{0.8cm}: this options specifies which is the distance among the bubble center node and the other bubbles; keep this value under controll to avoid that bubbles do not overlap anymore the bubble center node;
495 %
496 % \item \packoption{distance text center bubble}{0.5cm}: this option sets the distance from the text to the border of the bubble center node;
497 %
498 % \item \packoption{bubble fill opacity}{0.5}: this option sets the opacity at which the bubbles are shown;
499 %
500 % \item \packoption{bubble node size}{2.5cm}: the option specifies the minimum size of the bubbles;
501 %
502 % \item \packoption{bubble text opacity}{0.8}: this option sets the opacity at which the bubble text is shown;
503 %
504 % \item \packoption{bubble node font}{\textbackslash normalfont}: this option sets the font size of the bubbles;
505 %
506 % \item \packoption{planet size}{2.5cm}: the option specifies the minimum size of the planet;
507 %
508 % \item \packoption{planet color}{lightgray!60}: this option allows to customize the background color of the planet;
509 %
510 % \item \packoption{planet font}{\textbackslash large}: this option sets the font size of the planet;
511 %
512 % \item \packoption{distance planet-connection}{0.1cm}: this option sets the distance from the planet to the arrow directed to the satellites;
513 %
514 % \item \packoption{distance planet-text}{0.5cm}: this option sets the distance from the text to the border of the planet;
515 %
516 % \item \packoption{planet text width}{1.75cm}: this option sets the planet text width;
517 %
518 % \item \packoption{satellite size}{1.75cm}: the option specifies the minimum size of the satellites;
519 %
520 % \item \packoption{satellite font}{\textbackslash normalfont}: this option sets the font size of the satellites;
521 %
522 % \item \packoption{satellite fill opacity}{0.5}: this option sets the opacity at which the satellites are shown;
523 %
524 % \item \packoption{satellite text opacity}{0.8}: this option sets the opacity at which the satellite text is shown;
525 %
526 % \item \packoption{satellite text width}{1.5cm}: this option sets the satellite text width;
527 %
528 % \item \packoption{distance satellite-connection}{0.075cm}: this option sets the distance from the satellites to the arrows directed to the planet;
529 %
530 % \item \packoption{connection line width}{0.1cm}: this option allows to customize the width of the connections from the planet to the satellites;
531 %
532 % \item \packoption{distance planet-satellite}{3.5cm}: this option determine the distance among any pair of planet-satellite.
533 % \end{itemize}
534 %
535 % Considering just the the \diagram{constellation diagram} and the \diagram{connected constellation diagram}:
536 % \begin{itemize}
537 % \item \packoption{uniform connection color}{false}: the option, set to \texttt{true} overrides the color list definition;
538 % \item \packoption{connection color}{gray}: this option allows to specify the color valid for all the connections.
539 % \end{itemize}
540 % For what concern the \diagram{sequence diagram}:
541 % \begin{itemize}
542 %
543 % \item \packoption{sequence item height}{1cm}: the option specifies the minimum height of the items;
544 %
545 % \item \packoption{sequence item width}{2cm}: the option specifies the minimum width of the items;
546 %
547 % \item \packoption{sequence item border color}{gray}: sets the border line color;
548 %
549 % \item \packoption{sequence item border size}{1.65\textbackslash pgflinewidth}: sets the border line width;
550 %
551 % \item \packoption{sequence item font size}{\textbackslash normalfont}: this option sets the font size of the items;
552 %
553 % \item \packoption{sequence item fill opacity}{1}: sets the opacity at which the item is shown;
554 %
555 % \item \packoption{sequence item text opacity}{1}: sets the opacity at which the item text is shown;
556 %
557 % \item \packoption{sequence item text width}{1.9cm}: the option allows to select the item text width;
558 %
559 % \item \packoption{sequence item text color}{black}: the option allows to select the item text color;
560 %
561 % \item \packoption{uniform sequence color}{false}: the option, set to \texttt{true} overrides the color list definition;
562 %
563 % \item \packoption{sequence item uniform color}{gray!60!black}: this option allows to specify the color valid for all the items in the sequence.
564 %
565 % \end{itemize}
566 %
567 % \subsubsection{Options of the additions library}
568 % \label{subsubsect:options}
569 % The options of the library necessitate to be set within a specific key \smkey{additions}; this key is defined as
570 % \begin{verbatim}
571 % \pgfkeys{/smart diagram/.cd,
572 % additions/.style={/smart diagram/additions/.cd,#1}%
573 % }
574 % \end{verbatim} and it basically sets the correct path; indeed all of these keys are defined in a subtree of the main path: \verb!/smart diagram/additions!. For example:
575 % \begin{verbatim}
576 % \smartdiagramset{
577 % additions={
578 % additional item offset=0.85cm,
579 % additional item border color=red,
580 % additional arrow color=red,
581 % additional arrow tip=stealth,
582 % additional arrow line width=1pt,
583 % additional arrow style=]-latex',
584 % }
585 % }
586 % \end{verbatim}
587 % Notice that each key starts with \smkey{additional}: in my opinion, although it may seems heavy type this every time, it could avoid some confusion with other keys.
588 % \begin{itemize}
589 %
590 % \item \packoption{additional item shape}{rectangle,rounded corners}: this option should be used to change the shape of the additional module; similarly to the key \smkey{module shape}, for some shapes the user should load manually the proper Ti\textit{k}Z library;
591 %
592 % \item \packoption{additional item border color}{none}: sets the border line color;
593 %
594 % \item \packoption{additional item bottom color}{white}: this option sets the bottom color of the module; use it if you want to keep the same aspect of the diagrams: \diagram{circular diagram}, \diagram{flow diagram}, \diagram{circular diagram:clockwise} and \diagram{flow diagram:horizontal};
595 %
596 % \item \packoption{additional item fill color}{none}: this option sets the fill color of the module; use it if you want to keep the same aspect of the other types of diagrams;
597 %
598 % \item \packoption{additional item text width}{1.75cm}: it defines the text width of the module;
599 %
600 % \item \packoption{additional item width}{2cm}: it defines the minimum width of the module;
601 %
602 % \item \packoption{additional item height}{1cm}: it defines the minimum height of the module;
603 %
604 % \item \packoption{additional item font}{\textbackslash normalfont}: this option allows to customize the font of the module;
605 %
606 % \item \packoption{additional item border decoration}{none}: this option allows to customize the module with a decoration; some more hints are given in section \ref{sec:recommendations};
607 %
608 % \item \packoption{additional item offset}{0.25cm}: this option defines the distance between the original module and the additional one;
609 %
610 % \item \packoption{additional item fill opacity}{1}: it sets the fill opacity of the module;
611 %
612 % \item \packoption{additional item text opacity}{1}: it sets the text opacity of the module;
613 %
614 % \item \packoption{additional arrow tip}{stealth}: this option defines the single arrow tip of the connection;
615 %
616 % \item \packoption{additional arrow line width}{0.1cm}: this option defines the line width of the connection;
617 %
618 % \item \packoption{additional arrow color}{gray}: this option defines the connection color;
619 %
620 % \item \packoption{additional arrow style}{->}: this option allows to customize the connection aspect, that is both arrow tips simultaneously;
621 %
622 % \item \packoption{additional item shadow}{none}: it allows to define a shadow for the module; use the usual Ti\textit{k}Z shadow options;
623 %
624 % \item \packoption{additional connections disabled}{true}: this option when set to \texttt{false} makes all the connections visible.
625 %
626 % \end{itemize}
627 % \section{Gallery of examples}
628 % \label{sec:gallery}
629 % \DescribeMacro{Horizontal flow chart: custom color list - no back arrow}
630 % Example of an horizontal flow chart with custom color list and back arrow disabled:
631 % \begin{verbatim}
632 % \begin{center}
633 % \smartdiagramset{border color=none,
634 % set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black},
635 % back arrow disabled=true}
636 % \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
637 % \end{center}
638 % \end{verbatim}
639 % \begin{center}
640 % \scalebox{0.8}{
641 % \smartdiagramset{border color=none,
642 % set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black},
643 % back arrow disabled=true}
644 % \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
645 % }
646 % \end{center}
647 % \DescribeMacro{Horizontal flow chart: uniform color list - custom arrow style}
648 % A similar example with an uniform color list and custom arrow style definition:
649 % \begin{verbatim}
650 % \begin{center}
651 % \smartdiagramset{border color=none,
652 % uniform color list=teal!60 for 4 items,
653 % arrow style=[-stealth',
654 % module x sep=3.75,
655 % back arrow distance=0.75,
656 % }
657 % \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
658 % \end{center}
659 % \end{verbatim}
660 % \begin{center}
661 % \scalebox{0.8}{
662 % \smartdiagramset{border color=none,
663 % uniform color list=teal!60 for 4 items,
664 % arrow style=stealth'-], module x sep=3.75,
665 % back arrow distance=0.75,
666 % }
667 % \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
668 % }
669 % \end{center}
670 % \smartdiagramset{use predefined color list}
671 % \DescribeMacro{Circular diagram with custom options}
672 % Another example:
673 % \begin{verbatim}
674 % \begin{center}
675 % \smartdiagramset{circular distance=4cm,
676 % font=\large,
677 % text width=2.5cm,
678 % module minimum width=2.5cm,
679 % module minimum height=1.5cm,
680 % arrow tip=to}
681 % \smartdiagram[circular diagram]{Set up~/ Adapt,Run,Analyse,Modify~/ Add,
682 % Check,Check again}
683 % \end{center}
684 % \end{verbatim}
685 % \begin{center}
686 % \scalebox{0.7}{
687 % \smartdiagramset{circular distance=4cm, font=\large, text width=2.5cm,
688 % module minimum width=2.5cm, module minimum height=1.5cm,arrow tip=to}
689 % \smartdiagram[circular diagram]{Set up~/ Adapt,Run,Analyse,Modify~/ Add,Check,Check again}
690 % }
691 % \end{center}
692 % \DescribeMacro{Circular diagram with custom shape and final arrow disabled}
693 % An example with a diamond shape and the final arrow disabled:
694 % \begin{verbatim}
695 % \begin{center}
696 % \usetikzlibrary{shapes.geometric} % required in the preamble
697 % \smartdiagramset{module shape=diamond,
698 % font=\scriptsize,
699 % module minimum width=1cm,
700 % module minimum height=1cm,
701 % text width=1cm,
702 % circular distance=2cm,
703 % circular final arrow disabled=true,
704 % }
705 % \smartdiagram[circular diagram:clockwise]{Set up,Run,Analyse,Modify~/ Add}
706 % \end{center}
707 % \end{verbatim}
708 % \begin{center}
709 % \smartdiagramset{module shape=diamond,font=\scriptsize,
710 % module minimum width=1cm,module minimum height=1cm,text width=1cm,
711 % circular distance=2cm,
712 % circular final arrow disabled=true,
713 % }
714 % \smartdiagram[circular diagram:clockwise]{Set up,Run,Analyse,Modify~/ Add}
715 % \end{center}
716 % \DescribeMacro{Flow diagram with decorated border and uniform arrow color}
717 % An example with a decorated shape and uniform arrow color:
718 % \begin{verbatim}
719 % \usetikzlibrary{decorations.pathmorphing} % required in the preamble
720 % \begin{center}
721 % \tikzset{my decoration/.style={decorate,decoration=zigzag}}
722 % \smartdiagramset{module shape=rectangle,
723 % insert decoration={my decoration},
724 % uniform arrow color=true,
725 % arrow color=gray!50!black,
726 % }
727 % \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
728 % \end{center}
729 % \end{verbatim}
730 % \begin{center}
731 % \tikzset{my decoration/.style={decorate,decoration=zigzag}}
732 % \smartdiagramset{module shape=rectangle,insert decoration={my decoration},
733 % uniform arrow color=true, arrow color=gray!50!black,
734 % }
735 % \scalebox{0.8}{
736 % \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
737 % }
738 % \end{center}
739 % \DescribeMacro{Descriptive diagram}
740 % An example of descriptive diagram:
741 % \begin{verbatim}
742 % \begin{center}
743 % \smartdiagram[descriptive diagram]{
744 % {Set up,The set up operation consist of..},
745 % {Run, {After having set up the program, you must run..}},
746 % {Analyse, You must check what did with analytical tools like..},
747 % {Modify, {After the analysis, you can still modify or add..}},
748 % }
749 % \end{center}
750 % \end{verbatim}
751 % \begin{center}
752 % \scalebox{0.8}{
753 % \smartdiagram[descriptive diagram]{
754 % {Set up,The set up operation consist of..},
755 % {Run, {After having set up the program, you must run..}},
756 % {Analyse, You must check what did with analytical tools like..},
757 % {Modify, {After the analysis, you can still modify or add..}},
758 % }
759 % }
760 % \end{center}
761 % \DescribeMacro{Bubble diagram}
762 % An example of bubble diagram:
763 % \begin{verbatim}
764 % \begin{center}
765 % \smartdiagram[bubble diagram]{
766 % Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check
767 % }
768 % \end{center}
769 % \end{verbatim}
770 % \begin{center}
771 % \scalebox{0.8}{
772 % \smartdiagram[bubble diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
773 % }
774 % \end{center}
775 % \DescribeMacro{Constellation diagram}
776 % An example of constellation diagram:
777 % \begin{verbatim}
778 % \begin{center}
779 % \smartdiagram[constellation diagram]{
780 % Build a program,Set up,Run,Analyze,Modify~/\\ Add
781 % }
782 % \end{center}
783 % \end{verbatim}
784 % \begin{center}
785 % \scalebox{0.8}{
786 % \smartdiagram[constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
787 % }
788 % \end{center}
789 % \DescribeMacro{Constellation diagram with custom colors}
790 % An example of constellation diagram with custom colors:
791 % \begin{verbatim}
792 % \begin{center}
793 % \smartdiagramset{set color list={orange!60, green!50!lime!60,magenta!60,
794 % blue!50!cyan},
795 % uniform connection color=true
796 % }
797 % \smartdiagram[constellation diagram]{
798 % Build a program,Set up,Run,Analyze,Modify~/\\ Add
799 % }
800 % \end{center}
801 % \end{verbatim}
802 % \begin{center}
803 % \scalebox{0.8}{
804 % \smartdiagramset{set color list={orange!60, green!50!lime!60,magenta!60,blue!50!cyan},
805 % uniform connection color=true}
806 % \smartdiagram[constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
807 % }
808 % \end{center}
809 % \DescribeMacro{Connected constellation diagram}
810 % An example of connected constellation diagram:
811 % \begin{verbatim}
812 % \begin{center}
813 % \smartdiagramset{planet color=orange!60,
814 % distance planet-satellite=1cm
815 % }
816 % \smartdiagram[connected constellation diagram]
817 % {Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
818 % \end{center}
819 % \end{verbatim}
820 % \begin{center}
821 % \scalebox{0.8}{
822 % \smartdiagramset{planet color=orange!60, distance planet-satellite=2.75cm,use predefined color list}
823 % \smartdiagram[connected constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
824 % }
825 % \end{center}
826 % \DescribeMacro{Priority descriptive diagram}
827 % An example of priority descriptive diagram describing that Ti\textit{k}Z is built on top of PGF and Smartdiagram on top of Ti\textit{k}Z:
828 % \begin{verbatim}
829 % \begin{center}
830 % \smartdiagramset{
831 % set color list={blue!50!cyan,green!60!lime,orange!50!red},
832 % priority arrow width=2cm,
833 % priority arrow height advance=2.25cm
834 % }
835 % \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
836 % \end{center}
837 % \end{verbatim}
838 % \begin{center}
839 % \smartdiagramset{set color list={blue!50!cyan,green!60!lime,orange!50!red},
840 % priority arrow width=2cm,priority arrow height advance=2.25cm}
841 % \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
842 % \end{center}
843 % \DescribeMacro{Sequence diagram}
844 % The same previous example with a sequence diagram:
845 % \begin{verbatim}
846 % \begin{center}
847 % \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
848 % \end{center}
849 % \end{verbatim}
850 % \begin{center}
851 % \smartdiagramset{use predefined color list}
852 % \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
853 % \end{center}
854 % and with \smkey{uniform sequence color} set to \verb|true|:
855 % \begin{verbatim}
856 % \begin{center}
857 % \smartdiagramset{uniform sequence color=true,
858 % sequence item border color=black,sequence item font size=\footnotesize,
859 % sequence item text color=white
860 % }
861 % \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
862 % \end{center}
863 % \end{verbatim}
864 % \begin{center}
865 % \smartdiagramset{uniform sequence color=true,
866 % sequence item border color=black,sequence item font size=\footnotesize,
867 % sequence item text color=white
868 % }
869 % \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
870 % \end{center}
871 % \DescribeMacro{Put additions to a diagram}
872 % Here is an example of a circular diagram with some additions:
873 % \begin{verbatim}
874 % \usesmartdiagramlibrary{additions} % required in the preamble
875 % \usetikzlibrary{arrows} % required in the preamble
876 % \bigskip
877 % \begin{minipage}[c][8cm]{\textwidth}
878 % \centering
879 % \smartdiagramset{
880 % uniform color list=orange!60!yellow for 5 items,
881 % circular final arrow disabled=true,
882 % circular distance=2.25cm,
883 % arrow tip=to,
884 % arrow line width=2pt,
885 % additions={
886 % additional item bottom color=orange!60!yellow,
887 % additional item border color=gray,
888 % additional item shadow=drop shadow,
889 % additional item offset=0.65cm,
890 % additional arrow line width=2pt,
891 % additional arrow tip=to,
892 % additional arrow color=orange!60!yellow,
893 % }
894 % }
895 % \smartdiagramadd[circular diagram]{
896 % aa,bb,cc,dd,ee
897 % }{
898 % above of module1/Start,right of module5/End
899 % }
900 % \smartdiagramconnect{to-}{module1/additional-module1}
901 % \smartdiagramconnect{-to}{module5/additional-module2}
902 % \end{minipage}
903 % \end{verbatim}
904 % \begin{minipage}[c][8cm]{\textwidth}
905 % \centering
906 % \smartdiagramset{
907 % uniform color list=orange!60!yellow for 5 items,
908 % circular final arrow disabled=true,
909 % circular distance=2.25cm,
910 % arrow tip=to,
911 % arrow line width=2pt,
912 % additions={
913 % additional item bottom color=orange!60!yellow,
914 % additional item border color=gray,
915 % additional item shadow=drop shadow,
916 % additional item offset=0.65cm,
917 % additional arrow line width=2pt,
918 % additional arrow tip=to,
919 % additional arrow color=orange!60!yellow,
920 % }
921 % }
922 % \smartdiagramadd[circular diagram]{
923 % aa,bb,cc,dd,ee
924 % }{
925 % above of module1/Start,right of module5/End
926 % }
927 % \smartdiagramconnect{to-}{module1/additional-module1}
928 % \smartdiagramconnect{-to}{module5/additional-module2}
929 % \end{minipage}
930 %
931 % \section{Recommendations and known issues}
932 % \label{sec:recommendations}
933 % \subsection{Something about colors}
934 % As seen in the section \ref{sec:options}, the colors could be customized by means of the key \smkey{set color list}. By default there are 10 predefined colors; in order: \colsmartbox{red!40}, \colsmartbox{cyan!40}, \colsmartbox{blue!40}, \colsmartbox{green!40}, \colsmartbox{orange!40}, \colsmartbox{yellow!40}, \colsmartbox{magenta!40}, \colsmartbox{brown!40}, \colsmartbox{violet!40} and \colsmartbox{teal!40}. This implies that, by default, it is not possible to have lists longer than 10 items. This, of course, could be avoided by declaring proper lists with, say, 20 colors and therefore develop diagrams with more than 10 items. In any case, it is always possible to reset custom color lists by means of:
935 % \begin{verbatim}
936 % \smartdiagramset{use predefined color list}
937 % \end{verbatim}
938 %
939 % In order to use one color for all the items it is possible to exploit the \smkey{uniform color list}; it has a particular syntax:
940 % \begin{verbatim}
941 % \smartdiagramset{uniform color list=<some color> for <n> items}
942 % \end{verbatim}
943 % The \meta{some color} is set for a list of \meta{n} items and nothing more, so in order to avoid problems make sure you dimension \meta{n} correctly. Indeed, in case \meta{n} is lower than the number of items inside the diagram the following happens:
944 % \begin{verbatim}
945 % \begin{center}
946 % \smartdiagramset{
947 % uniform color list=gray!60!black for 2 items,
948 % back arrow disabled=true,
949 % }
950 % \smartdiagram[flow diagram:horizontal]{PGF,Ti\textit{k}Z,Smartdiagram}
951 % \end{center}
952 % \end{verbatim}
953 % \begin{center}
954 % \smartdiagramset{use predefined color list,
955 % uniform color list=gray!60!black for 2 items,
956 % back arrow disabled=true,
957 % }
958 % \smartdiagram[flow diagram:horizontal]{PGF,Ti\textit{k}Z,Smartdiagram}
959 % \end{center}
960 % In conclusion, the uniform setting is extend only for \meta{n} items, for the remaining ones the predefined or a custom color list is used.
961 %
962 % Notice also that the key \smkey{uniform color list} makes the arrow color be uniform for \meta{n} items, but it has no relation with the \smkey{uniform arrow color} which automatically makes \emph{all} items with an uniform color. Indeed, the color taken by the arrows with:
963 % \begin{verbatim}
964 % \smartdiagramset{uniform arrow color=true}
965 % \end{verbatim}
966 % could be customized throught the key \smkey{arrow color}, while \smkey{uniform color list} make modules and arrows be rendered with the same color.
967 %
968 % \subsection{Defining styles}
969 % \label{subsec:stylesdef}
970 % The \textsf{smartdiagram} package admits the definition of styles to collect key-definitions; for example:
971 % \begin{verbatim}
972 % \smartdiagramset{my diagram style/.style={
973 % module shape=diamond,
974 % font=\scriptsize,
975 % module minimum width=1cm,
976 % module minimum height=1cm,
977 % text width=1cm
978 % }
979 % }
980 % \end{verbatim}
981 % can be subsequently used in:
982 % \begin{verbatim}
983 % \begin{center}
984 % \smartdiagramset{my diagram style, arrow tip=to}
985 % \smartdiagram[circular diagram]{Do, This, Only, For, Me}
986 % \end{center}
987 % \begin{center}
988 % \smartdiagramset{my diagram style, module y sep=2.5}
989 % \smartdiagram[flow diagram]{Do, This, For, Me}
990 % \end{center}
991 % \end{verbatim}
992 %
993 % \subsection{Circular, bubble and constellation diagrams}
994 % For these type of diagrams, the number of items is relevant: too many items lead to overlapping satellites and bubbles besides any attempt to resize things by means of keys that reduce the radius.
995 %
996 % Notice also that imposing a too short distance from the planet to satellites is bad and leads to something like:
997 % \smartdiagramset{use predefined color list}
998 % \begin{verbatim}
999 % \begin{center}
1000 % \smartdiagramset{planet color=orange!60, distance planet-satellite=1cm}
1001 % \smartdiagram[connected constellation diagram]
1002 % {Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
1003 % \end{center}
1004 % \end{verbatim}
1005 % \begin{center}
1006 % \scalebox{0.8}{
1007 % \smartdiagramset{planet color=orange!60, distance planet-satellite=1cm}
1008 % \smartdiagram[connected constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
1009 % }
1010 % \end{center}
1011 %
1012 % \subsection{Descriptive diagrams}
1013 % When the user has to build a \diagram{descriptive diagram}, simple or animated, the following rules have to be respected:
1014 % \begin{itemize}
1015 % \item each description title and description should be separated by a comma;
1016 % \item to use a comma inside a description, enclose by \{ \} the description;
1017 % \item use a comma after the last couple description title-description.
1018 % \end{itemize}
1019 % A working example:
1020 % \begin{verbatim}
1021 % \smartdiagram[descriptive diagram]{
1022 % {Set up, The set up operation consist of..},
1023 % {Run, {After having set up the program, you must run..}},
1024 % {Analyze, You must check what did with analytical tools like..},
1025 % }
1026 % \end{verbatim}
1027 % A non-working example:
1028 % \begin{verbatim}
1029 % \smartdiagram[descriptive diagram]{
1030 % {Set up, The set up operation consist of..},
1031 % {Run, {After having set up the program, you must run..}},
1032 % {Analyze, You must check what did with analytical tools like..}
1033 % }
1034 % \end{verbatim}
1035 % The \emph{mandatory} final comma is missing thus, as result, the last couple description title-description will be entirely treated as a description title.
1036 %
1037 % Another suggestion regarding descriptive diagrams is about the description title: it should be short in order to avoid the size of the circle explode. To kept it under controll, the keys \smkey{description title width}, \smkey{description title text width} and \smkey{description title font} are of help.
1038 %
1039 % \subsection{Decorations}
1040 % To decorate the border of modules, it is kindly recommended to first declare the decoration choosen by means of an apposite style and then apply the style. The procedure, in code, should be as follows:
1041 % \begin{verbatim}
1042 % \tikzset{my wonderful decoration/.style={decorate,decoration=bent}}
1043 % \smartdiagramset{insert decoration=my wonderful decoration,...}
1044 % \end{verbatim}
1045 % where the dots represent the other options.
1046 %
1047 % The insertion of decorations inside a \diagram{descriptive diagram} are problematic: only \verb|random steps|, \verb|bent| and \verb|coil| do not raise errors. Other decorations, like \verb|snake|, raise as error:
1048 % \begin{verbatim}
1049 % ! Dimension too large.
1050 % \end{verbatim} but, after all, the decoration is deployed anyway.
1051 %
1052 % In case the user wants to decorate a border with a decoration that involves random numbers, such as \verb|random steps| or other custom-built decorations, it is preferable to set a seed for the animated diagram, to avoid that at each step the border of the same module changes. An example:
1053 % \begin{verbatim}
1054 % \begin{frame}
1055 % \begin{center}
1056 % \pgfmathsetseed{12354}
1057 % \tikzset{my decoration/.style={decorate,decoration=random steps}}
1058 % \smartdiagramset{insert decoration=my decoration}
1059 % \smartdiagramanimated[descriptive diagram]{
1060 % {Set up, The set up operation consist of..},
1061 % {Run, {After having set up the program, you must run..}},
1062 % {Analyze, You must check what did with analytical tools like..},
1063 % {Modify, {After the analysis, you can still modify or add..}},
1064 % }
1065 % \end{center}
1066 % \end{frame}
1067 % \end{verbatim}
1068 %
1069 % \subsection{Priority descriptive diagrams}
1070 % The vertical arrow is drawn in background with a fading effect: it may occurr that under some pdf editor this effect is not shown (this happened to me with evince, but it perfectly worked with okular).
1071 %
1072 % For what concern these diagrams there is a bug in displaying the tick line when the \smkey{priority arrow head extend} is set with a bigger size than the default; a minimal-non-working example:
1073 % \begin{verbatim}
1074 % \begin{center}
1075 % \smartdiagramset{priority arrow width=2cm,
1076 % priority arrow height advance=2.25cm,
1077 % priority arrow head extend=0.3cm}
1078 % \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
1079 % \end{center}
1080 % \end{verbatim}
1081 % \begin{center}
1082 % \smartdiagramset{use predefined color list}
1083 % \smartdiagramset{priority arrow width=2cm,priority arrow height advance=2.25cm,
1084 % priority arrow head extend=0.25cm}
1085 % \scalebox{0.8}{
1086 % \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
1087 % }
1088 % \end{center}
1089 %
1090 % \section{Aknowledgements}
1091 % I would like to acknowledge first of all \href{http://tex.stackexchange.com/users/3144/alain-matthes}{Alain Matthes} and \href{http://tex.stackexchange.com/users/4956/mohsen}{Mohsen} because the \diagram{bubble diagram} and the \diagram{constellation diagram} are based on \href{http://tex.stackexchange.com/questions/52394/high-level-macros-and-environments-based-on-tikz?#52408}{Alain's answer} while the \diagram{circular diagram} is based on \href{http://tex.stackexchange.com/questions/52394/high-level-macros-and-environments-based-on-tikz?#52972}{Mohsen's answer}.
1092 %
1093 % I would also like to thank \href{http://tex.stackexchange.com/users/4427/egreg}{Enrico Gregorio} and \href{http://tex.stackexchange.com/users/994/ahmed-musa}{Ahmed Musa} for the courtesy of explaining me why my poor attempt in creating the \smkey{set color list} failed and for providing me valid solutions. Enrico also kindly fixed a spacing bug concerning the \smkey{uniform color list}.
1094 %
1095 % Last, but not least, I would like to thank prof.~Ludger~Humbert for suggesting and providing the code for the \diagram{circular diagram:clockwise} as well as for pointing out some bugs in the version 0.3 and André Hilbig for suggesting the key \smkey{back arrow disabled}.
1096 % \StopEventually{\PrintChanges}
1097 % \iffalse
1098 %<*package>
1099 % \fi
1100 % \section{Implementation}
1101 % \subsection{Initialization and Package Options}
1102 %
1103 % This subsection highlights which are the package loaded and the \verb|tikzlibraries| needed.
1104 % \begin{macrocode}
1105 \RequirePackage{tikz}
1106
1107 \RequirePackage{etoolbox}
1108 \RequirePackage{xparse}
1109 \RequirePackage{xstring}
1110
1111 \usetikzlibrary{backgrounds,
1112 calc,
1113 fadings,
1114 shadows,
1115 shapes.arrows,
1116 shapes.symbols
1117 }
1118 \pgfdeclarelayer{smart diagram arrow back}
1119 \pgfsetlayers{background,smart diagram arrow back,main}
1120
1121
1122 \def\usesmartdiagramlibrary{\pgfutil@ifnextchar[{\use@smartdiagramlibrary}{\use@@smartdiagramlibrary}}%}
1123 \def\use@smartdiagramlibrary[#1]{\use@@smartdiagramlibrary{#1}}
1124 \def\use@@smartdiagramlibrary#1{%
1125 \edef\pgf@list{#1}%
1126 \pgfutil@for\pgf@temp:=\pgf@list\do{%
1127 \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
1128 \ifx\pgf@temp\pgfutil@empty
1129 \else
1130 \expandafter\ifx\csname smartdiagram@library@\pgf@temp @loaded\endcsname\relax%
1131 \expandafter\global\expandafter\let\csname smartdiagram@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
1132 \expandafter\edef\csname smartdiagram@library@#1@atcode\endcsname{\the\catcode`\@}
1133 \expandafter\edef\csname smartdiagram@library@#1@barcode\endcsname{\the\catcode`\|}
1134 \catcode`\@=11
1135 \catcode`\|=12
1136 \pgfutil@InputIfFileExists{smartdiagramlibrary\[email protected]}{}{
1137 \PackageError{smartdiagram}{I did not find the smartdiagram library '\pgf@temp'.}{}
1138 }%
1139 \catcode`\@=\csname smartdiagram@library@#1@atcode\endcsname
1140 \catcode`\|=\csname smartdiagram@library@#1@barcode\endcsname
1141 \fi%
1142 \fi
1143 }%
1144 }
1145
1146 \usesmartdiagramlibrary{core.definitions}
1147 \usesmartdiagramlibrary{core.styles}
1148 \usesmartdiagramlibrary{core.commands}
1149 % \end{macrocode}
1150 % \iffalse
1151 %</package>
1152 % \fi
1153 %
1154 % \iffalse
1155 %<*definitions>
1156 % \fi
1157 % \subsection{Keys and color declaration}
1158 % The predefined colors:
1159 % \begin{macrocode}
1160 \@namedef{color@1}{red!40}
1161 \@namedef{color@2}{cyan!40}
1162 \@namedef{color@3}{blue!40}
1163 \@namedef{color@4}{green!40}
1164 \@namedef{color@5}{orange!40}
1165 \@namedef{color@6}{yellow!40}
1166 \@namedef{color@7}{magenta!40}
1167 \@namedef{color@8}{brown!40}
1168 \@namedef{color@9}{violet!40}
1169 \@namedef{color@10}{teal!40}
1170 % \end{macrocode}
1171 % Basic shape definition and function to compute the height of the \diagram{priority descriptive diagram}:
1172 % \begin{macrocode}
1173 \tikzset{rnd rectangle/.style={rectangle,rounded corners}
1174 }
1175
1176 \def\CalcHeight(#1,#2)#3{%
1177 \pgfpointdiff{\pgfpointanchor{#1}{south west}}{\pgfpointanchor{#2}{north west}}
1178 \pgfmathsetmacro{\myheight}{veclen(\pgf@x,\pgf@y)}
1179 \global\expandafter\edef\csname #3\endcsname{\myheight}
1180 }
1181 % \end{macrocode}
1182 % The key definition and the functions to set them:
1183 % \begin{macrocode}
1184 \pgfkeys{/smart diagram/.cd, module minimum width/.initial=2cm,
1185 module minimum height/.initial={1cm},
1186 module y sep/.initial={1.65},
1187 module x sep/.initial={2.75},
1188 descriptive items y sep/.initial={1.75},
1189 text width/.initial={1.5cm},
1190 description title width/.initial={1.5cm},
1191 description text width/.initial={5cm},
1192 description title text width/.initial={1.25cm},
1193 description title font/.initial={\small},
1194 description font/.initial={\small},
1195 description width/.initial={5.5cm},
1196 font/.initial={\small},
1197 border color/.initial={gray},
1198 circular distance/.initial={2.75cm},
1199 arrow line width/.initial={0.1cm},
1200 module shape/.initial={rnd rectangle},
1201 insert decoration/.initial={},
1202 arrow tip/.initial={stealth},
1203 arrow color/.initial={gray},
1204 bubble center node size/.initial={4cm},
1205 bubble center node font/.initial={\large},
1206 bubble center node color/.initial={lightgray!60},
1207 distance center/other bubbles/.initial=0.8cm,
1208 distance text center bubble/.initial={0.5cm},
1209 bubble fill opacity/.initial={0.5},
1210 bubble node size/.initial={2.5cm},
1211 bubble text opacity/.initial={0.8},
1212 bubble node font/.initial={\normalfont},
1213 planet size/.initial={2.5cm},
1214 planet color/.initial={lightgray!60},
1215 planet font/.initial={\large},
1216 distance planet-connection/.initial={0.1cm},
1217 distance planet-text/.initial={0.5cm},
1218 planet text width/.initial={1.75cm},
1219 satellite size/.initial={1.75cm},
1220 satellite font/.initial={\normalfont},
1221 satellite fill opacity/.initial={0.5},
1222 satellite text opacity/.initial={0.8},
1223 satellite text width/.initial={1.5cm},
1224 distance satellite-connection/.initial={0.075cm},
1225 connection line width/.initial={0.1cm},
1226 connection color/.initial={gray},
1227 distance planet-satellite/.initial={3.5cm},
1228 priority arrow width/.initial={1.5cm},
1229 priority arrow head extend/.initial={0.15cm},
1230 priority tick size/.initial={5pt},
1231 priority arrow height advance/.initial={2cm},
1232 sequence item height/.initial={1cm},
1233 sequence item width/.initial={2cm},
1234 sequence item border color/.initial={gray},
1235 sequence item border size/.initial={1.75\pgflinewidth},
1236 sequence item font size/.initial={\normalfont},
1237 sequence item fill opacity/.initial={1},
1238 sequence item text opacity/.initial={1},
1239 sequence item text width/.initial={1.9cm},
1240 sequence item text color/.initial={black},
1241 sequence item uniform color/.initial={gray!60!black},
1242 arrow style/.initial={<-},
1243 text color/.initial={black},
1244 back arrow distance/.initial={0.5},
1245 }%
1246
1247 \pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
1248 module minimum height/.get=\sm@core@moduleheight,
1249 module y sep/.get=\sm@core@moduleysep,
1250 module x sep/.get=\sm@core@modulexsep,
1251 descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
1252 text width/.get=\sm@core@moduletextwidth,
1253 description title width/.get=\sm@core@descriptiontitlewidth,
1254 description text width/.get=\sm@core@descriptiontextwidth,
1255 description title text width/.get=\sm@core@descriptiontitletextwidth,
1256 description title font/.get=\sm@core@descriptiontitlefontsize,
1257 description font/.get=\sm@core@descriptionfontsize,
1258 description width/.get=\sm@core@descriptionwidth,
1259 font/.get=\sm@core@modulefontsize,
1260 border color/.get=\sm@core@bordercolor,
1261 circular distance/.get=\sm@core@circulardistance,
1262 arrow line width/.get=\sm@core@arrowlinewidth,
1263 module shape/.get=\sm@core@moduleshape,
1264 insert decoration/.get=\sm@core@borderdecoration,
1265 arrow tip/.get=\sm@core@arrowtip,
1266 arrow color/.get=\sm@core@arrowcolor,
1267 bubble center node size/.get=\sm@core@bubblecenternodesize,
1268 bubble center node font/.get=\sm@core@bubblecenternodefont,
1269 bubble center node color/.get=\sm@core@bubblecenternodecolor,
1270 distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
1271 distance text center bubble/.get=\sm@core@distancetextcenterbubble,
1272 bubble fill opacity/.get=\sm@core@bubblefillopacity,
1273 bubble node size/.get=\sm@core@bubblenodesize,
1274 bubble text opacity/.get=\sm@core@bubbletextopacity,
1275 bubble node font/.get=\sm@core@bubblenodefont,
1276 planet size/.get=\sm@core@planetminimumsize,
1277 planet color/.get=\sm@core@planetcolor,
1278 planet font/.get=\sm@core@planetfont,
1279 distance planet-connection/.get=\sm@core@planetoutersep,
1280 distance planet-text/.get=\sm@core@planetinnersep,
1281 planet text width/.get=\sm@core@planettextwidth,
1282 satellite size/.get=\sm@core@satelliteminimumsize,
1283 satellite font/.get=\sm@core@satellitefont,
1284 satellite fill opacity/.get=\sm@core@satellitefillopacity,
1285 satellite text opacity/.get=\sm@core@satellitetextopacity,
1286 satellite text width/.get=\sm@core@satellitetextwidth,
1287 distance satellite-connection/.get=\sm@core@satelliteoutersep,
1288 connection line width/.get=\sm@core@connectionlinewidth,
1289 connection color/.get=\sm@core@connectioncolor,
1290 distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
1291 priority arrow width/.get=\sm@core@priorityarrowwidth,
1292 priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
1293 priority tick size/.get=\sm@core@prioritytick,
1294 priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
1295 sequence item height/.get=\sm@core@seqitemheight,
1296 sequence item width/.get=\sm@core@seqitemwidth,
1297 sequence item border color/.get=\sm@core@seqitembordercolor,
1298 sequence item border size/.get=\sm@core@seqlinewidth,
1299 sequence item font size/.get=\sm@core@seqitemfont,
1300 sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
1301 sequence item text opacity/.get=\sm@core@seqitemtextopacity,
1302 sequence item text width/.get=\sm@core@seqitemtextwidth,
1303 sequence item text color/.get=\sm@core@seqitemtextcolor,
1304 sequence item uniform color/.get=\sm@core@seqitemuniformcol,
1305 arrow style/.get=\sm@core@arrowstyle,
1306 text color/.get=\sm@core@textcolor,
1307 back arrow distance/.get=\sm@core@backarrowdistance,
1308 }%
1309 % \end{macrocode}
1310 % The specific key to set the list of colors:
1311 % \begin{macrocode}
1312 \pgfkeys{/smart diagram/.cd, set color list/.code={%
1313 \foreach \listitem [count=\i] in {#1}{%
1314 \global\@namedef{color@\i\expandafter}\expandafter{\listitem}%
1315 }%
1316 }%
1317 }
1318
1319 \pgfkeys{/smart diagram/.cd, uniform color list/.code args={#1 for #2 items}{%
1320 \foreach \listitem [count=\i] in {1,...,#2}{%
1321 \global\@namedef{color@\i\expandafter}\expandafter{#1}%
1322 }%
1323 }%
1324 }
1325
1326 \pgfkeys{/smart diagram/.cd, use predefined color list/.code={%
1327 \@namedef{color@1}{red!30}%
1328 \@namedef{color@2}{cyan!30}%
1329 \@namedef{color@3}{blue!30}%
1330 \@namedef{color@4}{green!30}%
1331 \@namedef{color@5}{orange!30}%
1332 \@namedef{color@6}{yellow!30}%
1333 \@namedef{color@7}{magenta!30}%
1334 \@namedef{color@8}{brown!30}%
1335 \@namedef{color@9}{violet!30}%
1336 \@namedef{color@10}{teal!30}%
1337 }
1338 }
1339 % \end{macrocode}
1340 % The specific key to disable the back arrow in the \diagram{flow diagram} and in the \diagram{flow diagram:horizontal}:
1341 % \begin{macrocode}
1342 \newif\ifbackarrowdisabled
1343 \pgfkeys{/smart diagram/.cd,
1344 back arrow disabled/.is if=backarrowdisabled,
1345 back arrow disabled=false,
1346 }
1347 % \end{macrocode}
1348 % The specific key to disable the final arrow in the \diagram{circular diagram} and in the \diagram{circular diagram: clockwise}:
1349 % \begin{macrocode}
1350 \newif\ifcircularfinalarrowdisabled
1351 \pgfkeys{/smart diagram/.cd,
1352 circular final arrow disabled/.is if=circularfinalarrowdisabled,
1353 circular final arrow disabled=false,
1354 }
1355 % \end{macrocode}
1356 % The command to activate the various keys:
1357 % \begin{macrocode}
1358 \NewDocumentCommand{\smartdiagramset}{m}{%
1359 \pgfkeys{/smart diagram/.cd,#1}%
1360 \pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
1361 module minimum height/.get=\sm@core@moduleheight,
1362 module y sep/.get=\sm@core@moduleysep,
1363 module x sep/.get=\sm@core@modulexsep,
1364 descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
1365 text width/.get=\sm@core@moduletextwidth,
1366 description title width/.get=\sm@core@descriptiontitlewidth,
1367 description text width/.get=\sm@core@descriptiontextwidth,
1368 description title text width/.get=\sm@core@descriptiontitletextwidth,
1369 description title font/.get=\sm@core@descriptiontitlefontsize,
1370 description font/.get=\sm@core@descriptionfontsize,
1371 description width/.get=\sm@core@descriptionwidth,
1372 font/.get=\sm@core@modulefontsize,
1373 border color/.get=\sm@core@bordercolor,
1374 circular distance/.get=\sm@core@circulardistance,
1375 arrow line width/.get=\sm@core@arrowlinewidth,
1376 module shape/.get=\sm@core@moduleshape,
1377 insert decoration/.get=\sm@core@borderdecoration,
1378 arrow tip/.get=\sm@core@arrowtip,
1379 arrow color/.get=\sm@core@arrowcolor,
1380 bubble center node size/.get=\sm@core@bubblecenternodesize,
1381 bubble center node font/.get=\sm@core@bubblecenternodefont,
1382 bubble center node color/.get=\sm@core@bubblecenternodecolor,
1383 distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
1384 distance text center bubble/.get=\sm@core@distancetextcenterbubble,
1385 bubble fill opacity/.get=\sm@core@bubblefillopacity,
1386 bubble node size/.get=\sm@core@bubblenodesize,
1387 bubble text opacity/.get=\sm@core@bubbletextopacity,
1388 bubble node font/.get=\sm@core@bubblenodefont,
1389 planet size/.get=\sm@core@planetminimumsize,
1390 planet color/.get=\sm@core@planetcolor,
1391 planet font/.get=\sm@core@planetfont,
1392 distance planet-connection/.get=\sm@core@planetoutersep,
1393 distance planet-text/.get=\sm@core@planetinnersep,
1394 planet text width/.get=\sm@core@planettextwidth,
1395 satellite size/.get=\sm@core@satelliteminimumsize,
1396 satellite font/.get=\sm@core@satellitefont,
1397 satellite fill opacity/.get=\sm@core@satellitefillopacity,
1398 satellite text opacity/.get=\sm@core@satellitetextopacity,
1399 satellite text width/.get=\sm@core@satellitetextwidth,
1400 distance satellite-connection/.get=\sm@core@satelliteoutersep,
1401 connection line width/.get=\sm@core@connectionlinewidth,
1402 connection color/.get=\sm@core@connectioncolor,
1403 distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
1404 priority arrow width/.get=\sm@core@priorityarrowwidth,
1405 priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
1406 priority tick size/.get=\sm@core@prioritytick,
1407 priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
1408 sequence item height/.get=\sm@core@seqitemheight,
1409 sequence item width/.get=\sm@core@seqitemwidth,
1410 sequence item border color/.get=\sm@core@seqitembordercolor,
1411 sequence item border size/.get=\sm@core@seqlinewidth,
1412 sequence item font size/.get=\sm@core@seqitemfont,
1413 sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
1414 sequence item text opacity/.get=\sm@core@seqitemtextopacity,
1415 sequence item text width/.get=\sm@core@seqitemtextwidth,
1416 sequence item text color/.get=\sm@core@seqitemtextcolor,
1417 sequence item uniform color/.get=\sm@core@seqitemuniformcol,
1418 arrow style/.get=\sm@core@arrowstyle,
1419 text color/.get=\sm@core@textcolor,
1420 back arrow distance/.get=\sm@core@backarrowdistance,
1421 }%
1422 }%
1423 % \end{macrocode}
1424 % Key to let the sequence color be uniform:
1425 % \begin{macrocode}
1426 \pgfkeys{/smart diagram/.cd,%
1427 uniform sequence color/.is choice,%
1428 uniform sequence color/true/.code={%
1429 \tikzset{sequence item/.append style={%
1430 fill=\sm@core@seqitemuniformcol,
1431 },%
1432 }%
1433 },%
1434 uniform sequence color/false/.style={sequence item},%
1435 uniform sequence color/.default=false,%
1436 }%
1437 % \end{macrocode}
1438 % Key to let the connection planet satellite color be uniform:
1439 % \begin{macrocode}
1440 \pgfkeys{/smart diagram/.cd,%
1441 uniform connection color/.is choice,%
1442 uniform connection color/true/.code={%
1443 \tikzset{connection planet satellite/.append style={%
1444 \sm@core@connectioncolor
1445 },%
1446 }%
1447 },%
1448 uniform connection color/false/.style={connection planet satellite},%
1449 uniform connection color/.default=false,%
1450 }%
1451 % \end{macrocode}
1452 % Key to let the arrow color be uniform:
1453 % \begin{macrocode}
1454 \pgfkeys{/smart diagram/.cd,%
1455 uniform arrow color/.is choice,%
1456 uniform arrow color/true/.code={%
1457 \tikzset{diagram arrow type/.append style={%
1458 \sm@core@arrowcolor
1459 },%
1460 }%
1461 },%
1462 uniform arrow color/false/.style={diagram arrow type},%
1463 uniform arrow color/.default=false,%
1464 }%
1465
1466 % \end{macrocode}
1467 % \iffalse
1468 %</definitions>
1469 % \fi
1470 %
1471 % \iffalse
1472 %<*styles>
1473 % \fi
1474 % The fading style applied to the \diagram{priority descriptive diagram} and styles diagram definition:
1475 % \begin{macrocode}
1476 \tikzfading[name=priorityarrowfading,
1477 bottom color=transparent!5,
1478 top color=transparent!80
1479 ]
1480 \tikzset{priority arrow fill/.style={
1481 fill=gray,
1482 path fading=priorityarrowfading
1483 }
1484 }
1485
1486 \tikzset{module/.style={%
1487 \pgfkeysvalueof{/smart diagram/module shape},
1488 thick,
1489 draw=\sm@core@bordercolor,
1490 top color=white,
1491 bottom color=\col,
1492 text=\sm@core@textcolor,
1493 text width=\sm@core@moduletextwidth,
1494 minimum width=\sm@core@modulewidth,
1495 minimum height=\sm@core@moduleheight,
1496 font=\sm@core@modulefontsize,
1497 \sm@core@borderdecoration
1498 },
1499 diagram arrow type/.style={%
1500 \sm@core@arrowstyle,
1501 >=\sm@core@arrowtip,
1502 line width=\sm@core@arrowlinewidth,
1503 \col
1504 },%
1505 }
1506 \tikzset{description title/.style={%
1507 circle,
1508 draw=\sm@core@bordercolor,
1509 minimum width=\sm@core@descriptiontitlewidth,
1510 anchor=east,
1511 bottom color=\col,
1512 top color=white!80!\col,
1513 font=\sm@core@descriptiontitlefontsize,
1514 text width=\sm@core@descriptiontitletextwidth,
1515 \sm@core@borderdecoration,
1516 },
1517 description/.style={%
1518 \pgfkeysvalueof{/smart diagram/module shape},
1519 text width=\sm@core@descriptiontextwidth,
1520 draw=\sm@core@bordercolor,
1521 anchor=west,
1522 minimum height=\sm@core@moduleheight,
1523 minimum width=\sm@core@descriptionwidth,
1524 bottom color=\col,
1525 top color=white!80!\col,
1526 font=\sm@core@descriptionfontsize,
1527 \sm@core@borderdecoration,
1528 }%
1529 }
1530 \tikzset{priority arrow/.style={
1531 draw=\sm@core@bordercolor,
1532 single arrow,
1533 minimum height=\distancemodules,
1534 minimum width=\sm@core@priorityarrowwidth,
1535 priority arrow fill,
1536 rotate=90,
1537 single arrow head extend=\sm@core@priorityarrowheadextend,
1538 anchor=west,
1539 }
1540 }
1541 \tikzset{bubble center node/.style={
1542 minimum size=\sm@core@bubblecenternodesize,
1543 circle,
1544 fill=\sm@core@bubblecenternodecolor,
1545 font=\sm@core@bubblecenternodefont,
1546 outer sep=\sm@core@distancecenterotherbubbles,
1547 inner sep=\sm@core@distancetextcenterbubble,
1548 },
1549 bubble node/.style={
1550 minimum size=\sm@core@bubblenodesize,
1551 circle,
1552 ultra thick,
1553 font=\sm@core@bubblenodefont,
1554 draw=white,
1555 fill opacity=\sm@core@bubblefillopacity,
1556 fill=\col,
1557 text opacity=\sm@core@bubbletextopacity,
1558 }
1559 }
1560 \tikzset{planet/.style={
1561 minimum size=\sm@core@planetminimumsize,
1562 circle,
1563 fill=\sm@core@planetcolor,
1564 font=\sm@core@planetfont,
1565 outer sep=\sm@core@planetoutersep,
1566 inner sep=\sm@core@planetinnersep,
1567 text width=\sm@core@planettextwidth,
1568 },
1569 satellite/.style={
1570 minimum size=\sm@core@satelliteminimumsize,
1571 circle,
1572 font=\sm@core@satellitefont,
1573 fill opacity=\sm@core@satellitefillopacity,
1574 fill=\col,
1575 text opacity=\sm@core@satellitetextopacity,
1576 text width=\sm@core@satellitetextwidth,
1577 outer sep=\sm@core@satelliteoutersep,
1578 },
1579 connection planet satellite/.style={
1580 ->,
1581 line width=\sm@core@connectionlinewidth,
1582 >=\sm@core@arrowtip,
1583 \col,
1584 }
1585 }
1586
1587 \tikzset{sequence item/.style={
1588 minimum height=\sm@core@seqitemheight,
1589 minimum width=\sm@core@seqitemwidth,
1590 signal,
1591 signal from=west,
1592 signal to=east,
1593 draw=\sm@core@seqitembordercolor,
1594 line width=\sm@core@seqlinewidth,
1595 font=\sm@core@seqitemfont,
1596 fill opacity=\sm@core@seqitemfillopacity,
1597 fill=\col,
1598 text opacity=\sm@core@seqitemtextopacity,
1599 text width=\sm@core@seqitemtextwidth,
1600 text=\sm@core@seqitemtextcolor,
1601 }
1602 }
1603 % let the first word of the item be hypenate
1604 \tikzset{let hypenation/.style={%
1605 execute at begin node={%
1606 \hspace{0pt}%
1607 }%
1608 }%
1609 }%
1610 % \end{macrocode}
1611 % The definition of the visibility style:
1612 % \begin{macrocode}
1613 \tikzset{%
1614 sminvisible/.style={opacity=0,text opacity=0},
1615 smvisible on/.style={smalt=#1{}{sminvisible}},
1616 smalt/.code args={<#1>#2#3}{%
1617 \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
1618 },%
1619 }%
1620 % \end{macrocode}
1621 % \iffalse
1622 %</styles>
1623 % \fi
1624 %
1625 % \iffalse
1626 %<*commands>
1627 % \fi
1628 % \subsection{Commands}
1629 % Definition of the two commands. The diagrams:
1630 % \begin{macrocode}
1631 \NewDocumentCommand{\smartdiagram}{r[] m}{%
1632 \StrCut{#1}{:}\diagramtype\option
1633 \IfNoValueTF{#1}{% true-no value 1
1634 \PackageError{smartdiagram}%
1635 {Type of the diagram not inserted. Please insert it}%
1636 {Example: \protect\smartdiagram[flow diagram]}}
1637 {%false-no value 1
1638 \IfStrEq{\diagramtype}{}{%
1639 \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
1640 {Example: \protect\smartdiagram[flow diagram]}
1641 }{}
1642 \IfStrEq{\diagramtype}{circular diagram}{% true-circular diagram
1643 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1644
1645 \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi}
1646
1647 \foreach \smitem [count=\xi] in {#2}{%
1648 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1649 \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi}
1650 }{% false-clockwise-circular diagram
1651 \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
1652 }
1653 \edef\col{\@nameuse{color@\xi}}
1654 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1655 \node[module,drop shadow] (module\xi)
1656 at (-\angle:\sm@core@circulardistance) {\smitem };
1657 }{% false-clockwise-circular diagram
1658 \node[module,drop shadow] (module\xi)
1659 at (\angle:\sm@core@circulardistance) {\smitem };
1660 }
1661 }%
1662 \foreach \smitem [count=\xi] in {#2}{%
1663 \ifnum\xi=\maxsmitem
1664 \ifcircularfinalarrowdisabled
1665 \relax
1666 \else
1667 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1668 \edef\col{\@nameuse{color@\xj}}
1669 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1670 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm]
1671 (module\xj) to[bend right] (module\xi);
1672 }{% false-clockwise-circular diagram
1673 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm]
1674 (module\xj) to[bend left] (module\xi);
1675 }
1676 \fi
1677 \else
1678 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1679 \edef\col{\@nameuse{color@\xj}}
1680 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1681 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm]
1682 (module\xj) to[bend right] (module\xi);
1683 }{% false-clockwise-circular diagram
1684 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm]
1685 (module\xj) to[bend left] (module\xi);
1686 }
1687
1688 \fi
1689 }%
1690 \end{tikzpicture}
1691 }{}% end-circular diagram
1692 \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram
1693 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1694
1695 \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi}
1696
1697 \foreach \smitem [count=\xi] in {#2}{%
1698 \edef\col{\@nameuse{color@\xi}}
1699 \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
1700 \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\sm@core@modulexsep} in
1701 node[module,drop shadow] (module\xi) at +(\n2,0) {\smitem};
1702 }{% false-horizontal-flow diagram
1703 \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\sm@core@moduleysep} in
1704 node[module,drop shadow] (module\xi) at +(0,\n2) {\smitem};
1705 }
1706 }%
1707
1708 \foreach \smitem [count=\xi] in {#2}{%
1709 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1710 \edef\col{\@nameuse{color@\xj}}
1711 \ifnum\xi<\maxsmitem
1712 \begin{pgfonlayer}{smart diagram arrow back}
1713 \draw[diagram arrow type] (module\xj) -- (module\xi);
1714 \end{pgfonlayer}
1715 \fi
1716 % last arrow - not display it in background - check if disabled
1717 \ifbackarrowdisabled
1718 \relax
1719 \else
1720 \ifnum\xi=\maxsmitem
1721 \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
1722 \tikzset{square arrow/.style={%
1723 to path={-- ++(0,\sm@core@backarrowdistance) -| (\tikztotarget)}
1724 }%
1725 }%
1726 \draw[diagram arrow type, square arrow]
1727 (module\xj.north) to (module\xi.north);
1728 }{% false-horizontal-flow diagram
1729 \tikzset{square arrow/.style={%
1730 to path={-- ++(\sm@core@backarrowdistance,0) |- (\tikztotarget)}
1731 }%
1732 }%
1733 \draw[diagram arrow type,square arrow]
1734 (module\xj.east) to (module\xi);
1735 }%
1736 \fi
1737 \fi
1738 }%
1739 \end{tikzpicture}
1740 }{}% end-flow diagram
1741 \IfStrEq{\diagramtype}{descriptive diagram}{% true-descr. diagram
1742 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1743 \foreach \smitem [count=\xi] in {#2}{%
1744 \edef\col{\@nameuse{color@\xi}}
1745 \foreach \subitem [count=\xii] in \smitem{%
1746 \ifnumequal{\xii}{1}{% true
1747 \node[description title,drop shadow]
1748 (module-title\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
1749 }{}
1750 \ifnumequal{\xii}{2}{% true
1751 \node[description,drop shadow](module\xi)
1752 at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
1753 }{}
1754 }%
1755 }%
1756 \end{tikzpicture}
1757 }{}% end-descr. diagram
1758 \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram
1759 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1760 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
1761 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
1762 \foreach \smitem [count=\xi] in {#2}{%
1763 \ifnumequal{\xi}{1}{ %true
1764 \node[bubble center node](center bubble){\smitem};
1765 }{%false
1766 \pgfmathtruncatemacro{\xj}{\xi-1}
1767 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
1768 \edef\col{\@nameuse{color@\xj}}
1769 \node[bubble node] (module\xi)
1770 at (center bubble.\angle) {\smitem };
1771 }%
1772 }%
1773 \end{tikzpicture}
1774 }{}%end-bubble diagram
1775 \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram
1776 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1777 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
1778 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
1779 \foreach \smitem [count=\xi] in {#2}{%
1780 \ifnumequal{\xi}{1}{ %true
1781 \node[planet](planet){\smitem};
1782 }{%false
1783 \pgfmathtruncatemacro{\xj}{\xi-1}
1784 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
1785 \edef\col{\@nameuse{color@\xj}}
1786 \node[satellite] (satellite\xi)
1787 at (\angle:\sm@core@distanceplanetsatellite) {\smitem };
1788 \draw[connection planet satellite] (planet) -- (satellite\xi);
1789 }%
1790 }%
1791 \end{tikzpicture}
1792 }{}%end-const diagram
1793 \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram
1794 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1795 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
1796 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
1797 \foreach \smitem [count=\xi] in {#2}{%
1798 \ifnumequal{\xi}{1}{ %true
1799 \node[planet](planet){\smitem};
1800 }{%false
1801 \pgfmathtruncatemacro{\xj}{\xi-1}
1802 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
1803 \edef\col{\@nameuse{color@\xj}}
1804 \node[satellite] (satellite\xj)
1805 at (\angle:\sm@core@distanceplanetsatellite) {\smitem };
1806 }%
1807 }%
1808 \foreach \smitem [count=\xi] in {#2}{%
1809 \ifnumgreater{\xi}{1}{ %true
1810 \pgfmathtruncatemacro{\xj}{\xi-1}
1811 \edef\col{\@nameuse{color@\xj}}
1812 \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
1813 \path[connection planet satellite,-]
1814 (satellite\xj) edge[bend right] (satellite\xk);
1815 }{}
1816 }%
1817 \end{tikzpicture}
1818 }{}%end-connected constellation diagram
1819 \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
1820 \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
1821 \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
1822 \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
1823 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1824 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
1825 \foreach \smitem [count=\xi] in {#2}{%
1826 \edef\col{\@nameuse{color@\xi}}
1827 \node[description,drop shadow](module\xi)
1828 at (0,0+\xi*\sm@core@descriptiveitemsysep) {\smitem};
1829 \draw[line width=\sm@core@prioritytick,\col]
1830 ([xshift=-\arrowtickxshift pt]module\xi.base west)--
1831 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);
1832 }%
1833 \coordinate (A) at (module1);
1834 \coordinate (B) at (module\maxsmitem);
1835 \CalcHeight(A,B){heightmodules}
1836 \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
1837 \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
1838 \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
1839 \begin{pgfonlayer}{background}
1840 \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
1841 \end{pgfonlayer}
1842 \end{tikzpicture}
1843 }{}% end-priority descriptive diagram
1844 \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram
1845 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1846 \foreach \x[count=\xi, count=\prevx from 0] in {#2}{%
1847 \edef\col{\@nameuse{color@\xi}}
1848 \ifnum\xi=1
1849 \node[sequence item] (sequence-item\xi) {\x};
1850 \else
1851 \node[sequence item,anchor=west] (sequence-item\xi) at (sequence-item\prevx.east) {\x};
1852 \fi
1853 }
1854 \end{tikzpicture}
1855 }{}% end-sequence diagram
1856 }% end-no value 1
1857 }% end-command
1858 % \end{macrocode}
1859 % The command definition for the animated diagrams:
1860 % \begin{macrocode}
1861 \NewDocumentCommand{\smartdiagramanimated}{r[] m}{%
1862 \StrCut{#1}{:}\diagramtype\option
1863 \IfNoValueTF{#1}{% true-no value 1
1864 \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
1865 {Example: \protect\smartdiagram[flow diagram]}}
1866 {%false-no value 1
1867 \IfStrEq{\diagramtype}{}{%
1868 \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
1869 {Example: \protect\smartdiagram[flow diagram]}
1870 }{}
1871 \IfStrEq{\diagramtype}{circular diagram}{% true-circular diagram
1872 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1873 \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi}
1874 \foreach \smitem [count=\xi] in {#2}{%
1875 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1876 \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi}
1877 }{% false-clockwise-circular diagram
1878 \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
1879 }
1880 \edef\col{\@nameuse{color@\xi}}
1881 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1882 \node[module,
1883 drop shadow={smvisible on=<\xi->},
1884 smvisible on=<\xi->] (module\xi)
1885 at (-\angle:\sm@core@circulardistance) {\smitem};
1886 }{% false-clockwise-circular diagram
1887 \node[module,
1888 drop shadow={smvisible on=<\xi->},
1889 smvisible on=<\xi->] (module\xi)
1890 at (\angle:\sm@core@circulardistance) {\smitem};
1891 }
1892 }%
1893 \foreach \smitem [count=\xi] in {#2}{%
1894 \ifnum\xi=\maxsmitem
1895 \ifcircularfinalarrowdisabled
1896 \relax
1897 \else
1898 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1899 \pgfmathtruncatemacro{\adv}{\xi + 1)}
1900 \edef\col{\@nameuse{color@\xj}}
1901 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1902 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
1903 smvisible on=<\adv->]
1904 (module\xj) to[bend right] (module\xi);
1905 }{% false-clockwise-circular diagram
1906 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
1907 smvisible on=<\adv->]
1908 (module\xj) to[bend left] (module\xi);
1909 }
1910 \fi
1911 \else
1912 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1913 \pgfmathtruncatemacro{\adv}{\xi + 1)}
1914 \edef\col{\@nameuse{color@\xj}}
1915 \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
1916 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
1917 smvisible on=<\adv->]
1918 (module\xj) to[bend right] (module\xi);
1919 }{% false-clockwise-circular diagram
1920 \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
1921 smvisible on=<\adv->]
1922 (module\xj) to[bend left] (module\xi);
1923 }
1924
1925 \fi
1926 }%
1927 \end{tikzpicture}
1928 }{}% end-circular diagram
1929 \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram
1930 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1931
1932 \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi}
1933
1934 \foreach \smitem [count=\xi] in {#2}{%
1935 \edef\col{\@nameuse{color@\xi}}
1936 \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
1937 \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\sm@core@modulexsep}
1938 in node[module,drop shadow={smvisible on=<\xi->},
1939 smvisible on=<\xi->] (module\xi) at +(\n2,0) {\smitem};
1940 }{% false-horizontal-flow diagram
1941 \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\sm@core@moduleysep}
1942 in node[module,drop shadow={smvisible on=<\xi->},
1943 smvisible on=<\xi->] (module\xi) at +(0,\n2) {\smitem};
1944 }
1945 }%
1946
1947 \foreach \smitem [count=\xi] in {#2}{%
1948 \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
1949 \edef\col{\@nameuse{color@\xj}}
1950 \ifnum\xi<\maxsmitem
1951 \begin{pgfonlayer}{smart diagram arrow back}
1952 \draw[diagram arrow type,smvisible on=<\xi->]
1953 (module\xj) -- (module\xi);
1954 \end{pgfonlayer}
1955 \fi
1956 % last arrow - not display it in background - check if disabled
1957 \ifbackarrowdisabled
1958 \relax
1959 \else
1960 \ifnum\xi=\maxsmitem
1961 \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
1962 \tikzset{square arrow/.style={
1963 to path={-- ++(0,\sm@core@backarrowdistance) -| (\tikztotarget)}
1964 }
1965 }
1966 \draw[diagram arrow type, square arrow,smvisible on=<\xi->]
1967 (module\xj.north) to (module\xi.north);
1968 }{% false-horizontal-flow diagram
1969 \tikzset{square arrow/.style={
1970 to path={-- ++(\sm@core@backarrowdistance,0) |- (\tikztotarget)}
1971 }
1972 }
1973 \draw[diagram arrow type,square arrow,smvisible on=<\xi->]
1974 (module\xj.east) to (module\xi);
1975 }
1976 \fi
1977 \fi
1978 }%
1979 \end{tikzpicture}
1980 }{}% end-flow diagram
1981 \IfStrEq{\diagramtype}{descriptive diagram}{% true-descriptive diagram
1982 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
1983 \foreach \smitem [count=\xi] in {#2}{%
1984 \edef\col{\@nameuse{color@\xi}}
1985
1986 \foreach \subitem [count=\xii] in \smitem{%
1987 \pgfmathtruncatemacro\subitemvisible{\xi}
1988 \ifnumequal{\xii}{1}{% true
1989 \node[description title,drop shadow, smvisible on=<\subitemvisible->]
1990 (module-title\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};\pause
1991 }{}
1992 \ifnumequal{\xii}{2}{% true
1993 \node[description,drop shadow,smvisible on=<\subitemvisible->]
1994 (module\xi)at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};\pause
1995 }{}
1996 }%
1997 }%
1998 \end{tikzpicture}
1999 }{}% end-descriptive diagram
2000 \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram
2001 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
2002 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
2003 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
2004 \foreach \smitem [count=\xi] in {#2}{%
2005 \ifnumequal{\xi}{1}{ %true
2006 \node[bubble center node, smvisible on=<\xi->](center bubble){\smitem};
2007 }{%false
2008 \pgfmathtruncatemacro{\xj}{\xi-1}
2009 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
2010 \edef\col{\@nameuse{color@\xj}}
2011 \node[bubble node, smvisible on=<\xi->](module\xi)
2012 at (center bubble.\angle) {\smitem };
2013 }%
2014 }%
2015 \end{tikzpicture}
2016 }{}%end-bubble diagram
2017 \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram
2018 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
2019 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
2020 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
2021 \foreach \smitem [count=\xi] in {#2}{%
2022 \ifnumequal{\xi}{1}{ %true
2023 \node[planet, smvisible on=<\xi->](planet){\smitem};
2024 }{%false
2025 \pgfmathtruncatemacro{\xj}{\xi-1}
2026 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
2027 \edef\col{\@nameuse{color@\xj}}
2028 \node[satellite, smvisible on=<\xi->] (satellite\xi)
2029 at (\angle:\sm@core@distanceplanetsatellite) {\smitem };
2030 \draw[connection planet satellite, smvisible on=<\xi->]
2031 (planet) -- (satellite\xi);
2032 }%
2033 }%
2034 \end{tikzpicture}
2035 }{}%end-constellation diagram
2036 \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram
2037 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
2038 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
2039 \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
2040 \foreach \smitem [count=\xi] in {#2}{%
2041 \ifnumequal{\xi}{1}{ %true
2042 \node[planet,smvisible on=<\xi->](planet){\smitem};
2043 }{%false
2044 \pgfmathtruncatemacro{\xj}{\xi-1}
2045 \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
2046 \edef\col{\@nameuse{color@\xj}}
2047 \node[satellite,smvisible on=<\xi->] (satellite\xj)
2048 at (\angle:\sm@core@distanceplanetsatellite) {\smitem };
2049 }%
2050 }%
2051 \foreach \smitem [count=\xi] in {#2}{%
2052 \ifnumgreater{\xi}{1}{ %true
2053 \pgfmathtruncatemacro{\xj}{\xi-1}
2054 \edef\col{\@nameuse{color@\xj}}
2055 \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
2056 \pgfmathtruncatemacro{\smvisible}{\xi+1}
2057 \path[connection planet satellite,-,smvisible on=<\smvisible->]
2058 (satellite\xj) edge[bend right] (satellite\xk);
2059 }{}
2060 }%
2061 \end{tikzpicture}
2062 }{}%end-connected constellation diagram
2063 \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
2064 \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
2065 \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
2066 \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
2067 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
2068 \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
2069 \foreach \smitem [count=\xi] in {#2}{%
2070 \edef\col{\@nameuse{color@\xi}}
2071 \pgfmathtruncatemacro\smvisible{\xi+1}
2072 \node[description,drop shadow={smvisible on=<\smvisible->},smvisible on=<\smvisible->]
2073 (module\xi) at (0,0+\xi*\sm@core@descriptiveitemsysep) {\smitem};
2074 \draw[line width=\sm@core@prioritytick,\col,smvisible on=<\smvisible->]
2075 ([xshift=-\arrowtickxshift pt]module\xi.base west)--
2076 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);
2077 }%
2078 \coordinate (A) at (module1);
2079 \coordinate (B) at (module\maxsmitem);
2080 \CalcHeight(A,B){heightmodules}
2081 \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
2082 \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
2083 \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
2084 \begin{pgfonlayer}{background}
2085 \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
2086 \end{pgfonlayer}
2087 \end{tikzpicture}
2088 }{}% end-priority descriptive diagram
2089 \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram
2090 \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
2091 \foreach \x[count=\xi, count=\prevx from 0] in {#2}{%
2092 \edef\col{\@nameuse{color@\xi}}
2093 \ifnum\xi=1
2094 \node[sequence item,smvisible on=<\xi->] (sequence-item\xi) {\x};
2095 \else
2096 \node[sequence item,anchor=west,smvisible on=<\xi->]
2097 (sequence-item\xi) at (sequence-item\prevx.east) {\x};
2098 \fi
2099 }
2100 \end{tikzpicture}
2101 }{}% end-sequence diagram
2102 }% end-no value 1
2103 }% end-command
2104 % \end{macrocode}
2105 %
2106 % \iffalse
2107 %</commands>
2108 % \fi
2109 %
2110 % \iffalse
2111 %<*additions>
2112 % \fi
2113 % \subsection{Library Additions}
2114 % The library at first loads the Ti\textit{k}Z library \library{positioning}.
2115 % \begin{macrocode}
2116 \usetikzlibrary{positioning}
2117 % \end{macrocode}
2118 % Key definition:
2119 % \begin{macrocode}
2120 \pgfkeys{/smart diagram/additions/.cd,
2121 additional item shape/.initial=\pgfkeysvalueof{/smart diagram/module shape},
2122 additional item shape/.get=\sm@additions@additionalitemshape,
2123 additional item shape/.store in=\sm@additions@additionalitemshape,
2124 additional item border color/.initial=none,
2125 additional item border color/.get=\sm@additions@additionalitembordercolor,
2126 additional item border color/.store in=\sm@additions@additionalitembordercolor,
2127 additional item bottom color/.initial=white,
2128 additional item bottom color/.get=\sm@additions@additionalitembottomcolor,
2129 additional item bottom color/.store in=\sm@additions@additionalitembottomcolor,
2130 additional item fill color/.initial=none,
2131 additional item fill color/.get=\sm@additions@additionalitemfillcolor,
2132 additional item fill color/.store in=\sm@additions@additionalitemfillcolor,
2133 additional item text width/.initial=1.75cm,
2134 additional item text width/.get=\sm@additions@additionalitemtextwidth,
2135 additional item text width/.store in=\sm@additions@additionalitemtextwidth,
2136 additional item width/.initial=2cm,
2137 additional item width/.get=\sm@additions@additionalitemwidth,
2138 additional item width/.store in=\sm@additions@additionalitemwidth,
2139 additional item height/.initial=1cm,
2140 additional item height/.get=\sm@additions@additionalitemheight,
2141 additional item height/.store in=\sm@additions@additionalitemheight,
2142 additional item font/.initial=\normalfont,
2143 additional item font/.get=\sm@additions@additionalitemfont,
2144 additional item font/.store in=\sm@additions@additionalitemfont,
2145 additional item border decoration/.initial={},
2146 additional item border decoration/.get=\sm@additions@additionalitemdecoration,
2147 additional item border decoration/.store in=\sm@additions@additionalitemdecoration,
2148 additional item offset/.initial={0.25cm},
2149 additional item offset/.get=\sm@additions@additionalitemoffset,
2150 additional item offset/.store in=\sm@additions@additionalitemoffset,
2151 additional item fill opacity/.initial={1},
2152 additional item fill opacity/.get=\sm@additions@additionalitemfillopacity,
2153 additional item fill opacity/.store in=\sm@additions@additionalitemfillopacity,
2154 additional item text opacity/.initial={1},
2155 additional item text opacity/.get=\sm@additions@additionalitemtextopacity,
2156 additional item text opacity/.store in=\sm@additions@additionalitemtextopacity,
2157 additional arrow tip/.initial={stealth},
2158 additional arrow tip/.get=\sm@additions@additionalarrowtip,
2159 additional arrow tip/.store in=\sm@additions@additionalarrowtip,
2160 additional arrow line width/.initial={0.1cm},
2161 additional arrow line width/.get=\sm@additions@additionalarrowlinewidth,
2162 additional arrow line width/.store in=\sm@additions@additionalarrowlinewidth,
2163 additional arrow color/.initial={gray},
2164 additional arrow color/.get=\sm@additions@additionalarrowcolor,
2165 additional arrow color/.store in=\sm@additions@additionalarrowcolor,
2166 additional arrow style/.initial={->},
2167 additional arrow style/.get=\sm@additions@additionalarrowstyle,
2168 additional arrow style/.store in=\sm@additions@additionalarrowstyle,
2169 additional item shadow/.initial={},
2170 additional item shadow/.get=\sm@additions@additionalitemshadow,
2171 additional item shadow/.store in=\sm@additions@additionalitemshadow,
2172 }
2173
2174 \newif\ifconnectionsdisabled
2175 \pgfkeys{/smart diagram/additions/.cd,
2176 additional connections disabled/.is if=connectionsdisabled,
2177 additional connections disabled=true,
2178 }
2179
2180 \pgfkeys{/smart diagram/.cd,
2181 additions/.style={/smart diagram/additions/.cd,#1}%
2182 }
2183 % \end{macrocode}
2184 % Style definition; the \texttt{additional item} style comprises lot of usual Ti\textit{k}Z options: it possible to select a coloring with a vertical shading or an uniform filling.
2185 % \begin{macrocode}
2186 \tikzset{additional item/.style={
2187 align=center,
2188 \sm@additions@additionalitemshape,
2189 thick,
2190 draw=\sm@additions@additionalitembordercolor,
2191 top color=white,
2192 bottom color=\sm@additions@additionalitembottomcolor,
2193 postaction={fill=\sm@additions@additionalitemfillcolor},
2194 text width=\sm@additions@additionalitemtextwidth,
2195 minimum width=\sm@additions@additionalitemwidth,
2196 minimum height=\sm@additions@additionalitemheight,
2197 font=\sm@additions@additionalitemfont,
2198 fill opacity=\sm@additions@additionalitemfillopacity,
2199 text opacity=\sm@additions@additionalitemtextopacity,
2200 \sm@additions@additionalitemshadow,
2201 \sm@additions@additionalitemdecoration
2202 },
2203 additional item arrow type/.style={
2204 \sm@additions@additionalarrowstyle,
2205 >=\sm@additions@additionalarrowtip,
2206 line width=\sm@additions@additionalarrowlinewidth,
2207 \sm@additions@additionalarrowcolor
2208 },
2209 }
2210 % \end{macrocode}
2211 % Command definition; at first the diagram is created with the usual command, then the foreach iterates in order to get additions. The additions' strings are cut by means of the package xstring and its macro \cs{StrCut}. Of course, to all the tikzpictures, the option \texttt{remember picture} is added.
2212 % \begin{macrocode}
2213 \NewDocumentCommand{\smartdiagramadd}{r[] m m}{
2214 \tikzstyle{every picture}+=[remember picture]
2215 \smartdiagram[#1]{#2}
2216 \begin{tikzpicture}[remember picture,overlay,
2217 every node/.style={align=center,let hypenation}]
2218 \foreach \smitem [count=\xi] in {#2} {\global\let\numitems\xi}
2219 \foreach \smitem[count=\xi] in {#3}{
2220 \StrCut{\smitem}{/}\pos\textitem
2221 \StrCut{\pos}{\space of\space}\point\modulenum
2222 \node[additional item,
2223 \point=\sm@additions@additionalitemoffset of \modulenum]
2224 (additional-module\xi) {\textitem};
2225 \ifconnectionsdisabled
2226 \relax
2227 \else
2228 \begin{pgfonlayer}{smart diagram arrow back}
2229 \draw[additional item arrow type]
2230 (additional-module\xi) -- (\modulenum);
2231 \end{pgfonlayer}
2232 \fi
2233 }
2234 \end{tikzpicture}
2235 }
2236 % \end{macrocode}
2237 % Definition of the command to connect additions with diagram modules:
2238 % \begin{macrocode}
2239 \NewDocumentCommand{\smartdiagramconnect}{m m}{%
2240 \begin{tikzpicture}[remember picture,overlay]
2241 \foreach \start/\end in {#2}
2242 \draw[additional item arrow type,#1]
2243 (\start) -- (\end);
2244 \end{tikzpicture}
2245 }
2246 % \end{macrocode}
2247 % \iffalse
2248 %</additions>
2249 % \fi
2250 %
2251 % \Finale
2252
2253 \endinput