Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ....

share|improve this question
    
please make this a complete document showing all packages used –  David Carlisle Sep 30 '12 at 18:01
    
Those errors are unrelated to the translation to French problem, you wuld get them even without the redefinition from For to Pour (which would need to be \renewcommand not \newcommand . It is much easier to answer questions if they contain a single code section starting \documentclass and ending \end{document} If your question had a working document using english keywords someone could show you how to redefine the commands to make it use French keywords. algorithmic appears to define \FOR not \For and doesn't define \Begin as far as I can see. –  David Carlisle Sep 30 '12 at 21:33
    
thank you for answer but i can't find in the list Algorithm --> Algorithme have you an idea please ? –  researcher Sep 30 '12 at 22:01
    
That's from algorithm.sty not algorithmic \newcommand{\ALG@name}{Algorithm} \newcommand{\listalgorithmname}{List of \ALG@name s} to rename \ALG@name you need \makeatletter \makeatother but please post a _complete_example that works in English then it is easy to post an answer using French.then –  David Carlisle Sep 30 '12 at 22:04
    
i add this \renewcommand{\ALG@name}{Algorithm} \renewcommand{\listalgorithmname}{List of \ALG@name s} \makeatletter \makeatother in \begin{document} ? –  researcher Sep 30 '12 at 22:15
show 9 more comments

1 Answer

up vote 8 down vote accepted

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.

share|improve this answer
    
have you an idea please ? –  researcher Sep 30 '12 at 17:50
    
Please edit the question to have a complete document that shows the problem. –  David Carlisle Sep 30 '12 at 17:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.