I want to type an algorithm in ieee format. I have used algorithmic package. But using that package, I couldn't type a caption to the algorithm and "Algorithm " above the written algorithm. What should I do to get those things written in my algorithm ? I need the algorithm as in the given figure.
The structure I have used is given below
\documentclass{IEEEtran}
\usepackage{algorithmic}
\begin{document}
%\begin{algorithm}
%\caption{Algorithm for ...}
\begin{algorithmic}[1]
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\REQUIRE in
\ENSURE out
\\ \textit{Initialisation} :
\STATE first statement
\\ \textit{LOOP Process}
\FOR {$i = l-2$ to $0$}
\STATE statements..
\IF {($i \ne 0$)}
\STATE statement..
\ENDIF
\ENDFOR
\RETURN $P$
\end{algorithmic}
%\end{algorithm}
\end{document}
Best Answer
First of all, if you want to use the
algorithm
environment and also want to respect the IEEE format (which doesn't allow it to float), you can use theH
floating specifier to tellalgorithm
not to float:Then, it seems that you want to use the
ruled
style for thealgorithm
environment, but without lines.This can be achieved defining a new floating style (the
algorithm
package loads thefloat
package), let's saynorules
, which has no rulesand applying it to the
algorithm
environmentMWE:
Output: