# How can I put a period right after the algorithm's number in the algorithm's title?

I wish it said "Algorithm 1.", with a period after the number, and not just "Algorithm 1". It's how I see most people using it, so I must be using an unconventional package? Would you say I should stick to the default? It's not ugly.

\documentclass{article}

\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\caption{Some random algorithm}
\begin{algorithmic}[0]
\Procedure{random}{}:
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}


Use caption to change the labelsep method to period. Since the original caption sets the algorithm label in bold, we also change labelfont to bf.

\documentclass{article}

\usepackage{algorithm,caption}
\usepackage{algpseudocode}

\captionsetup[algorithm]{
labelfont = bf,
labelsep = period
}

\begin{document}

\begin{algorithm}
\caption{Some random algorithm}
\begin{algorithmic}[0]
\Procedure{random}{}
\EndProcedure
\end{algorithmic}
\end{algorithm}

\end{document}


The usual way seems to work. (See here for further examples.)

\documentclass{article}

\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\renewcommand\thealgorithm{\arabic{algorithm}.}
\begin{algorithm}
\caption{Some random algorithm}
\begin{algorithmic}[0]
\Procedure{random}{}:
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}


• While this works in terms of the presentation you'll see an issue when you use \label-\ref. The period will carry to \ref. – Werner Feb 24 at 3:32
• @Werner It depends on what the OP wants. And it is no problem to remove the period, as you probably know. And if you really think it is a reason for concern, make the comment under this answer. – user121799 Feb 24 at 3:33
• Everything depends on what the OP wants. And the main principle is to insert the period, not remove it. Why reference Gonzalo's answer? – Werner Feb 24 at 8:43
• @Werner Because in Gonzalo's answer the same trick is used. – user121799 Feb 24 at 11:31
• His answer correctly applies changes to the counter representation because it only contains numbers, not punctuation. Same "trick," but a correct application. – Werner Feb 24 at 16:38