TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a follow-up question to Option in the algorithm with Latex. This is my algorithm:

 \caption{My algo}
 \LState instruction 1
 \LState instruction 2

enter image description here

Please how can I add "Données" before "Début" ?

share|improve this question

closed as too localized by Stephan Lehmke, Gonzalo Medina, Thorsten, Stefan Kottwitz Oct 11 '12 at 6:01

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

How did you define \Debut and \Fin? – Gonzalo Medina Oct 10 '12 at 22:09
it is werner'algo :\algnewcommand{\Debut}{\Statex \textbf{D\'ebut}\pushindent} \algnewcommand{\Fin}{\Statex \textbf{Fin}\popindent} – researcher Oct 10 '12 at 22:10
Then define \Donnees in a similar way: \algnewcommand{\Donnees}{\Statex\textbf{Donn\'ees}\pushindent} – Gonzalo Medina Oct 10 '12 at 22:12
thank you Gonzalo :) – researcher Oct 10 '12 at 22:27
up vote 3 down vote accepted


\algnewcommand{\Donnees}{\Statex \textbf{Donn\'ees}}

you can now obtain

enter image description here

  \caption{My algorithme}
    \Donnees: My data
    \Statex% Blank line
      \LState $r\gets a\bmod b$
      \While{$r\not=0$}\Comment{We have the answer if r is 0}
        \LState $a\gets b$
        \LState $b\gets r$
        \LState $r\gets a\bmod b$
      \LState \textbf{Retour} $b$\Comment{The gcd is b}

The use of \Statex inserts a blank line, depending on whether you need a separation between the algorithm and the input.

The above code snippet uses the same preamble as in Option in the algorithm with LaTeX.

share|improve this answer
Please i have one more question: when i divide the algorithm after an IF and before an EndIF, i have an error , have you an idea please? – researcher Dec 11 '12 at 16:11

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