.png)
私の論文の最後には付録としてRスクリプトがいくつか載っています。付録自体には\lstlistoflistings
。
これにより、リストが章としてフォーマットされます (toc の場合と同じ)。
セクションとしてフォーマットするにはどうすればいいでしょうか? 章のタイトルの後の改ページを避けて、その直後に小さいフォントでリストを表示したいだけです。
ここに最小限の動作例を示します
\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}
目次で正しいページ番号を取得するために\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}