How do I confine text within a shape such as a circle or triangle? I don't want text along the perimeter, I would like it to break appropriately at all the inner edges.
Asked
Active
Viewed 5,131 times
2 Answers
18
As @Yossi mentioned before, shapepar is your friend. The full documentation is at its usual place in CTAN. Here's an example how to use it:
\documentclass{article}
\usepackage{shapepar}
\begin{document}
\def\triangledownshape{%
{0}%
{0}b{0}\\%
{0}t{-10}{20}\\%
{8.66}t{-5}{10}\\%
{17.32}e{0}%
}
\def\triangledownpar#1{\Shapepar\triangledownshape #1\unskip\ $\bigtriangledown$\par}
\triangledownpar{This is an example of a shape created with
\texttt{shapepar}. Other predefined possibilities include \textbf{circle},
\textbf{donut}, \textbf{heart}, \textbf{star}, \textbf{star}, \textbf{nut},
\textbf{rectangle}. Also, there are other definitions currently not included
by default, which you'd find in the \texttt{*shapes.def} files in the
\texttt{shapepar} directory~--- \textbf{drops}, \textbf{triangles} (facing all
directions), \textbf{\TeX logo}, \textbf{candle}, \textbf{Canadian flag}.
Your result may or may not look weird, depending on the size of the shape
and the word distribution.}
\end{document}
The result looks like the following image (example uses \documentclass{standalone}, to preserve space):
A simple circle example:
\documentclass[preview]{standalone}
\usepackage{shapepar}
\begin{document}
\Shapepar{\circleshape} I see now the many ways of creating beautiful forms. As you use shapepar, text may be made to appear in geometric shapes and arrangements. Very nice are the things you can do.\par
\end{document}
Cutouts with custom shapes are also possible, but I haven't tried that in this particular example.
Personally, I find defining new shapes not very straight-forward, but YMMV. Also, if you're into xfig (I'm not), you could try the shapepatch package which basically patches (duh!) the xfig package so that you could use your masterpiece as a boundary for shapepar. I can't comment how well this works, though -- I've never used it.
qubodup
- 199
Martin Tapankov
- 17,900


\parshape. – TH. Oct 28 '10 at 06:15shapepatchpackage could be useful, if one finds defining shapes complicated. It allows usingxfigshapes to describe the boundaries, if that's your thing. – Martin Tapankov Oct 28 '10 at 07:00