If I have this script:


  \While{$x = y$}
    \State Something

I want to change while with repeat .. until. I tried \Repeat .. \Until but it doesn't work. How can I do that? Thank you

  • 1
    Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Apr 1, 2017 at 0:11

1 Answer 1


This is a snippet from the package documentation at http://tug.ctan.org/macros/latex/contrib/algorithmicx/algorithmicx.pdf (page 6).

enter image description here

  • It's giving me an error telling ! Undefined control sequence. at \repeat.
    – Nappa
    Jan 3, 2019 at 4:39
  • 1
    I was having the same issue and I realized the problem was that I wrote some statements without using \State prior to the loop. Dec 7, 2020 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.