how to insert a visible box around a set of content in latex?

FurtiveFelon picture FurtiveFelon · Jun 8, 2010 · Viewed 14.2k times · Source

I'm trying to figure out how the books draw a box perhaps with different background around a digression/example? Preferably how this would be accomplished in lyx, but latex solution would be welcomed as well :D

Answer

Heinzi picture Heinzi · Jun 8, 2010

The color package should allow you to use the \colorbox command.

Examples (cited from this page, where you will find more details):

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

\fcolorbox{blue}{red}%
  {Black text, red background, blue frame}

If you need just a border and no background color, the built-in \fbox{text} command should do fine.