I've been trying to use this answer Changing label name for algorithm to no avail. I use the packages:
\usepackage{algorithm}
\usepackage{algpseudocode}
And this code for defining new environment:
\newenvironment{megaalgorithm}[1][htb]{
\renewcommand{\algorithmcfname}{MegaAlgorithm}% Update algorithm name
\begin{algorithm}[#1]%
}{\end{algorithm}}
But then it tells me that there is an error:
Latex Error: \algorithmcfname undefined
I can't use algorithm2e
as in previous example as it breaks my current code.
Best Answer
The right one when using the
algorithm
package is\ALG@name
and not\algorithmcfname
.So you have to define your new environment as
MWE
In
algorithm.sty
(part of thealgorithms
bundle) you can find:and
So, another option is to define your new environment as
The first method is taken directly from the style file, while the latter can be found in subsection 4.4, "Customization", of the
algorithms
documentation