7

How is it possible to wrap text around a symbol? This is my code so far:

\documentclass{report}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{fourier}
\usepackage{blindtext}

\newcommand{\mybox}[2][\danger]{%
    \colorbox{lime}{\parbox{\textwidth}{%
        {\Huge#1}{#2}%
    }}%
}
\begin{document}
\mybox{\blindtext}
\end{document}
raphink
  • 31,894
  • 1
    Do you want lettrine? See http://www.ctan.org/tex-archive/help/Catalogue/entries/lettrine.html – Leo Liu Feb 12 '11 at 14:34

3 Answers3

8

You can use the lettrine package for this, which is usually used for having a large first letter that spans several lines. It needs a bit of adjustment because of the symbol's large depth:

\documentclass{report}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{fourier}
\usepackage{blindtext}
\usepackage{lettrine}

\newcommand{\mybox}[2][\danger]{%
    \colorbox{lime}{\parbox{\textwidth}{%
        \lettrine[lraise=.2,findent=1pt,nindent=0pt]{#1}{}{#2} }%
    }%
}
\begin{document}

\mybox{\blindtext}
\end{document}

enter image description here

Jake
  • 232,450
4

Generally speaking, I think it is difficult to do this in LaTeX. There is a shapepar package, which can dig a hole in the text and put something in the hole. But it's not easy to customize the shape of the hole to fit specific symbol.

An example of predefined circle hole:

\documentclass{article}
\usepackage{shapepar}

\begin{document}

\cutout{r}(-4em,5\baselineskip)\shapepar{\circleshape} cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut cut\par text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\end{document}

This kind of work is easier in ConTeXt, with help of MetaFun. You may refer:

http://mirror.contextgarden.net/general/manuals/metafun-s.pdf


If you just want a rectangle hole, you can use (old) picinpar, (newer) picins and wrapfig for this.

For more simpler situations, lettrine package is enough. Also there are \hangindent, \hangafter commands to get a paragraph of special shape.

Leo Liu
  • 77,365
3

You could use the wrapfig package for this:

 Environments "wrapfigure" and "wraptable" place a figure or table
 at the side of the page and wrap text around it.

\begin{wrapfigure}[12]{r}[34pt]{5cm} <figure> \end{wrapfigure} -- - ---- --- [number of narrow lines] {placement} [overhang] {width of figure}%

...

Environments similar to "wrapfigure" and "wraptable" may be easily added,
or invoked by "\begin{wrapfloat}{float_name}"
Martin Scharrer
  • 262,582