summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/smartdiagram/smartdiagram.dtx
blob: 27ee87ff150b3f7397ea531a1d4b54990fab9d98 (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
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*readme>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
smartdiagram --- Automatic creation of smart diagrams with LaTeX

E-mail: claudio <dot> fiandrino <at> gmail <dot> 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.

The package is composed and necessitates of the core libraries:
 - core.definitions,
 - core.styles,
 - core.commands
and of the external library:
 - additions.
%</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 <dot> fiandrino <at> gmail <dot> 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-2013 by Claudio Fiandrino 
E-mail: <claudio <dot> fiandrino <at> gmail <dot> 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, 
                                smartdiagramlibrarycore.definitions.code.tex,
                                smartdiagramlibrarycore.styles.code.tex,
                                smartdiagramlibrarycore.commands.code.tex
                                smartdiagramlibraryadditions.code.tex and
                                smartdiagram.sty.

\endpostamble
\usedir{tex/latex/smartdiagram}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
\generate{
  \file{smartdiagramlibrarycore.definitions.code.tex}{\from{\jobname.dtx}{definitions}}
}
\generate{
  \file{smartdiagramlibrarycore.styles.code.tex}{\from{\jobname.dtx}{styles}}
}
\generate{
  \file{smartdiagramlibrarycore.commands.code.tex}{\from{\jobname.dtx}{commands}}
}
\generate{
  \file{smartdiagramlibraryadditions.code.tex}{\from{\jobname.dtx}{additions}}
}
%</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}[2016/12/23 v0.3b 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}
\usesmartdiagramlibrary{additions}
\usetikzlibrary{shapes.geometric,decorations.pathmorphing,arrows}
\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{\smnumeration}[1]{\textcolor{green!70!blue}{\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{1368}
%
% \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         \~}
%
%
% \changes{v0.1}{2012/10/28}{Initial version}
% \changes{v0.2}{2013/03/09}{Clockwise order circular diagram/horizontal order flow diagram/Uniform colors/Sequence diagram}
% \changes{v0.3}{2013/03/26}{Fix color arrow problem in circular diagram animated, add possibility uniform color list,
%   added initial null space to items to hypenate first word,libraries, additions, arrows styles
% }
% \changes{v0.3a}{2013/04/19}{Fix bug in circular diagram animated: last arrow appearence, added key "back arrow distance"}
% \changes{v0.3b}{2016/12/23}{Fix bug uniform color list}
%
% \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 originated 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};
% \item \textsf{xstring} (from version 0.2).
% \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};
% \item \library{shapes.symbols} (from version 0.2).
% \end{itemize}
% and it sets a new layer called \verb|smart diagram arrow back|. From version 0.3, the package is composed of three core libraries:
% \begin{itemize}
% \item \library{core.definitions},
% \item \library{core.styles},
% \item \library{core.commands}
% \end{itemize}
% which actually form the package \library{smartdiagram.sty} and of the external library:
% \begin{itemize}
% \item \library{additions}
% \end{itemize}
% which can be loaded separately by the user. By loading this library:
% \begin{flushleft}
% \texttt{\textbackslash usesmartdiagramlibrary\{}\library{additions}\texttt{\}}
% \end{flushleft}
% forces the Ti\textit{k}Z library \library{positioning} to be loaded as well.
% 
% 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 typically in counterclockwise order; 
% \item \diagram{circular diagram:clockwise}: same as before, but now items are placed in clockwise order (no space between names and \diagram{:});
% \item \diagram{flow diagram}: the items in the list are diplayed as a flow chart;
% \item \diagram{flow diagram:horizontal}: the items in the list are diplayed as an horizontal flow chart (no space between names and \diagram{:});
% \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;
% \item \diagram{sequence diagram}: the items in the list are diplayed in sequence and each item points to the subsequent.
% \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.
%
% From version 0.2 there is availble also the \diagram{sequence diagram} which displays the \mbrarg{list of items} with a particular shape.
%
% \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.
% 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. 
% Finally, in the \diagram{sequence} diagram, the items are presented one at a time starting from the left one ending with the right one.
%
% \section{Additions}
% \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:
% \begin{flushleft}
% \texttt{\textbackslash usesmartdiagramlibrary\{}\library{additions}\texttt{\}}
% \end{flushleft}
% 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:
% \begin{flushleft}
% \meta{position of module/Annotation text}
% \end{flushleft}
% where:
% \begin{itemize}
% \item \textit{position} is an anchor of Ti\textit{k}Z (i.e \texttt{above}, \texttt{below right} and so on);
% \item \textit{module} is the name of a module in the smart diagram;
% \item \textit{position} and \textit{module} should be separated by the string \texttt{of}: spaces before and after the string are \emph{mandatory}.
% \end{itemize}
% \textsf{Smartdiagram} defines as names:
% \begin{itemize}
% \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};
% \item for the diagrams \diagram{flow diagram} and \diagram{flow diagram:horizontal}:\\ \smkey{module}\smnumeration{progressive-number}; example: \texttt{module3};
% \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};
% \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};
% \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};
% \item for the diagram \diagram{priority descriptive diagram}: \smkey{module}\smnumeration{progressive-number};
% \item for the diagram \diagram{sequence diagram}: \smkey{sequence-item}\smnumeration{progressive-number}; example: \texttt{sequence-item1}.
% \end{itemize}
% 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}.
%
% An example:
% \begin{verbatim}
% \begin{minipage}[t][3.5cm]{\textwidth}
% \begin{center}
% \smartdiagramset{
%  uniform color list=gray!60!black for 3 items,
%  back arrow disabled=true,
%  additions={
%   additional item offset=0.85cm,
%   additional item border color=red,
%   additional connections disabled=false,
%   additional arrow color=red,
%   additional arrow tip=stealth,
%   additional arrow line width=1pt,
%   additional arrow style=]-latex',
%   }
% }
% \smartdiagramadd[flow diagram:horizontal]{%
% PGF,Ti\textit{k}Z,Smartdiagram%
% }{%
% below of module1/Low Level, below of module3/High level%
% }
% \end{center}
% \end{minipage}
% \end{verbatim}
% The result:
% \medskip
%
% \begin{minipage}[t][3.5cm]{\textwidth}
% \begin{center}
% \smartdiagramset{
%  uniform color list=gray!60!black for 3 items,
%  back arrow disabled=true,
%  additions={
%   additional item offset=0.85cm,
%   additional item border color=red,
%   additional connections disabled=false,
%   additional arrow color=red,
%   additional arrow tip=stealth,
%   additional arrow line width=1pt,
%   additional arrow style=]-latex',
%   }
% }
% \smartdiagramadd[flow diagram:horizontal]{%
% PGF,Ti\textit{k}Z,Smartdiagram%
% }{%
% below of module1/Low Level, below of module3/High level%
% }
% \end{center}
% \end{minipage}
%
% \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:
% \begin{verbatim}
% \begin{minipage}[t][3.5cm]{\textwidth}
% \begin{center}
% \smartdiagramset{
%  uniform color list=gray!60!black for 3 items,
%  back arrow disabled=true,
%  additions={
%   additional item offset=0.85cm,
%   additional item border color=red,
%   additional arrow color=red,
%   additional arrow tip=stealth,
%   additional arrow line width=1pt,
%   additional arrow style=]-latex',
%   }
% }
% \smartdiagramadd[flow diagram:horizontal]{%
% PGF,Ti\textit{k}Z,Smartdiagram%
% }{%
% below of module1/Low Level, below of module3/High level%
% }
% \smartdiagramconnect{{]-latex'}}{additional-module1/module1}
% \smartdiagramconnect{{latex'-[}}{additional-module2/module3}
% \end{center}
% \end{minipage}
% \end{verbatim}
% gives:
% \medskip
%
% \begin{minipage}[t][3.5cm]{\textwidth}
% \begin{center}
% \smartdiagramset{
%  uniform color list=gray!60!black for 3 items,
%  back arrow disabled=true,
%  additions={
%   additional item offset=0.85cm,
%   additional item border color=red,
%   additional arrow color=red,
%   additional arrow tip=stealth,
%   additional arrow line width=1pt,
%   additional arrow style=]-latex',
%   }
% }
% \smartdiagramadd[flow diagram:horizontal]{%
% PGF,Ti\textit{k}Z,Smartdiagram%
% }{%
% below of module1/Low Level, below of module3/High level%
% }
% \smartdiagramconnect{{]-latex'}}{additional-module1/module1}
% \smartdiagramconnect{{latex'-[}}{additional-module2/module3}
% \end{center}
% \end{minipage}
% 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.
%
% 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:
% \begin{verbatim}
% \smartdiagramconnect{{latex'-[},green}{additional-module2/module3}
% \end{verbatim}
% For the moment, the library \library{additions} \emph{does not work} in the animated mode.
%
% \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}. 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}.
% \subsection{Available options}
% Here follows the list of general available options: these options are related to generic aspects as color lists or arrows.
% \subsubsection{General options}
% \begin{itemize}
% \item \packoption{set color list}{none}: this option allows the user to define the list of colors usable in the diagram;
%
% \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;
%
% \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 line width}{0.1cm}: this option sets the width of the connection arrows within two modules;
%
% \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};
%
% \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;
%
% \item \packoption{uniform arrow color}{false}: this option, set to true, activates the possibility to use one single arrow color for all the connections;
%
% \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.
%
% \end{itemize}
% \subsubsection{Specific options}
% Here follows the list of specific available options per type of diagram.
%
% For what concern the \diagram{circular diagram}, \diagram{circular diagram:clockwise}, the \diagram{flow diagram} and the \diagram{flow diagram:horizontal}:
% \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 \diagram{flow diagram};
%
% \item \packoption{module x sep}{2.75}: this option sets an horizontal distance factor among the modules in a \diagram{flow diagram:horizontal};
%
% \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{text color}{black}: this option sets the text color of the module;
%
% \item \packoption{circular distance}{2.75cm}: this option sets the radius of cirle around which the modules in a \diagram{circular diagram};
%
% \end{itemize}
% 
% 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:
% \begin{itemize}
% \item \packoption{back arrow distance}{0.5}: the option sets the distance (it hold for both types);
% \item \packoption{back arrow disabled}{false}: the option, set to \texttt{true} disables the back arrow.
% \end{itemize}
%
% 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:
% \begin{itemize}
% \item \packoption{circular final arrow disabled}{false}: the option, set to \texttt{true} disables the final connection.
% \end{itemize}
% 
% 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}
%
% Considering just the the \diagram{constellation diagram} and the \diagram{connected constellation diagram}:
% \begin{itemize}
% \item \packoption{uniform connection color}{false}: the option, set to \texttt{true} overrides the color list definition;
% \item \packoption{connection color}{gray}: this option allows to specify the color valid for all the connections.
% \end{itemize}
% For what concern the \diagram{sequence diagram}:
% \begin{itemize}
%
% \item \packoption{sequence item height}{1cm}: the option specifies the minimum height of the items;
%
% \item \packoption{sequence item width}{2cm}: the option specifies the minimum width of the items;
%
% \item \packoption{sequence item border color}{gray}: sets the border line color;
%
% \item \packoption{sequence item border size}{1.65\textbackslash pgflinewidth}: sets the border line width;
%
% \item \packoption{sequence item font size}{\textbackslash normalfont}: this option sets the font size of the items;
%
% \item \packoption{sequence item fill opacity}{1}: sets the opacity at which the item is shown;
%
% \item \packoption{sequence item text opacity}{1}: sets the opacity at which the item text is shown;
%
% \item \packoption{sequence item text width}{1.9cm}: the option allows to select the item text width;
%
% \item \packoption{sequence item text color}{black}: the option allows to select the item text color;
%
% \item \packoption{uniform sequence color}{false}: the option, set to \texttt{true} overrides the color list definition;
%
% \item \packoption{sequence item uniform color}{gray!60!black}: this option allows to specify the color valid for all the items in the sequence.
%
% \end{itemize}
%
% \subsubsection{Options of the additions library}
% \label{subsubsect:options}
% The options of the library necessitate to be set within a specific key \smkey{additions}; this key is defined as
% \begin{verbatim}
% \pgfkeys{/smart diagram/.cd,
%  additions/.style={/smart diagram/additions/.cd,#1}%
% }
% \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:
% \begin{verbatim}
% \smartdiagramset{
%  additions={
%   additional item offset=0.85cm,
%   additional item border color=red,
%   additional arrow color=red,
%   additional arrow tip=stealth,
%   additional arrow line width=1pt,
%   additional arrow style=]-latex',
%   }
% }
% \end{verbatim}
% 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. 
% \begin{itemize}
% 
% \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;
% 
% \item \packoption{additional item border color}{none}: sets the border line color;
% 
% \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};
% 
% \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;
% 
% \item \packoption{additional item text width}{1.75cm}: it defines the text width of the module;
% 
% \item \packoption{additional item width}{2cm}: it defines the minimum width of the module;
% 
% \item \packoption{additional item height}{1cm}: it defines the minimum height of the module;
% 
% \item \packoption{additional item font}{\textbackslash normalfont}: this option allows to customize the font of the module;
% 
% \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};
% 
% \item \packoption{additional item offset}{0.25cm}: this option defines the distance between the original module and the additional one;
% 
% \item \packoption{additional item fill opacity}{1}: it sets the fill opacity of the module;
% 
% \item \packoption{additional item text opacity}{1}: it sets the text opacity of the module;
% 
% \item \packoption{additional arrow tip}{stealth}: this option defines the single arrow tip of the connection;
% 
% \item \packoption{additional arrow line width}{0.1cm}: this option defines the line width of the connection;
% 
% \item \packoption{additional arrow color}{gray}: this option defines the connection color;
% 
% \item \packoption{additional arrow style}{->}: this option allows to customize the connection aspect, that is both arrow tips simultaneously;
% 
% \item \packoption{additional item shadow}{none}: it allows to define a shadow for the module; use the usual Ti\textit{k}Z shadow options;
% 
% \item \packoption{additional connections disabled}{true}: this option when set to \texttt{false} makes all the connections visible.
%
% \end{itemize}
% \section{Gallery of examples}
% \label{sec:gallery}
% \DescribeMacro{Horizontal flow chart: custom color list - no back arrow}
% Example of an horizontal flow chart with custom color list and back arrow disabled:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{border color=none,
%   set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black},
%   back arrow disabled=true}
% \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagramset{border color=none,
%   set color list={blue!50!cyan,green!60!lime,orange!50!red,red!80!black},
%   back arrow disabled=true}
% \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
% }
% \end{center}
% \DescribeMacro{Horizontal flow chart: uniform color list - custom arrow style}
% A similar example with an uniform color list and custom arrow style definition:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{border color=none,
%   uniform color list=teal!60 for 4 items,
%   arrow style=[-stealth', 
%   module x sep=3.75,
%   back arrow distance=0.75,
% }
% \smartdiagram[flow diagram:horizontal]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagramset{border color=none,
%   uniform color list=teal!60 for 4 items,
%   arrow style=stealth'-], module x sep=3.75,
%   back arrow distance=0.75,
% }
% \smartdiagram[flow diagram:horizontal]{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}
% \scalebox{0.7}{
% \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 and final arrow disabled}
% An example with a diamond shape and the final arrow disabled:
% \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,
%  circular final arrow disabled=true,
% }
% \smartdiagram[circular diagram:clockwise]{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,
%  circular final arrow disabled=true,
% }
% \smartdiagram[circular diagram:clockwise]{Set up,Run,Analyse,Modify~/ Add}
% \end{center}
% \DescribeMacro{Flow diagram with decorated border and uniform arrow color}
% An example with a decorated shape and uniform arrow color:
% \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},
%   uniform arrow color=true, 
%   arrow color=gray!50!black,
% }
% \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},
%   uniform arrow color=true, arrow color=gray!50!black,
% }
% \scalebox{0.8}{
% \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{Constellation diagram with custom colors}
% An example of constellation diagram with custom colors:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{set color list={orange!60, green!50!lime!60,magenta!60,
%   blue!50!cyan},
%   uniform connection color=true
% }
% \smartdiagram[constellation diagram]{
%  Build a program,Set up,Run,Analyze,Modify~/\\ Add
% }
% \end{center}
% \end{verbatim}
% \begin{center}
% \scalebox{0.8}{
% \smartdiagramset{set color list={orange!60, green!50!lime!60,magenta!60,blue!50!cyan},
%   uniform connection color=true}
% \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,use predefined color list}
% \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}
% \DescribeMacro{Sequence diagram}
% The same previous example with a sequence diagram:
% \begin{verbatim}
% \begin{center}
% \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{use predefined color list}
% \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% and with \smkey{uniform sequence color} set to \verb|true|:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{uniform sequence color=true,
%   sequence item border color=black,sequence item font size=\footnotesize,
%   sequence item text color=white
% }
% \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{uniform sequence color=true,
%   sequence item border color=black,sequence item font size=\footnotesize,
%   sequence item text color=white
% }
% \smartdiagram[sequence diagram]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \DescribeMacro{Put additions to a diagram}
% Here is an example of a circular diagram with some additions:
% \begin{verbatim}
% \usesmartdiagramlibrary{additions} % required in the preamble
% \usetikzlibrary{arrows} % required in the preamble
% \bigskip
% \begin{minipage}[c][8cm]{\textwidth}
% \centering
% \smartdiagramset{
%  uniform color list=orange!60!yellow for 5 items,
%  circular final arrow disabled=true,
%  circular distance=2.25cm,
%  arrow tip=to,
%  arrow line width=2pt,
%  additions={
%    additional item bottom color=orange!60!yellow,
%    additional item border color=gray,
%    additional item shadow=drop shadow,
%    additional item offset=0.65cm,
%    additional arrow line width=2pt,
%    additional arrow tip=to,
%    additional arrow color=orange!60!yellow,
%  } 
% }
% \smartdiagramadd[circular diagram]{
%  aa,bb,cc,dd,ee
% }{
%  above of module1/Start,right of module5/End
% }
% \smartdiagramconnect{to-}{module1/additional-module1}
% \smartdiagramconnect{-to}{module5/additional-module2}
% \end{minipage}
% \end{verbatim}
% \begin{minipage}[c][8cm]{\textwidth}
% \centering
% \smartdiagramset{
%  uniform color list=orange!60!yellow for 5 items,
%  circular final arrow disabled=true,
%  circular distance=2.25cm,
%  arrow tip=to,
%  arrow line width=2pt,
%  additions={
%    additional item bottom color=orange!60!yellow,
%    additional item border color=gray,
%    additional item shadow=drop shadow,
%    additional item offset=0.65cm,
%    additional arrow line width=2pt,
%    additional arrow tip=to,
%    additional arrow color=orange!60!yellow,
%  } 
% }
% \smartdiagramadd[circular diagram]{
%  aa,bb,cc,dd,ee
% }{
%  above of module1/Start,right of module5/End
% }
% \smartdiagramconnect{to-}{module1/additional-module1}
% \smartdiagramconnect{-to}{module5/additional-module2}
% \end{minipage}
%
% \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 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:
% \begin{verbatim}
% \smartdiagramset{use predefined color list}
% \end{verbatim}
%
% 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:
% \begin{verbatim}
% \smartdiagramset{uniform color list=<some color> for <n> items}
% \end{verbatim}
% 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:
% \begin{verbatim}
% \begin{center}
% \smartdiagramset{
%  uniform color list=gray!60!black for 2 items,
%  back arrow disabled=true,
% }
% \smartdiagram[flow diagram:horizontal]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% \end{verbatim}
% \begin{center}
% \smartdiagramset{use predefined color list,
%  uniform color list=gray!60!black for 2 items,
%  back arrow disabled=true,
% }
% \smartdiagram[flow diagram:horizontal]{PGF,Ti\textit{k}Z,Smartdiagram}
% \end{center}
% 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.
% 
% 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:
% \begin{verbatim}
% \smartdiagramset{uniform arrow color=true} 
% \end{verbatim}
% could be customized throught the key \smkey{arrow color}, while \smkey{uniform color list} make modules and arrows be rendered with the same color.
% 
% \subsection{Defining styles}
% \label{subsec:stylesdef}
% The \textsf{smartdiagram} package admits the definition of styles to collect key-definitions; for example:
% \begin{verbatim}
% \smartdiagramset{my diagram style/.style={
%        module shape=diamond,
%        font=\scriptsize,
%        module minimum width=1cm,
%        module minimum height=1cm,
%        text width=1cm
%   }
% }
% \end{verbatim}
% can be subsequently used in:
% \begin{verbatim}
% \begin{center}
%  \smartdiagramset{my diagram style, arrow tip=to}
%  \smartdiagram[circular diagram]{Do, This, Only, For, Me}
% \end{center}
% \begin{center}
%  \smartdiagramset{my diagram style, module y sep=2.5}
%  \smartdiagram[flow diagram]{Do, This, For, Me}
% \end{center}
% \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:
% \smartdiagramset{use predefined color list}
% \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|snake|, raise as error: 
% \begin{verbatim}
% ! Dimension too large.
% \end{verbatim} but, after all, the decoration is deployed 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}.
%
% 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}.
%
% 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}. 
% \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{etoolbox}
\RequirePackage{xparse}
\RequirePackage{xstring}

