Text Formattinglistings | Change the Listings Entry in ToC

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

listings | Change the Listings Entry in ToC

Post by Cham »

I added the list of listings at the end of my document, and its entry is appearing in the Table of Content (just before the table of figures), which is nice. However, its name is simply "Listings" in the ToC, and I would like to change it to "Liste des codes" (in French). How can I do that ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

listings | Change the Listings Entry in ToC

Post by Stefan Kottwitz »

Hi Cham,

redefine \lstlistlistingname, this macro contains the header name for the list of listings, as described in the listings documentation.

Code: Select all

\renewcommand*{\lstlistlistingname}{Liste des codes}
Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: listings | Change the Listings Entry in ToC

Post by Cham »

Great. Now, why the "*" in this command ?

And one last glitch : currently, the list is working, but their number aren't right for the codes from my appendix. I simply get something like this :

1 Code bla bla
2 Code bla bla bla

instead of

A.1 Code bla bla
A.2 Code bla bla bla
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

listings | Change the Listings Entry in ToC

Post by Stefan Kottwitz »

Cham wrote:Great. Now, why the "*" in this command ?
An answer is here:
Stefan_K wrote:The star marks a "short command", parameters for such commands must not contain paragraph breaks, making it easier to locate errors with some LaTeX error messages. That's why I prefer short commands when their parameters cannot exceed a paragraph, that's also the case when there are no parameters at all.
Cham wrote:currently, the list is working, but their number aren't right for the codes from my appendix.
You need a chapter or a section for your appendix. Perhaps post with details (class, how you make the appendix). Also here, a new thread would be appropriate, as readers don't expect such a question here, as the title is about ToC entries.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: listings | Change the Listings Entry in ToC

Post by Cham »

Ok.

But the case of my appendix is a bit complicated anyway. I'll start a new topic about it later.

Thanks again for your precious help, Stefan.
Post Reply