summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/smartdiagram/smartdiagram.dtx
blob: 3d7ea5b44a5b8e5f1f4661465cb7f6bedc54afdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*readme>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
smartdiagram --- Automatic creation of smart diagrams with LaTeX
E-mail: claudio.fiandrino@gmail.com
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The package allows to create smart diagrams from lists of items for 
simple documents and for presentations.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
smartdiagram --- Automatic creation of smart diagrams from lists of items.
E-mail: claudio.fiandrino@gmail.com
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

\endpreamble
\postamble

Copyright (C) 2012 by Claudio Fiandrino <claudio.fiandrino@gmail.com>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Claudio Fiandrino.

This work consists of the file  smartdiagram.dtx
and the derived files           smartdiagram.ins,
                                smartdiagram.pdf, and
                                smartdiagram.sty.

\endpostamble
\usedir{tex/latex/smartdiagram}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/smartdiagram}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/demopkg}
\generate{
  \file{README.txt}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{smartdiagram}[2012/10/28 v0.1 Automatic creation of smart diagrams from lists of items.]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{charter}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{\jobname}
\usetikzlibrary{shapes.geometric,decorations.pathmorphing}
\usepackage{hypdoc}
\newcommand{\library}[1]{\textcolor{red!80!black}{\texttt{#1}}}
\newcommand{\packoption}[2]{\textcolor{blue!60!cyan}{\texttt{#1}} \texttt{(initial:~#2)}}
\newcommand{\smkey}[1]{\textcolor{blue!60!cyan}{\texttt{#1}}}
\newcommand{\diagram}[1]{\textcolor{orange!30!red}{\texttt{#1}}}
\newcommand{\mbrarg}[1]{\texttt{\{}\small\meta{#1}\texttt{\}}}
\newcommand{\mqbarg}[1]{\texttt{[}\small\meta{#1}\texttt{]}}
\newcommand{\colsmartbox}[1]{#1~\tikz[baseline=-0.5ex] \node[fill=#1,rectangle,draw=black,thick,minimum width=5mm,minimum height=3mm,rounded corners]{};}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
  \PrintChanges
\end{document}
%</driver>
% \fi
%
% \CheckSum{883}
%
% \CharacterTable
%  {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
%   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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \GetFileInfo{smartdiagram.sty}
% \title{The \textsf{smartdiagram} package\thanks{This document
% corresponds to \textsf{smartdiagram}~\fileversion,
% dated \filedate; it is released under and subject to the \href{http://www.latex-project.org/lppl/}{\LaTeX\ Project Public License (LPPL)}.}}
% \author{Claudio Fiandrino \\ \footnotesize\href{mailto:claudio.fiandrino@gmail.com}{claudio.fiandrino@gmail.com}}
% \maketitle
% \begin{abstract}
% This package provides a way to easily draw diagrams in documents and presentations from a list of items thanks to Ti\textit{k}Z.
% The idea cames out from \href{http://tex.stackexchange.com/questions/78310/powerpoints-smart-art-for-tikz}{this question} on \href{http://tex.stackexchange.com}{TeX.StackExchange}.
%
% \end{abstract}
%
% \tableofcontents
% \section{Introduction and requirements}
% 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.
% 
% Automatically, the \textsf{smartdiagram} package loads:
% \begin{itemize}
% \item Ti\textit{k}Z;
% \item \textsf{etoolbox};
% \item \textsf{xparse}.
% \end{itemize}
% Moreover, the package loads the following Ti\textit{k}Z libraries:
% \begin{itemize}
% \item \library{backgrounds};
% \item \library{calc};
% \item \library{fadings};
% \item \library{shadows};
% \item \library{shapes.arrows}.
% \end{itemize}
% and it sets a new layer called \verb|smart diagram arrow back|.
% 
% The package could be loaded by means of \cs{usepackage}\texttt{\{smartdiagram\}}.
% 
% \section{Basic Usage}
% \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}|.
%
% The possible diagrams that could be created are:
% \begin{itemize}
% \item \diagram{circular diagram}: the items in the list are diplayed around a circle;
% \item \diagram{flow diagram}: the items in the list are diplayed as a flow chart;
% \item \diagram{descriptive diagram}: a diagram in which are displayed concepts and their description;
% \item \diagram{priority descriptive diagram}: a diagram in which the items are deployted based on their relevance;
% \item \diagram{bubble diagram}: each item is a bubble deployted around a bubble center, which is the first element in the list;
% \item \diagram{constellation diagram}: each item is a circle connected to the center, the first element in the list again;
% \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.
% \end{itemize}
% 
% For example:
% \begin{verbatim}
% \begin{center}
% \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% produces:
% \begin{center}
% \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
%
% 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}.
%
% 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.
%
% \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}. 

% 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.
% Finally, for 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.
% 
% 
% \section{The options}
% \label{sec:options}
% \subsection{Setting the options}
% \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}. Examples in which some options are used are shown in section \ref{sec:gallery}.
% \subsection{Available options}
% Here follows the list of general available options.
% \subsubsection{General options}
% \begin{itemize}
% \item \packoption{module minimum width}{2cm}: this option sets the minimum width of the module;
%
% \item \packoption{module minimum height}{1cm}: this option sets the minimum height of the module;
%
% \item \packoption{module y sep}{1.65}: this option sets a vertical distance factor among the modules in a \verb|flow diagram|;
%
% \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;
%
% \item \packoption{text width}{1.75cm}: this option sets the text width inside the module;
%
% \item \packoption{font}{\textbackslash small}: this option sets the module font;
%
% \item \packoption{border color}{gray}: this option sets the border color of the module;
%
% \item \packoption{circular distance}{2.75cm}: this option sets the radius of cirle around which the modules in a \verb|circular diagram|;
%
% \item \packoption{arrow line width}{0.1cm}: this option sets the width of the connection arrows within two modules;
%
% \item \packoption{set color list}{none}: this option allows the user to define the list of colors usable in the diagram;
%
% \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;
%
% \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};
%
% \item \packoption{arrow tip}{stealth}: this option allows to select the arrow tip; possible choices are described in the pgfmanual and for particular types it is recommended to load the library \library{arrows}.
% \end{itemize}
% \subsubsection{Specific options}
% Here follows the list of specific available options per type of diagram.
% 
% For what concern the \diagram{descriptive diagram} and the \diagram{priority descriptive diagram}:
% \begin{itemize}
% \item \packoption{descriptive items y sep}{1.75}: this option sets a vertical distance factor among the descriptive items;
%
% \item \packoption{description title width}{1.5cm}: this option sets the minimum width of the description-title;
%
% \item \packoption{description title text width}{1.25cm}: this option sets the text width of the description-title;
%
% \item \packoption{description text width}{5cm}: this option sets the text width of the description;
%
% \item \packoption{description title font}{\textbackslash small}: this option sets the font size of the description-title;
%
% \item \packoption{description font}{\textbackslash small}: this option sets the font size of the description;
%
% \item \packoption{description width}{5.5cm}: this option sets the minimum width of the description;
%
% \item \packoption{priority arrow width}{1.5cm}: this option sets the width of the vertical arrow;
%
% \item \packoption{priority arrow head extend}{0.15cm}: this option sets the width of the arrow head extend;
%
% \item \packoption{priority tick size}{5pt}: this option sets the size of the line denoting the relevance position of items in the vertical arrow;
%
% \item \packoption{priority arrow height advance}{2cm}: this option specifies how much the vertical arrow is vertically extended above the most relevant item.
% \end{itemize}
%
% For what concern the \diagram{bubble diagram}, the \diagram{constellation diagram} and the \diagram{connected constellation diagram}:
% \begin{itemize}
%
% \item \packoption{bubble center node size}{4cm}: the option specifies the minimum size of the bubble center node;
%
% \item \packoption{bubble center node font}{\textbackslash large}: this option sets the font size of the bubble center node;
%
% \item \packoption{bubble center node color}{lightgray!60}: this option allows to customize the background color of the bubble center node;
%
% \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;
%
% \item \packoption{distance text center bubble}{0.5cm}: this option sets the distance from the text to the border of the bubble center node;
%
% \item \packoption{bubble fill opacity}{0.5}: this option sets the opacity at which the bubbles are shown;
%
% \item \packoption{bubble node size}{2.5cm}: the option specifies the minimum size of the bubbles;
%
% \item \packoption{bubble text opacity}{0.8}: this option sets the opacity at which the bubble text is shown;
%
% \item \packoption{bubble node font}{\textbackslash normalfont}: this option sets the font size of the bubbles;
%
% \item \packoption{planet size}{2.5cm}: the option specifies the minimum size of the planet;
%
% \item \packoption{planet color}{lightgray!60}: this option allows to customize the background color of the planet;
%
% \item \packoption{planet font}{\textbackslash large}: this option sets the font size of the planet;
%
% \item \packoption{distance planet-connection}{0.1cm}: this option sets the distance from the planet to the arrow directed to the satellites;
%
% \item \packoption{distance planet-text}{0.5cm}: this option sets the distance from the text to the border of the planet;
%
% \item \packoption{planet text width}{1.75cm}: this option sets the planet text width;
%
% \item \packoption{satellite size}{1.75cm}: the option specifies the minimum size of the satellites;
%
% \item \packoption{satellite font}{\textbackslash normalfont}: this option sets the font size of the satellites;
%
% \item \packoption{satellite fill opacity}{0.5}: this option sets the opacity at which the satellites are shown;
%
% \item \packoption{satellite text opacity}{0.8}: this option sets the opacity at which the satellite text is shown;
%
% \item \packoption{satellite text width}{1.5cm}: this option sets the satellite text width;
%
% \item \packoption{distance satellite-connection}{0.075cm}: this option sets the distance from the satellites to the arrows directed to the planet;
%
% \item \packoption{connection line width}{0.1cm}: this option allows to customize the width of the connections from the planet to the satellites;
%
% \item \packoption{distance planet-satellite}{3.5cm}: this option determine the distance among any pair of planet-satellite.
% \end{itemize}
% 
% \section{Gallery of examples}
% \label{sec:gallery}
% \DescribeMacro{Flow chart with custom color list}
% Example with a flow chart:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{border color=none,
%   set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black}}
% \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{border color=none,set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black}}
% \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \smartdiagramset{use predefined color list}
% \DescribeMacro{Circular diagram with custom options}
% Another example:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{circular distance=4cm, font=\large, text width=2.5cm,
%  module minimum width=2.5cm, module minimum height=1.5cm,arrow tip=to}
% \smartdiagram[circular diagram]{Set up~/ Adapt,Run,Analyse,Modify~/ Add,Check,Check again}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{circular distance=4cm, font=\large, text width=2.5cm,
%  module minimum width=2.5cm, module minimum height=1.5cm,arrow tip=to}
% \smartdiagram[circular diagram]{Set up~/ Adapt,Run,Analyse,Modify~/ Add,Check,Check again}
% \end{center}
% \DescribeMacro{Circular diagram with custom shape}
% An example with a diamond shape:
% \begin{verbatim}
% \begin{center}
% \usetikzlibrary{shapes.geometric} % required in the preamble
% \smartdiagramset{module shape=diamond,font=\scriptsize,
%  module minimum width=1cm,module minimum height=1cm,text width=1cm,
%  circular distance=2cm}
% \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{module shape=diamond,font=\scriptsize,
%  module minimum width=1cm,module minimum height=1cm,text width=1cm,
%  circular distance=2cm}
% \smartdiagram[circular diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \DescribeMacro{Flow diagram with decorated border}
% An example with a decorated shape:
% \begin{verbatim}
% \usetikzlibrary{decorations.pathmorphing} % required in the preamble
% \begin{center}
% \tikzset{my decoration/.style={decorate,decoration=zigzag}}
% \smartdiagramset{module shape=rectangle,insert decoration={my decoration}}
% \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \tikzset{my decoration/.style={decorate,decoration=zigzag}}
% \smartdiagramset{module shape=rectangle,insert decoration={my decoration}}
% \smartdiagram[flow diagram]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \DescribeMacro{Descriptive diagram}
% An example of descriptive diagram:
% \begin{verbatim}
% \begin{center}
% \smartdiagram[descriptive diagram]{
% {Set up,The set up operation consist of..},
% {Run, {After having set up the program, you must run..}},
% {Analyse, You must check what did with analytical tools like..},
% {Modify, {After the analysis, you can still modify or add..}},
% }
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagram[descriptive diagram]{
% {Set up,The set up operation consist of..},
% {Run, {After having set up the program, you must run..}},
% {Analyse, You must check what did with analytical tools like..},
% {Modify, {After the analysis, you can still modify or add..}},
% }
% }
% \end{center}
% \DescribeMacro{Bubble diagram}
% An example of bubble diagram:
% \begin{verbatim}
% \begin{center}
% \smartdiagram[bubble diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagram[bubble diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
% }
% \end{center}
% \DescribeMacro{Constellation diagram}
% An example of constellation diagram:
% \begin{verbatim}
% \begin{center}
% \smartdiagram[constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagram[constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
% }
% \end{center}
% \DescribeMacro{Connected constellation diagram}
% An example of connected constellation diagram:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{planet color=orange!60, distance planet-satellite=1cm}
% \smartdiagram[connected constellation diagram]
%  {Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagramset{planet color=orange!60, distance planet-satellite=2.75cm}
% \smartdiagram[connected constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
% }
% \end{center}
% \DescribeMacro{Priority descriptive diagram}
% 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:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{set color list={blue!50!cyan,green!60!lime,orange!50!red},
%  priority arrow width=2cm,priority arrow height advance=2.25cm}
% \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{set color list={blue!50!cyan,green!60!lime,orange!50!red},
%  priority arrow width=2cm,priority arrow height advance=2.25cm}
% \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
%
% \section{Recommendations and known issues}
% \label{sec:recommendations}
% \subsection{Something about colors}
% 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 list longer than 10 items. This, of course, could be avoided by declaring its own proper list 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:
% \begin{verbatim}
% \smartdiagramset{use predefined color list}
% \end{verbatim}
% 
% \subsection{Circular, bubble and constellation diagrams}
% 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. 
% 
% Notice also that imposing a too short distance from the planet to satellites is bad and leads to something like:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{planet color=orange!60, distance planet-satellite=1cm}
% \smartdiagram[connected constellation diagram]
%  {Build a program,Set up,Run,Analyze,Modify~/\\ Add,Check}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagramset{planet color=orange!60, distance planet-satellite=1cm}
% \smartdiagram[connected constellation diagram]{Build a program,Set up,Run,Analyze,Modify~/\\ Add}
% }
% \end{center}
% 
% \subsection{Descriptive diagrams}
% When the user has to build a \diagram{descriptive diagram}, simple or animated, the following rules have to be respected:
% \begin{itemize}
% \item each description title and description should be separated by a comma;
% \item to use a comma inside a description, enclose by \{ \} the description;
% \item use a comma after the last couple description title-description. 
% \end{itemize}
% A working example:
% \begin{verbatim}
% \smartdiagram[descriptive diagram]{
% {Set up,The set up operation consist of..},
% {Run, {After having set up the program, you must run..}},
% {Analyze, You must check what did with analytical tools like..},
% }
% \end{verbatim}
% A non-working example:
% \begin{verbatim}
% \smartdiagram[descriptive diagram]{
% {Set up,The set up operation consist of..},
% {Run, {After having set up the program, you must run..}},
% {Analyze, You must check what did with analytical tools like..}
% }
% \end{verbatim}
% The \emph{mandatory} final comma is missing thus, as result, the last couple description title-description will be entirely treated as a description title.
%
% 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. 
%
% \subsection{Decorations}
% 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:
% \begin{verbatim}
% \tikzset{my wonderful decoration/.style={decorate,decoration=bent}}
% \smartdiagramset{insert decoration=my wonderful decoration,...}
% \end{verbatim}
% where the dots represent the other options.
%
% 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|coil|, raise as error: 
% \begin{verbatim}
% ! Dimension too large.
% \end{verbatim} but, after all, the decoration is deployted anyway.
% 
% 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:
% \begin{verbatim}
% \begin{frame}
% \begin{center}
% \pgfmathsetseed{12354}
% \tikzset{my decoration/.style={decorate,decoration=random steps}}
% \smartdiagramset{insert decoration=my decoration}
% \smartdiagramanimated[descriptive diagram]{
% {Set up,The set up operation consist of..},
% {Run, {After having set up the program, you must run..}},
% {Analyze, You must check what did with analytical tools like..},
% {Modify, {After the analysis, you can still modify or add..}},
% }
% \end{center}
% \end{frame}
% \end{verbatim}
% 
% \subsection{Priority descriptive diagrams}
% 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).
% 
% 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:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{priority arrow width=2cm,priority arrow height advance=2.25cm,
%  priority arrow head extend=0.3cm}
% \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{use predefined color list}
% \smartdiagramset{priority arrow width=2cm,priority arrow height advance=2.25cm,
%  priority arrow head extend=0.25cm}
% \scalebox{0.8}{
% \smartdiagram[priority descriptive diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% }
% \end{center}
%
% \section{Aknowledgements}
% 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}.
%
% Last, but not least, I would 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.
% \StopEventually{\PrintChanges}
% \iffalse
%<*package>
% \fi
% \section{Implementation}
% \subsection{Initialization and Package Options}
%
% This subsection highlights which are the package loaded and the \verb|tikzlibraries| needed.
%    \begin{macrocode}
\RequirePackage{tikz}
\RequirePackage{xparse,etoolbox}

\usetikzlibrary{backgrounds,calc,fadings,shadows,shapes.arrows}
\pgfdeclarelayer{smart diagram arrow back}
\pgfsetlayers{background,smart diagram arrow back,main}
%    \end{macrocode} 
% \subsection{Keys and color declaration}
% The predefined colors:
%    \begin{macrocode}
\@namedef{color@1}{red!40}
\@namedef{color@2}{cyan!40}   
\@namedef{color@3}{blue!40} 
\@namedef{color@4}{green!40}  
\@namedef{color@5}{orange!40} 
\@namedef{color@6}{yellow!40}    
\@namedef{color@7}{magenta!40}    
\@namedef{color@8}{brown!40}
\@namedef{color@9}{violet!40}
\@namedef{color@10}{teal!40}
%    \end{macrocode} 
% Basic shape definition and function to compute the height of the \diagram{priority descriptive diagram}:
%    \begin{macrocode}
\tikzset{rnd rectangle/.style={rectangle,rounded corners}
}

\def\CalcHeight(#1,#2)#3{%
\pgfpointdiff{\pgfpointanchor{#1}{south west}}{\pgfpointanchor{#2}{north west}}
\pgfmathsetmacro{\myheight}{veclen(\pgf@x,\pgf@y)}
\global\expandafter\edef\csname #3\endcsname{\myheight}
}
%    \end{macrocode} 
% The key definition and function to set them:
%    \begin{macrocode}
\pgfkeys{/smart diagram/.cd, module minimum width/.initial=2cm,
   module minimum height/.initial={1cm},
   module y sep/.initial={1.65},
   descriptive items y sep/.initial={1.75},
   text width/.initial={1.5cm},
   description title width/.initial={1.5cm},
   description text width/.initial={5cm},
   description title text width/.initial={1.25cm},
   description title font/.initial={\small},
   description font/.initial={\small},
   description width/.initial={5.5cm},
   font/.initial={\small},
   border color/.initial={gray},
   circular distance/.initial={2.75cm},
   arrow line width/.initial={0.1cm},
   module shape/.initial={rnd rectangle},
   insert decoration/.initial={},
   arrow tip/.initial={stealth},
   bubble center node size/.initial={4cm},
   bubble center node font/.initial={\large},
   bubble center node color/.initial={lightgray!60},
   distance center/other bubbles/.initial=0.8cm,
   distance text center bubble/.initial={0.5cm},
   bubble fill opacity/.initial={0.5},
   bubble node size/.initial={2.5cm},
   bubble text opacity/.initial={0.8},
   bubble node font/.initial={\normalfont},
   planet size/.initial={2.5cm},
   planet color/.initial={lightgray!60},
   planet font/.initial={\large},
   distance planet-connection/.initial={0.1cm},
   distance planet-text/.initial={0.5cm},
   planet text width/.initial={1.75cm},
   satellite size/.initial={1.75cm},
   satellite font/.initial={\normalfont},
   satellite fill opacity/.initial={0.5},
   satellite text opacity/.initial={0.8},
   satellite text width/.initial={1.5cm},
   distance satellite-connection/.initial={0.075cm},
   connection line width/.initial={0.1cm},
   distance planet-satellite/.initial={3.5cm},
   priority arrow width/.initial={1.5cm},
   priority arrow head extend/.initial={0.15cm},
   priority tick size/.initial={5pt},
   priority arrow height advance/.initial={2cm},
}%

\pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth,
   module minimum height/.get=\moduleheight,
   module y sep/.get=\moduleysep,
   descriptive items y sep/.get=\descriptiveitemsysep,
   text width/.get=\moduletextwidth,
   description title width/.get=\descriptiontitlewidth,
   description text width/.get=\descriptiontextwidth,
   description title text width/.get=\descriptiontitletextwidth,
   description title font/.get=\descriptiontitlefontsize,
   description font/.get=\descriptionfontsize,
   description width/.get=\descriptionwidth,
   font/.get=\modulefontsize,
   border color/.get=\bordercolor,
   circular distance/.get=\circulardistance,
   arrow line width/.get=\arrowlinewidth,
   module shape/.get=\moduleshape,
   insert decoration/.get=\borderdecoration,
   arrow tip/.get=\arrowtip,
   bubble center node size/.get=\bubblecenternodesize,
   bubble center node font/.get=\bubblecenternodefont,
   bubble center node color/.get=\bubblecenternodecolor,
   distance center/other bubbles/.get=\distancecenterotherbubbles,
   distance text center bubble/.get=\distancetextcenterbubble,
   bubble fill opacity/.get=\bubblefillopacity,
   bubble node size/.get=\bubblenodesize,
   bubble text opacity/.get=\bubbletextopacity,
   bubble node font/.get=\bubblenodefont,
   planet size/.get=\planetminimumsize,
   planet color/.get=\planetcolor,
   planet font/.get=\planetfont,
   distance planet-connection/.get=\planetoutersep,
   distance planet-text/.get=\planetinnersep,
   planet text width/.get=\planettextwidth,
   satellite size/.get=\satelliteminimumsize,
   satellite font/.get=\satellitefont,
   satellite fill opacity/.get=\satellitefillopacity,
   satellite text opacity/.get=\satellitetextopacity,
   satellite text width/.get=\satellitetextwidth,
   distance satellite-connection/.get=\satelliteoutersep,
   connection line width/.get=\connectionlinewidth,
   distance planet-satellite/.get=\distanceplanetsatellite,
   priority arrow width/.get=\priorityarrowwidth,
   priority arrow head extend/.get=\priorityarrowheadextend,
   priority tick size/.get=\prioritytick,
   priority arrow height advance/.get=\priorityarrowheightadvance,
}%

\pgfkeys{/smart diagram/.cd, set color list/.code={
      \foreach \listitem [count=\i] in {#1}{
         \global\@namedef{color@\i\expandafter}\expandafter{\listitem}
      }
   } 
}

\pgfkeys{/smart diagram/.cd, use predefined color list/.code={
      \@namedef{color@1}{red!30}
      \@namedef{color@2}{cyan!30}   
      \@namedef{color@3}{blue!30} 
      \@namedef{color@4}{green!30}  
      \@namedef{color@5}{orange!30} 
      \@namedef{color@6}{yellow!30}    
      \@namedef{color@7}{magenta!30}    
      \@namedef{color@8}{brown!30}
      \@namedef{color@9}{violet!30}
      \@namedef{color@10}{teal!30}
   } 
}

\NewDocumentCommand{\smartdiagramset}{m}{%
  \pgfkeys{/smart diagram/.cd,#1}%
  \pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth,
   module minimum height/.get=\moduleheight,
   module y sep/.get=\moduleysep,
   descriptive items y sep/.get=\descriptiveitemsysep,
   text width/.get=\moduletextwidth,
   description title width/.get=\descriptiontitlewidth,
   description text width/.get=\descriptiontextwidth,
   description title text width/.get=\descriptiontitletextwidth,
   description title font/.get=\descriptiontitlefontsize,
   description font/.get=\descriptionfontsize,
   description width/.get=\descriptionwidth,
   font/.get=\modulefontsize,
   border color/.get=\bordercolor,
   circular distance/.get=\circulardistance,
   arrow line width/.get=\arrowlinewidth,
   module shape/.get=\moduleshape,
   insert decoration/.get=\borderdecoration,
   arrow tip/.get=\arrowtip,
   bubble center node size/.get=\bubblecenternodesize,
   bubble center node font/.get=\bubblecenternodefont,
   bubble center node color/.get=\bubblecenternodecolor,
   distance center/other bubbles/.get=\distancecenterotherbubbles,
   distance text center bubble/.get=\distancetextcenterbubble,
   bubble fill opacity/.get=\bubblefillopacity,
   bubble node size/.get=\bubblenodesize,
   bubble text opacity/.get=\bubbletextopacity,
   bubble node font/.get=\bubblenodefont,
   planet size/.get=\planetminimumsize,
   planet color/.get=\planetcolor,
   planet font/.get=\planetfont,
   distance planet-connection/.get=\planetoutersep,
   distance planet-text/.get=\planetinnersep,
   planet text width/.get=\planettextwidth,
   satellite size/.get=\satelliteminimumsize,
   satellite font/.get=\satellitefont,
   satellite fill opacity/.get=\satellitefillopacity,
   satellite text opacity/.get=\satellitetextopacity,
   satellite text width/.get=\satellitetextwidth,
   distance satellite-connection/.get=\satelliteoutersep,
   connection line width/.get=\connectionlinewidth,
   distance planet-satellite/.get=\distanceplanetsatellite,
   priority arrow width/.get=\priorityarrowwidth,
   priority arrow head extend/.get=\priorityarrowheadextend,
   priority tick size/.get=\prioritytick,
   priority arrow height advance/.get=\priorityarrowheightadvance,
  }%
}%
%    \end{macrocode} 
% The fading style applied to the \diagram{priority descriptive diagram} and styles diagram definition:
%    \begin{macrocode}
\tikzfading[name=priorityarrowfading, bottom color=transparent!5, top color=transparent!80]
\tikzset{priority arrow fill/.style={fill=gray,path fading=priorityarrowfading}}

\tikzset{module/.style={
      \pgfkeysvalueof{/smart diagram/module shape},
      thick,
      draw=\bordercolor,
      top color=white,
      bottom color=\col,     
      text width=\moduletextwidth,
      minimum width=\modulewidth,
      minimum height=\moduleheight,
      font=\modulefontsize,
      \borderdecoration
   },
   diagram arrow type/.style={
      >=\arrowtip,line width=\arrowlinewidth,\col,
   },
}
\tikzset{description title/.style={
      circle,
      draw=\bordercolor,
      minimum width=\descriptiontitlewidth,
      anchor=east,      
      bottom color=\col,
      top color=white!80!\col,
      font=\descriptiontitlefontsize,
      text width=\descriptiontitletextwidth,
      \borderdecoration,
   },
   description/.style={
      \pgfkeysvalueof{/smart diagram/module shape},
      text width=\descriptiontextwidth,
      draw=\bordercolor, 
      anchor=west,
      minimum height=\moduleheight,
      minimum width=\descriptionwidth,
      bottom color=\col,
      top color=white!80!\col,
      font=\descriptionfontsize,
      \borderdecoration,
   }
}
\tikzset{priority arrow/.style={
      draw=\bordercolor,
      single arrow, 
      minimum height=\distancemodules,
      minimum width=\priorityarrowwidth,
      priority arrow fill,
      rotate=90,
      single arrow head extend=\priorityarrowheadextend,
      anchor=west,
   }
}
\tikzset{bubble center node/.style={
      minimum size=\bubblecenternodesize,
      circle,
      fill=\bubblecenternodecolor,
      font=\bubblecenternodefont,
      outer sep=\distancecenterotherbubbles,
      inner sep=\distancetextcenterbubble,
   },
   bubble node/.style={
      minimum size=\bubblenodesize,
      circle,
	   ultra thick,
	   font=\bubblenodefont,
	   draw=white,
	   fill opacity=\bubblefillopacity,
	   fill=\col,        
	   text opacity=\bubbletextopacity,
   }
}
\tikzset{planet/.style={
      minimum size=\planetminimumsize,
      circle,
      fill=\planetcolor,
      font=\planetfont,
      outer sep=\planetoutersep,
      inner sep=\planetinnersep,
      text width=\planettextwidth,
   },
   satellite/.style={
      minimum size=\satelliteminimumsize,
      circle,
	   font=\satellitefont,
	   fill opacity=\satellitefillopacity,
	   fill=\col,        
	   text opacity=\satellitetextopacity,
	   text width=\satellitetextwidth,
	   outer sep=\satelliteoutersep,
   },
   connection planet satellite/.style={
   line width=\connectionlinewidth,
   >=\arrowtip,
   \col,
   }
}
%    \end{macrocode} 
% \subsection{Commands}
% Definition of the two basic commands. The diagrams:
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagram}{r[] m}{%
   \IfNoValueTF{#1}{% true-no value 1
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}}
   {%false-no value 1
   \ifstrequal{#1}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center}]  

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}  

   \foreach \smitem [count=\xi] in {#2}{% 
   \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   \edef\col{\@nameuse{color@\xi}}
   \node[module,drop shadow] (module\xi) at (\angle:\circulardistance) {\smitem };
   }%

   \foreach \smitem [count=\xi] in {#2}{% 
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} 
   \edef\col{\@nameuse{color@\xj}}
   \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] 
   (module\xj) to[bend left] (module\xi);
   }%
   \end{tikzpicture}  
   }{}% end-circular diagram
   \ifstrequal{#1}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center}]  

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}  

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\moduleysep}
       in node[module,drop shadow] (module\xi) at +(0,\n2) {\smitem};

   }%

   \foreach \smitem [count=\xi] in {#2}{% 
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} 
   \edef\col{\@nameuse{color@\xj}}
   \ifnum\xi<\maxsmitem
   \begin{pgfonlayer}{smart diagram arrow back}
   \draw[<-,diagram arrow type] (module\xj) -- (module\xi);
   \end{pgfonlayer}
   \fi
   % last arrow - not display it in background
   \ifnum\xi=\maxsmitem
   \draw[<-,diagram arrow type] (module\xj.east)--
   ($(module\xj.east)+(1,0)$) |- (module\xi);
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{%
	   \edef\col{\@nameuse{color@\xi}}
	   \foreach \subitem [count=\xii] in \smitem{%
		   \ifnumequal{\xii}{1}{% true
		   \node[description title,drop shadow]
		    (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem};
		   }{}
		   \ifnumequal{\xii}{2}{% true
		   \node[description,drop shadow](module\xi) 
		    at (0,0-\xi*\descriptiveitemsysep) {\subitem};
		   }{}
	   }%
   }%
   \end{tikzpicture} 
   }{}% end-descriptive diagram
   \ifstrequal{#1}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[bubble center node](center bubble){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[bubble node] (module\xi) at (center bubble.\angle) {\smitem };
	   }%
   }%
   \end{tikzpicture}  
   }{}%end-bubble diagram
   \ifstrequal{#1}{constellation diagram}{% true-constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[planet](planet){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[satellite] (satellite\xi) at (\angle:\distanceplanetsatellite) {\smitem };
	   \draw[->,connection planet satellite] (planet) -- (satellite\xi);    
	   }%
   }%
   \end{tikzpicture}  
   }{}%end-constellation diagram
   \ifstrequal{#1}{connected constellation diagram}{% true-connected constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[planet](planet){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[satellite] (satellite\xj) at (\angle:\distanceplanetsatellite) {\smitem };
	   }%  
   }%
   \foreach \smitem [count=\xi] in {#2}{%
      \ifnumgreater{\xi}{1}{ %true
	      \pgfmathtruncatemacro{\xj}{\xi-1}
	      \edef\col{\@nameuse{color@\xj}}
	      \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
	      \path[connection planet satellite] (satellite\xj) edge[bend right] (satellite\xk);  
	   }{}
   }%
   \end{tikzpicture}  
   }{}%end-connected constellation diagram
   \ifstrequal{#1}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)}
   \pgfmathsetmacro\priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \foreach \smitem [count=\xi] in {#2}{%
	   \edef\col{\@nameuse{color@\xi}}
	    \node[description,drop shadow](module\xi) 
		    at (0,0+\xi*\descriptiveitemsysep) {\smitem};
		\draw[line width=\prioritytick,\col] ([xshift=-\arrowtickxshift pt]module\xi.base west)--
		 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$);    
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture} 
   }{}% end-priority descriptive diagram
}% end-no value 1
}% end-command
%    \end{macrocode} 
% Definition of the style for making visible elements and command definition for animations:
%    \begin{macrocode}
\tikzset{
   sminvisible/.style={opacity=0,text opacity=0},
   smvisible on/.style={smalt=#1{}{sminvisible}},
   smalt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
   },
}


\NewDocumentCommand{\smartdiagramanimated}{r[] m}{%
   \IfNoValueTF{#1}{% true-no value 1
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}}
   {%false-no value 1
   \ifstrequal{#1}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center}]  

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}  

   \foreach \smitem [count=\xi] in {#2}{% 
   \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   \edef\col{\@nameuse{color@\xi}}
   \node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) at (\angle:\circulardistance) {\smitem };
   }%

   \foreach \smitem [count=\xi] in {#2}
   {% 
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
   \pgfmathtruncatemacro{\adv}{\xi + 1)}
   \edef\col{\@nameuse{color@\xi}}
   \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
   smvisible on=<\adv->] (module\xj) to[bend left] (module\xi);
   }%
   \end{tikzpicture}  
   }{}% end-circular diagram
   \ifstrequal{#1}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center}]  

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}  

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\moduleysep}
       in node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) at +(0,\n2) {\smitem};

   }%

   \foreach \smitem [count=\xi] in {#2}{% 
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} 
   \edef\col{\@nameuse{color@\xj}}
   \ifnum\xi<\maxsmitem
   \begin{pgfonlayer}{smart diagram arrow back}
   \draw[<-,diagram arrow type,smvisible on=<\xi->] 
   (module\xj) -- (module\xi);
   \end{pgfonlayer}
   \fi
   % last arrow - not display it in background
   \ifnum\xi=\maxsmitem
   \draw[<-,diagram arrow type,smvisible on=<\xi->] 
   (module\xj.east)--($(module\xj.east)+(1,0)$) |- (module\xi);
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{%
	   \edef\col{\@nameuse{color@\xi}}
	
	   \foreach \subitem [count=\xii] in \smitem{%
	      \pgfmathtruncatemacro\subitemvisible{\xi}
		   \ifnumequal{\xii}{1}{% true
		   \node[description title,drop shadow, smvisible on=<\subitemvisible->] 
		   (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause
		   }{}
		   \ifnumequal{\xii}{2}{% true
		   \node[description,drop shadow,smvisible on=<\subitemvisible->] 
		   (module\xi)at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause
		   }{}
	   }%
   }%
   \end{tikzpicture} 
   }{}% end-descriptive diagram
   \ifstrequal{#1}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[bubble center node, smvisible on=<\xi->](center bubble){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[bubble node, smvisible on=<\xi->](module\xi) at (center bubble.\angle) {\smitem };
	   }%
   }%
   \end{tikzpicture}  
   }{}%end-bubble diagram
   \ifstrequal{#1}{constellation diagram}{% true-constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[planet, smvisible on=<\xi->](planet){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[satellite, smvisible on=<\xi->] (satellite\xi) 
	    at (\angle:\distanceplanetsatellite) {\smitem };
	   \draw[->,connection planet satellite, smvisible on=<\xi->]
	    (planet) -- (satellite\xi);    
	 }%
   }%
   \end{tikzpicture}  
   }{}%end-constellation diagram
   \ifstrequal{#1}{connected constellation diagram}{% true-connected constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]  
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{% 
	   \ifnumequal{\xi}{1}{ %true
	   \node[planet,smvisible on=<\xi->](planet){\smitem};  
	   }{%false
	   \pgfmathtruncatemacro{\xj}{\xi-1}
	   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}	
	   \edef\col{\@nameuse{color@\xj}}
	   \node[satellite,smvisible on=<\xi->] (satellite\xj)
	    at (\angle:\distanceplanetsatellite) {\smitem };
	   }%  
   }%
   \foreach \smitem [count=\xi] in {#2}{%
      \ifnumgreater{\xi}{1}{ %true
	      \pgfmathtruncatemacro{\xj}{\xi-1}
	      \edef\col{\@nameuse{color@\xj}}
	      \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
	      \pgfmathtruncatemacro{\smvisible}{\xi+1}
	      \path[connection planet satellite,smvisible on=<\smvisible->]
	       (satellite\xj) edge[bend right] (satellite\xk);  
	   }{}
   }%
   \end{tikzpicture}
   }{}%end-connected constellation diagram
   \ifstrequal{#1}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)}
   \pgfmathsetmacro\priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \foreach \smitem [count=\xi] in {#2}{%
	   \edef\col{\@nameuse{color@\xi}}
	   \pgfmathtruncatemacro\smvisible{\xi+1}
	   \node[description,drop shadow={smvisible on=<\smvisible->},smvisible on=<\smvisible->]
	    (module\xi) at (0,0+\xi*\descriptiveitemsysep) {\smitem};
		\draw[line width=\prioritytick,\col,smvisible on=<\smvisible->] 
		 ([xshift=-\arrowtickxshift pt]module\xi.base west)--
		 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$);    
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture} 
   }{}% end-priority descriptive diagram
   }% end-no value 1
}% end-command
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \Finale

\endinput