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 make something similar to the following green alert box

http://twitter.github.com/bootstrap/components.html#alerts

I have tried various combinations of verbatim without success

share|improve this question
1  
I would use mdframed for this –  cmhughes Feb 12 '12 at 17:22

1 Answer 1

up vote 9 down vote accepted

You can use a color box.

\documentclass{article}
\usepackage{graphicx,xcolor}
\begin{document}
\colorbox{pink}{\hbox to \textwidth{alert box\hfill}}
\end{document}

If you want the text to have a different color use,

\textcolor{brown}{your text...}

For a paragraph you can you parbox or minipage.

\documentclass{article}
\usepackage{graphicx,xcolor,lipsum}
\begin{document}
\colorbox{pink}{\parbox{\textwidth}{\lipsum[1]}}
\end{document}

If you want a bit of "padding"

\documentclass{article}
\usepackage{graphicx,xcolor,lipsum}
\begin{document}
\colorbox{pink}{\parbox{\textwidth}{%
  \vskip10pt
  \leftskip10pt\rightskip10pt
  \lipsum[1]
  \vskip10pt
 }
}
\end{document}
share|improve this answer
    
Thank you. Is there a way to make line wrapping work? My text runs off the screen –  Hoa Feb 12 '12 at 5:50
    
@Hoa See edit. I added another minimal. –  Yiannis Lazarides Feb 12 '12 at 6:12

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.