Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
2  
Does \begin{lstlisting}[frame=none] work? –  Scott H. Oct 10 '12 at 1:48
    
Welcome to TeX.SE. –  Peter Grill Oct 10 '12 at 2:00
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Mar 1 at 18:59

1 Answer 1

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

share|improve this answer
    
Awesome! Then as a follow-up question, is it possible to selectively enable borders, or otherwise specify options specific to a particular block? For example, if I normally didn't want to display line numbers, but I want to use them on some. –  limp_chimp Oct 10 '12 at 1:53
1  
@limp_chimp of course, see my updated answer. –  Gonzalo Medina Oct 10 '12 at 2:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.