I'm starting using tikz for drawing a lot of mindmaps and I need environments or commands to simplify the task. So I
defined an environment for a mindmap like this:
Code: Select all
\newenvironment{tree}[2]{
\begin{center}
\tikz \draw (0,-10) node [anchor=east,fill=orange!20] {some title};
\tikz[mindmap,concept color=black,text=white]
\node [concept] {\small #1\\#2}
}{
;
\end{center}
}
Code: Select all
\begin{tree}{ABC}{XYZ}
child[concept color=blue,grow=0] {node[concept] {Y20}}
child[concept color=blue,grow=-180] {node[concept] {Y200}}
\end{tree}
Code: Select all
\newenvironment{tchild}[3]{
child[concept color=#2,grow=#3] {node[concept] {#1}}
}{
}
Code: Select all
\newenvironment{treep}[2]{
\begin{center}
\begin{tikzpicture}[mindmap,concept color=black,text=white]
\draw (0,-10) node [anchor=east,fill=orange!20] {some title};
\node [concept] {\small #1\\#2}
}{
\end{tikzpicture}
\end{center}
}
Thanks in advance for any help!
This is a minimal mostly-non-working example:
Code: Select all
\documentclass[10pt]{report}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\newenvironment{tree}[2]{
\begin{center}
\tikz \draw (0,-10) node [anchor=east,fill=orange!20] {some title};
\tikz[mindmap,concept color=black,text=white]
\node [concept] {\small #1\\#2}
}{
;
\end{center}
}
\newenvironment{treep}[2]{
\begin{center}
\begin{tikzpicture}[mindmap,concept color=black,text=white]
\draw (0,-10) node [anchor=east,fill=orange!20] {some title};
\node [concept] {\small #1\\#2}
}{
\end{tikzpicture}
\end{center}
}
%%%% this fails, also as command
% name, color, position
\newenvironment{tchild}[3]{
child[concept color=#2,grow=#3]
{node[concept] {#1}}
}{
}
\begin{document}
This works:
\begin{verbatim}
\begin{tree}{ABC}{XYZ}
child[concept color=blue,grow=0] {node[concept] {Y20}}
child[concept color=blue,grow=-180] {node[concept] {Y200}}
\end{tree}
\end{verbatim}
\begin{tree}{ABC}{XYZ}
child[concept color=blue,grow=0] {node[concept] {Y20}}
child[concept color=blue,grow=-180] {node[concept] {Y200}}
\end{tree}
But not this:
\begin{verbatim}
\begin{treep}{ABC}{XYZ}
child[concept color=blue,grow=0] {node[concept] {Y20}}
child[concept color=blue,grow=-180] {node[concept] {Y200}}
\end{treep}
\end{verbatim}
nor this:
\begin{verbatim}
\begin{treep}{ABC}{XYZ}
\begin{tchild}{Y20}{blue}{0}
\end{tchild}
\begin{tchild}{Y200}{}{blue}{-180}
\end{tchild}
\end{treep}
\end{verbatim}
nor this:
\begin{verbatim}
\begin{tree}{ABC}{XYZ}
\begin{tchild}{Y20}{blue}{0}
\end{tchild}
\begin{tchild}{Y200}{}{blue}{-180}
\end{tchild}
\end{tree}
\end{verbatim}
\end{document}