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:
Best Answer
You could use
SetKwInput
for the first conditions, asSetKwInOut
works just adjusting the space as you have seen.Here an example
result: