I use the algorithm2e
package to typeset algorithms with custom keywords for input and output.
When using \SetKwInput{KwInput}{Input}
to define the keywords, colons are added but input and output are not aligned.
When using \SetKwInOut{KwInput}{Input}
the text is aligned. However, the colon is at the right, so there will be ugly space like "Input :" that creates eye cancer.
My question is: How can I get the output (shown in the image below) without fiddling with \hspace
in every algorithm
environment?
Here is a MWE:
\documentclass[a4paper]{article}
\usepackage[ruled]{algorithm2e}
% Define keywords
\SetKwInput{KwInput}{Input}
\SetKwInput{KwOutput}{Output}
% This aligns the colons
%\SetKwInOut{KwInput}{Input}
%\SetKwInOut{KwOutput}{Output}
\begin{document}
\begin{algorithm}[h]
\KwInput{Network}
\KwOutput{Flow}
\begin{enumerate}
\item Start with $\ldots$
\end{enumerate}
\caption{Some algorithm.}
\end{algorithm}
\end{document}