# Mutliple inputs with line breaking

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

The result I would like to have is something like

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

\begin{algorithm}
\KwIn{Input number 1}
\KwIn{Input number 2\\ Input number 3
\end{algorithm}


which archives

Algorithm
-------------------
Input: Input number 1
Input: Input number 2
Input number 3


Any idea how to get the desired result?

-

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

\documentclass{article}
\usepackage{algorithm2e}

\newlength\mylen
\newcommand\myinput[1]{%
\settowidth\mylen{\KwIn{}}%
\setlength\hangindent{\mylen}%
\hspace*{\mylen}#1\\}

\begin{document}

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

\end{document}


-
Works fantastic. Thank's a lot! – Thilo Jul 21 '12 at 18:58
\SetKwInOut{Input}{input}
\Input{a\\
b\\
c
}


works fine

-

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