我怎样才能删除此处代码上方和下方的黑线:
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{orange}{RGB}{255,127,0}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=left, %eller none
numberstyle=\tiny\color{codegray},
keywordstyle=\color{mauve},
commentstyle=\color{gray},
stringstyle=\color{orange},
breaklines=false,
breakatwhitespace=true,
tabsize=3,
backgroundcolor=\color{backcolour},
}
\begin{document}
{\setlength{\parindent}{0cm}
\begin{lstlisting}
// some comment
import javax.swing.JApplet;
import java.awt.Graphics;
public class Hello extends JApplet {
public void paintComponent(Graphics g) {
g.drawString("Hello, world!", 65, 95);
}
}
\end{lstlisting}
}
\end{document}
答案1
回答我自己的问题:
我找到了代码底部和顶部的行的原因。其为frame=tb
。应将其更改为frame=none
。