Here's my beamer frame:

    var = 3 list print

        \item Armazenamento de dados




My piece of code is on the same background everything else. How can I put the code on a rectangle of another color?


As there is no MWE in the question and I don't want to find out how \defverbatim is to be used I put the listing directly in the frame.




var = 3 list print


enter image description here

  • This does unfortunately not work for every theme. I had an occurance, where this was rendered as lines with a yellow background with the background color of the frame visible between them.
    – mat
    Oct 11 '19 at 10:43
  • 1
    @mat May be it would be nice, if you can ask a new question with your concerns, because, the samcater/user36296 is suspended from this site and therefore, she cannot answer. Oct 11 '19 at 11:45
  • @Raaja: I added a reference and expanded the solution
    – mat
    Oct 14 '19 at 8:44
  • @mat I dont completely understand your comment. Oct 14 '19 at 9:21
  • My edit was rejected. Unfortunately I cannot post the solution as a new answer, since the question is closed: To get a solid background for a listing, you can use the mdframe environment as suggested here: \begin{mdframed}[backgroundcolor=yellow] \begin{lstlisting}language=python,tabsize=2] ... \end{lstlisting} \end{mdframed}
    – mat
    Oct 14 '19 at 13:02

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