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}
7

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

  • The optional argument for the \mybox environment makes no sense if you don't use it. – Thorsten Donig Feb 12 '11 at 14:52
  • @Thorsten: Thanks for the note. I've edited my answer to incorporate the optional argument in the way the Duwee intended. – Jake Feb 12 '11 at 14:57
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 custom 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, lettirne package is enough. Also there are \hanginednt, \hangafter commands to get a paragraph of special shape.

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}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy