I'm using the package algorithm2e and create a list of algorithms with \listofalgorithms. My problem is that not only the algorithms (algorithm), but also the functions (function) are displayed in the list of algorithms.

Is it somehow possible that the function func() (see the following example) is not shown in the list of algorithms?




\caption{Foo bar} 




1 Answer 1


This behaviour is descriped in the documentation at page 17:

label now puts the name (the text before the braces in the caption) of the procedure or function as reference (not the number like a classic algorithm environment).

You can change it by redefining some internals of the package:

  % we tell hyperref to use algocfproc as category and to take the appropriate ref.
  \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else...
      \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%if procnumbered, take \thealgocf as ref
      \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%else take procedure or function name
    \addtocounter{algocf}{-1}% \caption do a refstepcounter, so we restore the precedent value
    \gdef\@currentlabel{\algocf@captname#3@}% let the label be the name of the function, not the counter
  \ifthenelse{\equal{\algocf@captparam#2@}{\arg@e}}{% if no paramater, we remove the ()
  }{%                                                 else we give the complete name

I removed the following statement:


You must log in to answer this question.

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