0

I am making a Latex docuemnt where I have to input some code in R with the command \lstinputlisting. I have my own style defined with the following configuration:

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},   
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b, 
frame=single, 
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2,
} 

The problem is the following: When there are long commentaries, they are placed in different lines, and the background colour of the second and following lines of commentaries is changed to white. I attach a photo of the output to make things clearer. Piece of the output in Latex

As you can see there are no problems with the backgorund colour when I have code in multiple lines, but when reffering to a long commentary the background colour is "cut".

Thanks in advance for your answers.

  • Welcome to TEX.SE! Please provide a full minimal working example starting with \documentclass{...} and ending with \end{document} instead of a code snippet and a picture of the output of some unknown code. This makes our lives easier and increases the chance of people helping you. – campa Nov 25 '20 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.