# Array of numbers with arrows

In Principles of Mathematical Analysis, Walter Rudin utilizes the following array of numbers: I want to recreate it in TeX but I don't even know how to start. Can someone help me?

EDITED: I tried to edit some of the answers in post cited in Alenanno's comment. It kinda worked, but I couldn't make the arrows parallel.

My attempt:

$$\begin{array}{*{6}{c}} & \tikzmark{e1}x_{11}\tikzmark{s1} & x_{12}\tikzmark{s2} & x_{13}\tikzmark{s3} & \cdots \\ \\ & \tikzmark{e2}x_{21} & x_{22} & x_{23}\tikzmark{s4} & \cdots \\ \\ & \tikzmark{e3}x_{31} & \tikzmark{e4}x_{32} & \tikzmark{e5}x_{33}\tikzmark{s5} & \cdots \\ & \vdots & \vdots & \vdots & \ddots \\ \end{array}$$
\begin{tikzpicture}[overlay,remember picture]
\foreach \i in {1,2,...,5}
\draw[<-] ($(s\i.north east)+(-0.1,0.1)$) -- ($(e\i.south west)+(0.1,0)$);
\end{tikzpicture}

• 'Just' the array or also the diagonal lines?
– user31729
Aug 26, 2016 at 18:47
• Related (possible duplicates): Drawing Multiple Diagonal Arrows in a Table, Drawing Arrows in Tables. Aug 26, 2016 at 18:48
• Please try the solutions inside of those linked questions. It shouldn't be hard to edit those. If you still have problems, you can edit your question showing what you're having trouble with. Aug 26, 2016 at 18:54
• Edited the post. Christian, the array is easy to do. I couldn't figure out the diagonal lines. Aug 26, 2016 at 19:26
• @GabrielRibeiro: Yes, but please don't use  -- that's outdated syntax. Use $....$ instead if you need display math style
– user31729
Aug 26, 2016 at 20:08

One way would be to use the TikZ matrix library. The arrows may be added using a simple loop and the automatic names assigned by the matrix of nodes operation. \documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes]
{
x_{11} & x_{12} & x_{13} & x_{14} & \dots \\
x_{21} & x_{22} & x_{23} & x_{24} & \dots \\
x_{31} & x_{32} & x_{33} & x_{34} & \dots \\
x_{41} & x_{42} & x_{43} & x_{44} & \dots \\
\dots \\
};
\foreach \i in {1,...,4} \draw [->] (m-\i-1.south west) -- (m-1-\i.north east);
\end{tikzpicture}
\end{document}


Here is a solution with {NiceTabular} of nicematrix (and TikZ to draw the arrows). The environment {NiceTabular} of nicematrix is similar to the environment {tabular} (as provided by array) but creates PGF/TikZ nodes under the cells, rows and columns. Then, it's possible to draw whatever rule you want with TikZ.

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

$\begin{NiceMatrix} x_{11} & x_{12} & x_{13} & x_{14} & \cdots \\ x_{21} & x_{22} & x_{23} & x_{24} & \cdots \\ x_{31} & x_{32} & x_{33} & x_{34} & \cdots \\ x_{41} & x_{42} & x_{43} & x_{44} & \cdots \\ \Hdotsfor{5} \\ \CodeAfter \tikz \foreach \i in {2,...,5} { \draw [->,shorten > = 2pt] (\i-|1) -- (1-|\i) ; } ; \end{NiceMatrix}$

\end{document} 