I am using the minted
package to insert code listings for different programming languages in my document. Here is a MWE:
\documentclass{article}
\usepackage{minted}
\usepackage{color}
\definecolor{bg}{rgb}{0.95,0.95,0.95}
\newminted{python}{autogobble, bgcolor=bg}
%... other minted environments for other languages
\begin{document}
\begin{listing}[htb]
\begin{pythoncode}
def myClass:
pass
\end{pythoncode}
\caption{Some Python}
\label{lst:python}
\end{listing}
\end{document}
Now, what I would like to do is specify for each listing what programming language is being used in in. I was thinking about putting a box around the listing, with a header in which I can specify the language. I would like this language label to be on the right end of the header.
Are there any packages that can help with this? How could I do this?
Best Answer
The documentation of
minted
says forbgcolor
key:In section "Framing alternatives", you have:
Below you'll find two boxes with
tcolorbox
and standardminted
(more accurate:fancyvrb
) possibilities: You see the limitations of standard solution where background color box is larger than the frame. Code: