1

I want to have a figure or table that looks like this:

enter image description here

I found a similar structure on this thread: Creating a graphical representation of a table of contents in TikZ

I might quote the code from there:

\documentclass[border=2pt,tikz]{standalone}
\usetikzlibrary{calc,positioning,backgrounds,fit}
\renewcommand{\rmdefault}{ptm}
\begin{document}

\newcommand{\ut}{4mm}
\begin{tikzpicture}[bk/.style args={#1}{draw,fill=gray!20,minimum height=2.7*\ut,minimum width=#1*\ut,align=center}, part/.style={inner sep=0pt,outer sep=0pt,font={\Large\bfseries}, white,align=left, xshift=-8*\ut}, node distance=.5*\ut]

\node[bk=30](c1){Chapter 1\\\textit{Chapter 1 Title}};
\node[bk=9.75,below=of c1.south west, anchor=north west](c2){Chapter 2\\\textit{Chapter 2 Title}};
\node[bk=19.75,below=of c1.south east, anchor=north east](c3){Chapter 3\\\textit{Chapter 3 Title}};

\node[part,left=of {$(c1.west)!.5!(c2.west)$},anchor=west](P1){Part I\\\textit{Part I Title}};

\begin{scope}[on background layer]
\node[rectangle,fill=gray!70,fit=(c1)(c2)(P1),inner sep=10pt] {};
\end{scope}

\node[bk=30,below=of c2.south west,anchor=north west,yshift=-2em](c1){Chapter 4\\\textit{Chapter 4 Title}};
\node[bk=30,below=of c1.south west, anchor=north west](c2){Chapter 5\\\textit{Chapter 5 Title}};
\node[bk=30,below=of c2.south east, anchor=north east](c3){Chapter 6\\\textit{Chapter 6 Title}};

\node[part,left=of {$(c1.west)!.5!(c3.west)$},anchor=west](P2){Part II\\\textit{Part II Title}};

\begin{scope}[shift={(0,-10*\ut)},on background layer]
\node[rectangle,fill=gray!70,fit=(c1)(c3)(P2),inner sep=10pt] {};
\end{scope}

\node[bk=30,below=of c3.south,anchor=north,yshift=-2em](c1){Chapter 7\\\textit{Chapter 7 Title}};
\node[bk=9.75,below=of c1.south west, anchor=north west](c2){Chapter 8\\\textit{Chapter 8 Title}};
\node[bk=9.75,below=of c1.south east, anchor=north east](c3){Chapter 10\\\textit{Chapter 10 Title}};
\node[bk=9.5,left=of c3.west, anchor=east](c4){Chapter 9\\ \textit{Chapter 9 Title}};

\node[part,left=of {$(c1.west)!.5!(c2.west)$},anchor=west](P3){Part III\\\textit{Part III Title}};

\begin{scope}[shift={(0,-24*\ut)},on background layer]
\node[rectangle,fill=gray!70,fit=(c1)(c2)(P3),inner sep=10pt] {};
\end{scope}

\end{tikzpicture}

\end{document}

How can I modify this code so that it looks like the structure I want to have? Many thanks in advance.

4
  • The code you are using is putting the nodes for the parts at the left of the nodes for the chapters (see \node[part,left=of ...). In addition, it puts some nodes below at the left and at the right of another one (see \node[bk=9.75,below=of c1.south west ... and \node[bk=19.75,below=of c1.south east ...) -- You may check how to create TikZ nested nodes
    – Jaime
    Sep 16, 2017 at 16:00
  • Just duplicating code from somewhere else isn't a minimal example. How have you tried to modify it? Which particular aspect of the modification are you stuck on?
    – cfr
    Sep 16, 2017 at 22:32
  • You will probably find it easier to use tcolorbox rather than trying to reinvent ice skates.
    – cfr
    Sep 16, 2017 at 22:33
  • Why tikz-arrows tag?
    – Ignasi
    Sep 21, 2017 at 7:11

1 Answer 1

4

If you want to write everything by hand, here you have an option with tcolorbox

\documentclass{article}
\usepackage[most]{tcolorbox}

\tcbset{every box/.style={fontupper=\sffamily, 
    colframe=black, notitle, sharp corners}}

\newtcolorbox{project}{colback=black!40}

\newtcolorbox{subproject}{colback=black!30}

\newtcolorbox{subsubproject}{colback=black!10}

\begin{document}

\begin{project}
Project P1: Long Name of Project 1.
\end{project}

\begin{project}
Project P2: Long Name of Project 2.
    \begin{subproject}
    Subproject S1: Long Name of subproject 1.
        \begin{subsubproject}
        Subsubproject 1: Long Name of subsubproject 1.
        \end{subsubproject}
        \begin{subsubproject}
        Subsubproject 2: Long Name of subsubproject 3.
        \end{subsubproject}
    \end{subproject}
    \begin{subproject}
    Subproject S2: Long Name of subproject 2.
        \begin{subsubproject}
        Subsubproject 3: Long Name of subsubproject 3.
        \end{subsubproject}
        \begin{subsubproject}
        Subsubproject 4: Long Name of subsubproject 4.
        \end{subsubproject}
    \end{subproject}
    \begin{subproject}
    Subproject S3: Long Name of subproject 3.
        \begin{subsubproject}
        Subsubproject 5: Long Name of subsubproject 5.
        \end{subsubproject}
    \end{subproject}
\end{project}

\begin{project}
Project P3: Long Name of Project 3.
\end{project}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .