\usepackage{ytableau}
\usepackage{tikz} 

%%%%%%%%%%%%%%%%%%%%%
%solution from 
%https://tex.stackexchange.com/questions/197702/staircase-paths-through-young-tableaux
%%%%%%%%%%%%%%%%%%%%%

\newcommand{\tikzmark}[2]{\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {$#2$};}

\newcommand{\DrawVLineRight}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]%
    \draw[shorten >=-2.87mm,shorten <=-0.76mm, #1] ([xshift=1.72mm]#2.south east) -- ([xshift=1.72mm]#3.north east);%
  \end{tikzpicture}%
}

\newcommand{\DrawVLineLeft}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]%
    \draw[shorten >=-2.87mm,shorten <=-0.76mm, #1] ([xshift=-1.72mm]#2.south west) -- ([xshift=-1.72mm]#3.north west);%
  \end{tikzpicture}%
}

\newcommand{\DrawHLineEmpty}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]%
    %\draw[shorten <=-0.2mm,shorten >=-0.1mm, #1] (#2.south west) -- (#3.south east);
    \draw[shorten <=-1.815mm,shorten >=-1.815mm, #1] ([yshift=-0.69mm]#2.south west) -- ([yshift=-0.69mm]#3.south east);%
  \end{tikzpicture}%
}

\newcommand{\DrawHLineOne}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]%
    %\draw[shorten <=-0.2mm,shorten >=-0.1mm, #1] (#2.south west) -- (#3.south east);
    \draw[shorten <=-0.52mm,shorten >=-0.52mm, #1] ([yshift=-0.58mm]#2.south west) -- ([yshift=-0.58mm]#3.south east);%
  \end{tikzpicture}%
}

\newcommand{\DrawHLineTwo}[3][]{%
  \begin{tikzpicture}[overlay,remember picture]%
    %\draw[shorten <=-0.2mm,shorten >=-0.1mm, #1] (#2.south west) -- (#3.south east);
    \draw[shorten <=0.36mm,shorten >=0.36mm, #1] ([yshift=-0.58mm]#2.south west) -- ([yshift=-0.58mm]#3.south east);%
  \end{tikzpicture}%
}


%%%%%%%%%%%%%%%%%%%%%%%%
% -----------------
% |       |       |
% |       3       5
% |       |       |
% ----1-------2-----
% |       |       |
% |       4       6
% |       |       |
% ------------------
%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mytwobytwo}[6]{%
\resizebox{!}{7mm}{%
\begin{tabular}{c}%
\begin{ytableau}%
		\tikzmark{a}{} & \tikzmark{b}{} \\
		\tikzmark{c}{} & \tikzmark{d}{} 
\end{ytableau}%
\ifthenelse{#1=1 \AND #2=1}{%
	\DrawHLineEmpty[line width=0.5mm,color=red]{a}{b}%
}{%
\ifthenelse{#1=1}{%
	\DrawHLineEmpty[line width=0.5mm,color=red]{a}{a}%
	}%
	{%
	\ifthenelse{#2=1}{%
		\DrawHLineEmpty[line width=0.5mm,color=red]{b}{b}%	
	}{}%
	}%
}%
%
\ifthenelse{#3=1 \AND #4=1}{%
	\DrawVLineRight[line width=0.5mm,color=red]{c}{a}%
}{%
\ifthenelse{#3=1}{%
	\DrawVLineRight[line width=0.5mm,color=red]{a}{a}%
	}%
	{%
	\ifthenelse{#4=1}{%
		\DrawVLineRight[line width=0.5mm,color=red]{c}{c}%	
	}{}%
	}%
}%
%
\ifthenelse{#5=1 \AND #6=1}{%
	\DrawVLineRight[line width=0.5mm,color=red]{d}{b}%
	\DrawVLineLeft[line width=0.5mm,color=red]{c}{a}%
}{%
\ifthenelse{#5=1}{%
	\DrawVLineRight[line width=0.5mm,color=red]{b}{b}%
	\DrawVLineLeft[line width=0.5mm,color=red]{a}{a}%
	}%
	{%
	\ifthenelse{#6=1}{%
		\DrawVLineRight[line width=0.5mm,color=red]{d}{d}%	
	\DrawVLineLeft[line width=0.5mm,color=red]{c}{c}%
	}{}%
	}%
}%
\mypadding%
\end{tabular}%
}}

%\macro{shapes}{OEIS}{nature}{formula}  
\newcommand{\twobytworow}[9]{%
	%
	\mytwobytwo{#1}{#2}{#3}{#4}{#5}{#6}
	%
	&
	%
	\begin{tabular}{ll}
	\oeisshort{#7} & 
	#8
	\\
	\multicolumn{2}{c}{$\displaystyle #9$}
	\end{tabular}
	%
	\\
}