At the moment all provided answers can't break across pages. There are some packages which can handle page breaks as well. The most common are
For a simple background can be achieved with framed
. If you want to draw a more power full frame you may use mdframed
or tcolorbox
. Instead of redefining all description environments I recommend to provide an new environment. If you redefine all description environments the following solutions don't work well.
To setup the new description environment I am using the package enumitem
.
framed
The package framed
defines the environment shaded
. To use the environment you have to declare the shadecolor
first:
\documentclass{article}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{framed}
\newlist{cdescription}{description}{1}
\definecolor{shadecolor}{gray}{0.95}%color of the background
\setlist[cdescription,1]{before=\begin{shaded},after=\end{shaded}}
\usepackage{lipsum}
\begin{document}
\begin{cdescription}
\item[first lipsum] \lipsum[1]
\item[second lipsum] \lipsum[2]
\item[third lipsum] \lipsum[3]
\item[fourth lipsum] \lipsum[4]
\item[fifth lipsum] \lipsum[5]
\end{cdescription}
\end{document}
mdframed
The package mdframed
provide his own command to surround any environment. This is done by \surroundwithmdframed
:
\documentclass{article}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage[framemethod=TikZ]{mdframed}
\newlist{cdescription}{description}{1}
\mdfdefinestyle{cdescription}{%
hidealllines=true,%no lines drawn
backgroundcolor=gray!15,
skipabove=\topskip,
skipbelow=\topskip,
roundcorner=15pt,
}
\surroundwithmdframed[style=cdescription]{cdescription}
\usepackage{lipsum}
\begin{document}
\begin{cdescription}
\item[first lipsum] \lipsum[1]
\item[second lipsum] \lipsum[2]
\item[third lipsum] \lipsum[3]
\item[fourth lipsum] \lipsum[4]
\item[fifth lipsum] \lipsum[5]
\end{cdescription}
\end{document}
tcolorbox
\documentclass{article}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage[]{tcolorbox}
\tcbuselibrary{breakable}
\newlist{cdescription}{description}{1}
\setlist[cdescription,1]{before={\begin{tcolorbox}[breakable,boxrule=0pt]},after=\end{tcolorbox}}
\usepackage{lipsum}
\begin{document}
\begin{cdescription}
\item[first lipsum] \lipsum[1]
\item[second lipsum] \lipsum[2]
\item[third lipsum] \lipsum[3]
\item[fourth lipsum] \lipsum[4]
\item[fifth lipsum] \lipsum[5]
\end{cdescription}
\end{document}