[Tex/LaTex] Package Algorithmic in French

algorithms

I use

\usepackage[section]{algorithm}  
\usepackage{algorithmic}

to create an algorithm, I'd like to change "algorithm, begin, end while …" to French. Is that possible?

This is my example with the package \usepackage{algorithmic}:

\newcommand{\algorithmicfor}{\textbf{Pour}}
\begin{algorithm}[H] 
\Begin{ \For{$x\in X$}{ $NbSuccInS(x) 
\longleftarrow 0$\; $NbPredInMin(x) 
\longleftarrow 0$\; $NbPredNotInMin(x) 
\longleftarrow |ImPred(x)|$\; 
} } 
\caption{My Algorithm} \label{alg:test} 
 \end{algorithm} 

I have these errors: undefined control sequence \Begin \for, \newcommand ….

Best Answer

The package defines all the fixed text words using simple macros that you can redefine with \renewcommand so for example

\newcommand{\algorithmicrequire}{\textbf{Require:}}
\newcommand{\algorithmicensure}{\textbf{Ensure:}}
\newcommand{\algorithmiccomment}[1]{\{#1\}}
\newcommand{\algorithmicend}{\textbf{end}}
\newcommand{\algorithmicif}{\textbf{if}}
\newcommand{\algorithmicthen}{\textbf{then}}
\newcommand{\algorithmicelse}{\textbf{else}}
\newcommand{\algorithmicelsif}{\algorithmicelse\ \algorithmicif}
\newcommand{\algorithmicendif}{\algorithmicend\ \algorithmicif}
\newcommand{\algorithmicfor}{\textbf{for}}
\newcommand{\algorithmicforall}{\textbf{for all}}
\newcommand{\algorithmicdo}{\textbf{do}}
\newcommand{\algorithmicendfor}{\algorithmicend\ \algorithmicfor}
\newcommand{\algorithmicwhile}{\textbf{while}}

if you change \newcommand to \renewcommand and change the English words to French to redefine these commands after loading the package it should all work I think.

Related Question