From ba89989f5cd51530e500f47fc9d078289265e6a6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 2 Apr 2013 22:28:50 +0000 Subject: smartdiagram (2apr13) git-svn-id: svn://tug.org/texlive/trunk@29611 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/smartdiagram/smartdiagram.sty | 867 +-------------------- 1 file changed, 36 insertions(+), 831 deletions(-) (limited to 'Master/texmf-dist/tex/latex/smartdiagram') diff --git a/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty b/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty index de6878aedcd..e50fc6a2819 100644 --- a/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty +++ b/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty @@ -7,13 +7,15 @@ %% smartdiagram.dtx (with options: `package') %% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %% smartdiagram --- Automatic creation of smart diagrams from lists of items. -%% E-mail: claudio.fiandrino@gmail.com +%% +%% 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 %% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{smartdiagram}[2013/03/09 v0.2 Automatic creation of smart diagrams from lists of items.] +\ProvidesPackage{smartdiagram}[2013/04/01 v0.3 Automatic creation of smart diagrams from lists of items.] \RequirePackage{tikz} @@ -30,839 +32,38 @@ } \pgfdeclarelayer{smart diagram arrow back} \pgfsetlayers{background,smart diagram arrow back,main} -\@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} -\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} -} -\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}, -}% - -\pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth, - module minimum height/.get=\moduleheight, - module y sep/.get=\moduleysep, - module x sep/.get=\modulexsep, - descriptive items y sep/.get=\descriptiveitemsysep, - text width/.get=\moduletextwidth, - description title width/.get=\descriptiontitlewidth, - description text width/.get=\descriptiontextwidth, - description title text width/.get=\descriptiontitletextwidth, - description title font/.get=\descriptiontitlefontsize, - description font/.get=\descriptionfontsize, - description width/.get=\descriptionwidth, - font/.get=\modulefontsize, - border color/.get=\bordercolor, - circular distance/.get=\circulardistance, - arrow line width/.get=\arrowlinewidth, - module shape/.get=\moduleshape, - insert decoration/.get=\borderdecoration, - arrow tip/.get=\arrowtip, - arrow color/.get=\arrowcolor, - bubble center node size/.get=\bubblecenternodesize, - bubble center node font/.get=\bubblecenternodefont, - bubble center node color/.get=\bubblecenternodecolor, - distance center/other bubbles/.get=\distancecenterotherbubbles, - distance text center bubble/.get=\distancetextcenterbubble, - bubble fill opacity/.get=\bubblefillopacity, - bubble node size/.get=\bubblenodesize, - bubble text opacity/.get=\bubbletextopacity, - bubble node font/.get=\bubblenodefont, - planet size/.get=\planetminimumsize, - planet color/.get=\planetcolor, - planet font/.get=\planetfont, - distance planet-connection/.get=\planetoutersep, - distance planet-text/.get=\planetinnersep, - planet text width/.get=\planettextwidth, - satellite size/.get=\satelliteminimumsize, - satellite font/.get=\satellitefont, - satellite fill opacity/.get=\satellitefillopacity, - satellite text opacity/.get=\satellitetextopacity, - satellite text width/.get=\satellitetextwidth, - distance satellite-connection/.get=\satelliteoutersep, - connection line width/.get=\connectionlinewidth, - connection color/.get=\connectioncolor, - distance planet-satellite/.get=\distanceplanetsatellite, - priority arrow width/.get=\priorityarrowwidth, - priority arrow head extend/.get=\priorityarrowheadextend, - priority tick size/.get=\prioritytick, - priority arrow height advance/.get=\priorityarrowheightadvance, - sequence item height/.get=\seqitemheight, - sequence item width/.get=\seqitemwidth, - sequence item border color/.get=\seqitembordercolor, - sequence item border size/.get=\seqlinewidth, - sequence item font size/.get=\seqitemfont, - sequence item fill opacity/.get=\seqitemfillopacity, - sequence item text opacity/.get=\seqitemtextopacity, - sequence item text width/.get=\seqitemtextwidth, - sequence item text color/.get=\seqitemtextcolor, - sequence item uniform color/.get=\seqitemuniformcol, -}% - - -\pgfkeys{/smart diagram/.cd, set color list/.code={ - \foreach \listitem [count=\i] in {#1}{ - \global\@namedef{color@\i\expandafter}\expandafter{\listitem} - } - } -} - -\pgfkeys{/smart diagram/.cd, use predefined color list/.code={ - \@namedef{color@1}{red!30} - \@namedef{color@2}{cyan!30} - \@namedef{color@3}{blue!30} - \@namedef{color@4}{green!30} - \@namedef{color@5}{orange!30} - \@namedef{color@6}{yellow!30} - \@namedef{color@7}{magenta!30} - \@namedef{color@8}{brown!30} - \@namedef{color@9}{violet!30} - \@namedef{color@10}{teal!30} - } -} - - -\newif\ifbackarrowdisabled -\pgfkeys{/smart diagram/.cd, - back arrow disabled/.is if=backarrowdisabled, - back arrow disabled=false, -} - - -\NewDocumentCommand{\smartdiagramset}{m}{% - \pgfkeys{/smart diagram/.cd,#1}% - \pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth, - module minimum height/.get=\moduleheight, - module y sep/.get=\moduleysep, - module x sep/.get=\modulexsep, - descriptive items y sep/.get=\descriptiveitemsysep, - text width/.get=\moduletextwidth, - description title width/.get=\descriptiontitlewidth, - description text width/.get=\descriptiontextwidth, - description title text width/.get=\descriptiontitletextwidth, - description title font/.get=\descriptiontitlefontsize, - description font/.get=\descriptionfontsize, - description width/.get=\descriptionwidth, - font/.get=\modulefontsize, - border color/.get=\bordercolor, - circular distance/.get=\circulardistance, - arrow line width/.get=\arrowlinewidth, - module shape/.get=\moduleshape, - insert decoration/.get=\borderdecoration, - arrow tip/.get=\arrowtip, - arrow color/.get=\arrowcolor, - bubble center node size/.get=\bubblecenternodesize, - bubble center node font/.get=\bubblecenternodefont, - bubble center node color/.get=\bubblecenternodecolor, - distance center/other bubbles/.get=\distancecenterotherbubbles, - distance text center bubble/.get=\distancetextcenterbubble, - bubble fill opacity/.get=\bubblefillopacity, - bubble node size/.get=\bubblenodesize, - bubble text opacity/.get=\bubbletextopacity, - bubble node font/.get=\bubblenodefont, - planet size/.get=\planetminimumsize, - planet color/.get=\planetcolor, - planet font/.get=\planetfont, - distance planet-connection/.get=\planetoutersep, - distance planet-text/.get=\planetinnersep, - planet text width/.get=\planettextwidth, - satellite size/.get=\satelliteminimumsize, - satellite font/.get=\satellitefont, - satellite fill opacity/.get=\satellitefillopacity, - satellite text opacity/.get=\satellitetextopacity, - satellite text width/.get=\satellitetextwidth, - distance satellite-connection/.get=\satelliteoutersep, - connection line width/.get=\connectionlinewidth, - connection color/.get=\connectioncolor, - distance planet-satellite/.get=\distanceplanetsatellite, - priority arrow width/.get=\priorityarrowwidth, - priority arrow head extend/.get=\priorityarrowheadextend, - priority tick size/.get=\prioritytick, - priority arrow height advance/.get=\priorityarrowheightadvance, - sequence item height/.get=\seqitemheight, - sequence item width/.get=\seqitemwidth, - sequence item border color/.get=\seqitembordercolor, - sequence item border size/.get=\seqlinewidth, - sequence item font size/.get=\seqitemfont, - sequence item fill opacity/.get=\seqitemfillopacity, - sequence item text opacity/.get=\seqitemtextopacity, - sequence item text width/.get=\seqitemtextwidth, - sequence item text color/.get=\seqitemtextcolor, - sequence item uniform color/.get=\seqitemuniformcol, - }% -}% -\tikzfading[name=priorityarrowfading, - bottom color=transparent!5, - top color=transparent!80 -] -\tikzset{priority arrow fill/.style={ - fill=gray, - path fading=priorityarrowfading - } -} - -\tikzset{module/.style={ - \pgfkeysvalueof{/smart diagram/module shape}, - thick, - draw=\bordercolor, - top color=white, - bottom color=\col, - text width=\moduletextwidth, - minimum width=\modulewidth, - minimum height=\moduleheight, - font=\modulefontsize, - \borderdecoration - }, - diagram arrow type/.style={ - >=\arrowtip,line width=\arrowlinewidth,\col - }, -} - -\pgfkeys{/smart diagram/.cd,% - uniform arrow color/.is choice,% - uniform arrow color/true/.code={% - \tikzset{diagram arrow type/.append style={ - \arrowcolor - }, - } - },% - uniform arrow color/false/.style={diagram arrow type},% - uniform arrow color/.default=false, -}% -\tikzset{description title/.style={ - circle, - draw=\bordercolor, - minimum width=\descriptiontitlewidth, - anchor=east, - bottom color=\col, - top color=white!80!\col, - font=\descriptiontitlefontsize, - text width=\descriptiontitletextwidth, - \borderdecoration, - }, - description/.style={ - \pgfkeysvalueof{/smart diagram/module shape}, - text width=\descriptiontextwidth, - draw=\bordercolor, - anchor=west, - minimum height=\moduleheight, - minimum width=\descriptionwidth, - bottom color=\col, - top color=white!80!\col, - font=\descriptionfontsize, - \borderdecoration, - } -} -\tikzset{priority arrow/.style={ - draw=\bordercolor, - single arrow, - minimum height=\distancemodules, - minimum width=\priorityarrowwidth, - priority arrow fill, - rotate=90, - single arrow head extend=\priorityarrowheadextend, - anchor=west, - } -} -\tikzset{bubble center node/.style={ - minimum size=\bubblecenternodesize, - circle, - fill=\bubblecenternodecolor, - font=\bubblecenternodefont, - outer sep=\distancecenterotherbubbles, - inner sep=\distancetextcenterbubble, - }, - bubble node/.style={ - minimum size=\bubblenodesize, - circle, - ultra thick, - font=\bubblenodefont, - draw=white, - fill opacity=\bubblefillopacity, - fill=\col, - text opacity=\bubbletextopacity, - } -} -\tikzset{planet/.style={ - minimum size=\planetminimumsize, - circle, - fill=\planetcolor, - font=\planetfont, - outer sep=\planetoutersep, - inner sep=\planetinnersep, - text width=\planettextwidth, - }, - satellite/.style={ - minimum size=\satelliteminimumsize, - circle, - font=\satellitefont, - fill opacity=\satellitefillopacity, - fill=\col, - text opacity=\satellitetextopacity, - text width=\satellitetextwidth, - outer sep=\satelliteoutersep, - }, - connection planet satellite/.style={ - line width=\connectionlinewidth, - >=\arrowtip, - \col, - } -} - -\tikzset{sequence item/.style={ - minimum height=\seqitemheight, - minimum width=\seqitemwidth, - signal, - signal from=west, - signal to=east, - draw=\seqitembordercolor, - line width=\seqlinewidth, - font=\seqitemfont, - fill opacity=\seqitemfillopacity, - fill=\col, - text opacity=\seqitemtextopacity, - text width=\seqitemtextwidth, - text=\seqitemtextcolor, - } -} - -\pgfkeys{/smart diagram/.cd,% - uniform sequence color/.is choice,% - uniform sequence color/true/.code={% - \tikzset{sequence item/.append style={ - fill=\seqitemuniformcol, - }, - } - },% - uniform sequence color/false/.style={sequence item},% - uniform sequence color/.default=false, -}% - -\pgfkeys{/smart diagram/.cd,% - uniform connection color/.is choice,% - uniform connection color/true/.code={% - \tikzset{connection planet satellite/.append style={ - \connectioncolor - }, - } - },% - uniform connection color/false/.style={connection planet satellite},% - uniform connection color/.default=false, -}% -\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}] - - \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:\circulardistance) {\smitem }; - }{% false-clockwise-circular diagram - \node[module,drop shadow] (module\xi) - at (\angle:\circulardistance) {\smitem }; - } - }% - - \foreach \smitem [count=\xi] in {#2}{% - \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} - \edef\col{\@nameuse{color@\xj}} - \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); - } - }% - \end{tikzpicture} - }{}% end-circular diagram - \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram - \begin{tikzpicture}[every node/.style={align=center}] - - \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi} - - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram - \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\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*\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,0.5) -| (\tikztotarget)} - } - } - \draw[<-,diagram arrow type, square arrow] - (module\xj.north) to (module\xi.north); - }{% false-horizontal-flow diagram - \tikzset{square arrow/.style={ - to path={-- ++(0.5,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}] - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - \foreach \subitem [count=\xii] in \smitem{% - \ifnumequal{\xii}{1}{% true - \node[description title,drop shadow] - (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem}; - }{} - \ifnumequal{\xii}{2}{% true - \node[description,drop shadow](module\xi) - at (0,0-\xi*\descriptiveitemsysep) {\subitem}; - }{} - }% - }% - \end{tikzpicture} - }{}% end-descr. diagram - \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[bubble center node](center bubble){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[bubble node] (module\xi) - at (center bubble.\angle) {\smitem }; - }% - }% - \end{tikzpicture} - }{}%end-bubble diagram - \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[planet](planet){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[satellite] (satellite\xi) - at (\angle:\distanceplanetsatellite) {\smitem }; - \draw[->,connection planet satellite] (planet) -- (satellite\xi); - }% - }% - \end{tikzpicture} - }{}%end-const diagram - \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[planet](planet){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[satellite] (satellite\xj) - at (\angle:\distanceplanetsatellite) {\smitem }; - }% - }% - \foreach \smitem [count=\xi] in {#2}{% - \ifnumgreater{\xi}{1}{ %true - \pgfmathtruncatemacro{\xj}{\xi-1} - \edef\col{\@nameuse{color@\xj}} - \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1} - \path[connection planet satellite] - (satellite\xj) edge[bend right] (satellite\xk); - }{} - }% - \end{tikzpicture} - }{}%end-connected constellation diagram - \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram - \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)} - \pgfmathsetmacro\priorityticksize{\pgfmathresult/2} - \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2} - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - \node[description,drop shadow](module\xi) - at (0,0+\xi*\descriptiveitemsysep) {\smitem}; -\draw[line width=\prioritytick,\col] - ([xshift=-\arrowtickxshift pt]module\xi.base west)-- - ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$); - }% - \coordinate (A) at (module1); - \coordinate (B) at (module\maxsmitem); - \CalcHeight(A,B){heightmodules} - \pgfmathadd{\heightmodules}{\priorityarrowheightadvance} - \pgfmathsetmacro{\distancemodules}{\pgfmathresult} - \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2} - \begin{pgfonlayer}{background} - \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){}; - \end{pgfonlayer} - \end{tikzpicture} - }{}% end-priority descriptive diagram - \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \x[count=\xi, count=\prevx from 0] in {#2}{% - \edef\col{\@nameuse{color@\xi}} -\ifnum\xi=1 - \node[sequence item] (x-\xi) {\x}; -\else - \node[sequence item,anchor=west] (x-\xi) at (x-\prevx.east) {\x}; -\fi - } - \end{tikzpicture} - }{}% end-sequence diagram -}% end-no value 1 -}% end-command -\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}} - }, +\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 + }% } -\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}] - \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:\circulardistance) {\smitem}; - }{% false-clockwise-circular diagram - \node[module, - drop shadow={smvisible on=<\xi->}, - smvisible on=<\xi->] (module\xi) - at (\angle:\circulardistance) {\smitem}; - } - }% - \foreach \smitem [count=\xi] in {#2} - {% - \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)} - \pgfmathtruncatemacro{\adv}{\xi + 1)} - \edef\col{\@nameuse{color@\xi}} - \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); - } - }% - \end{tikzpicture} - }{}% end-circular diagram - \IfStrEq{\diagramtype}{flow diagram}{% true-flow diagram - \begin{tikzpicture}[every node/.style={align=center}] - - \foreach \smitem [count=\xi] in {#2} {\global\let\maxsmitem\xi} - - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram - \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\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*\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,0.5) -| (\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={-- ++(0.5,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}] - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - - \foreach \subitem [count=\xii] in \smitem{% - \pgfmathtruncatemacro\subitemvisible{\xi} - \ifnumequal{\xii}{1}{% true - \node[description title,drop shadow, smvisible on=<\subitemvisible->] - (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause - }{} - \ifnumequal{\xii}{2}{% true - \node[description,drop shadow,smvisible on=<\subitemvisible->] - (module\xi)at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause - }{} - }% - }% - \end{tikzpicture} - }{}% end-descriptive diagram - \IfStrEq{\diagramtype}{bubble diagram}{% true-bubble diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[bubble center node, smvisible on=<\xi->](center bubble){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[bubble node, smvisible on=<\xi->](module\xi) - at (center bubble.\angle) {\smitem }; - }% - }% - \end{tikzpicture} - }{}%end-bubble diagram - \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[planet, smvisible on=<\xi->](planet){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[satellite, smvisible on=<\xi->] (satellite\xi) - at (\angle:\distanceplanetsatellite) {\smitem }; - \draw[->,connection planet satellite, smvisible on=<\xi->] - (planet) -- (satellite\xi); - }% - }% - \end{tikzpicture} - }{}%end-constellation diagram - \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} - \foreach \smitem [count=\xi] in {#2}{% - \ifnumequal{\xi}{1}{ %true - \node[planet,smvisible on=<\xi->](planet){\smitem}; - }{%false - \pgfmathtruncatemacro{\xj}{\xi-1} - \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} - \edef\col{\@nameuse{color@\xj}} - \node[satellite,smvisible on=<\xi->] (satellite\xj) - at (\angle:\distanceplanetsatellite) {\smitem }; - }% - }% - \foreach \smitem [count=\xi] in {#2}{% - \ifnumgreater{\xi}{1}{ %true - \pgfmathtruncatemacro{\xj}{\xi-1} - \edef\col{\@nameuse{color@\xj}} - \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1} - \pgfmathtruncatemacro{\smvisible}{\xi+1} - \path[connection planet satellite,smvisible on=<\smvisible->] - (satellite\xj) edge[bend right] (satellite\xk); - }{} - }% - \end{tikzpicture} - }{}%end-connected constellation diagram - \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram - \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)} - \pgfmathsetmacro\priorityticksize{\pgfmathresult/2} - \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2} - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} - \foreach \smitem [count=\xi] in {#2}{% - \edef\col{\@nameuse{color@\xi}} - \pgfmathtruncatemacro\smvisible{\xi+1} - \node[description,drop shadow={smvisible on=<\smvisible->},smvisible on=<\smvisible->] - (module\xi) at (0,0+\xi*\descriptiveitemsysep) {\smitem}; -\draw[line width=\prioritytick,\col,smvisible on=<\smvisible->] - ([xshift=-\arrowtickxshift pt]module\xi.base west)-- - ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$); - }% - \coordinate (A) at (module1); - \coordinate (B) at (module\maxsmitem); - \CalcHeight(A,B){heightmodules} - \pgfmathadd{\heightmodules}{\priorityarrowheightadvance} - \pgfmathsetmacro{\distancemodules}{\pgfmathresult} - \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2} - \begin{pgfonlayer}{background} - \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){}; - \end{pgfonlayer} - \end{tikzpicture} - }{}% end-priority descriptive diagram - \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram - \begin{tikzpicture}[every node/.style={align=center}] - \foreach \x[count=\xi, count=\prevx from 0] in {#2}{% - \edef\col{\@nameuse{color@\xi}} -\ifnum\xi=1 - \node[sequence item,smvisible on=<\xi->] (x-\xi) {\x}; -\else - \node[sequence item,anchor=west,smvisible on=<\xi->] - (x-\xi) at (x-\prevx.east) {\x}; -\fi - } - \end{tikzpicture} - }{}% end-sequence diagram - }% end-no value 1 -}% end-command +\usesmartdiagramlibrary{core.definitions} +\usesmartdiagramlibrary{core.styles} +\usesmartdiagramlibrary{core.commands} %% -%% Copyright (C) 2012-2013 by Claudio Fiandrino +%% 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 @@ -876,7 +77,11 @@ %% %% This work consists of the file smartdiagram.dtx %% and the derived files smartdiagram.ins, -%% smartdiagram.pdf, and +%% smartdiagram.pdf, +%% smartdiagramlibrarycore.definitions.code.tex, +%% smartdiagramlibrarycore.styles.code.tex, +%% smartdiagramlibrarycore.commands.code.tex +%% smartdiagramlibraryadditions.code.tex and %% smartdiagram.sty. %% %% -- cgit v1.2.3