# Draw a long arrow next to multiple rows of tabular

I have the following table which I use to teach limits in calculus class (don't worry if you don't know what that is)

\begin{tabular}{l|l}
\bm{x}  & \bm{h(x)} \\
\hline
1.9    & 3.61   \\
1.99   & 3.9601 \\
1.999  & 3.9960 \\
1.9999 & 3.9996 \\
\hline
2.0001 & 4.0004 \\
2.001  & 4.004  \\
2.01   & 4.0401 \\
2.1    & 4.41   \\
\hline
\end{tabular}


In class I point out that the numbers in the left column get closer to 2 as we got down the column by drawing an arrow down to the left of the first column for four rows and writing "2" at the bottom of it (except that I can't draw on screens).

I also point out that the bottom half of the table, left side, gets closer to 2 as we go up by drawing an arrow up the rows (to their left).

The right column gets closer to 4 and I point that out (or would if I could draw on the screen) by drawing a down arrow to the right of the right column, etc.

How can I draw an arrow over multiple rows to the right or left of those columns to show the numbers progression?

• It doesn't really help anyone answer if they can not even run the supplied code to make a table Commented Jan 29, 2017 at 10:40
• I doubt this really helps in understanding the concept of limit, which is quite different from what you're presenting. Commented Jan 29, 2017 at 13:35
• @DavidCarlisle Why can't it run? It runs on mine.
– Jeff
Commented Jan 30, 2017 at 1:19
• @egreg This is introductory. It is how the textbook presents it.
– Jeff
Commented Jan 30, 2017 at 1:20
• @Jeff It's still teaching the wrong concept. Commented Jan 30, 2017 at 1:21

\documentclass{article}

\let\bm\textbf

\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}

\begin{document}

\begin{tabular}{cl|lc}
&\bm{x}  & \bm{h(x)} \\
\cline{2-3}
\tikzmark{a}&1.9    & 3.61&\tikzmark{aa}   \\
&1.99   & 3.9601& \\
&1.999  & 3.9960 &\\
\tikzmark{b}&1.9999 & 3.9996&\tikzmark{bb} \\
\cline{2-3}
&2.0001 & 4.0004& \\
&2.001  & 4.004 & \\
&2.01   & 4.0401& \\
\tikzmark{c}&2.1    & 4.41&\tikzmark{cc}   \\
\cline{2-3}
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
\draw[->,line width=3pt, color=red] ($(pic cs:a)+(0pt,.5ex)$) to ($(pic cs:b)+(0pt,-.1ex)$);
\node[color=red] at ($(pic cs:b)+(0pt,-1ex)$) {\Large 2};
\draw[->,line width=3pt, color=red] ($(pic cs:c)+(0pt,.5ex)$) to ($(pic cs:b)+(0pt,-2.5ex)$);

\draw[->,line width=3pt, color=red] ($(pic cs:aa)+(0pt,.5ex)$) to ($(pic cs:bb)+(0pt,-.1ex)$);
\node[color=red] at ($(pic cs:bb)+(0pt,-1ex)$) {\Large 4};
\draw[->,line width=3pt, color=red] ($(pic cs:cc)+(0pt,.5ex)$) to ($(pic cs:bb)+(0pt,-2.5ex)$);

\end{tikzpicture}

\end{document}


If this is what you want, then following is my code,

\documentclass{article}
\usepackage{multirow,tikz,bm}

\def\limitarrow#1{%
\begin{tikzpicture}
\draw[->] (0,1.5) to (0,0.25);
\node at (0,0) {#1};
\draw[->] (0,-1.5) to (0,-0.25);
\end{tikzpicture}}

\begin{document}
\begin{tabular}{l|l|l|l}
&  $\bm{x}$  & $\bm{h(x)}$ &\\
\hline
\multirow{8}{*}{\limitarrow{2}} & 1.9    & 3.61 & \multirow{8}{*}{\limitarrow{4}}\\
& 1.99       & 3.9601      & \\
& 1.999      & 3.9960      & \\
& 1.9999     & 3.9996      & \\
\cline{2-3}
& 2.0001     & 4.0004      &\\
& 2.001      & 4.004       &\\
& 2.01       & 4.0401      &\\
& 2.1        & 4.41        &\\
\hline
\end{tabular}
\end{document}

• And what can you do if you want these arrows in a column in between 2 other columns? Commented Feb 18, 2021 at 8:52