% \iffalse meta-comment %<*internal> \iffalse % %<*readme> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * smartdiagram --- Automatic creation of smart diagrams with LaTeX E-mail: claudio fiandrino gmail com Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * The package allows to create smart diagrams from lists of items for simple documents and for presentations. The package is composed and necessitates of the core libraries: - core.definitions, - core.styles, - core.commands and of the external library: - additions. % %<*internal> \fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup \fi % %<*install> \input docstrip.tex \keepsilent \askforoverwritefalse \preamble * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * smartdiagram --- Automatic creation of smart diagrams from lists of items. E-mail: claudio fiandrino gmail com Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \endpreamble \postamble Copyright (C) 2012-2013 by Claudio Fiandrino E-mail: fiandrino gmail com> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at your option) any later version. The latest version of this license is in the file: http://www.latex-project.org/lppl.txt This work is "maintained" (as per LPPL maintenance status) by Claudio Fiandrino. This work consists of the file smartdiagram.dtx and the derived files smartdiagram.ins, smartdiagram.pdf, 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}} } % %\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 % %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{smartdiagram}[2016/12/23 v0.3b Automatic creation of smart diagrams from lists of items.] % %<*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} % % \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= for 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 % % \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 % % \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 % % \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 % % \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 % % \fi % % \Finale \endinput