1
votes

This is a screen capture from Pragmatic Bookshelf.

How to make this boxed text with LaTeX? It has it's own heading with underline, and uses color.

And how to make some text with gray background as follows?

http://img20.imageshack.us/img20/7351/screenshot20100718at916.png

Added

Konrad's method works, but it looks like that it doesn't work well with multicolumn package.

Tonio's method shows the gray only for the characters, but I want to have the gray box expanded to the end of \textwidth.

http://img714.imageshack.us/img714/8417/screenshot20100718at247.png

I posted another question with respect to the \texwidth, and it seems to working anyway.

2

2 Answers

2
votes

You should use the color package.

For example,

\colorbox{red}{Black text on red background}

creates a black text, with a red background. A good description of the color capabilities can be seen here, and an extended example here.

2
votes

The rounded box is most easily created using TikZ:

\begin{tikzpicture}
  \draw node[draw=black,fill=black!20,rounded corners,inner sep=2ex,text width=\textwidth] {
    Lorem ipsum dolor sit amet \dots
    };
\end{tikzpicture}