具有距离样式属性的边缘周围有多余的空白

具有距离样式属性的边缘周围有多余的空白

例如,在边上使用距离样式属性时,

\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]

我的边缘周围有过多的空白。我尝试使用 clip 和“用作边界框”,但无济于事。有没有关于如何删除它或首先不让它出现的建议?我不得不求助于使用与 TeXLive 捆绑在一起的“pdfcrop”来摆脱它。

请参阅所附代码和图片以了解我的意思。您会注意到,在我的两个底部循环的左侧和右侧有一个循环宽度的空白。

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

参见下图来了解空白: 具有距离样式属性的边缘周围有多余的空白

答案1

如果你将该overlay选项添加到图片中,边界框将设置为 0x0,从而消除空白。你可以通过将图片放入以下位置来亲自证明这一点\fbox

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

要重新建立边界框,我认为路径上的“用作边界框”选项可以做到这一点。

相关内容