
I am trying to write an algorithm in LaTeX. I used a for loop inside the algorithm (see attached image), but the problem is that the statements that are below the for loop are not tapped. Why?
I used the packages \usepackage{algorithm} and \usepackage{algpseudocode}.
This the code I wrote:
\begin{algorithm}
\caption{CH election algorithm}
\label{CHalgorithm}
\begin{algorithmic}[1]
\Procedure{CH\textendash Election} {}
\For{each node $i$ \Pisymbol{psy}{206} $N$ }
\\Broadcast HELLO message to its neighbor
\\let $k$ \Pisymbol{psy}{206} $N1$ ($i$) U {$i$} be s.t
\\QOS($k$) = max {QOS($j$) \textbar $j$ \Pisymbol{psy}{206} $N1$($i$) U $i$}
\\ MPRSet($i$) = $k$
\EndFor
\EndProcedure
\end{algorithmic}
\end{algorithm}

\documentclass{...}and ending with\end{document}. – yo' Nov 27 '14 at 17:12$i$ \Pisymbol{psy}{206} $N$instead of just$i \in N$? – wchargin Nov 27 '14 at 20:19