I want to define an environment with appointed color, that is to say the whole environment from the \begin{env}
to \end{env}
will be drawed by the color. Just like a code block. Roughly, this is waht I expect.
I tried to use \colorbox
, but it seemed that the box didn't support for multiple lines of text. For instance, I have a costomized environment myenv
, then how can I realize what I expect.
\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{framed}
\newenvironment{myenv}{%
%\colorbox{gray}
\medskip
\begin{quote}
\centering
}{\end{quote}\medskip}
\begin{document}
\section{A}
\lipsum{1}
\begin{myenv}
\lipsum{2}
\end{myenv}
\lipsum{3}\par
{\centering
\colorbox{gray}{AAAAAA}
\end{document}
Please give me an example. Thanks.
tcolorbox
package.