Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

latex - How to change title in listings?

I have a question about the listings package. Do you know how to change it to get a title like this "Algorithm ## Title" rather than the casual "Listing ## Title" in the title line?

question from:https://stackoverflow.com/questions/2814714/how-to-change-title-in-listings

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Put these lines to preamble (the preamble is everything from the start of the LaTeX source file until the egin{document} command):


enewcommandlstlistingname{Algorithm}

enewcommandlstlistlistingname{Algorithms}

The first changes the caption name for listings. The second — the header name for the list of listings which is printed by the lstlistoflistings command. You would also probably want to modify the text in autorefs:

deflstlistingautorefname{Alg.}

Then when you're referring to a particular listing, e. g. For details see autoref{sec2:bubblesort}. it is written as "For details see Alg. 2.1."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...