Ich verwende das Package listings und habe dazu einen custom Listing Design angelegt. Nun habe ich folgendes Problem in itemize bzw. enumerate, dass die Listings nicht wie gewünscht aussehen. Ich habe hierzu ein Beispiel eingefügt und hoffe, dass jemand mir weiterhelfen kann. Das unerwünschte Ergebnis seht ihr jeweils in enumerate. Alle Listings sollen wie Beispiel 0 aussehen.
Danke im Voraus!
\documentclass{article} \usepackage{xcolor} \usepackage{listings} \definecolor{lstbgc}{gray}{0.9} \usepackage{xcolor} \usepackage{listings} \usepackage{caption} \definecolor{backgroundcolor}{rgb}{0.95, 0.95, 0.92} \definecolor{commentcolor}{rgb}{0.55, 0.55, 0.55} \definecolor{identifiercolor}{rgb}{0, 0, 0} \definecolor{keywordcolor}{rgb}{0, 0, 0.5} \definecolor{numbercolor}{rgb}{0, 0, 0} \definecolor{stringcolor}{rgb}{0, 0.5, 0} \lstdefinestyle{Java}{ basicstyle = \mdseries, backgroundcolor = \color{backgroundcolor}, breaklines = true, commentstyle = \color{commentcolor}, identifierstyle = \color{identifiercolor}, keywordstyle = \color{keywordcolor}, language = Java, morekeywords = {assert}, numbers = left, numberstyle = \color{numbercolor}, showspaces = false, showstringspaces = false, showtabs = false, stringstyle = \color{stringcolor}, tabsize = 2, title = ~ } \usepackage{caption}[2015/09/20] \captionsetup[lstlisting]{% box = colorbox, boxcolor = black, font = {color = white}, singlelinecheck = off } \begin{document} \begin{lstlisting}[style = Java,title = Beispiel 0] public static void main(String[] args) { System.out.println("Hello World"); } \end{lstlisting} \begin{enumerate} \item item 1 \begin{lstlisting}[style = Java ,title = Beispiel 1] public static void main(String[] args) { System.out.println("Hello World"); } \end{lstlisting} bla bla \item item 2 \begin{lstlisting}[style = Java ,title = Beispiel 2] public static void main(String[] args) { System.out.println("Hello World"); } \end{lstlisting} \end{enumerate} \end{document}