Minted: no margin outside of frame when using background color

framemintedsyntax highlighting

I am using minted with a background color and a frame (see MWE below) for displaying code with syntax highlighting in my document. How can I remove the space (see red arrows in image below) outside of the frame so that the frame and edge of the background overlap? There should not be any gray outside of the frame.

enter image description here


MWE:

\documentclass{article}
\usepackage{minted}
\usepackage{xcolor}
\definecolor{LightGray}{gray}{0.9}

\begin{document}

\begin{minted}
[
frame=single,
framesep=2mm,
bgcolor=LightGray
]
{cpp}
std::vector<int> test;

example_function();
\end{minted}

\end{document}

Best Answer

Put \setlength{\fboxsep}{0pt} before \begin{minted}

d