When using the algorithm package it is possible to prefix algorithm numbers with a string (in this example Cool.) like so:


(This works for a bunch of other elements as well as explained in detail at https://www.stat.berkeley.edu/~paciorek/computingTips/Customizing_numbering_pages.html)

The same setting does not work with the algorithm2e package. Is there another way to prefix algorithm numbers with algorithm2e?

Update: It's possible to provide a custom reference name using \SetAlgoRefName{XYZ} but that requires manual setting of every reference name. I am wondering if it's possible to automatically / globally prefix all algorithm numbers.

  • 2
    Can you post your complete MWE, please? – Sebastiano Sep 16 '18 at 20:48
  • 3
    Section 9.2 of algorithm2e documentation may help – BambOo Sep 16 '18 at 21:04
  • @Sebastiano What does MWE stand for and what are you missing? I am trying to find out how to prefix algorithm numbers with a specific string so that Algorithm 1:... turns into Algorithm Cool.1:.... – F Lekschas Sep 17 '18 at 13:58
  • @BambOo Thanks. \SetAlgoRefName{} works on a per algorithm basis but then I have to manually set every algorithm. – F Lekschas Sep 17 '18 at 13:59
  • Did you try to define \SetAlgoRefName{} in your preamble ? – BambOo Sep 17 '18 at 14:47

Thanks to this post, I found out algorithm2e's correct counter name. The following allows customizing the enumeration of algorithm2e numbers:


I.e., the first algorithm's number is now S1 instead of 1

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.