2

I'm trying to use the 'listings' package for my project work in LaTex. This is my stripped down code for illustration:

\documentclass[a4paper, 12pt, BCOR5mm, captions=tableheading, pointlessnumbers, listof=entryprefix]{scrreprt}

\usepackage{listings}
\usepackage{amsmath}

\begin{document}
\lstlistoflistings
\addcontentsline{toc}{chapter}{Quellcodeverzeichnis}
\newpage
\begin{lstlisting}[caption={Beispielcode}, label={code:code},captionpos=b]
rofl
\end{lstlisting}

\end{document}

When I compile the file in LaTex I always get 3 errors. These are the 3 errors I get:Errors

A PDF is built, but the result doesn't look like the table of figures. Result

I'm using TeXnicCenter 2.02 Stable (64 bit), Win10, MiKTeX-pdfTeX 4.10 (MiKTeX 22.3).

1
  • Welcome. // To narrow down the trouble makers I suggest to comment out all lines and, starting from top, uncomment them one by one, with a new compile. This way you'll quickly narrow down the problem.
    – MS-SPO
    Jun 17, 2022 at 13:56

1 Answer 1

4

I would say there is a typo in the KOMA code (\@dottedtoclilne). Try with this work-around. I will report it

\documentclass[listof=entryprefix]{scrreprt}

\usepackage{listings}
\usepackage{amsmath}

\usepackage{etoolbox}
%replace faulty command:
\makeatletter 
\patchcmd \before@starttoc{\@dottedtoclilne}{\@dottedtocline}{}{\fail}
\makeatletter

\begin{document}
\lstlistoflistings

abc
\begin{lstlisting}[caption={Beispielcode}, label={code:code},captionpos=b]
rofl
\end{lstlisting}

\end{document}
1
  • Thank you that fixed my problem :)
    – Zeus
    Jun 20, 2022 at 6:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .