# Transparent background to achieve better wrapped diagrams

I have generated the following using Tikz. I then would like to wrap it with text as in (the red boxes) :

Is there a way to achieve this? knowing that the flowchart (generated separately) is included in my main as a pdf

Update: After the first comment, I think it is better if i include the flowchart code into the main. Here is a MWE:

\documentclass{article}
\usepackage{ulem,tikz,amsmath, amssymb,bm,color}
\usepackage[english]{babel}
\usepackage{lipsum}
\usetikzlibrary{shapes,arrows}
\usepackage{pgfplots}
\usepackage{wrapfig}
% needed for BB
\usetikzlibrary{calc}
\usetikzlibrary{shapes,arrows}

\tikzstyle{line} = [draw, -latex']
\begin{document}
\lipsum[5]
\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\begin{tikzpicture}[node distance =1.5cm,auto]

% Place nodes
\node [draw,rounded corners] (node1) {a};
\node [draw,rounded corners, below of=node1] (node2) {b};
\node [draw,rounded corners, below of=node2] (node3) {c};
\node [ below of=node3] (Inter1){};
\node [draw,rounded corners, right of=Inter1,node distance =2.5cm] (node4) {d};
\node [draw,rounded corners, right of=node4,node distance =3.5cm] (node5) {d};
\node [draw,rounded corners, left of=Inter1,node distance =2.5cm] (node6) {d};
\node [draw,rounded corners, left of=node6,node distance =3.5cm] (node7) {d};
\node [ below of=node7] (Inter2){};
\node [draw,rounded corners, right of=Inter2] (node8) {d};
\node [draw,rounded corners, left of=Inter2] (node9) {d};
\node [ below of=node8] (Inter3){};
%     % Draw edges
\path[line] (node1) -- (node2);
\path [line] (node2) -- (node3);
\path [line] (node3) --++(-90:8mm)-| (node4.north);
\path [line] (node3)  --++(-90:8mm)-|  (node5.north);
\path [line] (node3)  --++(-90:8mm)-|  (node6.north);
\path [line] (node3) --++(-90:8mm)-|  (node7.north);
\path [line] (node7)--++(-90:8mm)-| (node8.north);
\path [line] (node7) --++(-90:8mm)-|  (node9.north);

\end{center}
\end{wrapfigure}
\end{document}

• what do the long boxes represent? Also can you include the part you have with the tree? – percusse Oct 17 '15 at 11:41
• @percusse The long boxes simply mean that I want my text to wrap the tree – user2536125 Oct 17 '15 at 11:54
• I think you can use \parshape command to shape the right edge of the paragraph. The figure doesn't need to be transparent, but instead to have "zero width" at the eyes of tex, so that it is "overimposed" on the paragraph, but it will have appropiate "holes" thanks to \parshape. See for example tex.stackexchange.com/questions/32226/… – JLDiaz Oct 17 '15 at 12:01
• Then you can do a standard wrapfigure no? – percusse Oct 17 '15 at 12:09
• @percusse I just tried that, but I don't get the desired result – user2536125 Oct 17 '15 at 18:02

Expanding the idea I gave in the comment, the following code shows a possible way to accomplish this:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[margin=2.5cm,a4paper]{geometry}
\usepackage{lipsum}
\newcommand\smashfigure[1]{%
\marginpar{\llap{%
\includegraphics[width=0.6\textwidth]{#1}
}}
}
\begin{document}
\smashfigure{tree}
\parshape12
0cm 11.2cm
0cm 11.2cm
0cm 11.2cm
0cm 11.2cm
0cm 11.2cm
0cm 11.2cm
0cm 7.2cm
0cm 7.2cm
0cm 6.2cm
0cm 6.2cm
0cm 6.2cm
0cm \textwidth
\lipsum[1]

\end{document}


But, imho, the output is very ugly:

• (+1) for "the output is very ugly". – CroCo Oct 18 '15 at 4:01