\usetikzlibrary{backgrounds,
   calc,
   fadings,
   shadows,
   shapes.arrows,
   shapes.symbols
}
\pgfdeclarelayer{smart diagram arrow back}
\pgfsetlayers{background,smart diagram arrow back,main}


\def\usesmartdiagramlibrary{\pgfutil@ifnextchar[{\use@smartdiagramlibrary}{\use@@smartdiagramlibrary}}%}
\def\use@smartdiagramlibrary[#1]{\use@@smartdiagramlibrary{#1}}
\def\use@@smartdiagramlibrary#1{%
 \edef\pgf@list{#1}%
 \pgfutil@for\pgf@temp:=\pgf@list\do{%
  \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
  \ifx\pgf@temp\pgfutil@empty
  \else
    \expandafter\ifx\csname smartdiagram@library@\pgf@temp @loaded\endcsname\relax%
    \expandafter\global\expandafter\let\csname smartdiagram@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
    \expandafter\edef\csname smartdiagram@library@#1@atcode\endcsname{\the\catcode`\@}
    \expandafter\edef\csname smartdiagram@library@#1@barcode\endcsname{\the\catcode`\|}
    \catcode`\@=11
    \catcode`\|=12
    \pgfutil@InputIfFileExists{smartdiagramlibrary\pgf@temp.code.tex}{}{
      \PackageError{smartdiagram}{I did not find the smartdiagram library '\pgf@temp'.}{}
    }%
    \catcode`\@=\csname smartdiagram@library@#1@atcode\endcsname
    \catcode`\|=\csname smartdiagram@library@#1@barcode\endcsname
  \fi%
 \fi
 }%
}

\usesmartdiagramlibrary{core.definitions}
\usesmartdiagramlibrary{core.styles}
\usesmartdiagramlibrary{core.commands}
%    \end{macrocode} 
% \iffalse
%</package>
% \fi
%
% \iffalse
%<*definitions>
% \fi
% \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 the functions 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},
   module x sep/.initial={2.75},
   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},
   arrow color/.initial={gray},
   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},
   connection color/.initial={gray},
   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},
   sequence item height/.initial={1cm},
   sequence item width/.initial={2cm},
   sequence item border color/.initial={gray},
   sequence item border size/.initial={1.75\pgflinewidth},
   sequence item font size/.initial={\normalfont},
   sequence item fill opacity/.initial={1},
   sequence item text opacity/.initial={1},
   sequence item text width/.initial={1.9cm},
   sequence item text color/.initial={black},
   sequence item uniform color/.initial={gray!60!black},
   arrow style/.initial={<-},
   text color/.initial={black},
   back arrow distance/.initial={0.5},
}%

\pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
   module minimum height/.get=\sm@core@moduleheight,
   module y sep/.get=\sm@core@moduleysep,
   module x sep/.get=\sm@core@modulexsep,
   descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
   text width/.get=\sm@core@moduletextwidth,
   description title width/.get=\sm@core@descriptiontitlewidth,
   description text width/.get=\sm@core@descriptiontextwidth,
   description title text width/.get=\sm@core@descriptiontitletextwidth,
   description title font/.get=\sm@core@descriptiontitlefontsize,
   description font/.get=\sm@core@descriptionfontsize,
   description width/.get=\sm@core@descriptionwidth,
   font/.get=\sm@core@modulefontsize,
   border color/.get=\sm@core@bordercolor,
   circular distance/.get=\sm@core@circulardistance,
   arrow line width/.get=\sm@core@arrowlinewidth,
   module shape/.get=\sm@core@moduleshape,
   insert decoration/.get=\sm@core@borderdecoration,
   arrow tip/.get=\sm@core@arrowtip,
   arrow color/.get=\sm@core@arrowcolor,
   bubble center node size/.get=\sm@core@bubblecenternodesize,
   bubble center node font/.get=\sm@core@bubblecenternodefont,
   bubble center node color/.get=\sm@core@bubblecenternodecolor,
   distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
   distance text center bubble/.get=\sm@core@distancetextcenterbubble,
   bubble fill opacity/.get=\sm@core@bubblefillopacity,
   bubble node size/.get=\sm@core@bubblenodesize,
   bubble text opacity/.get=\sm@core@bubbletextopacity,
   bubble node font/.get=\sm@core@bubblenodefont,
   planet size/.get=\sm@core@planetminimumsize,
   planet color/.get=\sm@core@planetcolor,
   planet font/.get=\sm@core@planetfont,
   distance planet-connection/.get=\sm@core@planetoutersep,
   distance planet-text/.get=\sm@core@planetinnersep,
   planet text width/.get=\sm@core@planettextwidth,
   satellite size/.get=\sm@core@satelliteminimumsize,
   satellite font/.get=\sm@core@satellitefont,
   satellite fill opacity/.get=\sm@core@satellitefillopacity,
   satellite text opacity/.get=\sm@core@satellitetextopacity,
   satellite text width/.get=\sm@core@satellitetextwidth,
   distance satellite-connection/.get=\sm@core@satelliteoutersep,
   connection line width/.get=\sm@core@connectionlinewidth,
   connection color/.get=\sm@core@connectioncolor,
   distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
   priority arrow width/.get=\sm@core@priorityarrowwidth,
   priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
   priority tick size/.get=\sm@core@prioritytick,
   priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
   sequence item height/.get=\sm@core@seqitemheight,
   sequence item width/.get=\sm@core@seqitemwidth,
   sequence item border color/.get=\sm@core@seqitembordercolor,
   sequence item border size/.get=\sm@core@seqlinewidth,
   sequence item font size/.get=\sm@core@seqitemfont,
   sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
   sequence item text opacity/.get=\sm@core@seqitemtextopacity,
   sequence item text width/.get=\sm@core@seqitemtextwidth,
   sequence item text color/.get=\sm@core@seqitemtextcolor,
   sequence item uniform color/.get=\sm@core@seqitemuniformcol,
   arrow style/.get=\sm@core@arrowstyle,
   text color/.get=\sm@core@textcolor,
   back arrow distance/.get=\sm@core@backarrowdistance,
}%
%    \end{macrocode} 
% The specific key to set the list of colors:
%    \begin{macrocode}
\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, uniform color list/.code args={#1 for #2 items}{%
      \foreach \listitem [count=\i] in {1,...,#2}{%
         \global\@namedef{color@\i\expandafter}\expandafter{#1}%
      }%
   }%
}

