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 have a certain bug regarding listings. I have used the \lstset command to configure my lstlisting environment.

Somehow, when I have a line that is too long to fit into one row the listing breaks it properly, but somehow the border gets the same colour as the font.

Here is the \lstset:

\lstnewenvironment{pascalCode}[1][]
{
  \lstset{  
    backgroundcolor=\color{lightgrey},
    breaklines=true,
    basicstyle=\footnotesize,
    keywordstyle=\color{Blue},
    commentstyle=\color{DarkGreen}\textit,
    numbers=left,
    numberstyle=\footnotesize,
    stringstyle=\color{red},
    showspaces = false,
    showstringspaces = false,
    tabsize = 2,
    %numbers=left,
    %numbersyle=\tiny
    frame=single,
    xleftmargin=5pt,
    xrightmargin=3pt,
    language =  Pascal,
    aboveskip = 20pt,
    #1
  }
}{}

If you have any ideas how to fix that please reply.

share|improve this question
1  
Is this really a bug - or a feature? –  Stephen Nov 5 '12 at 19:18
    
i'd prefere a black border over a colored one... –  Andreas Pabst Nov 5 '12 at 19:22
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  Kurt Nov 5 '12 at 19:36
add comment

1 Answer 1

up vote 7 down vote accepted

Using the option rulecolor=\color{black} fixes that. Here is a before and after comparison:

enter image description hereenter image description here

Code:

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}

\lstnewenvironment{pascalCode}[1][]
{
  \lstset{  
    backgroundcolor=\color{gray!40},
    breaklines=true,
    basicstyle=\footnotesize,
    keywordstyle=\color{blue},
    commentstyle=\color{green}\textit,
    numbers=left,
    numberstyle=\footnotesize,
    stringstyle=\color{red},
    showspaces = false,
    showstringspaces = false,
    tabsize = 2,
    %numbers=left,
    %numbersyle=\tiny
    frame=single,
    xleftmargin=5pt,
    xrightmargin=3pt,
    language =  Pascal,
    aboveskip = 20pt,
    rulecolor=\color{black},
    #1
  }
}{}

\begin{document}
\begin{pascalCode}
(*
Some really long line that takes more than one line so lstlistings needs to wrap this line.
*)
\end{pascalCode}
\end{document}
share|improve this answer
    
Thank you very much! That solved my problem. :) –  Andreas Pabst Nov 5 '12 at 21:36
add comment

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.