2

I am using algorithmicx package in LaTeX to write an algorithm and a procedure in my LaTeX file. I want LaTeX to number the procedures differently, but the numbering is the same as algorithms. Is there any way to have an independent numbering for the procedures?

\documentclass[12pt]{article}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}

\begin{algorithm}[h]                
\caption{Set $S$} \label{alg001}
\begin{algorithmic}[1]
    \State $S \gets \emptyset$;
\end{algorithmic}
\end{algorithm}

\floatname{algorithm}{Procedure}
\begin{algorithm}[h]
 \begin{algorithmic}[1]
 \Procedure{Proc}{$A,B$}
     \State $T \gets \emptyset$;
 \EndProcedure
 \end{algorithmic}
 \caption{The Procedure}
\end{algorithm}


\end{document}
1

It may be done better, but the idea should be clear. We define the second algorithm-like float.

\documentclass[12pt]{article}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}




\newfloat{procedure}{htbp}{loa}
\floatname{procedure}{Procedure} %It may be done better


\begin{algorithm}[h]                
\caption{Set $S$} \label{alg001}
\begin{algorithmic}[1]
    \State $S \gets \emptyset$;
\end{algorithmic}
\end{algorithm}

%\floatname{algorithm}{Procedure}
%\begin{algorithm}[h]
\begin{procedure}
 \begin{algorithmic}[1]
 \Procedure{Proc}{$A,B$}
     \State $T \gets \emptyset$;
 \EndProcedure
 \end{algorithmic}
 \caption{The Procedure}
%\end{algorithm}
\end{procedure}


\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.