\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}%
   } 
}
%    \end{macrocode} 
% The specific key to disable the back arrow in the \diagram{flow diagram} and in the \diagram{flow diagram:horizontal}:
%    \begin{macrocode}
\newif\ifbackarrowdisabled
\pgfkeys{/smart diagram/.cd,
  back arrow disabled/.is if=backarrowdisabled,
  back arrow disabled=false,
}
%    \end{macrocode} 
% The specific key to disable the final arrow in the \diagram{circular diagram} and in the \diagram{circular diagram: clockwise}:
%    \begin{macrocode}
\newif\ifcircularfinalarrowdisabled
\pgfkeys{/smart diagram/.cd,
  circular final arrow disabled/.is if=circularfinalarrowdisabled,
  circular final arrow disabled=false,
}
%    \end{macrocode} 
% The command to activate the various keys:
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagramset}{m}{%
  \pgfkeys{/smart diagram/.cd,#1}%
  \pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
   module minimum height/.get=\sm@core@moduleheight,
   module y sep/.get=\sm@core@moduleysep,
   module x sep/.get=\sm@core@modulexsep,
   descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
   text width/.get=\sm@core@moduletextwidth,
   description title width/.get=\sm@core@descriptiontitlewidth,
   description text width/.get=\sm@core@descriptiontextwidth,
   description title text width/.get=\sm@core@descriptiontitletextwidth,
   description title font/.get=\sm@core@descriptiontitlefontsize,
   description font/.get=\sm@core@descriptionfontsize,
   description width/.get=\sm@core@descriptionwidth,
   font/.get=\sm@core@modulefontsize,
   border color/.get=\sm@core@bordercolor,
   circular distance/.get=\sm@core@circulardistance,
   arrow line width/.get=\sm@core@arrowlinewidth,
   module shape/.get=\sm@core@moduleshape,
   insert decoration/.get=\sm@core@borderdecoration,
   arrow tip/.get=\sm@core@arrowtip,
   arrow color/.get=\sm@core@arrowcolor,
   bubble center node size/.get=\sm@core@bubblecenternodesize,
   bubble center node font/.get=\sm@core@bubblecenternodefont,
   bubble center node color/.get=\sm@core@bubblecenternodecolor,
   distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
   distance text center bubble/.get=\sm@core@distancetextcenterbubble,
   bubble fill opacity/.get=\sm@core@bubblefillopacity,
   bubble node size/.get=\sm@core@bubblenodesize,
   bubble text opacity/.get=\sm@core@bubbletextopacity,
   bubble node font/.get=\sm@core@bubblenodefont,
   planet size/.get=\sm@core@planetminimumsize,
   planet color/.get=\sm@core@planetcolor,
   planet font/.get=\sm@core@planetfont,
   distance planet-connection/.get=\sm@core@planetoutersep,
   distance planet-text/.get=\sm@core@planetinnersep,
   planet text width/.get=\sm@core@planettextwidth,
   satellite size/.get=\sm@core@satelliteminimumsize,
   satellite font/.get=\sm@core@satellitefont,
   satellite fill opacity/.get=\sm@core@satellitefillopacity,
   satellite text opacity/.get=\sm@core@satellitetextopacity,
   satellite text width/.get=\sm@core@satellitetextwidth,
   distance satellite-connection/.get=\sm@core@satelliteoutersep,
   connection line width/.get=\sm@core@connectionlinewidth,
   connection color/.get=\sm@core@connectioncolor,
   distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
   priority arrow width/.get=\sm@core@priorityarrowwidth,
   priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
   priority tick size/.get=\sm@core@prioritytick,
   priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
   sequence item height/.get=\sm@core@seqitemheight,
   sequence item width/.get=\sm@core@seqitemwidth,
   sequence item border color/.get=\sm@core@seqitembordercolor,
   sequence item border size/.get=\sm@core@seqlinewidth,
   sequence item font size/.get=\sm@core@seqitemfont,
   sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
   sequence item text opacity/.get=\sm@core@seqitemtextopacity,
   sequence item text width/.get=\sm@core@seqitemtextwidth,
   sequence item text color/.get=\sm@core@seqitemtextcolor,
   sequence item uniform color/.get=\sm@core@seqitemuniformcol,
   arrow style/.get=\sm@core@arrowstyle,
   text color/.get=\sm@core@textcolor,
   back arrow distance/.get=\sm@core@backarrowdistance,
  }%
}%
%    \end{macrocode}
% Key to let the sequence color be uniform:
%    \begin{macrocode} 
\pgfkeys{/smart diagram/.cd,% 
    uniform sequence color/.is choice,%
    uniform sequence color/true/.code={%
      \tikzset{sequence item/.append style={%
         fill=\sm@core@seqitemuniformcol,
         },%
       }%
    },%
    uniform sequence color/false/.style={sequence item},%
    uniform sequence color/.default=false,%
}%
%    \end{macrocode}
% Key to let the connection planet satellite color be uniform:
%    \begin{macrocode}
\pgfkeys{/smart diagram/.cd,% 
      uniform connection color/.is choice,%
      uniform connection color/true/.code={%
        \tikzset{connection planet satellite/.append style={%
           \sm@core@connectioncolor
           },%
        }%
      },%
      uniform connection color/false/.style={connection planet satellite},%
    uniform connection color/.default=false,%
}%
%    \end{macrocode}
% Key to let the arrow color be uniform:
%    \begin{macrocode}
\pgfkeys{/smart diagram/.cd,% 
      uniform arrow color/.is choice,%
      uniform arrow color/true/.code={%
        \tikzset{diagram arrow type/.append style={%
           \sm@core@arrowcolor
           },%
        }%
      },%
      uniform arrow color/false/.style={diagram arrow type},%
    uniform arrow color/.default=false,%
}%

