# algorithm2e - How to remove space between colon and text?

How can I reduce this large space between colon and text in line with Input: ? Also please how to remove align of text after Input: and Precondition: ? I am using algorithm2e. Is it possible with this package? Here is my code:

\documentclass{article}

\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{amsmath}
\usepackage{setspace}

\begin{document}

\begin{algorithm}
\SetAlgorithmName{Algorithm}{}{}
\SetKwInOut{Precondition}{Precondition~}
\SetKwInOut{Input}{Input~}
\Input{~There is some fancy input definition.}
\Precondition {~There is some fancy precondition.}
\begin{doublespace}
\eIf{$b=0$}
{
return $a$
}
{
$b$
}
\end{doublespace}
\caption{Best algorithm ever.}
\end{algorithm}

\end{document}


This is actual state:

This is wanted final state:

• Your example, apart from not being complete, also does not compile – Moriambar Apr 28 '17 at 22:04
• @Moriambar Sorry for that, should be ok now. – delusionX Apr 28 '17 at 22:12

You could use SetKwInput for the first conditions, as SetKwInOut works just adjusting the space as you have seen.

Here an example

\documentclass{article}

\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{amsmath}
\usepackage{setspace}

\begin{document}

\begin{algorithm}
\SetAlgorithmName{Algorithm}{}{}
\SetKwInput{Precondition}{Precondition~}
\SetKwInput{Input}{Input~}

\Input{~There is some fancy input definition.}
\Precondition {~There is some fancy precondition.}
\begin{doublespace}
\eIf{$b=0$}
{
return $a$
}
{
$b$
}
\end{doublespace}
\caption{Best algorithm ever.}
\end{algorithm}

\end{document}


result: