9

I would like to draw jigsaw blocks (boxes) and then write text into it. Something like the following figure.

enter image description here

I could not find a package to get this shape, however, I am posting a minimal example with rectangle shapes.

\documentclass{report}

\usepackage{tikz} 
\usetikzlibrary{shapes,arrows,shapes.geometric,positioning,patterns}
\usepackage{pgfplots}

\begin{document}    
%
\begin{center}
    \begin{tikzpicture}[ node distance=0 cm,outer sep = 0pt]
    %
    \tikzstyle{introStyle}=[rectangle,draw, minimum width=4 cm, minimum height=3.5cm, anchor=north west,fill=red!20]
    \tikzstyle{lrStyle}=[rectangle,draw, minimum width=4 cm, minimum height=3.5cm, anchor=north west,fill=green!20]
    \tikzstyle{methodStyle}=[rectangle,draw, minimum width=8 cm, minimum height=3.5cm, anchor=north west,fill=blue!20]
    %
    \node[introStyle] (intro) at (0,0) {
        \parbox{3.5cm}{\color{red}%
            \begin{itemize}
            \item context
            \item research problem
            \item objectives 
            \end{itemize}
        }
    };
    %   
    \node[lrStyle] (lr) [right = of intro] {
        \parbox{3.5cm}{\color{green}%
            \begin{itemize}
            \item studies before 2000
            \item studies after 2000
            \end{itemize}
        }
    };
    %
    \node[methodStyle] (method) at (0,-3.5) {
        \parbox{3.5cm}{\color{blue}%
            \begin{itemize}
            \item method
            \item set up
            \end{itemize}
        }
    };
    %
    %
    \end{tikzpicture}
\end{center}
%    
\end{document}

Here is my result, however, I would like to have jigsaw blocks rather than rectangle.

Edit after comments

  1. I would like to get blocks with two different sizes as shown here (red/green box and blue box)
  2. In my case, I just need one dent (bump/notch) on bottom of red and green boxes so that they are embedded into blue box.

enter image description here

7
  • Are the sizes of the blocks uniform or they can too change sizes? – percusse Jun 20 '16 at 9:56
  • No, they are not. I would like to get blocks with at least two different sizes as shown above. Red and green boxes embedding into blue. – novice Jun 20 '16 at 9:59
  • so the bottom one would have two dents or bumps (or whatever they are called)? Can you please clarify your requirements in that sense so that efforts are not wasted? – percusse Jun 20 '16 at 10:00
  • thanks @percusse. I have entered my requirements to the post. – novice Jun 20 '16 at 10:06
  • 1
    texample.net/tikz/examples/puzzle – Elad Den Jun 20 '16 at 10:45
2

You could use the jigsaw package to create such shapes:

\documentclass{standalone}

\usepackage[svgnames]{xcolor}
\usepackage{jigsaw}


\begin{document}

\begin{tikzpicture}

\tiny
\sffamily

\begin{scope}
    \color{blue!40!white}
    \piece[blue!40!white]{-1}{-1}{0}{0}
\end{scope}
\begin{scope}[xshift=1cm]
    \color{green!30!white}
    \piece[green!30!white]{1}{1}{0}{1}
\end{scope}   
\begin{scope}[xshift=2cm]
    \color{green!30!white}
    \piece[green!30!white]{0}{1}{0}{-1}
\end{scope}    
\begin{scope}[xshift=3cm]
    \color{orange}
    \piece[orange]{-1}{0}{0}{-1}
\end{scope}       

\begin{scope}[yshift=-1cm]
    \color{green!50!black}
    \piece[green!50!black]{0}{-1}{1}{0}
\end{scope}
\begin{scope}[xshift=1cm,yshift=-1cm]
    \color{brown}
    \piece[brown]{0}{0}{-1}{1}
\end{scope}   
\begin{scope}[xshift=2cm,yshift=-1cm]
    \color{blue}
    \piece[blue]{0}{1}{0}{0}
\end{scope}    
\begin{scope}[xshift=3cm,yshift=-1cm]
    \color{blue!25!white}
    \piece[blue!25!white]{0}{0}{1}{-1}
\end{scope}      

\node at (0.5,0.5) {Abstract};
\node at (2,0.5) {Literature Review};
\node at (3.5,0.5) {Discussion};

\node at (0.5,-0.5) {\color{white}Introduction};
\node at (1.6,-0.5) {Methods};
\node at (2.4,-0.5) {\color{white}Results};
\node at (3.5,-0.5) {Conclusions};

\end{tikzpicture}

enter image description here

1

Well, after looking on this and other references, I think, it is too difficult for me than needed. So, I fixed it by using arrow and rectangle...

\documentclass[12pt]{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.geometric,positioning,patterns,arrows.meta}

\begin{document}
\thispagestyle{empty}

\begin{center}
    \begin{tikzpicture}[ node distance=0 cm,outer sep = 0pt,inner sep=0pt]
    %
    \def\x{0.4\textwidth}
    \def\y{0.35\textwidth}

    \tikzstyle{introStyle}=[rectangle,  minimum width=\x, minimum height=\y, anchor=north west, fill=red!20]
    \tikzstyle{lrStyle}=[rectangle, minimum width=\x, minimum height=\y, anchor=north west, fill=green!20]
    \tikzstyle{methodStyle}=[rectangle,  minimum width= 2*\x, minimum height=\y, anchor=north west, fill=blue!20]

    \node[methodStyle] (method) at (0,-\y) { % plotting it first, in order to overlaid by other rectangle/arrows.
        \parbox[c]{5cm}{%
            \begin{itemize}
            \item method
            \item set up
            \end{itemize}
        }
    };
    %
    \node[introStyle] (intro) at (0,0) {
        \parbox[c]{4cm}{%
            \begin{itemize}
            \item context
            \item research problem
            \item objectives 
            \end{itemize}
        }
    };
    \draw[-Triangle, line width=.22cm,red!20] (\x/2,-\y) - - (\x/2,-1.18*\y) ;
    %
    \node[lrStyle] (lr) [right = of intro] {
        \parbox[c]{4cm}{%
            \begin{itemize}
            \item studies before 2000
            \item objectives 
            \item 
            \end{itemize}
        }
    };
    \draw[-Triangle,  line width=.22cm,green!20] (1.5*\x,-\y) - - (1.5*\x,-1.18*\y) ;

    % outer rectangle
    \draw [densely dashed] (0,0) rectangle (2*\x,-2*\y);
    %
    %
    \end{tikzpicture}
\end{center}

\end{document}

Here is output...

enter image description here

This is not exactly what is described above but good enough given the time and effort required. Hopefully, useful for others too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.