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

I am trying to write an algorithm with multiple inputs in algorithm2e.

The result I would like to have is something like

Input: Input number 1
       Input number 2
       Input number 3

[Some clever algorithm]

The best I could do yet was one of those two solutions

\KwIn{Input number 1}
\KwIn{Input number 2\\ Input number 3

which archives

Input: Input number 1
Input: Input number 2
Input number 3

Any idea how to get the desired result?

share|improve this question
up vote 6 down vote accepted

You can define a new command to give you the desired indentation:




\KwIn{Input number 1}
\myinput{Input number 2}
\myinput{Input number 3 spanning more than one line just as an illustration for the example}


enter image description here

share|improve this answer
Works fantastic. Thank's a lot! – Thilo Jul 21 '12 at 18:58

works fine

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Welcome to TeX.sx! This is a good to suggestion. To help future visitors please make this in to a complete minimal working example (MWE), cf. Gonzalo Medina's answer. – Andrew Swann Apr 25 '13 at 8:11

Your Answer


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.