# colored full width box with some verbatim text inside?

I would like to create a text box of "reminders" for my readers. I'd like the box to be gray, go full text width, and have both normal and verbatim text in it.

Reminder

ensure blah blah \underline{before} running \verb!-egrmaclean-!.
make blah blah \emph{2. TEMP filename.dta}'' \emph{2. country project.do} file.

-

## 1 Answer

You can use the mdframed package. A simple example (please refer to the package documentation to learn all the possibilities for customization offered by the package):

\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\newmdenv[
backgroundcolor=gray!20,
frametitle=Reminder,
skipabove=\topsep,
skipbelow=\topsep,
]{reminder}

\begin{document}

\lipsum[2]
\begin{reminder}
ensure blah blah \underline{before} running \verb!-egrmaclean-!.
make blah blah \emph{2. TEMP filename.dta}'' \emph{2. country project.do} file.
\end{reminder}
\lipsum[2]

\end{document}


Another option would be to use the framed package:

\documentclass{article}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{lipsum}% just to generate text for the example

\colorlet{shadecolor}{gray!20}

\newenvironment{myshaded}
{\def\FrameCommand{\fboxsep=\topsep\colorbox{shadecolor}}%
\MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}

\newenvironment{reminder}
{\begin{myshaded}\noindent\textbf{Reminder}\par\nobreak\noindent\ignorespaces}
{\end{myshaded}}

\begin{document}

\lipsum[2]
\begin{reminder}
ensure blah blah \underline{before} running \verb!-egrmaclean-!.
make blah blah \emph{2. TEMP filename.dta}'' \emph{2. country project.do} file.\end{reminder}
\lipsum[2]

\end{document}


-
Thanks Gonzalo. Any idea what this error means? I'm guessing that it has to do with not having the mdframed package installed, but I'm kinda new, and the videos on youtube dont't seem to help much. ! LaTeX Error: File mdframed.sty' not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) – Michael Nov 29 '12 at 4:30
@Michael yes, the error indicates that the package is missing in your system. Depending on your LaTeX distribution, you could use the packagemanager to install it; if there's no package manager available, then you could try installing it manually from mdframed in CTAN (this could be time consuning due to possible unresolved dependencies). I updated my answer with another option, using the framed` package which should be in your system. By the way, you should consider doing an updated and complete LaTeX installation. – Gonzalo Medina Nov 29 '12 at 5:03