I am wondering is it possible instead of Algorithm 1" it could be something else, like "Code 1" without modifying other algorithms in my latex file (or without globally changing things).
I see this question has been asked many times but all of the solutions are either using different algorithm package or globally modify algorithm properties.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath,amssymb}
\usepackage{amsthm}
\begin{document}
\begin{algorithm}[h]
\caption{Rule evaluator for classical attribute grammar}\label{alg:ag-eval}
\begin{algorithmic}
\Procedure{\texttt{AG\_EVAL}}{$r, Val$}
\If{$r \equiv v_0 \texttt{=} g( v_1, \dots, v_n)$}
\State $Val(v_0) \gets g( Val(v_1), \dots, Val(v_n))$
\EndIf
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
Best Answer
The trick was using
{ }
or group to wrap the algorithm to prevent changing global settings and usefloatname
command to update the name.Credit
Reference