I am farly new to LateX, so please be kind ;-). I am using minted to show off some code I wrote. I want the code to have a caption and label so i can refer to it from the text and have it appear in the "List of Listings" at the bottom of my document. Thats why I put minted inside this listing thing.
This is my definition for minted - so i dont need to specify everything mutliple times:
\usepackage[chapter]{minted}
\newminted{glsl}{
mathescape,
linenos,
numbersep=5pt,
gobble=2,
frame=lines,
framesep=2mm}
And this is the code inside my Text.
\begin{listing}[H]
\caption{Berechnung der Runlength für einen bestimmten Pixel}
\begin{glslcode}
void getRlHor() {
for(int j=1; j < maxSize; j++) {
int xRunlength = px + j;
if(xRunlength > imgWidth)
break;
nextGreyV = getGreyValue(xRunlength, py);
if(currentGreyV == nextGreyV) {
rlHor++;
}else{
break;
}
}
}
\end{glslcode}
\label{lis:getRlHor}
\end{listing}
I am using \begin{listing} because i saw it on multiple examples with minted. But this is giving me the trouble.
Here is the error report i am getting: There are always these 8 lines that pop off.
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
Something's wrong--perhaps a missing \item. \addvspace {10\p@ }
It seems when i delete the main.lol file. I can compile once without an error. If i write another sentence and then compile again, i get these errors mentioned above. But thats a buggy workarround.
Help is appreciated!!
Edit: I feel a bit dump for not realising this. When i open the main.lol file, here is what it shows
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\contentsline {listing}{\numberline {3.1}{\ignorespaces Spezialf\"alle abfangen und Randbedingungen setzen}}{8}{listing.3.1}%
\contentsline {listing}{\numberline {3.2}{\ignorespaces Berechnung der Runlength f\"ur einen bestimmten Pixel}}{8}{listing.3.2}%
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
\addvspace {10\p@ }
The bottom 8 of these (\addvspace {10\p@ }) show red after i compile. I thought it came from the code i put in, since the error started occuring after i put the code it. I cant really post the whole document, since i had to post like 8 whole files here.