[Tex/LaTex] Rename algorithm caption

algorithms

How to rename algorithm caption name from Algorithm to some name. This is my code:

\documentclass[oneside,a4paper  , 12 pt, titlepage]{book}


\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{listings}
\usepackage{algcompatible}
\usepackage{algpseudocode}

\renewcommand*{\ALG@name}{Algoritma}


\begin{document}
\begin{algorithm}[h!]
\caption{Algoritma direct search}\label{direct search}
\begin{algorithmic}[1]
\Procedure{Direct-Search}{$G$}
\For{$i \gets  1,\, G.length$}
    \For {$j \gets 1, \, i- 1$}
        \State  $r \gets  \Call {distance}{G_i ,G_j} $
        \If {$r \le treshoold $ }
            \State  $ \Call{calculate-interaction}{G_i,G_j}$
        \EndIf 
    \EndFor 
\EndFor
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}

and my error:

Missing \begin{document}. \renewcommand*{\ALG@name}

Best Answer

Since your redefinition has the @ character, you need \makeatletter, \makeatother:

\makeatletter
\renewcommand*{\ALG@name}{Algoritma}
\makeatother

The code:

\documentclass[oneside,a4paper  , 12 pt, titlepage]{book}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{listings}
\usepackage{algcompatible}
\usepackage{algpseudocode}

\makeatletter
\renewcommand*{\ALG@name}{Algoritma}
\makeatother

\begin{document}
\begin{algorithm}
\caption{Algoritma direct search}\label{direct search}
\begin{algorithmic}[1]
\Procedure{Direct-Search}{$G$}
\For{$i \gets  1,\, G.length$}
    \For {$j \gets 1, \, i- 1$}
        \State  $r \gets  \Call {distance}{G_i ,G_j} $
        \If {$r \le treshoold $ }
            \State  $ \Call{calculate-interaction}{G_i,G_j}$
        \EndIf 
    \EndFor 
\EndFor
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}

enter image description here

I'd suggest you not to use such a restrictive placement option as [!h].