¿Cómo puedo redefinir el estilo del título \lstlistoflistings?

¿Cómo puedo redefinir el estilo del título \lstlistoflistings?

Estoy usando un cls basado en memoiry el paquete listings. Quiero un capítulo de apéndice con todas las listas (lista de tablas, lista de figuras, lista de listados). El estilo del título de estas listas debe ser como un sectiontítulo.

Puedo hacer esto para las tablas y las figuras como esta:

\makeatletter
\renewcommand\@lofmaketitle{%
  \section*{\listfigurename}%
  \tocmark%
  \@afterheading}
\makeatother

\makeatletter
\renewcommand\@lotmaketitle{%
  \section*{\listtablename}%
  \tocmark%
  \@afterheading}
\makeatother

Entonces pensé que también debería funcionar para los listados, pero lo siguiente no tiene ningún efecto:

\makeatletter
\renewcommand\@lolmaketitle{%
  \section*{\lstlistlistingname}%
  \tocmark%
  \@afterheading}
\makeatother

Lo uso \lstlistoflistings*así que no me gustaría que apareciera en el TOC.

¿Cómo puedo hacer esto?

Respuesta1

Esto debería hacerlo

\documentclass[a4paper]{memoir}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[caption=Hest]
a
\end{lstlisting}


\begingroup

\makeatletter
\renewcommand\@tocmaketitle{%
  \section*{\contentsname}%
  \markboth{\contentsname}{\contentsname}
  \@afterheading}
\makeatother

% adding a star to \lstlistoflistings does not work, the inner 
% \tableofcontents never sees it. Locally use \KeepFromToc 
% to emulate the *
\KeepFromToc
\lstlistoflistings
\endgroup

\end{document}

Tenga en cuenta que el cambio no puede estar realmente en el preámbulo ya que también afecta \tableofcontents.

El código relevante de listingses

\lst@UserCommand\lstlistoflistings{\bgroup
    \let\contentsname\lstlistlistingname
    \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
    \tableofcontents \egroup}

Aquí podemos ver cómo se restablece \contentsnamey qué archivo \@starttocse debe utilizar. \tableofcontentsgeneralmente se ejecuta, \@starttocpor lo que simplemente se ejecuta \tableofcontents.

información relacionada