In algorithm2e
, if you use the "ruled" option, the caption of algorithms are automatically numbered. E.g. if you write 2 algorithms in one document, the first one will be titled Algorithm 1 and the second one will be titled Algorithm 2. How can I customize this number? Say I only write one algorithm and want it to be titled "Algorithm 3" as shown by the picture below.
[Tex/LaTex] How to customize the number in the caption of an algorithm in algorithm2e
algorithm2enumbering
Best Answer
You could just force the counter associated with that environment.
Note that, in typical LaTeX fashion, counters are incremented just before they're used. So, in order to force the algorithm to start as
Algorithm 3
(say), one would set the associated counter to 2. The counter used byalgorithm2e
for thealgorithm
environment isalgocf
(named after the author, Christophe Fiorio, I presume). So, usingimmediately before using the
algorithm
environment would set the following algorithm asAlgorithm 3
.The following example is taken from the
algorithm2e
documentation: