答案1
日志文件包含一条警告:
Class scrreprt Warning: \float@listhead detected!
(scrreprt) Implementation of \float@listhead became
(scrreprt) deprecated in KOMA-Script v3.01 2008/11/14 and
(scrreprt) has been replaced by several more flexible
(scrreprt) features of package `tocbasic`.
(scrreprt) Maybe implementation of \float@listhead will
(scrreprt) be removed from KOMA-Script soon.
(scrreprt) Loading of package `scrhack' may help to
(scrreprt) avoid this warning, if you are using a
(scrreprt) a package that still implements the
(scrreprt) deprecated \float@listhead interface on input line 8.
如果我更改代码以包含建议的包,我就会得到预期的结果。
\documentclass[parskip]{scrreprt}
\usepackage{scrhack} %%% <---- ADDED
\usepackage{graphicx} % benötigt für Grafiken
\usepackage{listings}
\begin{document}
\lstlistoflistings
\listoffigures
\clearpage
\begin{figure}[ht]
\includegraphics[width=5cm]{_img/Link.png}
\caption[Link]{Eine Beispielabbildung}
\end{figure}
\clearpage
\begin{lstlisting}[caption={Hello World}]
public class HelloWorld
{
public static void main (String[] args)
{
// Prints Hello World!
System.out.println("Hello World!");
}
}
\end{lstlisting}
\end{document}