How to draw a matrix with arrows in limited space
Another option is using matrix of nodes in tikz environment, but it has lots of optios and makes more dificult but hightly customizable.
RESULT:
MWE:
% arara: pdflatex: {synctex: yes, interaction: nonstopmode}
\documentclass[margin=0.5cm]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{matrix,arrows.meta}
\begin{document}
\begin{tikzpicture}[
%Global environment config.
%baseline=0cm, %Nice but I think is usefull only in tikzpicture env.
%Environment styles declarations
>=Stealth,
Matrix/.style={
matrix of math nodes,
nodes in empty cells,
column sep=0.25em,
row sep=1em,
nodes={inner xsep=0.5pt,inner ysep=2pt,minimum width=1.5em}
},
Brackets/.style={
left delimiter={[},
right delimiter={]}
}
]
%Start drawing the thing.
\matrix [Matrix] at (0,0)(M1){
%Matrix contents
&&0&0&0&0&0&0&0&0&0&0\\
&0&1&2&3&4&5&6&7&8&9&10\\
0&1&0&1&2&3&4&5&6&7&8&9\\
0&2&1&0&1&2&3&4&5&6&7&8\\
0&3&2&1&0&1&2&3&4&5&6&7\\
0&4&3&2&1&0&1&2&3&4&5&6\\
0&5&4&3&2&1&0&1&2&3&4&5\\
0&6&5&4&3&2&1&0&1&2&3&4\\
0&7&6&5&4&3&2&1&0&1&2&3\\
0&8&7&6&5&4&3&2&1&0&1&2\\
1&9&8&7&6&5&4&3&2&1&1&2\\
1&10&9&8&7&6&5&4&3&2&2&2\\
1&11&10&9&8&7&6&5&4&3&3&3\\
1&12&11&10&9&8&7&6&5&4&4&4\\
};
\foreach \x [evaluate=\x as \m using int(\x+1)]in {2,3,...,10}{
\draw[->] (M1-\x-\x) -- (M1-\m-\m);
}
\draw[->] (M1-11-11) -- (M1-12-11);
\draw[->] (M1-12-11) -- (M1-13-11);
\draw[->] (M1-13-11) -- (M1-14-12);
\end{tikzpicture}
\end{document}
A rather simple way of making the arrows longer is to set the inner sep
to 0 and to increase the row
and column sep
s in such a way that the size stays the same (roughly).
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=3pt, row sep=5pt,nodes={inner sep=0pt,align=center,
text width={width("20")}}]
&&0&0&0&0&0&0&0&0&0&0\\
&0\ar[dr]&1&2&3&4&5&6&7&8&9&10\\
0&1&0\ar[dr]&1&2&3&4&5&6&7&8&9\\
0&2&1&0\ar[dr]&1&2&3&4&5&6&7&8\\
0&3&2&1&0\ar[dr]&1&2&3&4&5&6&7\\
0&4&3&2&1&0\ar[dr]&1&2&3&4&5&6\\
0&5&4&3&2&1&0\ar[dr]&1&2&3&4&5\\
0&6&5&4&3&2&1&0\ar[dr]&1&2&3&4\\
0&7&6&5&4&3&2&1&0\ar[dr]&1&2&3\\
0&8&7&6&5&4&3&2&1&0\ar[dr]&1&2\\
1&9&8&7&6&5&4&3&2&1&1\ar[d]&2\\
1&10&9&8&7&6&5&4&3&2&2\ar[d]&2\\
1&11&10&9&8&7&6&5&4&3&3\ar[dr]&3\\
1&12&11&10&9&8&7&6&5&4&4&4\\
\end{tikzcd}
\end{document}
Not really a viable solution for general purpose, but I just wanted to prove to myself it could be done as a TABstack.
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tabstackengine,graphicx}
\newcommand\minidarrow{\scalebox{.8}{\ensuremath{\downarrow}}}
\newcommand\minidrarrow{\scalebox{.8}{\rotatebox[origin=c]{-45}{$\rightarrow$}}}
\def\AR[#1#2]{%
\setbox0=\hbox{0}%
\ifx#1d
\ifx\relax#2\relax
\kern-.5\wd0
\bclap[.35\dimexpr\Lstackgap]{\minidarrow}%
\kern.5\wd0%
\else
\ifx r#2
\kern.5\wd0
\bclap[.3\dimexpr\Lstackgap]{\minidrarrow}%
\kern-.5\wd0
\else
% ...
\fi
\fi
\else
% ...
\fi
}
\fixTABwidth{T}
\setstackgap{L}{1.15\baselineskip}
\setstacktabbedgap{3pt}% May need to be tailored
\begin{document}
\Matrixstack{
&&0&0&0&0&0&0&0&0&0&0\\
&0\AR[dr]&1&2&3&4&5&6&7&8&9&10\\
0&1&0\AR[dr]&1&2&3&4&5&6&7&8&9\\
0&2&1&0\AR[dr]&1&2&3&4&5&6&7&8\\
0&3&2&1&0\AR[dr]&1&2&3&4&5&6&7\\
0&4&3&2&1&0\AR[dr]&1&2&3&4&5&6\\
0&5&4&3&2&1&0\AR[dr]&1&2&3&4&5\\
0&6&5&4&3&2&1&0\AR[dr]&1&2&3&4\\
0&7&6&5&4&3&2&1&0\AR[dr]&1&2&3\\
0&8&7&6&5&4&3&2&1&0\AR[dr]&1&2\\
1&9&8&7&6&5&4&3&2&1&1\AR[d]&2\\
1&10&9&8&7&6&5&4&3&2&2\AR[d]&2\\
1&11&10&9&8&7&6&5&4&3&3\AR[dr]&3\\
1&12&11&10&9&8&7&6&5&4&4&4}
\end{document}
One can play with the compression by changing a few lines:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tabstackengine,graphicx}
\newcommand\minidarrow{\scalebox{.8}[.6]{\ensuremath{\downarrow}}}
\newcommand\minidrarrow{\scalebox{.8}{\rotatebox[origin=c]{-45}{$\rightarrow$}}}
\def\AR[#1#2]{%
\setbox0=\hbox{0}%
\ifx#1d
\ifx\relax#2\relax
\kern-.5\wd0
\bclap[.15\dimexpr\Lstackgap]{\minidarrow}%
\kern.5\wd0%
\else
\ifx r#2
\kern.5\wd0
\bclap[.3\dimexpr\Lstackgap]{\minidrarrow}%
\kern-.5\wd0
\else
% ...
\fi
\fi
\else
% ...
\fi
}
\fixTABwidth{T}
\setstackgap{L}{.8\baselineskip}
\setstacktabbedgap{0.7pt}% May need to be tailored
\begin{document}
\Matrixstack{
&&0&0&0&0&0&0&0&0&0&0\\
&0\AR[dr]&1&2&3&4&5&6&7&8&9&10\\
0&1&0\AR[dr]&1&2&3&4&5&6&7&8&9\\
0&2&1&0\AR[dr]&1&2&3&4&5&6&7&8\\
0&3&2&1&0\AR[dr]&1&2&3&4&5&6&7\\
0&4&3&2&1&0\AR[dr]&1&2&3&4&5&6\\
0&5&4&3&2&1&0\AR[dr]&1&2&3&4&5\\
0&6&5&4&3&2&1&0\AR[dr]&1&2&3&4\\
0&7&6&5&4&3&2&1&0\AR[dr]&1&2&3\\
0&8&7&6&5&4&3&2&1&0\AR[dr]&1&2\\
1&9&8&7&6&5&4&3&2&1&1\AR[d]&2\\
1&10&9&8&7&6&5&4&3&2&2\AR[d]&2\\
1&11&10&9&8&7&6&5&4&3&3\AR[dr]&3\\
1&12&11&10&9&8&7&6&5&4&4&4}
\end{document}