# Adding caption in algorithmic package without using algorithm

For an IEEE submission I am not allowed to use algorithm package. They recommend to use algorithmic package. I am not able to add caption in the algorithmic package. This and this answer solves the problem using algorithm package, which is of no use to me.

I am allowed to use algorithmicx package too. I am using IEEEtran file.

## 1 Answer

The following code defines \algcaption{<caption>} that sets a "pseudo-caption" for an algorithm:

\documentclass[conference]{IEEEtran}

\usepackage{lipsum}% Just for this example
\usepackage{algorithmic}

% A regular caption without a number
\newcommand{\algcaption}[1]{%
\par\noindent
\textbf{Algorithm:}
#1\par
}

% If you need an algorithm counter, then use the following code definitions instead
% \newcounter{algorithm}
% \newcommand{\algcaption}[1]{%
%   \par\noindent
%   \refstepcounter{algorithm}%
%   \textbf{Algorithm \thealgorithm:}
%   #1\par
% }

\begin{document}

\title{A title}
\author{An author}

\maketitle

\section{A section}\lipsum[1]

\algcaption{This is an algorithm}

\begin{algorithmic}[1]
\STATE Some statement
\IF{some conditional}
\STATE Another statement
\ENDIF
\end{algorithmic}

\end{document}


You can also add a numbered caption using the code above (uncomment as necessary).