Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
Do you want lettrine? See ctan.org/tex-archive/help/Catalogue/entries/lettrine.html –  Leo Liu Feb 12 '11 at 14:34
add comment

3 Answers

up vote 7 down vote accepted

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

share|improve this answer
    
Thanks. This is exactly what I've searched. –  user3531 Feb 12 '11 at 14:47
    
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
add comment

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.

share|improve this answer
add comment

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}"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.