# Text wrap with shapepar (insert image between text)

How do insert image between text and text wrap with shapepar or other package?

-
Although this is not an exact duplicate, the following post should guide you through the steps using Xfig: tex.stackexchange.com/questions/32997/…. –  Werner Nov 12 '11 at 3:07
I used the steps in the link that you passed, but I can not subtract the signal section with -. It does not work. –  Regis da Silva Nov 12 '11 at 5:21

Use package cutwin and run the example with xelatex because I use an eps image as vector graphic which has no background. Using a png image with clipping may also be possible.

\documentclass{article}

\usepackage{cutwin,graphicx,pstricks,lipsum}
\begin{document}

\opencutcenter
\newcommand\Margins{%
0.4\textwidth, 0.4\textwidth,
0.35\textwidth, 0.35\textwidth,
0.32\textwidth, 0.32\textwidth,
0.3\textwidth, 0.3\textwidth,
0.28\textwidth, 0.28\textwidth,
0.26\textwidth, 0.26\textwidth,
0.26\textwidth, 0.26\textwidth,
0.28\textwidth, 0.28\textwidth,
0.3\textwidth, 0.3\textwidth,
0.32\textwidth, 0.32\textwidth,
0.35\textwidth, 0.35\textwidth,
0.4\textwidth, 0.4\textwidth}
\renewcommand\putstuffinpic{%
\rput(0,-5\normalbaselineskip){%
\includegraphics[width=0.38\textwidth]{tiger}}}
\begin{shapedcutout}{2}{12}{\Margins}% 2 normal lines, 12 shaped lines
\lipsum[1]
\end{shapedcutout}

\end{document}


-
Many thanks to everyone who helped me, all solutions are used. –  Regis da Silva Nov 12 '11 at 12:44

Here is a similar play-by-play of what was described by @KarlOveHufthammer in his excellent answer regarding the coat-of-arms construction using Xfig. I'm running Windows 7 with Cygwin/X, and is therefore also able to use Xfig (version 3.2.5b). I also have transfig (version 3.2.5c-1, also called fig2dev) installed as part of the Cygwin/X distribution setup:

1. Open Xfig and set up a comfortable view/zoom level that is detailed enough. It does not have to be perfect, since LaTeX will resize the paragraph shape as specified using \shapepar to match whatever text you want to put into it.

2. Draw the outer shape of the paragraph. In this case I used the rectangle tool to draw a square.

3. Once complete, edit the rectangle and add the comment "+" (without the quotes).

4. Now draw the interior cut-out shape. In this case I used the circle tool.

5. Once complete, edit the rectangle and add the comment "-" (without the quotes).

6. Save the image in Xfig format as (say) myshape.fig.

The Xfig file looks like this:

#FIG 3.2  Produced by xfig version 3.2.5b
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
# -
1 3 0 1 0 7 50 -1 -1 0.000 1 0.0000 3000 3000 1500 1500 3000 3000 4500 3000
# +
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
0 0 6000 0 6000 6000 0 6000 0 0

7. Execute:

fig2dev -L shape -n myshape myshape.fig myshape.shape


The flag -L sets the output language used to shape (that conforms to shapepar). Other languages also exist, but this option should be specified first. The flag -n sets the name to be used within the output file myshape.shape. So, using -L shape -n <name> will create \<name>par. The output myshape.shape from myshape.fig now contains the newly-created macro \myshapepar{<par>} where the paragraph definition in "shape language" is given by \myshapeshape:

\def\myshapepar#1{\shapepar{\myshapeshape}#1\par}
\def\myshapeshape{%
{25.0833}%
{0.0833333}b{0.0833333}\\%
{0.0833333}t{0.0833333}{50}\\%
{12.5833}t{0.0833333}{25}st{25.0833}{25}\\%
{12.6667}t{0.0833333}{23.3333}t{26.75}{23.3333}\\%
{13.0833}t{0.0833333}{21.6667}t{28.4167}{21.6667}\\%
{13.5833}t{0.0833333}{20}t{30.0833}{20}\\%
{14.4167}t{0.0833333}{18.5}t{31.5833}{18.5}\\%
{15.4167}t{0.0833333}{17.0833}t{33}{17.0833}\\%
{16.5833}t{0.0833333}{15.8333}t{34.25}{15.8333}\\%
{17.8333}t{0.0833333}{14.75}t{35.3333}{14.75}\\%
{19.3333}t{0.0833333}{13.9167}t{36.1667}{13.9167}\\%
{20.9167}t{0.0833333}{13.25}t{36.8333}{13.25}\\%
{22.5}t{0.0833333}{12.75}t{37.3333}{12.75}\\%
{24.25}t{0.0833333}{12.5}t{37.5833}{12.5}\\%
{25.9167}t{0.0833333}{12.5}t{37.5833}{12.5}\\%
{27.6667}t{0.0833333}{12.75}t{37.3333}{12.75}\\%
{29.25}t{0.0833333}{13.25}t{36.8333}{13.25}\\%
{30.8333}t{0.0833333}{13.9167}t{36.1667}{13.9167}\\%
{32.3333}t{0.0833333}{14.75}t{35.3333}{14.75}\\%
{33.5833}t{0.0833333}{15.8333}t{34.25}{15.8333}\\%
{34.75}t{0.0833333}{17.0833}t{33}{17.0833}\\%
{35.75}t{0.0833333}{18.5}t{31.5833}{18.5}\\%
{36.5833}t{0.0833333}{20}t{30.0833}{20}\\%
{37.0833}t{0.0833333}{21.6667}t{28.4167}{21.6667}\\%
{37.5}t{0.0833333}{23.3333}t{26.75}{23.3333}\\%
{37.5833}t{0.0833333}{25}jt{25.0833}{25}\\%
{50.0833}t{0.0833333}{50}\\%
{50.0833}e{50.0833}%
}

8. Create and compile your TeX file:

\documentclass{article}
\usepackage{shapepar}% http://ctan.org/pkg/shapepar
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\input{myshape.shape}% Contains \myshapepar{<par>}
\begin{document}
\myshapepar{\lipsum*[1-3]}
\end{document}


As mentioned, the size of the shape is not necessary. If you supply \lipsum*[1] instead (a shorter paragraph text), the output resembles:

Also note the use of \lipsum*. \shapepar does not allow the use of \par. Line breaking is achieved using \\.

Image insertion is achieved with an overlay, by moving the image to appropriate position using horizontal/vertical skips or otherwise.

-
Thank you, is not working because I could not install the transfig plugin in Ubuntu. –  Regis da Silva Nov 12 '11 at 5:34
Your answers are so good that I want to up-vote them twice :) –  cmhughes Nov 12 '11 at 5:35
With the shape defined already in the code above, you can just use it without having to install transfig. The answer merely shows how it can be achieved. In your specific case, the answer (shape-wise) matches your post exactly. –  Werner Nov 12 '11 at 5:36
@cmhughes: Thanks for the feedback! –  Werner Nov 12 '11 at 5:39
Good and useful answer! –  Gonzalo Medina Nov 12 '11 at 15:03