[Tex/LaTex] Mindmap with Tikz

mindmapstikz-pgftikz-trees

I created a mindmap according to this example: http://www.texample.net/tikz/examples/computer-science-mindmap/

Sometimes the branches contain too much information so that the map looks ugly like in this example here:

enter image description here

This is the code I used:

\documentclass[landscape]{article}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
  \path[mindmap,concept color=black,text=white]
    node[concept] {Main Topic}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {definition}
      child { node[concept] {this is a very long sentence ... very long sentence ... and it is even longer ...} }
      child { node[concept] {this is a very long sentence ... very long sentence ... and it is even longer ...} }
    }  
    child[concept color=blue] { node[concept] {Subtopic 1} }
    child[concept color=red] { node[concept] {Subtopic 2} }
    child[concept color=orange] { node[concept] {Subtopic 3} }
    child[concept color=purple] { node[concept] {Subtopic 4} }
    child[concept color=brown] { node[concept] {Subtopic 5} };
\end{tikzpicture}
\end{document}

Is there a possibility to create branches that are not displayed as a circle but just as a line like in this example, simply without the pictures?

enter image description here

Best Answer

Manually

One rather manual way would be to name the node with “Definition”, e.g. (def), and use normal nodes that get positioned right of def.

I have created a style for these so called “non-concepts”:

  • rectangle (default),
  • text width=12em,
  • execute at begin node=\footnotesize instead of font=\footnotesize (which does not perfectly combine with text width.

Further more I created a style cncc east for the to path from def to those non-concepts.
It consists of

  • out=0 and in=180, and
  • a to path.

    As the usage of to inside the to path declaration failed, I fell back to the lower version \tikz@to@curve@path which calculates the path from

    • tikztostart and
    • tikztotarget

    which are set previously to the .east and respectively the .south west anchor.

    Additionally the .south east corner of the target node is used to finalize the line below the node.

Code

\documentclass[tikz, border=2pt]{standalone}
\usetikzlibrary{mindmap,trees,positioning}
\makeatletter
\tikzset{
    non-concept/.style={
        rectangle,
        execute at begin node=\footnotesize,
        text width=12em,
    },
    cncc east/.style={% concept-non-concept-connection
                      % where the non-concept is east of the concept
        out=0,
        in=180,
        to path={
            \pgfextra{
                \edef\tikztostart{\tikztostart.east}
                \edef\tikztotargetB{\tikztotarget.south east}
                \edef\tikztotarget{\tikztotarget.south west}
            }
            \tikz@to@curve@path% needs \makeatletter and \makeatother
            -- (\tikztotargetB)
        }
    }
}
\makeatother
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
  \path[mindmap, concept color=black, text=white]
    node[concept] {Main Topic}[clockwise from=0]% named \___/ node
    child[concept color=green!50!black] { node[concept] (def) {definition} }
    child[concept color=blue]           { node[concept]       {Subtopic 1} }
    child[concept color=red]            { node[concept]       {Subtopic 2} }
    child[concept color=orange]         { node[concept]       {Subtopic 3} }
    child[concept color=purple]         { node[concept]       {Subtopic 4} }
    child[concept color=brown]          { node[concept]       {Subtopic 5} };

  \tikzset{
    every node/.style=non-concept,
    node distance=1ex,
  }
  \node[right=1cm of def, anchor=south west] (know)
    {What does each person know and not know about my topic?};
  \node[below=of know]                       (react)
    {How will each person react?
                      What concerns will I need to overcome?};
  \node[above=of know]                       (audi)
    {Who exactly is my audience?
      What is each listener's role and reason for attending?};

  \draw[
    line width=.8pt,
    shorten <=.06em,
    ]
        (def) edge[cncc east] (know)
              edge[cncc east] (react)
              edge[cncc east] (audi);
\end{tikzpicture}
\end{document}

Output

enter image description here

(Kind of) automatically

I prefer the manual way as described above.

Setting the edge of parent path is not a big problem and is even easier.

But assigning the right styles at the right level is very annoying and one has to write up a custom growth function.

Code

\documentclass[tikz, border=2pt]{standalone}
\usetikzlibrary{mindmap,trees,positioning}
\makeatletter
\tikzset{
    non-concept/.style={
        rectangle,
        text width=12em,
        text=black,
        align=left,
    },
    cncc east/.style={
        edge from parent path={
            (\tikzparentnode.east) to[out=0, in=180] (\tikzchildnode.south west)
            -- (\tikzchildnode.south east)
        }
    }
}
\makeatother
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
  \path[mindmap, concept color=black, text=white]
    node[concept] {Main Topic}[clockwise from=0]% named \___/ node
    child[concept color=green!50!black] {
        node[concept] (def) {definition}
        [
            grow=right,
            sibling distance=14ex,
        ]
            child[level distance=5cm] { node[non-concept] {What does each person know and not know about my topic?}                            edge from parent[cncc east] }
            child[level distance=5cm] { node[non-concept] {How will each person react? What concerns will I need to overcome?}                 edge from parent[cncc east] }
            child[level distance=5cm] { node[non-concept] {Who exactly is my audience? What is each listener's role and reason for attending?} edge from parent[cncc east] }
        }
    child[concept color=blue]           { node[concept]       {Subtopic 1} }
    child[concept color=red]            { node[concept]       {Subtopic 2} }
    child[concept color=orange]         { node[concept]       {Subtopic 3} }
    child[concept color=purple]         { node[concept]       {Subtopic 4} }
    child[concept color=brown]          { node[concept]       {Subtopic 5} };
\end{tikzpicture}
\end{document}

Output

enter image description here