Cómo formatear una lista de listados encabezados como sección NO como capítulo (clase de informe)

Cómo formatear una lista de listados encabezados como sección NO como capítulo (clase de informe)

En mi tesis tengo algunos scripts R al final, como Apéndice. Dentro del apéndice quiero el archivo \lstlistoflistings.

Esto formatea la lista como un capítulo (igual que para el toc).

¿Cómo puedo formatearlo como sección? Solo quiero evitar el salto de página después del título del capítulo y tener la lista justo después, con una fuente más pequeña.

Aquí hay un ejemplo de trabajo mínimo.

\documentclass{report}  

\usepackage{listings}
    \lstset{language=R}
    \renewcommand{\lstlistlistingname}{List of R scripts}


\begin{document}
\tableofcontents

\chapter{the first chapter}
    \section{section1}
some text
\chapter{the second chapter}

\addcontentsline{toc}{chapter}{Appendix A}
\chapter*{Appendix A}
\lstlistoflistings

\newpage
\begin{lstlisting}[caption=A script]
some code
\end{lstlisting}

\begin{lstlisting}[caption=Another script]
some more code
\end{lstlisting}

\end{document}

¡Gracias!

Respuesta1

Podrías cargar tocbasicy scrhack. Entonces puedes usar \setuptoc{lol}{leveldown}:

\documentclass{report}

\usepackage{scrhack}
\usepackage{tocbasic}
\setuptoc{lol}{leveldown}

\usepackage{listings}
    \lstset{language=R}
    \renewcommand{\lstlistlistingname}{List of R scripts}

\begin{document}
\tableofcontents

\chapter{the first chapter}
    \section{section1}
some text
\chapter{the second chapter}
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\lstlistoflistings
\newpage
\begin{lstlisting}[caption=A script]
some code
\end{lstlisting}
\begin{lstlisting}[caption=Another script]
some more code
\end{lstlisting}
\end{document}

ingrese la descripción de la imagen aquí

Cambié el orden de \chapter*y \addcontentslinepara obtener el número de página correcto en ToC.

Respuesta2

\lstlistoflistings(qué nombre tan fácil de recordar ;-)) \tableofcontentsen realidad lo usa internamente y lo redefine \@starttocligeramente para aplicarlo, pero todavía tiene el \chapter*título de \tableofcontents.

Desde mi punto de vista, es más fácil aplicar una redefinición de \lstlistoflistingstal que tenga la misma apariencia que \tableofcontents.

\documentclass{report}  
\usepackage{listings}
\lstset{language=R}
\renewcommand{\lstlistlistingname}{List of R scripts}


\makeatletter
\renewcommand{\lstlistoflistings}{%
  \begingroup
  \clearpage
  \section*{\lstlistlistingname% Taken from `article.cls`....
   \@mkboth{%
     \MakeUppercase\lstlistlistingname}{\MakeUppercase   
     \lstlistlistingname}
   }%
  \@starttoc{lol}
  \endgroup
}
\makeatother




\begin{document}
\tableofcontents

\chapter{the first chapter}
\section{section1}
some text
\chapter{the second chapter}

\addcontentsline{toc}{chapter}{Appendix A}
\chapter*{Appendix A}
\lstlistoflistings

\newpage
\begin{lstlisting}[caption=A script]
some code
\end{lstlisting}

\begin{lstlisting}[caption=Another script]
some more code
\end{lstlisting}

\end{document}

ingrese la descripción de la imagen aquí

información relacionada