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.

When using the distance style attribute on edges, for example,

\tikzstyle{flowloop} = [out=-150, in=-30, looseness=0.8, loop, distance=7*\limw]

or

\tikzstyle{flowloop} = [out=-150,in=-30,looseness=0.8,distance=9*\limw]

I get excessive whitespace around my edges. I've tried using clip and 'use as bounding box' to no avail. Any suggestions on how to remove it or not have it appear in the first place? I've had to resort to using the 'pdfcrop' bundled with TeXLive to get rid of it.

See attached code and graphic to see what I mean. You'll notice that there's a loop's width of whitespace to the left and right of my two bottom loops.

\def\limw{0.050\textwidth}
\setlength{\tabcolsep}{1pt}
\renewcommand{\arraystretch}{0.3}
\def\bug{\includegraphics[width=\limw]{graphics/icons/kbugbuster}}
\def\suser{\includegraphics[width=\limw]{graphics/icons/system-users}}
\def\hat{\includegraphics[width=\limw]{graphics/icons/applications-engineering}}
\def\patch{\includegraphics[width=\limw]{graphics/icons/text-x-patch}}
\def\source{\includegraphics[width=\limw]{graphics/icons/text-x-objchdr}}
\def\debf{\includegraphics[width=\limw]{graphics/icons/application-x-deb}}
\def\litim{%
  \bug
  \hat
  \suser
  \patch
  \source
  }
\def\litimt{%
  \begin{tabular}{c c}
    \bug & \hat \\
    \suser & \patch\\
    \source &
  \end{tabular}
  }
\def\litimp{%
  \begin{tabular}{c c}
    \bug & \hat\\
    \suser & \patch\\
    \source & \debf
  \end{tabular}
  }
% Define a few styles and constants
\def\blockdist{8.0*\limw}
\def\logosize{3.2em}
\tikzstyle{projects} = [draw, fill=orange!30, text width=5em,
    text centered, minimum height=\logosize+0.6em,
    node distance=0.5*\blockdist and \blockdist]
\tikzstyle{ecosystem} = [projects, text width=6em, fill=blue!30,
    minimum height=12em, rounded corners, draw=black,dashed,
    node distance=\blockdist and \blockdist]
\tikzstyle{label} = [text width=6em, text centered,
    node distance=0.1*\blockdist and 0.1*\blockdist]
%\tikzstyle{flowloop} = [out=-150, in=-30, looseness=0.8, loop, distance=7*\limw]
\tikzstyle{flowloop} = [out=-150, in=-30,looseness=0.8,distance=9*\limw]%distance=8*\limw]
\pgfdeclarelayer{background2}
\pgfdeclarelayer{background1}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background2,background1,main,foreground}

