About
Shop
LaTeX
Free Software
Books
News
Contact
Seasonal promotion: 15% discount on LaTeX books and fiction books at the Dickimaw Books Store. Use discount code bfc2ff60 at the checkout to take advantage of this offer. Offer ends: 21st December 2014.


4.7.1 Framed Boxes

Recall the \framebox command described in §2.8.2. Optional Arguments:

\framebox[<width>][<align>]{<text>}

This treats <text> as a box of width <width> and puts a frame around it. The second optional argument may be one of: c (centred contents), l (left-aligned contents), r (right-aligned contents).

Example:

Some \framebox[2in]{framed} text.

Some framed text (the word 'framed' is inside a 2
inch wide box)

There is a shorter related command with no optional arguments:

\fbox{<text>}

The fancybox package provides some additional framing commands:

\shadowbox{<text>}

Puts a shadow-style frame around its contents:

Some \shadowbox{framed} text.

Some framed text (the word 'framed' is in a 
box with a shadow)

\doublebox{<text>}

Puts a double-lined frame around its contents:

Some \doublebox{framed} text.

Some framed text (the word 'framed' is in a 
box with a double lined frame)

\ovalbox{<text>}

Puts a thin-lined oval frame around its contents:

Some \ovalbox{framed} text.

Some framed text (the word 'framed' is in a 
a box with rounded corners)

\Ovalbox{<text>}

Puts a thick-lined oval frame around its contents:

Some \Ovalbox{framed} text.

Some framed text (the word 'framed' is in a 
a thick bordered box with rounded corners)

If you want a different frame effect, you will need to use a graphical package, such as pgf/tikz.

Example:

This example uses commands beyond the scope of this book, but gives you an idea of what's possible.

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}

Some
\begin{tikzpicture}[baseline=(n.base),decoration=bumps]
\node[draw,ellipse,decorate] (n) {framed};
\end{tikzpicture}
text.

\end{document}

Some framed text (the word 'framed' is in a 
decorated with a wiggly border)

For further details, see the pgf documentation.

Related UK FAQ topics:


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).
© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Site Map FAQs Guest Book