2

enter image description here

A tiling interpretation of Fibonacci theorems

This is the basic code outline that I have to illustrate the tiling images. I can modify the code to take on any color or size perhaps, but what I'm confused about is the alignment. How do I represent my tilings as per as this specific alignment with arrows and subscripts under the figure as depicted in the image given?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{mathtools}
\usepackage{xparse}
\usepackage{bigstrut}

\usepackage[table, svgnames]{xcolor} 
\usepackage{boldline} 
\DeclareExpandableDocumentCommand{\colourcells}{O{2}m}{\multicolumn{#1}{c|}{\cellcolor{#2}\bigstrut}}
\newcommand{\redcell}{\cellcolor{Red}\strut}
\newcommand{\mathcell}[1]{\multicolumn{1}{c}{\boldmath$#1$\bigstrut}}

\begin{document}

\begin{table}\itshape
\setlength{\arrayrulewidth}{2pt}
\setlength{\bigstrutjot}{2.2ex}
\begin{tabular}{*{8}{p{0.7cm}|}}
    \hline
& & & & & \colourcells{NavyBlue} & \redcell \\
\hline
\multicolumn{3}{c}{} & \mathcell{n{-}1} & \mathcell{n} & \mathcell{n {+} 1} & \mathcell{n {+} 2} & \mathcell{n {+} 3} \\
\hline
 & & & & &\redcell & \colourcells{NavyBlue}
  \\
 \hline
\multicolumn{3}{c}{} & \mathcell{n{-}1} & \mathcell{n} & \mathcell{n {+} 1} & \mathcell{n {+} 2} & \mathcell{n {+} 3} \\
\hline
 & & & & &\redcell &\redcell &\redcell\rule[-4.5ex]{1pt}{0ex} \\
 \hline
\multicolumn{3}{c}{} & \mathcell{n{-}1} & \mathcell{n} & \mathcell{n {+} 1} & \mathcell{n {+} 2} & \mathcell{n {+} 3} \\
\hline
 & & & &
  \colourcells{NavyBlue} &\colourcells{NavyBlue} \\
 \hline
\multicolumn{3}{c}{} & \mathcell{n{-}1} & \mathcell{n} & \mathcell{n {+} 1} & \mathcell{n {+} 2} & \mathcell{n {+} 3} \\
\hline
 & & & &
  \colourcells{NavyBlue} & \redcell & \redcell \\
 \hline
\multicolumn{3}{c}{} & \mathcell{n{-}1} & \mathcell{n} & \mathcell{n {+} 1} & \mathcell{n {+} 2} & \mathcell{n {+} 3}
\end{tabular}
\end{table}

\end{document} 
3
  • 4
    Could you provide us with the code you already have for the rest of the image minus the arrows? It would be even better if you included that code as part of Minimal Working Example (MWE)
    – Flexo013
    Commented Jul 13, 2018 at 15:06
  • The code seems to be not too different from the answer you got on a previous question.
    – user121799
    Commented Jul 14, 2018 at 17:15
  • Yes I'm changing the color scheme on the code since I am not using the blue colors. And ofcourse the number of the tiles are varying in my code, but I don't know how my how to align them as per this photo.
    – tex_mate
    Commented Jul 14, 2018 at 17:28

1 Answer 1

1
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\newcommand{\Domino}[2]{%
\foreach  \X/\Y [count=\Z] in {#1}
{\ifnum\Z=1
\draw[thick,fill=\Y] (0,0) rectangle (\X,1);
\draw[thick,latex-latex] (0,0.5) -- (\X,0.5) node[midway,fill=\Y]{#2};
\xdef\lastX{\X}
\else
\draw[thick,fill=\Y] (\lastX,0) rectangle ({\lastX+\X},1);
\pgfmathsetmacro{\lastX}{\lastX+\X}
\xdef\lastX{\lastX}
\fi
}}
\begin{tikzpicture}[font=\sffamily,fat arrow/.style={->,ultra thick,shorten
>=2pt, shorten <=2pt}]
\begin{scope}[local bounding box=left tiling]
\Domino{5/white}{$n$-tiling}
\end{scope}
\begin{scope}[xshift=6.5cm]
 \begin{scope}[yshift=2cm,local bounding box=tiling 1]
  \Domino{7/white,1/blue,1/blue}{$n$-tiling}
 \end{scope}
 \node[anchor=north east] at (tiling 1.south east){Add a domino};
 \begin{scope}[local bounding box=tiling 2]
  \Domino{7/white,1/red,1/red}{$n$-tiling}
 \end{scope}
 \node[anchor=north east] at (tiling 2.south east){Add two squares};
 \begin{scope}[yshift=-2cm,local bounding box=tiling 3]
  \Domino{6/white,1/blue,1/blue,1/white}{$(n-1)$-tiling}
 \end{scope}
 \node[anchor=north east] at (tiling 3.south east){Insert domino before squares};
 \begin{scope}[yshift=-4cm,local bounding box=tiling 4]
  \Domino{5/white}{$(n-2)$-tiling}
 \end{scope}
 \node[anchor=north east] at (tiling 4.south east -|tiling 3.south east)
 {Remove domino};
\end{scope}
\draw[decorate,very thick,decoration={brace}] ([xshift=-2pt]tiling 4.south west) --
([xshift=-2pt]tiling 3.north west) coordinate[midway,left=3pt] (X);
\draw[fat arrow] (left tiling) -- (tiling 1.west);
\draw[fat arrow] (left tiling) -- (tiling 2.west);
\draw[fat arrow] (left tiling) -- (X);
\end{tikzpicture}
\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 .