# How can I remove/change the "Algorithm X" label from the caption of an algorithmicx algorithm?

I am using algpseudocode for writing an algorithm, and I would like to remove the "Algorithm X" from the title when adding a caption. How can I do this?

Example:

\documentclass{article}

\usepackage{algorithmicx, algpseudocode, algorithm}

\begin{document}

\begin{algorithm}
\textbf{Input:} Placeholder input \\
\textbf{Output:} Placeholder output
\begin{algorithmic}[1]
\Function{foo}{x} \\
\Return $x+1$
\EndFunction
\end{algorithmic}
\caption{Placeholder caption}
\label{placeholder}
\end{algorithm}

\end{document}


Output:

How can I remove "Algorithm 1" from the title, and replace it with my own text, say "My text 1", where the counter also increases? I would still like to have a caption at the top, I just want to replace "Algorithm 1" with something else. I tried using figure instead of algorithm, but I would like to have the other formatting (horizontal lines) that the algorithm environment provides.

I have seen this, but that refers to algorithmic, not algorithmicx. Additionally, I would prefer a solution that can be applied to a specific algorithm instead of the whole document, since I have other algorithms where I want to keep the title intact.

Thank you.

## Remove caption label and entry in \listofalgorithms

If you want to remove the caption label entirely, you could use the caption package and then \caption* (note, though, that this will remove the algorithm from the \listofalgorithms):

\documentclass{article}

\usepackage{caption}

\usepackage{algorithmicx, algpseudocode, algorithm}

\begin{document}

\begin{algorithm}
\textbf{Input:} Placeholder input \\
\textbf{Output:} Placeholder output
\begin{algorithmic}[1]
\Function{foo}{x} \\
\Return $x+1$
\EndFunction
\end{algorithmic}
\caption*{Placeholder caption} % <-- CHANGED LINE
\label{placeholder}
\end{algorithm}

\end{document}


## Remove caption label (\listofalgorithms unchanged)

Using the caption package again, we can use \captionsetup{labelformat=empty} (see p. 6 of the caption documentation).

\documentclass{article}

\usepackage{algorithmicx, algpseudocode, algorithm}

\usepackage{caption}

\begin{document}

\begin{algorithm}
\captionsetup{labelformat=empty} % <-- CHANGED LINE
\textbf{Input:} Placeholder input \\
\textbf{Output:} Placeholder output
\begin{algorithmic}[1]
\Function{foo}{x} \\
\Return $x+1$
\EndFunction
\end{algorithmic}
\caption{Placeholder caption}
\label{placeholder}
\end{algorithm}

\listofalgorithms

\end{document}


## Change caption label locally (\listofalgorithms unchanged)

If you want to locally change the caption label, you can use the \floatname command (see §4.4 of the algorithms documentation). For this you don't even need the caption package.

\documentclass{article}

\usepackage{algorithmicx, algpseudocode, algorithm}

\begin{document}

\begin{algorithm}
\floatname{algorithm}{Something} % <-- CHANGED LINE
\textbf{Input:} Placeholder input \\
\textbf{Output:} Placeholder output
\begin{algorithmic}[1]
\Function{foo}{x} \\
\Return $x+1$
\EndFunction
\end{algorithmic}
\caption{Placeholder caption}
\label{placeholder}
\end{algorithm}

\end{document}


• Thank you (+1), this is partly helpful. Is there a way to replace the "Algorithm" title with something else, however? I will accept this if I don't get a better solution. Apr 28, 2020 at 22:13
• @GoodDeeds Working on it, the question got edited a few seconds before I posted my answer Apr 28, 2020 at 22:16
• This is perfect, thank you! Appreciate your help in editing the question as well. Apr 29, 2020 at 3:21