# Modify Algorithm name in French

This is my code:

\usepackage[section]{algorithm}
\usepackage{algorithmic}
\begin{document}
\makeatletter\renewcommand{\ALG@name}{Algorithme}
\renewcommand{\listalgorithmname}{Liste des \ALG@name s} \makeatother
\begin{algorithm}[H]
\caption{My-algo}
\begin{algorithmic}[1]
\Debut
\LState instruction1
\Fin
\end{algorithmic}
\end{algorithm}
\end{document}


With this code I have Algorithme instead Algorithm. Please I ask if you have an idea, I have one algorithm that I'd like to change Algorithme --> Pseudo Algorithme ? How can I do it please? Just one algorithm, not all of them.

-
Would you please remove \include{Chapter 1} from your example (we obviously do not have this your file). Instead of that, put there the algorithm you want to modify, so that it is a Minimal Working Example. –  tohecz Dec 6 '12 at 18:49

## 1 Answer

The following minimal example defined \newalgname{<alg name>} that you can call from within an algorithm environment in order to change the name of the algorithm. Since you call it within algorithm, the redefinition of \ALG@name would be local, so it only affects the specific algorithm you're in.

Algorithme 0.1 My-algo
...

Pseudo Algorithme 0.2 My-algo
...

Algorithme 0.3 My-algo
...

\documentclass{article}
\usepackage[section]{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\makeatletter
\newcommand{\newalgname}[1]{%
\renewcommand{\ALG@name}{#1}%
}
\newalgname{Algorithme}% All algorithms will be called "Algorithme"
\renewcommand{\listalgorithmname}{Liste des \ALG@name s}
\makeatother
\begin{document}
\begin{algorithm}
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\newalgname{Pseudo Algorithme}% This algorithm will be called "Pseudo Algorithme"
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{algorithm}

\end{document}


It would also be possible, perhaps based on your requirements, to create an entirely new floating environment that is specific to "Pseudo Algorithme"s. This is possible using the float package, loaded by algorithm by default. It will have it's own counter and therefore will be numbered independently from the algorithm environment. Here's a quick view on that:

Algorithme 1 My-algo
...

Pseudo Algorithme 1 My-algo
...

Algorithme 2 My-algo
...

\documentclass{article}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\newfloat{pseudoalgorithm}{htb}{lop}
\floatname{pseudoalgorithm}{Pseudo Algorithme}
\makeatletter
\newcommand{\newalgname}[1]{%
\renewcommand{\ALG@name}{#1}%
}
\newalgname{Algorithme}
\renewcommand{\listalgorithmname}{Liste des \ALG@name s}
\makeatother
\begin{document}
\begin{algorithm}
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{algorithm}

\begin{pseudoalgorithm}
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{pseudoalgorithm}

\begin{algorithm}
\caption{My-algo}
\begin{algorithmic}[1]
\STATE \textbf{Begin}
\STATE instruction1
\STATE \textbf{End}
\end{algorithmic}
\end{algorithm}

\end{document}


Counter adjustments are also easy. The first example (in the article document class) used

\usepackage[section]{algorithm}% http://ctan.org/pkg/algorithms


which passes the option section to algorithm. This implies that algorithm numbering will be by-section. That is, algorithms in section 7 (say) will be numbered 7.1, 7.2, and so on. If your document class supports \chapter (like book or report), then using

\usepackage[chapter]{algorithm}% http://ctan.org/pkg/algorithms


would do the same just for chapters. This also means that numbering of algorithms will be reset at the start of every chapter.

In the second example, no option was passed to the algorithm package, and numbering was continuous throughout the document (across any sectional unit).

To have the same numbering for your pseudoalgorithm environment, you can create it with

\newfloat{pseudoalgorithm}{htb}{lop}[<within>]


where <within> specifies the sectional unit that you want the numbering to be done with (chapter, section, ...). A discussion around the creation of a new float in this way is contained within the float documentation (section 2 The User Interface - New Floats, p 2).

-
Thank you so much for answer :) i have Pseudo Algorithme 2 but it's the fisrt pseudo algo , please how can reinitialize it to 1? –  researcher Dec 6 '12 at 20:22
@researcher: Do you want to include the pseudo codes in your List of Algorithmes? I assume you do not want to do that. Otherwise I would think it might be better to create a separate pseudoalgorithm environment. Let me know. –  Werner Dec 6 '12 at 20:25
no it's Pseudo Algorithme,, but i should have Pseudo Algorithme 1 –  researcher Dec 6 '12 at 20:26
Unless you have plenty of both Alg. and Pseudo Alg., I would suggest you to use one counter for both, i.e., have Alg. 1, PsAlg. 2, Alg. 3, Alg. 4, ..., Alg. 57, PsAlg. 58, ... I think that the reader might find it more convinient in the end. –  tohecz Dec 6 '12 at 20:33
i want Algoorithme 1, Pseudo Algorithme 1, is that possible ? –  researcher Dec 6 '12 at 20:41