9.7. Putting thoughts in a mind map

A mind map visualizes information or ideas. Usually, there’s a main concept in the center and major concepts branching outward from it. Smaller ideas start from the major concepts. So, a mind map can look like a spider web.

In this recipe, we will draw a mind map of the concepts of TeX.

How to do it…

We will use the TikZ mindmap library. Follow these steps:

  1. Start with a document class:

    \documentclass{article}
    
  2. Load the geometry package with the landscape option so that your wide map will fit the page:

    \usepackage[landscape]{geometry}
    
  3. Then load the TikZ package:

    \usepackage{tikz}
    
  4. Next, load the mindmap TikZ library:

    \usetikzlibrary{mindmap}
    
  5. Load the dtklogos package to get additional TeX-related logo macros:

    \usepackage{dtklogos}
    
  6. Start the document and begin the TikZ picture:

    \begin{document}
    \begin{tikzpicture}
    
  7. Start a path with options:

      \path [
    
  8. Provide the mindmap option and choose the white text color:

        mindmap,
        text = white,
    
  9. Adjust the styles for the levels of the map:

        level 1 concept/.append style =
          {font=\Large\bfseries, sibling angle=90},
        level 2 concept/.append style =
          {font=\normalsize\bfseries},
        level 3 concept/.append style =
          {font=\small\bfseries},
    
  10. Define some styles for use in related concepts, and end the option list:

        tex/.style     = {concept, ball color=blue,
          font=\Huge\bfseries},
        engines/.style = {concept, ball color=green!50!black},
        formats/.style = {concept, ball color=blue!50!black},
        systems/.style = {concept, ball color=red!90!black},
        editors/.style = {concept, ball color=orange!90!black}
      ]
    
  11. Now place the main concept node and its children. The structure is similar to that in our tree recipe in Constructing a flowchart section in this chapter. End the path with a semicolon:

      node [tex] {\TeX} [clockwise from=0]
        child[concept color=green!50!black, nodes={engines}] {
          node {Engines} [clockwise from=90]
            child { node {\TeX} }
            child { node {pdf\TeX} }
            child { node {\XeTeX} }
            child { node {Lua\TeX} }}
        child [concept color=blue, nodes={formats}] {
          node {Formats} [clockwise from=300]
            child { node {\LaTeX} }
            child { node {\ConTeXt} }}
        child [concept color=red, nodes={systems}] {
          node {Systems} [clockwise from=210]
            child { node {\TeX Live} [clockwise from=300]
              child { node {Mac \TeX} }}
            child { node {MiK\TeX} [clockwise from=60]
              child { node {Pro \TeX t} }}}
        child [concept color=orange, nodes={editors}] {
          node {Editors} };
    
  12. End the picture and the document:

    \end{tikzpicture}
    \end{document}
    
  13. Compile, and examine the output:

Mindmap

How it works…

The key is the mindmap style, which adds further styles and settings for implicit use, such as the concept style for nodes. They are responsible for the basic appearance.

First, we fine-tuned the design by adding style options for each level of subconcepts. So, we chose a bold font—it improved the readability of the white text in darker concepts—and chose smaller font sizes for concepts that farther away from the root. After doing this, we added a sibling angle value to tell TikZ the angle between major concepts. We would have chosen a smaller angle if we had more concepts.

Furthermore, we created our own styles. They extend the standard concept node style by adding ball shading. This gives us a 3D appearance. On one hand, it should be just a demonstration of how to add some bells and whistles; on the other hand, flat colors may seem a bit boring if we remove the ball color option to get a more sober style. You may try colors and shadings as offered by TikZ.

The path is just like the tree in our earlier tree recipe. The notable options are as follows:

  • start angle: This is set by clockwise from = ..., which could be counterclockwise as an alternative.
  • nodes = {style name}: This applies our chosen style to all children.
  • concept color: This is for the color behind our ball shading. It is also applied to the node connections.

The mindmap library has a dedicated section in the TikZ manual. There, you can read about alternative connections between nodes and adding annotations.

Navigate: