in meiner Abschlussarbeit habe ich ganz am Ende ein paar R-Skripte als Anhang. Im Anhang selbst möchte ich das \lstlistoflistings
…
Dadurch wird die Liste als Kapitel formatiert (dasselbe wie beim Inhaltsverzeichnis).
Wie kann ich es als Abschnitt formatieren? Ich möchte einfach den Seitenumbruch nach dem Kapiteltitel vermeiden und die Liste direkt dahinter haben, mit einer kleineren Schriftart.
Hier ist ein minimales funktionierendes Beispiel
\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}
Danke!
Antwort1
Sie könnten tocbasic
und laden scrhack
. Dann können Sie verwenden \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}
Ich habe die Reihenfolge geändert \chapter*
, \addcontentsline
um die richtige Seitenzahl im Inhaltsverzeichnis zu erhalten.
Antwort2
\lstlistoflistings
(was für ein leicht zu merkender Name ;-)) wird \tableofcontents
intern tatsächlich verwendet und \@starttoc
leicht neu definiert, um anzuwenden, hat aber immer noch die \chapter*
Überschrift \tableofcontents
.
Meiner Ansicht nach ist es einfacher, eine Neudefinition von anzuwenden, \lstlistoflistings
sodass es dasselbe Erscheinungsbild wie hat \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}