Putting text into a colorful box

You often see important content put into a colored box, especially on posters and slides, although it's used in other documents, too. In this recipe, we will put a little text and also whole paragraphs into a colored box. They can also have titles.

How to do it...

We will use the tcolorbox package. It is based on pgf, so you need to have that package installed as well.

We will create a box with the defaults, a titled box with split content, and boxes placed inline that fit the width of the content. Proceed as follows:

  1. Create a small document based on any document class. The article package is a simple choice. Load the blindtext package to generate dummy text. This time, we will use the pangram option to create short ...

Get LaTeX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.