The title said it all…I want to combine the two under one list with the title "Algorithms and program code". Style wise the page should match the usual style of the other lists (\listoffigures
, \listoftables
, … itd.). Is there a way to do this?
Combine \listoflistings and \listofalgorithms – Creating Unified Lists in LaTeX
algorithmslistingstable of contents
Best Answer
The contents lines and environment counters are added/incremented by
\caption
. So to change the list that an environment appears on, thecaption
command can be modified/extended. To keep the two environments in numerical sequence (ie as if they were the same environment) one can be incremented when the other iscaption
'd.The MWE defines
algCaption
that adds its argument to thelstlisting
and then increments thelstlisting
counter. Whenever alstlisting
environment is used, thealgorithm
counter is incremented withAtBeginEnvironment
. One problem that I can see with this solution is that there is still alistofalgorithms
being produced bycaption
.