# How Can I make a run off table?

I am new in using Latex. I want to make a run off table like the one in the . I will appreciate your helps.

• Welcome to TeX.SE! What have you tried so far? Please show us the tried code ... – Mensch Mar 9 '18 at 22:16
• If I were doing this, I would use a TikZ matrix. Coloring individual cells and drawing all those lines is too much work with tabular. – John Kormylo Mar 10 '18 at 5:13
• I deleted thetcolorbox tag since that is unrelated here – user31729 Mar 10 '18 at 12:38
• The problem is I didn't tried any code..I have tried only this one tex.stackexchange.com/questions/241728/… but it's not what I am looking for..even I don't know what packages should I use. – Karima Touati Mar 10 '18 at 15:57
• Do you also want to draw the arrows like in the figure you provide? If not, you could just use a simple table like in the answer you found yourself. – timothymctim Mar 10 '18 at 16:31

You could use TikZ matrix.

\documentclass{article}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning, fit}
\usetikzlibrary{backgrounds, arrows.meta}
\tikzset{
basicnode/.style={
text height=2.5ex,
text depth=.5ex,
outer sep=0pt,
inner sep=4pt,
},
titlenode/.style={
anchor=west,
font=\bfseries,
basicnode
},
myarrow/.style={
line width=2pt, -Triangle, shorten >=2pt, shorten <=2pt
},
mymatr/.style={
matrix of nodes,
inner sep=0pt,
nodes in empty cells,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={
anchor=center,
text width=2cm,
text centered,
basicnode,
},
column 1/.style={nodes={align=left},},
},
mymatrix/.style={
mymatr,
row 2/.append style={font=\bfseries},
},
}
\begin{document}
\begin{tikzpicture}
% matrix bodies
\matrix[mymatrix] (first) {
&&&&\\
AY/DY & 0 & 1 & 2 & 3 \\
2000 & 1000 & 1000 & 333 & 777 \\
2001 & 2000 & 1100 & 444 & 888 \\
2002 & 3000 & 1111 & 555 & 999 \\
2003 & 4000 & 1112 & 666 & 111 \\
};
\matrix[mymatrix, below=of first] (second) {
&&&&\\
AY/DY & 0 & 1 & 2 & 3 \\
2000 & 1000 & 1000 & 333 & 777 \\
2001 & 2000 & 1100 & 444 & 888 \\
2002 & 3000 & 1111 & 555 & 999 \\
2003 & 4000 & 1112 & 666 & 111 \\
};
\matrix[mymatr, below=of second] (third) {
&&&&\\
& 1000 & 1000 & 333 & 777 \\
};
% source and notes
\node[
below =0pt of third, font=\footnotesize, text width=11.4cm, inner sep=0pt
]{\begin{description}[align=left, font=\itshape\mdseries, nosep]
\item [Source:] invented.
\item [Note:] since you didn't provide a MWE and copying all your data is boring, I have invented them.
\end{description}};
% titles
\node[titlenode] at (first-1-1.west) {Title of the first table};
\node[titlenode] at (second-1-1.west) {Title of the second table};
\node[titlenode] at (third-1-1.west) {Title of the third table};
% rules
\node[fit=(first)(third), inner sep=0pt, thick, draw]{};
\foreach \mytab in {first, second, third}
\foreach \myrow in {1,2}
\draw[thick] (\mytab-\myrow-1.south west) -- (\mytab-\myrow-5.south east);
\foreach \mytab in {second, third}
\draw[thick] (\mytab-1-1.north west) -- (\mytab-1-5.north east);
\foreach \mytab in {first, second}
{\draw[thick] (\mytab-6-1.south west) --
(\mytab-6-3.south west) -- (\mytab-6-3.north west) --
(\mytab-5-4.south west) -- (\mytab-5-4.north west) --
(\mytab-4-5.south west) -- (\mytab-4-5.north west) --
(\mytab-3-5.south east);
% gray cells
\scoped[on background layer]
\filldraw[lightgray!70]
(\mytab-6-3.south west) -- (\mytab-6-3.north west) --
(\mytab-5-4.south west) -- (\mytab-5-4.north west) --
(\mytab-4-5.south west) -- (\mytab-4-5.north west) --
(\mytab-3-5.south east) -- (\mytab-6-5.south east) --
cycle;}
% arrows
\draw[myarrow] (first) -- (second);
\draw[myarrow, lightgray]
(second-3-5.south west) -- (second-3-5.south west|-first.south);;
\end{tikzpicture}

\end{document}


You can do it with a combination of tabular and lots of tikzmarks. It needs two compilations!

\documentclass{article}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}
\newcounter{row}
\setcounter{row}{1}
\begin{tikzpicture}[overlay,remember picture]
\fill  [gray!50!white]
(pic cs:col1row3)-|
(pic cs:col2row2)-|
(pic cs:col3row1)--
(pic cs:col4row1)--  (pic cs:col4row3) --cycle;
\draw    (pic cs:col1row3)-|
(pic cs:col2row2)-|
(pic cs:col3row1)--(pic cs:col4row1);
\end{tikzpicture}

\begin{tabular}{!{\raisebox{-3pt}[0pt][0pt]{\tikzmark{col1row\therow}}}c
!{\raisebox{-3pt}[0pt][0pt]{\tikzmark{col2row\therow}}}c
!{\raisebox{-3pt}[0pt][0pt]{\tikzmark{col3row\therow}}}c
!{\raisebox{-3pt}[0pt][0pt]{\tikzmark{col4row\therow}}}l<{\refstepcounter{row}}@{}}
1111 & 2222 & 3333 &\\
1111 & 2222 & 3333 &\\
1111 & 2222 & 3333 &\\
\end{tabular}
\end{document}