# Arrow from last line of equation to the first

I would like to have something similar to the arrow in this picture:

Is this possible to include without a lot of coding? At the moment the code is:

\documentclass[10pt,a4paper]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}

$$\begin{split} & ^\text{1}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{2}\text{H} + \text{e}^+ + \nu \\ & ^\text{2}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{3}\text{He} + \gamma \\ & ^\text{3}\text{He} + {}^\text{4}\text{He} \rightarrow {}^\text{7}\text{Be} \\ & ^\text{7}\text{Be} + \text{p} \rightarrow {}^\text{8}\text{B} + \gamma \\ & ^\text{8}\text{B} \rightarrow {}^\text{8}\text{Be} + \nu + \text{e}^+ \\ & ^\text{8}\text{Be} \rightarrow \text{2}~ ^\text{4}\text{He} \label{eq:ppkette3} \end{split}$$

\end{document}


I tried some stuff with a box but did not get any usable results.

-

A possible solution with the famous \tikzmark macro:

\documentclass[10pt,a4paper]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}

\usepackage{tikz}
\newcommand{\tikzmark}[1]{%
\tikz[overlay,remember picture,
baseline=-\the\dimexpr\fontdimen22\textfont2\relax]% correct vertical alignment:
% http://tex.stackexchange.com/questions/59658/use-of-tikzpicture-matrix-in-align-or-gather-environment/59660#comment126261_59660
\node (#1) {};%
}
\tikzset{square arrow/.style={to path={(\tikztostart)-- ++(-0.5,0) |- (\tikztotarget)}}}

\begin{document}

$$\begin{split} \tikzmark{ini} & ^\text{1}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{2}\text{H} + \text{e}^+ + \nu \\ & ^\text{2}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{3}\text{He} + \gamma \\ & ^\text{3}\text{He} + {}^\text{4}\text{He} \rightarrow {}^\text{7}\text{Be} \\ & ^\text{7}\text{Be} + \text{p} \rightarrow {}^\text{8}\text{B} + \gamma \\ & ^\text{8}\text{B} \rightarrow {}^\text{8}\text{Be} + \nu + \text{e}^+ \\ \tikzmark{end} & ^\text{8}\text{Be} \rightarrow \text{2}~ ^\text{4}\text{He} \end{split} \begin{tikzpicture}[remember picture,overlay] \draw[-stealth,square arrow] (end) to (ini); \end{tikzpicture} \label{eq:ppkette3}$$

\end{document}


The result:

It requires two compilation runs.

To get an arrowhead matching with \rightarrow, it is possible to exploit the powerful arrows.meta library. Add

\usetikzlibrary{arrows.meta}


in the preamble and change:

\draw[-stealth,square arrow] (end) to (ini);


with

\draw[-{To[length=2.45pt]},square arrow] (end) to (ini);


The result will be:

-
I note that \draw[->,square arrow] (end) to (ini); would give you an arrowhead that matches the \rightarrows but how do you get it to be exactly the same size? –  Thruston May 30 at 15:01
@Thruston: you're right. Please, see my edited answer. –  Claudio Fiandrino May 30 at 15:19

We can also do this using a plain halign with no interline skips and vertical rules.

\documentclass{article}
\begin{document}
\vcenter{\offinterlineskip\halign{&#\hfil\cr \vrule height .6ex depth 6pt\mkern-1.67mu \to & \rm \mathord{{}^1H + {}^1H} \to \mathord{{}^2H + e^+ + \nu} \cr \vrule height 9pt depth 6pt & \rm \mathord{{}^2H + {}^1H} \to {}^3He +\gamma \cr \vrule height 9pt depth 6pt & \rm \mathord{{}^3He+ {}^4He} \to {}^7Be\cr \vrule height 9pt depth 6pt & \rm \mathord{{}^7Be+ p} \to {}^8B+\gamma\cr \vrule height 9pt depth 6pt & \rm \mathord{{}^8B} \to {}^8Be+\nu+e^+\cr \vrule height 9pt depth -.6ex\mkern-.67mu \vrule height .6ex depth -.5ex width 1em \ & \rm \mathord{{}^8Be} \to {}^4He\cr }}
\end{document}


This has the small advantage that the arrow heads look the same. Note that the final horizontal line is actually drawn by a \vrule.

-

A solution with pst-node, but you have to go the latex -> dvips -> pstopdf:

\documentclass[10pt,a4paper, pdf]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{pst-node}

\begin{document}

\label{eq:ppkette3} \begin{aligned} \pnode(0,0){F}& ^\text{1}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{2}\text{H} + \text{e}^+ + \nu \\ & ^\text{2}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{3}\text{He} + \gamma \\ & ^\text{3}\text{He} + {}^\text{4}\text{He} \rightarrow {}^\text{7}\text{Be} \\ & ^\text{7}\text{Be} + \text{p} \rightarrow {}^\text{8}\text{B} + \gamma \\ & ^\text{8}\text{B} \rightarrow{}^\text{8}\text{Be} + \nu + \text{e}^+ \\ \pnode(0,0){L}& ^\text{8}\text{Be} \rightarrow \text{2}~ ^\text{4}\text{He} \end{aligned}
\ncbar[angle = 180,nodesep = 0.5em]{->}{L}{F}

\end{document}     \documentclass[10pt,a4paper, pdf]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{pst-node}

\begin{document}

\label{eq:ppkette3} \begin{aligned} \pnode(0,0){F}& ^\text{1}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{2}\text{H} + \text{e}^+ + \nu \\ & ^\text{2}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{3}\text{He} + \gamma \\ & ^\text{3}\text{He} + {}^\text{4}\text{He} \rightarrow {}^\text{7}\text{Be} \\ & ^\text{7}\text{Be} + \text{p} \rightarrow {}^\text{8}\text{B} + \gamma \\ & ^\text{8}\text{B} \rightarrow{}^\text{8}\text{Be} + \nu + \text{e}^+ \\ \pnode(0,0){L}& ^\text{8}\text{Be} \rightarrow \text{2}~ ^\text{4}\text{He} \end{aligned}
\ncbar[angle = 180,nodesep = 0.5em]{->}{L}{F}

\end{document}


-

tkz-linknodes package is another option in case you accept to place the arrow on the right side of your equations.

Package objective is to

easily create links between the lines of an environment as aligned or still align by indicating the operation made between the two lines

Only three commands/environments are used NodesList, AddNode and LinkNodes. An example taken from package documentations looks like:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}
\begin{NodesList}
\begin{align}
\boxed{ 3(x^2-3) =4 } \AddNode\\
\intertext{\hfil isolate the term with the variable \hfil}
\end{align}
\LinkNodes[margin=1cm]{$\div 3$}%
\LinkNodes[margin=1.5cm]{$+3$}%
\LinkNodes[margin=2.5cm]{$\sqrt{\ldots}$}
\LinkNodes[margin=3cm]{$\sqrt{x^2}=|x|$}
\end{NodesList}
\end{document}


and produces

Therefore, your example could be

\documentclass[10pt,a4paper]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}

\begin{NodesList}
$$\begin{split} & ^\text{1}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{2}\text{H} + \text{e}^+ + \nu \AddNode \\ & ^\text{2}\text{H} + {}^\text{1}\text{H} \rightarrow {}^\text{3}\text{He} + \gamma \\ & ^\text{3}\text{He} + {}^\text{4}\text{He} \rightarrow {}^\text{7}\text{Be} \\ & ^\text{7}\text{Be} + \text{p} \rightarrow {}^\text{8}\text{B} + \gamma \\ & ^\text{8}\text{B} \rightarrow {}^\text{8}\text{Be} + \nu + \text{e}^+ \\ & ^\text{8}\text{Be} \rightarrow \text{2}~ ^\text{4}\text{He}\AddNode \label{eq:ppkette3} \end{split}$$
\tikzset{ArrowStyle/.append style={<-}}