I read the documentation of the package algorithm2e to figure out how to insert continue command within a while loop, but I couldn't find any way to do it. Is there any work-around for this lack of syntax in this package?

1 Answer 1


You can define custom keywords using the \SetKw command, as described in Section 11 of the manual. MWE:


    \KwData{this text}
    \KwResult{how to write algorithm with \LaTeX2e }
    \While{not at end of this document}{
        read current\;
            go to next section\;
            current section becomes this one\;
            go back to the beginning of current section\;
    \caption{How to write algorithms}


enter image description here

Note: for future questions, please always provide an example of code that you have tried, so it is easier to provide a solution.

  • Thanks! I didn't know that it is possible to define new keywords for the package algorithms2e.
    – Rasoul
    Mar 12, 2016 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .