Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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. 
share|improve this question

1 Answer 1

up vote 8 down vote accepted

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}

enter image description here

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}

enter image description here

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.