# High level macros and environments based on Tikz

I was browsing the tikz examples that I found this wonderful example. The example uses tikz to create a tex environment to produce a framed text. The result looks like this:

The underlying process may look too complicated for someone unfamiliar with tikz, but it is quite simple to use the environment:

\begin{parchment}[Paragraph Title]
The main text goes here ...
\end{parchment}


Then, it came to my mind that it would be great to have some high level tex macros or environments to produce such fancy figures or plots. Something like SmartArt graphics in microsoft office. For instance, use something like this:

\begin{env-name}[Discipline]
\usecolorpallet{pallet-name}
\item Love
\item Trust
\item Self-control
\item Journey
\item Obedience
\end{env-name}


to produce figures like this or this. I think, these kind of high level environments, in addition to hiding the details of tikz, provides some novel ideas for making much more elegant slides and documents with tex.

So my question is: Is there any tex package that has such a functionality? If not, do you know any idea/example like the ones that I described, with available source code?

-
You can look at the mdframed package which has been an active topic of this site too. Here is a list of questions. I am not sure about the extras and flexibility though, however it's definitely possible once we put enough effort as the linked torn paper example. The latter two figures are more suitable with a TikZ macro. –  percusse Apr 18 '12 at 12:18
Should this really have the beamer label? –  rvf0068 Apr 18 '12 at 22:54
Well, I'm not sure about it. I put the beamer label since the question is closely related to presentation slides. –  Mohsen Apr 18 '12 at 23:07

Not exactly what you want ( high level environments) but I propose a macro. I made this macro very quicly, so it's possible to make something better. We can add styles etc.

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\makeatletter
\@namedef{color@1}{red!40}
\@namedef{color@2}{green!40}
\@namedef{color@3}{blue!40}
\@namedef{color@4}{cyan!40}
\@namedef{color@5}{magenta!40}
\@namedef{color@6}{yellow!40}

\newcommand{\graphitemize}[2]{%
\begin{tikzpicture}[every node/.style={align=center}]
\node[minimum size=5cm,circle,fill=gray!40,font=\Large,outer sep=1cm,inner sep=.5cm](ce){#1};
\foreach \gritem [count=\xi] in {#2}
{\global\let\maxgritem\xi}
\foreach \gritem [count=\xi] in {#2}
{%
\pgfmathtruncatemacro{\angle}{360/\maxgritem*\xi}
\edef\col{\@nameuse{color@\xi}}
\node[circle,
ultra thick,
draw=white,
fill opacity=.5,
fill=\col,
minimum size=3cm] at (ce.\angle) {\gritem };}%
\end{tikzpicture}
}%

\begin{document}

\graphitemize{Discipline}{Love,Trust,Self-\\control,Journey,Obedience}

\graphitemize{Mathématiques}{Algèbre,Géométrie,Analyse}
\end{document}


Update

I added a new style, now it's possible to create some keys to choice the style

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\makeatletter
\@namedef{color@1}{red!40}
\@namedef{color@2}{green!40}
\@namedef{color@3}{blue!40}
\@namedef{color@4}{cyan!40}
\@namedef{color@5}{magenta!40}
\@namedef{color@6}{yellow!40}

\newcommand{\graphitemize}[2]{%
\begin{tikzpicture}[every node/.style={align=center}]
\node[minimum size=4cm,circle,fill=gray!40,font=\Large,outer sep =.25cm,inner sep=.5cm](ce){#1};
\foreach \gritem [count=\xi] in {#2}  {\global\let\maxgritem\xi}

\foreach \gritem [count=\xi] in {#2}
{%
\pgfmathtruncatemacro{\angle}{360/\maxgritem*\xi}
\edef\col{\@nameuse{color@\xi}}
\node[circle,
ultra thick,
draw=white,
fill opacity=.5,
fill=\col,outer sep=0.25cm,
minimum size=2cm] (satellite-\xi) at (\angle:5cm) {\gritem };
\draw[line width=0.5cm,->,\col] (ce) -- (satellite-\xi);
}%
\end{tikzpicture}
}%

\begin{document}

\graphitemize{Discipline}{Love,Trust,Self-\\control,Journey,Obedience}

\graphitemize{Mathématiques}{Algèbre,Géométrie,Analyse}
\end{document}


-
Thank you man. That's a nice example. –  Mohsen Apr 18 '12 at 21:20
Is it possible at all to use \items to separate the arguments to the environment, as the OP suggested in the question? –  rvf0068 Apr 25 '12 at 0:44
@rvf0068 It's a complex (for me) TeX's problem. It's not like a list because when you add (graph) item, you modify the final result. Really I don't know ... What you need it's to give arguments; with a macro it's easy but to do something like a list seems to be very complicated. –  Alain Matthes Apr 25 '12 at 7:26

Here is another one (I just adapted the code from Altermundus's answer):

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\makeatletter
\@namedef{color@1}{red!50}
\@namedef{color@2}{green!50}
\@namedef{color@3}{blue!50}
\@namedef{color@4}{cyan!50}
\@namedef{color@5}{magenta!50}
\@namedef{color@6}{yellow!50}

\newcommand{\graphitemize}[1]{%
\begin{tikzpicture}[every node/.style={align=center}]

\foreach \gritem [count=\xi] in {#1}  {\global\let\maxgritem\xi}

\foreach \gritem [count=\xi] in {#1}
{%
\pgfmathtruncatemacro{\angle}{90+360/\maxgritem*\xi}
\edef\col{\@nameuse{color@\xi}}
\node[circle,
inner sep=7pt,
outer sep=7pt,
ultra thick,
text opacity=1,
fill opacity=.5,
bottom color=\col,
top color=white!70!\col,
minimum size=3cm] (satellite\xi) at (\angle:4cm) {\gritem };
}%

\foreach \gritem [count=\xi] in {#1}
{%
\pgfmathtruncatemacro{\xj}{mod(\xi, \maxgritem) + 1}
\edef\col{\@nameuse{color@\xi}}
\draw[arrows={->},line cap=rounded,line width=.5cm,\col\relax!0.5] (satellite\xj) to (satellite\xi);
}%
\end{tikzpicture}
}%

\begin{document}

\graphitemize{Phase 1,Phase 2, Phase 3, Phase 4, Phase 5}

\end{document}

-