[Tex/LaTex] Listings without a border

listings

I'm using listings to format blocks of code in my LaTeX, and I like it. But, except for large blocks of code, the border around the code block is bulky and breaks up the flow of how I read the document. I've tried searching around for a way to disable this code, but thus far I haven't found anything. Is it just impossible? Seems strange if this is the case.

Best Answer

Use the available options for the selected lstlisting environments; a litle example in which the style selected uses numbers to the left and a frame on the four sides of the listing; using frame=<valid values> and numbers=<valid values> one can change the behaviour for selected environments (for a list of all the keys and their <valid values> refer to the package documentation):

\documentclass{article}
\usepackage{listings}
\lstset{
  basicstyle=\small\ttfamily,
  frame=lrtb,
  numbers=left
}

\begin{document}

\begin{lstlisting}
test
\end{lstlisting}

\begin{lstlisting}[frame=none]
test
\end{lstlisting}

\begin{lstlisting}[frame=bt,numbers=none]
test
\end{lstlisting}

\end{document}

enter image description here