I would like to create two boxes (or two frames) and one arrow which goes from the center of right side of one box and do half a circle and point on the other box.
Below is an example of code:
\documentclass{beamer}
\usepackage{algorithm,algpseudocode}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xcolor}
\makeatletter
\begin{document}
\begin{frame}
\begin{algorithm}[H]
\begin{algorithmic}
\State $y \leftarrow 1$
% Start box 1
\If{$n < 0$}
\State $X \leftarrow 1 / x$
\State $N \leftarrow -n$
\Else
\State $X \leftarrow x$
\State $N \leftarrow n$
\EndIf
%End box 1
%Start box 2
\While{$N \neq 0$}
\If{$N$ is even}
\State $X \leftarrow X \times X$
\State $N \leftarrow N / 2$
\Else[$N$ is odd]
\State $y \leftarrow y \times X$
\State $N \leftarrow N - 1$
\EndIf
\EndWhile
% End box 2
\end{algorithmic}
\end{algorithm}
\end{frame}
\end{document}
How could I create a box around the first \If
condition (until \EndIf
) and around while condition and then an arrow from the center of the right side of of the "if condition" to the "while condition" box?
Best Answer
Here's one possibility, placing marks and then using the marks to draw the boxes and the arrow: