0

I would like to adjust column width in algorithm below:

\usepackage{amsmath,amssymb}
\usepackage[norelsize, linesnumbered, ruled, lined, commentsnumbered]{algorithm2e}
\begin{document}
%\begin{minipage}[t]{0.5\linewidth}

\begin{algorithm*}
    \DontPrintSemicolon
    \KwIn{This is a input lines.}
    \KwOut{$n$ shadow images $S_1,S_2,\dots, S_n$. }

    \For{$(i=0;i< M;i++)$}{
        \For{$(j=0;j<\frac{N}{d};j++)$}{
            Assign  $a_0,a_1,\dots,a_{k-1}$ as follows:\;
        }
    }
    \caption{This is a long caption of the algorithm. So I need to break this long line into small multiple lines.} \label{Alg:1}
\end{algorithm*}
%\end{minipage}

\end{document}

Unfortunately whenever I am going to use minipage, occurs error. I can I fix this?

  • 2
    algorithm* seems to be a floating environment, so it can't go in a minipage the same way a figure can't. Try moving the minipage inside the algorithm* – Phelype Oleinik Dec 2 '19 at 12:14
  • 1
    This works fine for me. Thank you very much. @ PhelypeOleinik – MKS Dec 2 '19 at 12:38
  • You're welcome :-) I linked to a possibly better solution. – Phelype Oleinik Dec 2 '19 at 12:48