For the following algorithm, I get four spaces for each text line inside the loop. How can I get only two or three spaces? Some of my text lines go to next line. I want to save some horizontal spaces.
\usepackage[noline,boxruled,commentsnumbered,linesnumbered,titlenumbered]{algorithm2e}
\IncMargin{0.5em}
\begin{algorithm}
\SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
\SetKwFor{Foreach}{for each}{do}{endfor}
\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}
\BlankLine
\Input{A method \emph{m}}
\Output{result}
\BlankLine
\Foreach { $x \in M_{x}$}{
do something
}
\caption{Algorithm}\label{Method}
\end{algorithm}
\SetInd{0.1ex}{0.1ex}
, where the first parameter is the space before, and the 2nd is the space after. It would be helpful if you turned your code into a fully compilable MWE including\documentclass
and the appropriate packages that reproduces the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.em
is actually the correct unit to use for horizontal spacing.