LaTeX: coloured boxes with rounded edges

At the moment, I spend a fair amount of time documenting process, code, instructions, whatever; all in LaTeX. I love it.

At some point vanity seeps in. I like to tweak the visual elements here-and-there in order to have a more professional and visually appealing document.

In this particular instance I had exhausted my \subsubparagraphs and having played with various alternatives I decided I wanted a coloured box: much like you see in books for “tip” sections or asides. So I searched and searched the web and it transpires that the best route to follow is through the murky, uncharted (at least for me) depths of tikz! Thankfully it wasn’t that difficult, and I now get a lovely rounded, grey box!

Make sure you’ve got a \usepackage{tikz} and bear in mind this is using \documentclass{article}. Your mileage may vary!


begin{tikzpicture}
\node[fill=gray,rounded corners=5pt,text width=6in] {
This is a "tip" box or similar, that gets nice rounded edges; like you'd see in a real book!
};
\end{tikzpicture}

This entry was posted in Programming and tagged , , , , . Bookmark the permalink.

One Response to LaTeX: coloured boxes with rounded edges

  1. Pingback: Convert LaTeX to any output format easily » mente abierta

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>