# Arrow between lines in the align environment

I want to add some texts between lines in the align* environment like this:

I tried the following code:

\documentclass{article}
\usepackage{tikz,amsmath}
\usetikzlibrary{tikzmark}

\begin{document}
\begin{align*}
abc &= def + def + def + def \tikzmark{a}\\
&= ghi + ghi \tikzmark{b}\\
&= jkl\tikzmark{c}\\
&= mno + mno\tikzmark{d}
\end{align*}
\begin{tikzpicture}[remember picture, overlay]
\draw[->] ([xshift=2mm] pic cs:a)
to [out=0,in=0 ]
node[midway,anchor=west,xshift=3mm] {\footnotesize defitnition}
([xshift=2mm] pic cs:b);
\draw[->] ([xshift=2mm] pic cs:c)
to [out=0,in=0 ]
node[midway,anchor=west,xshift=3mm] {\footnotesize blablabla}
([xshift=2mm] pic cs:d);
\end{tikzpicture}
\end{document}


but it only gives

There are two problems:

(i) I want to make every arrow aligned vertically

(ii) As I am going to use this arrow very frequently, I want to define it as a sort of newcommand thing.

What can I do?

• Welcome to TeX.SE! Can you please show us what you have tried so far? – Kurt Mar 6 at 2:55

This can be done using the witharrows package.

Here is the code:

\documentclass{article}

\usepackage{witharrows}

\begin{document}

$\begin{WithArrows} abc &= def+def+def+def \Arrow[tikz={font={\mdseries}}]{definition} \\ &= hgi+hgi\\ &= jkl\Arrow[tikz={font={\mdseries}}]{blablabla}\\ &=mno+mno \end{WithArrows}$

\end{document}


Note that you may have to compile twice when using witharrows.

Go to the package documentation at CTAN to see the many options for usage including fonts, arrowheads, curvature, color, etc.

• This's exactly what I want. Thanks! – user182849 Mar 6 at 4:46
• My pleasure, @user182849. It may seem strange, but we typically don't thank posters in comments. Thanks are expressed by voting up (when you have sufficient reputation) and by accepting the answer you find best resolves your question. Welcome to TeX.SX! – Sandy G Mar 6 at 4:50
• Thank you for introducing me to this wonderful package witharrows : -) – AndréC Mar 6 at 5:36

Just for completeness: with tikzmark, which you are using, there is no problem in completing the code to give

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{align*}
abc &= def + def + def + def \tikzmarknode{a}{}\\
&= ghi + ghi \tikzmarknode{b}{}\\
&= jkl\tikzmarknode{c}{}\\
&= mno + mno\tikzmarknode{d}{}
\end{align*}
\begin{tikzpicture}[remember picture, overlay,font=\footnotesize]
\draw[-latex] ([xshift=2mm]a.east) coordinate (r)
to [out=0,in=0,looseness=2]
node[midway,anchor=west,xshift=3mm] {definition}
(b -| r);
\draw[-latex] (c-|r)
to [out=0,in=0,looseness=2]
node[midway,anchor=west,xshift=3mm] {blablabla}
(d-|r);
\end{tikzpicture}
\end{document}