1

I am using Overleaf to write an article in IEEE transactions template. I wish to write the caption of Algorithm as, Algorithm 4: (as shown in the picture below). But when I use my code, it shows Algorithm 4 (without full colon). The code I am using for caption is,

\documentclass[journal]{IEEEtran}

\usepackage{algorithm,algorithmic}

\begin{document}

\begin{algorithm}

\caption{Deployment Strategy}

  \begin{algorithmic} [1]

 \renewcommand{\algorithmicrequire}{\textbf{Input:}}

 \renewcommand{\algorithmicensure}{\textbf{Output:}}

 \REQUIRE AP1=(x,y)\\   

 Total APs= $T_{AP}$

 \ENSURE  All candidate positions C\{1:End\}


 \end{algorithmic} 

\end{algorithm}

\end{document}

required

  • Hi Sohaib! Could you add a complete minimal working example (MWE) that illustrates the problem to your question? The solution might depend on other things in your preamble, that we can't see right now. Reproducing the problem and finding out what the issue is will be much easier when we see complete compilable code, starting with \documentclass{...} and ending with \end{document}. – Paul Gessler Feb 1 at 14:50
  • I have added the MWE. I hope it has enough details for this specific problem. – Sohaib Bin Altaf Feb 1 at 15:43
  • @PaulGessler thanks for your reply. I hope you can help me solve this problem. – Sohaib Bin Altaf Feb 1 at 15:46
2

You can update \fnum@algorithm which is used to set the label and number of the algorithm \caption. I've just added : to the original definition.

enter image description here

\documentclass[journal]{IEEEtran}

\usepackage{algorithm,algorithmic}

\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}

\makeatletter
\renewcommand{\fnum@algorithm}{\fname@algorithm{} \thealgorithm:}
\makeatother

\begin{document}

\begin{algorithm}
  \caption{Deployment Strategy}
  \begin{algorithmic}[1]
    \REQUIRE \begin{tabular}[t]{ @{}l@{} }
      $AP1 = (x,y)$ \\
      Total $APs = T_{AP}$
    \end{tabular}
    \ENSURE All candidate positions $C\{1:\mbox{End}\}$
  \end{algorithmic} 
\end{algorithm}

\end{document}

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.