I'm using the framed package and I found it difficult to adjust the width of a frame to adapt to the current environment, e.g. if I use a shaded environment within the enumerate environment, I will get a frame box as wide as the current page (actually slightly wider) -- it will not indent accordingly; then I found a solution to make the frame of the same width as the current environment, but a new problem arised: there seems to be extra horizontal spacing inside the frame. A MWE is below:
\documentclass{article}
\usepackage{framed,color}
\definecolor{shadecolor}{rgb}{.9, .9, .9}
\newenvironment{myframe}{%
\def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}%
\MakeFramed {\hsize\linewidth\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
\begin{document}
test a frame within an enumerate environment
\begin{enumerate}
\item abc
\begin{myframe}
def
\end{myframe}
\end{enumerate}
\end{document}
Can anybody tell me how to eliminate the extra left padding so that the content of the frame can align to the list item? Thanks a lot!
A screenshot is here:



