TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using LyX with the listings package. I want to have Appendix A be titled "Code Listings" and then have the List of Listings.

Right now I have \lstlistoflistings in an ERT.

By using \renewcommand\lstlistlistingname{} in the pre-amble I was able to get the "Listings" text removed. But it still breaks to a new page. How do I keep it from doing that?


migration rejected from stackoverflow.com Mar 1 '14 at 20:11

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by Jubobs, Peter Jansson, Torbjørn T., Martin Schröder, Svend Tveskæg Mar 1 '14 at 20:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Apr 29 '12 at 6:04
This very much depends on the document class that you're using. report, book, memoir, ...? The previous assumptions suggest you're using a class that provides a \chapter. If there's no more chapters following Appendix A, then you can add \let\cleardoublepage\relax and \let\clearpage\relax in another ERT which should remove the new page. However, you would still have a complete chapter-style setting, which may not look good starting part-way on a page. – Werner Apr 29 '12 at 6:20

It seems you want your "Code listings" to be a numbered (appendix) \chapter. A solution that works for the classes book, report, scrbook, scrreprt , and memoir is to define a new command (say, \lolnoheading) in the preamble that will print the contents of the List of Listings without sectioning (here: chapter) heading, and then to use this command after \appendix\chapter{Code listings}.






\begin{lstlisting}[caption={A listing}]
Some text.


\chapter{Code listings}



enter image description here