I've searched a few forums to determine code that will make an environment that will make the background of the encapsulated content a specific colour. This is what I have:
Code: Select all
\definecolor{MyGray}{rgb}{0.9,0.9,0.9}
\makeatletter\newenvironment{graybox}{%
\paragraph{}\begin{lrbox}{\@tempboxa}\begin{minipage}{15.9cm}}{\end{minipage}\end{lrbox}%
\colorbox{MyGray}{\usebox{\@tempboxa}}\paragraph{}
}\makeatother
However, that 15.9cm needs to be variable, as if it's in a subsection (or indented for some other reason), that width is longer than the width of the (part where the text can fit on the) page, and hence, I get an overfull horizontal box.
I was wondering if there's a code (or some completely different way) to do this??
Thanks for your help!
Andrew