1

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

\renewcommand\thealgorithm{Cool.\arabic{algorithm}}

(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.

6
  • 2
    Can you post your complete MWE, please?
    – Sebastiano
    Commented Sep 16, 2018 at 20:48
  • 3
    Section 9.2 of algorithm2e documentation may help
    – BambOo
    Commented Sep 16, 2018 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
    Commented Sep 17, 2018 at 13:58
  • @BambOo Thanks. \SetAlgoRefName{} works on a per algorithm basis but then I have to manually set every algorithm.
    – F Lekschas
    Commented Sep 17, 2018 at 13:59
  • Did you try to define \SetAlgoRefName{} in your preamble ?
    – BambOo
    Commented Sep 17, 2018 at 14:47

1 Answer 1

1

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

\renewcommand{\thealgocf}{S\arabic{algocf}}

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

You must log in to answer this question.

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