0

Consider the following snippet:

\documentclass{article}
\usepackage[textwidth=8.5cm]{geometry}

\usepackage{amsmath}

\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{parskip}
\pagenumbering{gobble}



\begin{document}
    \hrule
    \smallskip
    \begin{algorithmic}[1]
        \State Initialize $Q$ to hold all pairs $(w_i,w_j)$ s.t. $v_i$ and $v_j$ are T-C
        \While {Sequence size is bigger than 1}
        \State Find T-C pair $(w_i,w_j)$ s.t. $w_i+w_j$ is minimal
        \State Combine $v_i$ and $v_j$ to a new node $v_k$, and form new sequence (if $v_i$ and $v_j$ are non-adjacent, let $v_k$ take the left position in the resultant sequence)
        \State Update $Q$ accordingly
        \EndWhile
    \end{algorithmic}
    \smallskip
    \hrule
\end{document}

Which produces the following:

enter image description here

How can I indent the lines in step 4. to be aligned with the other lines in the While loop?
I tried breaking them with // or adding \hspace{} but this didn't work...

1 Answers1

-1

Try \State \parbox[t]{\dimexpr\linewidth-\algorithmicindent}{long sentences}

chips
  • 9
  • Use backticks to highlight inline code. Unfortunately you have not answered the question, or explained what you are trying to do, so people will mark you down.... –  Jan 28 '16 at 07:32