%    \end{macrocode}
% \iffalse
%</definitions>
% \fi
%
% \iffalse
%<*styles>
% \fi 
% 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=\sm@core@bordercolor,
      top color=white,
      bottom color=\col,
      text=\sm@core@textcolor,
      text width=\sm@core@moduletextwidth,
      minimum width=\sm@core@modulewidth,
      minimum height=\sm@core@moduleheight,
      font=\sm@core@modulefontsize,
      \sm@core@borderdecoration
   },
   diagram arrow type/.style={%
      \sm@core@arrowstyle,
      >=\sm@core@arrowtip,
      line width=\sm@core@arrowlinewidth,
      \col
   },%
}
\tikzset{description title/.style={%
      circle,
      draw=\sm@core@bordercolor,
      minimum width=\sm@core@descriptiontitlewidth,
      anchor=east,      
      bottom color=\col,
      top color=white!80!\col,
      font=\sm@core@descriptiontitlefontsize,
      text width=\sm@core@descriptiontitletextwidth,
      \sm@core@borderdecoration,
   },
   description/.style={%
      \pgfkeysvalueof{/smart diagram/module shape},
      text width=\sm@core@descriptiontextwidth,
      draw=\sm@core@bordercolor, 
      anchor=west,
      minimum height=\sm@core@moduleheight,
      minimum width=\sm@core@descriptionwidth,
      bottom color=\col,
      top color=white!80!\col,
      font=\sm@core@descriptionfontsize,
      \sm@core@borderdecoration,
   }%
}
\tikzset{priority arrow/.style={
      draw=\sm@core@bordercolor,
      single arrow, 
      minimum height=\distancemodules,
      minimum width=\sm@core@priorityarrowwidth,
      priority arrow fill,
      rotate=90,
      single arrow head extend=\sm@core@priorityarrowheadextend,
      anchor=west,
   }
}
\tikzset{bubble center node/.style={
      minimum size=\sm@core@bubblecenternodesize,
      circle,
      fill=\sm@core@bubblecenternodecolor,
      font=\sm@core@bubblecenternodefont,
      outer sep=\sm@core@distancecenterotherbubbles,
      inner sep=\sm@core@distancetextcenterbubble,
   },
   bubble node/.style={
      minimum size=\sm@core@bubblenodesize,
      circle,
	   ultra thick,
	   font=\sm@core@bubblenodefont,
	   draw=white,
	   fill opacity=\sm@core@bubblefillopacity,
	   fill=\col,        
	   text opacity=\sm@core@bubbletextopacity,
   }
}
\tikzset{planet/.style={
      minimum size=\sm@core@planetminimumsize,
      circle,
      fill=\sm@core@planetcolor,
      font=\sm@core@planetfont,
      outer sep=\sm@core@planetoutersep,
      inner sep=\sm@core@planetinnersep,
      text width=\sm@core@planettextwidth,
   },
   satellite/.style={
      minimum size=\sm@core@satelliteminimumsize,
      circle,
	    font=\sm@core@satellitefont,
	    fill opacity=\sm@core@satellitefillopacity,
	    fill=\col,        
	    text opacity=\sm@core@satellitetextopacity,
	    text width=\sm@core@satellitetextwidth,
	    outer sep=\sm@core@satelliteoutersep,
   },
   connection planet satellite/.style={
     ->,
     line width=\sm@core@connectionlinewidth,
     >=\sm@core@arrowtip,
     \col,
   }
}

