4

The following code numbers each line in the algorithm as <number><colon>. Is there a way to number each line as <number><period>?

\documentclass{article}
\usepackage{algorithm, algorithmic}

\begin{document}

\begin{algorithm}[H]
\caption{An algorithm}
\begin{algorithmic}[1]
\REQUIRE Input
\STATE A
\STATE B
\STATE C
\STATE D
\end{algorithmic}
\end{algorithm}

\end{document}
2

You can adjust the line number delimiter using

\algsetup{
  linenodelimiter = {.}
}

Here is a visual of using a default and .:

enter image description here

\documentclass{article}

\usepackage{algorithm,algorithmic}

\begin{document}

\begin{algorithm}[H]
  \caption{An algorithm}
  \begin{algorithmic}[1]
    \REQUIRE Input
    \STATE A
    \STATE B
    \STATE C
    \STATE D
  \end{algorithmic}
\end{algorithm}

  \algsetup{
    linenodelimiter={.}
  }

\begin{algorithm}[H]
  \caption{An algorithm}
  \begin{algorithmic}[1]
    \REQUIRE Input
    \STATE A
    \STATE B
    \STATE C
    \STATE D
  \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.