\begin{tikzpicture}
    \node (debian) [projects] {\includegraphics[height=\logosize]{graphics/logos/DebianLogo}};
    \node (derivs) [projects, node distance=5*\limw, below=of debian] {Debian derivatives};
    \node (decos label) [label,below=of derivs] {Debian ecosystem};

    \node (kde) [projects, above=of debian]
      {\includegraphics[height=\logosize]{graphics/logos/KDELogo}};
    \node(gcc) [projects, right=of kde]
      {\includegraphics[height=\logosize]{graphics/logos/GCCLogo}};
    \path ($ (kde)!.5!(gcc) $) node (upstr label) [label] {Upstream projects};

    \node (fedora) [projects, right=of debian]
      {\includegraphics[height=\logosize]{graphics/logos/FedoraLogo}};
    \node (OpenBSD) [projects, right=of derivs]
      {\includegraphics[height=\logosize]{graphics/logos/GentooLogo}};
    \node (oecos label) [label,below=of OpenBSD] {Other ecosystems};

    \begin{pgfonlayer}{background1}
      \node (oecos) [ecosystem, fit={(fedora) (OpenBSD) (oecos label)}] {};
      \node (decos) [ecosystem, fit={(decos label) (debian) (derivs)}] { };
    \end{pgfonlayer}

    \path ($ (oecos.south)!.5!(decos.south) $)+(0,-3em) node [label] (FOSS label) {FOSS Ecosystem};

    \begin{pgfonlayer}{background1}
    \end{pgfonlayer}


    \begin{pgfonlayer}{background1}
      \node (upstreams) [ecosystem,fit={(kde) (upstr label) (gcc)},minimum
      height=4em] {};
    \end{pgfonlayer}

    \path [draw, <->] (debian) -- node {\litimp} (derivs);
    \path [draw, <->] (decos.east) -- node[above] {\litim} (oecos.west);
    \path [draw, <->] (decos.north |- upstreams.south) -- node {\litimt} (decos.north);
    \path [draw, <->] (oecos.north |- upstreams.south) -- node {\litimt} (oecos.north);

    \path [draw, ->] (decos.270) edge[flowloop]
      node [pos=0.25] (lbugl) {\bug}
      node [pos=0.35] {\hat}
      node [pos=0.45] {\suser}
      node [pos=0.55] (lpatch) {\patch}
      node [pos=0.65] {\source}
      node [pos=0.75] {\debf}
      (decos.270);
    \path [draw, ->] (oecos.270) edge[flowloop]
      node [pos=0.25] {\bug}
      node [pos=0.375] {\hat}
      node [pos=0.50] {\suser}
      node [pos=0.625] (lpatch) {\patch}
      node [pos=0.75] (lsource) {\source}
      (oecos.270);
    \path [draw, ->] (upstreams.270) edge[flowloop]
      node [pos=0.25] {\bug}
      node [pos=0.375] {\hat}
      node [pos=0.50] {\suser}
      node [pos=0.625] {\patch}
      node [pos=0.75] {\source}
      (upstreams.270);

    \begin{pgfonlayer}{background2}
      \path[use as bounding box,clip] node (foss)
      [ecosystem,fill=blue!50,fit=(oecos) (decos) (lpatch) (lbugl) (lsource)
        (FOSS label) (upstreams)] {};
    \end{pgfonlayer}
    \clip (foss.north east) rectangle (foss.south west);
\end{tikzpicture}

See the following image to get an idea of the whitespace: Excess whitespace around edges with distance style attribute

share|improve this question
    
My guess is that the control points for the loops are forcing the bounding box to be too big (see tex.stackexchange.com/q/4654/86 for a similar situation, and also how the current bounding box can be used to diagnose this). –  Loop Space Jun 14 '11 at 13:35
1  
Whitespace is... white. It's difficult to get a handle on what the problem is from the above picture. (I'm reminded of a joke from Red Dwarf: Holly says "the thing about black holes is they're black. and the thing about space is... it's black"... Anyone? –  Seamus Jun 14 '11 at 13:36
2  
@Seamus: "But what is it?" "It's like a magic door." "Well, why didn't you say so!". Seriously, that's why using the current bounding box node can help diagnose whitespace. Insert \draw (current bounding box.south west) rectangle (current bounding box.north east); before and after the suspect command to see how much whitespace it adds. –  Loop Space Jun 14 '11 at 15:32
    
I'd help, but I can't compile your sample without the images. –  Matthew Leingang Jun 15 '11 at 0:10
    
If you use use as bounding box, you first have to call \pgfresetboundingbox, as use as bounding box will not decrease the size of the bounding box. –  Jake Jun 15 '11 at 3:09

1 Answer 1

up vote 1 down vote accepted

If you add the overlay option to your picture, the bounding box will be set to 0x0, which gets rid of the whitespace. You can prove it to yourself by putting the picture in an \fbox:

\fbox{\begin{tikzpicture}[overlay]
...
\end{tikzpicture}}

To re-establish the bounding box, I think the "use as bounding box" option on a path will do it.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.