\tikzset{sequence item/.style={
      minimum height=\sm@core@seqitemheight,
      minimum width=\sm@core@seqitemwidth,
      signal,
      signal from=west,
      signal to=east,
      draw=\sm@core@seqitembordercolor,
      line width=\sm@core@seqlinewidth,
	    font=\sm@core@seqitemfont,
	    fill opacity=\sm@core@seqitemfillopacity,
	    fill=\col,        
	    text opacity=\sm@core@seqitemtextopacity,
	    text width=\sm@core@seqitemtextwidth,
      text=\sm@core@seqitemtextcolor,
  }
}
% let the first word of the item be hypenate
\tikzset{let hypenation/.style={%
    execute at begin node={%
       \hspace{0pt}%
    }%
  }%
}%
%    \end{macrocode}
% The definition of the visibility style:
%    \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}}
   },%
}%
%    \end{macrocode}
% \iffalse
%</styles>
% \fi
%
% \iffalse
%<*commands>
% \fi
% \subsection{Commands}
% Definition of the two commands. The diagrams:
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagram}{r[] m}{%   
   \StrCut{#1}{:}\diagramtype\option
   \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
   \IfStrEq{\diagramtype}{}{% 
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}
   }{}
   \IfStrEq{\diagramtype}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]

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

   \foreach \smitem [count=\xi] in {#2}{%
   \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
     \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi}
   }{% false-clockwise-circular diagram
     \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   }
   \edef\col{\@nameuse{color@\xi}}
   \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
     \node[module,drop shadow] (module\xi) 
      at (-\angle:\sm@core@circulardistance) {\smitem };
   }{% false-clockwise-circular diagram
     \node[module,drop shadow] (module\xi) 
      at (\angle:\sm@core@circulardistance) {\smitem };
   }
   }%
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnum\xi=\maxsmitem
     \ifcircularfinalarrowdisabled
       \relax
     \else
       \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} 
       \edef\col{\@nameuse{color@\xj}}
       \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
         \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] 
          (module\xj) to[bend right] (module\xi);
         }{% false-clockwise-circular diagram
          \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] 
           (module\xj) to[bend left] (module\xi);
         }
     \fi
   \else
     \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} 
     \edef\col{\@nameuse{color@\xj}}
     \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
       \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] 
         (module\xj) to[bend right] (module\xi);
     }{% false-clockwise-circular diagram
        \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] 
         (module\xj) to[bend left] (module\xi);
       }
     
   \fi
   }%
   \end{tikzpicture}  
   }{}% end-circular diagram
   \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]

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

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
     \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\sm@core@modulexsep} in
         node[module,drop shadow] (module\xi) at +(\n2,0) {\smitem};
   }{% false-horizontal-flow diagram
     \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\sm@core@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 - check if disabled
   \ifbackarrowdisabled
     \relax     
   \else
     \ifnum\xi=\maxsmitem     
       \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
         \tikzset{square arrow/.style={%
            to path={-- ++(0,\sm@core@backarrowdistance) -| (\tikztotarget)}
            }%
         }%
         \draw[diagram arrow type, square arrow] 
          (module\xj.north) to (module\xi.north);
       }{% false-horizontal-flow diagram
         \tikzset{square arrow/.style={%
            to path={-- ++(\sm@core@backarrowdistance,0) |- (\tikztotarget)}
            }%
         }%
         \draw[diagram arrow type,square arrow]
           (module\xj.east) to (module\xi);         
       }%
     \fi
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \IfStrEq{\diagramtype}{descriptive diagram}{% true-descr. diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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*\sm@core@descriptiveitemsysep) {\subitem};
		   }{}
		   \ifnumequal{\xii}{2}{% true
		   \node[description,drop shadow](module\xi) 
		    at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
		   }{}
	   }%
   }%
   \end{tikzpicture} 
   }{}% end-descr. diagram
   \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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
   \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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:\sm@core@distanceplanetsatellite) {\smitem };
	   \draw[connection planet satellite] (planet) -- (satellite\xi);    
	   }%
   }%
   \end{tikzpicture}  
   }{}%end-const diagram
   \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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:\sm@core@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
   \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
   \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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*\sm@core@descriptiveitemsysep) {\smitem};
		\draw[line width=\sm@core@prioritytick,\col] 
      ([xshift=-\arrowtickxshift pt]module\xi.base west)--
		 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);    
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture} 
   }{}% end-priority descriptive diagram
   \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \foreach \x[count=\xi, count=\prevx from 0] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \ifnum\xi=1
     \node[sequence item] (sequence-item\xi) {\x};
   \else
     \node[sequence item,anchor=west] (sequence-item\xi) at (sequence-item\prevx.east) {\x};
   \fi   
   }
   \end{tikzpicture} 
   }{}% end-sequence diagram
}% end-no value 1
}% end-command
%    \end{macrocode} 
% The command definition for the animated diagrams:
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagramanimated}{r[] m}{%
   \StrCut{#1}{:}\diagramtype\option
   \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
   \IfStrEq{\diagramtype}{}{% 
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}
   }{}
   \IfStrEq{\diagramtype}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}  
   \foreach \smitem [count=\xi] in {#2}{% 
   \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
     \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi}
   }{% false-clockwise-circular diagram
     \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   }
   \edef\col{\@nameuse{color@\xi}}
   \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
      \node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) 
       at (-\angle:\sm@core@circulardistance) {\smitem};
   }{% false-clockwise-circular diagram
      \node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) 
       at (\angle:\sm@core@circulardistance) {\smitem};
   }
   }%
   \foreach \smitem [count=\xi] in {#2}{%   
   \ifnum\xi=\maxsmitem
     \ifcircularfinalarrowdisabled
       \relax
     \else
       \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
       \pgfmathtruncatemacro{\adv}{\xi + 1)}
       \edef\col{\@nameuse{color@\xj}}
       \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
         \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
        smvisible on=<\adv->]
          (module\xj) to[bend right] (module\xi);
         }{% false-clockwise-circular diagram
          \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
        smvisible on=<\adv->]
           (module\xj) to[bend left] (module\xi);
         }
     \fi
   \else
     \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
     \pgfmathtruncatemacro{\adv}{\xi + 1)}
     \edef\col{\@nameuse{color@\xj}}
     \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram
       \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
        smvisible on=<\adv->] 
         (module\xj) to[bend right] (module\xi);
     }{% false-clockwise-circular diagram
        \draw[diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
          smvisible on=<\adv->] 
         (module\xj) to[bend left] (module\xi);
       }
     
   \fi
   }%
   \end{tikzpicture}  
   }{}% end-circular diagram
   \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]

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

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
     \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\sm@core@modulexsep}
        in node[module,drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) at +(\n2,0) {\smitem};
   }{% false-horizontal-flow diagram
     \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\sm@core@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 - check if disabled
   \ifbackarrowdisabled
     \relax     
   \else
     \ifnum\xi=\maxsmitem     
       \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram
         \tikzset{square arrow/.style={
           to path={-- ++(0,\sm@core@backarrowdistance) -| (\tikztotarget)}
           }
         }
         \draw[diagram arrow type, square arrow,smvisible on=<\xi->] 
          (module\xj.north) to (module\xi.north);
       }{% false-horizontal-flow diagram
         \tikzset{square arrow/.style={
           to path={-- ++(\sm@core@backarrowdistance,0) |- (\tikztotarget)}
           }
         }
         \draw[diagram arrow type,square arrow,smvisible on=<\xi->]
           (module\xj.east) to (module\xi);         
       }
     \fi
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \IfStrEq{\diagramtype}{descriptive diagram}{% true-descriptive diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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*\sm@core@descriptiveitemsysep) {\subitem};\pause
		   }{}
		   \ifnumequal{\xii}{2}{% true
		   \node[description,drop shadow,smvisible on=<\subitemvisible->] 
		   (module\xi)at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};\pause
		   }{}
	   }%
   }%
   \end{tikzpicture} 
   }{}% end-descriptive diagram
   \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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
   \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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:\sm@core@distanceplanetsatellite) {\smitem };
	   \draw[connection planet satellite, smvisible on=<\xi->]
	    (planet) -- (satellite\xi);    
	 }%
   }%
   \end{tikzpicture}  
   }{}%end-constellation diagram
   \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}] 
   \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:\sm@core@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
   \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\sm@core@priorityarrowwidth,\sm@core@priorityarrowheadextend)}
   \pgfmathsetmacro\sm@core@priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\sm@core@priorityarrowwidth-\sm@core@priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \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*\sm@core@descriptiveitemsysep) {\smitem};
		\draw[line width=\sm@core@prioritytick,\col,smvisible on=<\smvisible->] 
		 ([xshift=-\arrowtickxshift pt]module\xi.base west)--
		 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\sm@core@priorityticksize pt,0)$);    
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\sm@core@priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\sm@core@priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture} 
   }{}% end-priority descriptive diagram
   \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram
   \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
   \foreach \x[count=\xi, count=\prevx from 0] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \ifnum\xi=1
     \node[sequence item,smvisible on=<\xi->] (sequence-item\xi) {\x};
   \else
     \node[sequence item,anchor=west,smvisible on=<\xi->] 
      (sequence-item\xi) at (sequence-item\prevx.east) {\x};
   \fi   
   }
   \end{tikzpicture} 
   }{}% end-sequence diagram
   }% end-no value 1
}% end-command
%    \end{macrocode}
%
% \iffalse
%</commands>
% \fi
%
% \iffalse
%<*additions>
% \fi
% \subsection{Library Additions}
% The library at first loads the Ti\textit{k}Z library \library{positioning}.
%    \begin{macrocode}
\usetikzlibrary{positioning}
%    \end{macrocode} 
% Key definition:
%    \begin{macrocode}
\pgfkeys{/smart diagram/additions/.cd,
  additional item shape/.initial=\pgfkeysvalueof{/smart diagram/module shape},
  additional item shape/.get=\sm@additions@additionalitemshape,
  additional item shape/.store in=\sm@additions@additionalitemshape,
  additional item border color/.initial=none,
  additional item border color/.get=\sm@additions@additionalitembordercolor,
  additional item border color/.store in=\sm@additions@additionalitembordercolor,
  additional item bottom color/.initial=white,
  additional item bottom color/.get=\sm@additions@additionalitembottomcolor,
  additional item bottom color/.store in=\sm@additions@additionalitembottomcolor,
  additional item fill color/.initial=none,
  additional item fill color/.get=\sm@additions@additionalitemfillcolor,
  additional item fill color/.store in=\sm@additions@additionalitemfillcolor,
  additional item text width/.initial=1.75cm,
  additional item text width/.get=\sm@additions@additionalitemtextwidth,
  additional item text width/.store in=\sm@additions@additionalitemtextwidth,
  additional item width/.initial=2cm,
  additional item width/.get=\sm@additions@additionalitemwidth,
  additional item width/.store in=\sm@additions@additionalitemwidth,
  additional item height/.initial=1cm,
  additional item height/.get=\sm@additions@additionalitemheight,
  additional item height/.store in=\sm@additions@additionalitemheight,
  additional item font/.initial=\normalfont,
  additional item font/.get=\sm@additions@additionalitemfont,
  additional item font/.store in=\sm@additions@additionalitemfont,
  additional item border decoration/.initial={},
  additional item border decoration/.get=\sm@additions@additionalitemdecoration,
  additional item border decoration/.store in=\sm@additions@additionalitemdecoration,
  additional item offset/.initial={0.25cm},
  additional item offset/.get=\sm@additions@additionalitemoffset,
  additional item offset/.store in=\sm@additions@additionalitemoffset,
  additional item fill opacity/.initial={1},
  additional item fill opacity/.get=\sm@additions@additionalitemfillopacity,
  additional item fill opacity/.store in=\sm@additions@additionalitemfillopacity,
  additional item text opacity/.initial={1},
  additional item text opacity/.get=\sm@additions@additionalitemtextopacity,
  additional item text opacity/.store in=\sm@additions@additionalitemtextopacity,
  additional arrow tip/.initial={stealth},
  additional arrow tip/.get=\sm@additions@additionalarrowtip,
  additional arrow tip/.store in=\sm@additions@additionalarrowtip,
  additional arrow line width/.initial={0.1cm},
  additional arrow line width/.get=\sm@additions@additionalarrowlinewidth,
  additional arrow line width/.store in=\sm@additions@additionalarrowlinewidth,
  additional arrow color/.initial={gray},
  additional arrow color/.get=\sm@additions@additionalarrowcolor,
  additional arrow color/.store in=\sm@additions@additionalarrowcolor,
  additional arrow style/.initial={->},
  additional arrow style/.get=\sm@additions@additionalarrowstyle,
  additional arrow style/.store in=\sm@additions@additionalarrowstyle,
  additional item shadow/.initial={},
  additional item shadow/.get=\sm@additions@additionalitemshadow,
  additional item shadow/.store in=\sm@additions@additionalitemshadow,
}

