장(보고서 클래스)이 아닌 섹션으로 목록 제목 목록의 형식을 지정하는 방법

장(보고서 클래스)이 아닌 섹션으로 목록 제목 목록의 형식을 지정하는 방법

내 논문의 마지막 부분에는 부록으로 몇 개의 R 스크립트가 있습니다. 부록 자체 내에서 나는 \lstlistoflistings.

그러면 목록이 장으로 형식화됩니다(목차의 경우와 동일).

섹션으로 형식을 지정하려면 어떻게 해야 하나요? 나는 장 제목 뒤에 페이지 나누기를 피하고 그 바로 뒤에 더 작은 글꼴로 목록을 표시하고 싶습니다.

다음은 최소한의 작업 예입니다.

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

감사해요!

답변1

tocbasic및 를 로드할 수 있습니다 scrhack. 그런 다음 다음을 사용할 수 있습니다 \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}

여기에 이미지 설명을 입력하세요

ToC에서 올바른 페이지 번호를 얻기 위해 \chapter*및 순서를 변경했습니다 .\addcontentsline

답변2

\lstlistoflistings(기억하기 쉬운 이름입니다 ;-)) \tableofcontents실제로 내부적으로 사용하고 \@starttoc적용하기 위해 약간 재정의하지만 여전히 제목 \chapter*\tableofcontents.

내 관점에서는 \lstlistoflistings와 같은 모양을 갖도록 의 재정의를 적용하는 것이 더 쉽습니다 \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}

여기에 이미지 설명을 입력하세요

관련 정보