Could you please help in the following issues with the algorithme package, the French version of algorithm?

  1. I wanted to number the lines; but the option linesnumbered does not work, like in algorithm.

  2. There is an extra space after the parenthesis (in the resulting code), which I tried to remove but it does not work.

Unfortunately, I could not use the algorithm package, I need my pseudo-code to be written in French.

Here is a MWE followed by the image of the result:

{\Type{Donnée x}{entier}}
    \IfThenElse{x mod 2 = 0}

Resulting pseudo-code:


You can use the following definitions made from algorithm2e to replicate your output for the unknown algorithme.sty:

enter image description here



\newcommand{\Mod}[1]{\ (\text{mod}\ #1)}% http://tex.stackexchange.com/a/137076/5764

\newcounter{fargs}% Count number of arguments per function
  \stepcounter{fargs}% A new argument
  \ifnum\value{fargs}=1 (\else, \fi% Separator between arguments
  {#1}: {\KwSty{#2}}}
\newcommand{\FOutput}[1]{\unskip\ifnum\value{fargs}>0)\fi: {\KwSty{#1}}}

\SetKwIF{Si}{SinonSi}{Sinon}% LaTeX macros
  {Si}{Alors}{Sinon Si}{Sinon}{Fin Si}% Text set

\renewcommand{\ProgSty}[1]{{\textnormal #1}\unskip}
\renewcommand{\ArgSty}[1]{{\textnormal #1}\unskip}
\SetAlgorithmName{Algorithme}{Liste des Algorithmes}


  %\caption{Some algorithm}
  \Fonction{\FName{Pair} \FInput{Donnée x}{entier} \FInput{Donnée y}{entier} \FOutput{booléen}}
    \eSi{\mbox{$x \Mod{2} = 0$}}{


If you truly want a red styled algorithm, you can update the algorithme environment in the following way:



enter image description here

I made a slight change to the interface, which should be more intuitive.

| improve this answer | |
  • Thanks Werner it fits my needs. Also, the color tip works very well. – Amer Draa Oct 12 '16 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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