\newif\ifconnectionsdisabled
\pgfkeys{/smart diagram/additions/.cd,
  additional connections disabled/.is if=connectionsdisabled,
  additional connections disabled=true,
}

\pgfkeys{/smart diagram/.cd,
  additions/.style={/smart diagram/additions/.cd,#1}%
}
%    \end{macrocode} 
% 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. 
%    \begin{macrocode}
\tikzset{additional item/.style={
      align=center,
      \sm@additions@additionalitemshape,
      thick,
      draw=\sm@additions@additionalitembordercolor,
      top color=white,
      bottom color=\sm@additions@additionalitembottomcolor,
      postaction={fill=\sm@additions@additionalitemfillcolor},
      text width=\sm@additions@additionalitemtextwidth,
      minimum width=\sm@additions@additionalitemwidth,
      minimum height=\sm@additions@additionalitemheight,
      font=\sm@additions@additionalitemfont,
      fill opacity=\sm@additions@additionalitemfillopacity,
      text opacity=\sm@additions@additionalitemtextopacity,
      \sm@additions@additionalitemshadow,
      \sm@additions@additionalitemdecoration
   },
   additional item arrow type/.style={
      \sm@additions@additionalarrowstyle,
      >=\sm@additions@additionalarrowtip,
      line width=\sm@additions@additionalarrowlinewidth,
      \sm@additions@additionalarrowcolor
   },
}
%    \end{macrocode} 
% 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.
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagramadd}{r[] m m}{
\tikzstyle{every picture}+=[remember picture]
\smartdiagram[#1]{#2}
\begin{tikzpicture}[remember picture,overlay,
  every node/.style={align=center,let hypenation}]
\foreach \smitem [count=\xi] in {#2}  {\global\let\numitems\xi}
\foreach \smitem[count=\xi] in {#3}{
\StrCut{\smitem}{/}\pos\textitem
\StrCut{\pos}{\space of\space}\point\modulenum
 \node[additional item,
   \point=\sm@additions@additionalitemoffset of \modulenum]
  (additional-module\xi)  {\textitem};
 \ifconnectionsdisabled
   \relax     
 \else
  \begin{pgfonlayer}{smart diagram arrow back}
   \draw[additional item arrow type]
    (additional-module\xi) -- (\modulenum);
  \end{pgfonlayer}
 \fi
}
\end{tikzpicture}
}
%    \end{macrocode} 
% Definition of the command to connect additions with diagram modules:
%    \begin{macrocode}
\NewDocumentCommand{\smartdiagramconnect}{m m}{%
  \begin{tikzpicture}[remember picture,overlay]
  \foreach \start/\end in {#2}
  \draw[additional item arrow type,#1]
    (\start) -- (\end);
  \end{tikzpicture}
}
%    \end{macrocode}
% \iffalse
%</additions>
% \fi
%
% \Finale

\endinput