\lstlistoflistings 제목의 스타일을 어떻게 재정의할 수 있나요?

\lstlistoflistings 제목의 스타일을 어떻게 재정의할 수 있나요?

memoir나는 패키지를 기반으로 cls를 사용하고 있습니다 listings. 나는 모든 목록(표 목록, 그림 목록, 목록 목록)이 포함된 부록 장을 원합니다. 이 목록의 제목 스타일은 section제목과 같아야 합니다.

다음과 같이 테이블과 그림에 대해 이 작업을 수행할 수 있습니다.

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

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

그래서 목록에도 작동해야 한다고 생각했지만 다음은 효과가 없습니다.

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

\lstlistoflistings*나는 그것이 TOC에 표시되는 것을 원하지 않기 위해 사용합니다 .

어떻게 해야 하나요?

답변1

이건 꼭 해야 해

\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}

변경 사항은 에도 영향을 미치므로 실제로 서문에 포함될 수 없습니다 \tableofcontents.

관련 코드는 다음과 listings같습니다.

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

\contentsname여기에서 재설정 과 어떤 파일을 \@starttoc사용해야 하는지 확인할 수 있습니다 . \tableofcontents일반적 \@starttoc으로 실행되므로 jsut이 실행됩니다 \tableofcontents.

관련 정보