# How do I add curly arrows with labels to a table of numbers?

I want to add curved arrows with numbers underneath them, to a table of numbers, as shown below: !

Any suggestions as to how to do this in LaTeX, please? I want the arrows and the numbers below the arrows to all line up correctly. So far, I have just created the diagram in Excel and then pasted it into Paint and then used \includegraphics command, which produces a rather poor quality image in LaTeX. Excel doesn't allow you to align the numbers below the arrows correctly, as far as I can tell, otherwise I would just use an Excel add-in to convert the table (including the arrows etc.) to LaTeX.

One option using the tikzmark library from TikZ; place some marks in the desired locations in the table and use \DrawArrow to place the arrow:

The syntax for \DrawArrow is

\DrawArrow[<options>]{<start mark>}{<end mark>}{<text>}


The code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows.meta}

\newcommand\DrawArrow[4][]{
\begin{tikzpicture}[
remember picture,
overlay,
arr/.style={draw=gray,line width=3pt, {-latex}, #1}
]
\draw[arr]
([shift={(15pt,-1ex)}]pic cs:#2)
to[out=-40,in=220] node[below=3pt] {#4}
([shift={(6pt,-1ex)}]pic cs:#3);
\end{tikzpicture}
}

\begin{document}

\DrawArrow{start1}{start2}{1}
\DrawArrow{start2}{start3}{6}
\DrawArrow[cyan]{start3}{start4}{12}

\noindent
\begin{tabular}{llll}
column1 & column2 & column3 & column4 \\
column1 & column2 & column3 & column4 \\
column1 & column2 & column3 & column4 \\
\tikzmark{start1}column1 & \tikzmark{start2}column2 & \tikzmark{start3}column3 &\tikzmark{start4}column4 \\
\end{tabular}

\end{document}


Since internal calculation of coordinates is required, two compilations will be needed.

• Great solution. However, after realising that I had to update various packages, this worked very well, except that the curly arrows appear on the previous page within my document on top of some other text, rather than on the page containing the table. I used exactly the code above, and was planning to then amend it to apply to my actual table. I guess it must be something to do with getting the right coordinates for the arrows to position them in the right place in the document - but how do I do that please? – user3551438 Feb 8 '15 at 10:59
• I have now worked out how to get the arrows attached to the right table - I just moved the \DrawArrow command so that it was closer to the required table. However, as I am new to Tikz/pgf I am struggling to get the arrow in exactly the right place in my table. In particular, despite reading the relevant manuals, I cannot understand the syntax for \draw[arr] ([shift={(15pt,-1ex)}]pic cs:#2) to[out=-40,in=220] node[below=3pt] {#4} ([shift={(6pt,-1ex)}]pic cs:#3); \end{tikzpicture} } – user3551438 Feb 9 '15 at 9:17