I have part of an algorithm that branches off from another algorithm, so I would like to present the numbering of the steps starting from that number instead of 1. Right now, I have it set up as follows:

    \STATE Step 5
    \STATE Step 6

I've found a few things about how to change line numbering, but couldn't make anything affect the step numbering.


Store the counter and restore it using TeX's \label-\ref system and the support of refcount:

enter image description here




    \STATE First step
    \STATE Second step
    \STATE Third step
    \STATE Fourth step \label{alg:last-step}

    \STATE Fifth step
    \STATE Sixth step


Note that algorithmicx provides \algsave and \algrestore, specifically for this purpose.

| improve this answer | |
  • Actually it's ALG@line not ALC@line. – foobar Feb 17 '18 at 17:25
  • @foobar: Why do you say that? Have you tried it? – Werner Feb 18 '18 at 4:37
  • Yes. I tried with ALC@line and it didn't work. Changing it to ALG@line it was fine. Not sure, maybe different settings. – foobar Feb 18 '18 at 13:44
  • @foobar: The algorithms bundle - that produces algorithmic.sty - has not been updated since 2009. You can search for ALC@line in algorithms.dtx. My guess is you may have a local (updated/variation) copy of algorithmic.sty. – Werner Feb 18 '18 at 16:27

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.