I'm writing a document with a lot of listings ini it. I need to index the listing with the following format: "Listing a.b" with: a the chapter (arabic) and b the order of occurence in that chapter (arabic).

I have tried


But this creates a the chapter (arabic) and b the section of that chapter (arabic).

I have done similar thing for tables succesfully (in cls file), using:

\AtBeginDocument{ \renewcommand \thetable{\ifnum \c@chapter>\z@ \@arabic\c@chapter.\fi \@arabic\c@table} }

1 Answer 1


Found it! Apparently it's as simple as:


You must log in to answer this question.

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