Gray boxes in latex

I am sure you were wondering how to have boxes in latex with gray background. This is useful if you want to emphesize some text. This is not too hard to do, but since I just figured it out, I decided to provide the details.

The basic idea is to put your text in a minipage, and then encapsulate this inside a colorbox command. The first problem is that minipage for some reason kills the identation, so if you want regular identation, then you need the following stuff

Now, the \InGray command does it all:
\SaveIndent{} %
\begin{minipage}{0.965\linewidth} %

To use, you will need the \usepackage{color} command. Now, to use just put in the latex file:

bla bla


Given a set $\PSet = \brc{P_1, \ldots, P_k}$ of convex polygons in the
plane with total complexity $n$, we are interested in translating the
polygons of $\PSet$ such that some measure is minimized (or

bla bla

The results look like…

P.S. There are at least five different ways to do this. Ths is just one possible way.

Comments are closed.