# There is always a zero at the end of my algorithm [duplicate]

There is my source code.

\documentclass[conference]{IEEEtran}
\usepackage{algorithm}
\usepackage{algorithmic}
%\usepackage{algpseudocode}
\usepackage[algcompatible]{algpseudocode}
\usepackage{amsmath}
\begin{document}
\begin{algorithm}[!b]
\caption{algorithm 1}
\label{alg}
\begin{algorithmic}[1]
\Require
INFORMATION
\Ensure
Model;
\STATE CALCULATE
\STATE END
\RETURN MODEL
\end{algorithmic}
\end{algorithm}
\end{document}


When I compile it, it looks like this. No matter what I modified the content, the zero is always there.

## marked as duplicate by Werner, Kurt, Phelype Oleinik, Stefan Pinnow, TiuriFeb 4 at 17:04

• Yes. And I know the problem is algorithmic and algpseudocode which are not compatible. But I still have no idea how to solve it. – LC Dai Apr 10 '18 at 13:49

You may use the algorithm2e package

\documentclass[conference]{IEEEtran}
\usepackage[ruled,linesnumbered]{algorithm2e}
\SetKwInput{Require}{Require}
\SetKwInput{Ensure}{Ensure}
\usepackage{amsmath}
\begin{document}
\begin{algorithm}[!b]
\caption{algorithm 1}
\label{alg}
\SetAlgoLined
\Require{INFORMATION}
\Ensure{MODEL}
CALCULATE\\
END\\
\Return MODEL
\end{algorithm}
\end{document}

• It's normal, since commands starting with \algorithmic are defined by the algorithmic package. Have a look at the package documentation here Section 11, p32 to see how to define your own keywords, as well as already defined commands – BambOo Apr 10 '18 at 14:13
• I means that your solution is not compatible with the \Require and the \Ensure. Actually it works in my source code, but your solution skips it. – LC Dai Apr 10 '18 at 14:17
• As I said, everything is in the documentation. I edited the answer accordingly – BambOo Apr 10 '18 at 14:31
• Sorry it was totally my fault. Thank you very much! – LC Dai Apr 10 '18 at 15:10