3

Using positioning TikZ library, I am getting spurious white space between the arrow and the tikz node as shown in the figure below. It works fine with simple rectangles.

MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
  \begin{tikzpicture}
    \node[rectangle,draw](node1){Node 1}; 
    \node[rectangle,draw,below=of node1](node2){Node 2}; 
    \node[below=of node2](tikzpic){%
      \begin{tikzpicture}[scale=0.5]
          \draw [step=0.25cm,lightgray,very thin] (0,0) grid (2.5,1.5);
          \draw [->,ultra thick] (0,0.0) -- (0,1.5);
          \draw [->,ultra thick] (0,0.0) -- (2.5,0);
          \draw [fill=blue!7,ultra thick] (0.2,0) ..controls
          (0.5,2.2) and (1.5,0.3) .. (2,0);
        \end{tikzpicture}
    };  
    \draw[->,ultra thick] (node1) -- (node2);
    \draw[->,ultra thick] (node2) -- (tikzpic);
  \end{tikzpicture}
\end{document}

enter image description here

devendra
  • 2,818

1 Answers1

2

That's because the control points are enlarging the bounding box.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
  \begin{tikzpicture}
    \node[rectangle,draw](node1){Node 1}; 
    \node[rectangle,draw,below=of node1](node2){Node 2}; 
    \node[below=of node2,inner sep=0,outer sep=0](tikzpic){%
      \begin{tikzpicture}[scale=0.5]
          \draw [step=0.25cm,lightgray,very thin] (0,0) grid (2.5,1.5);
          \draw [->,ultra thick] (0,0.0) -- (0,1.5);
          \draw [->,ultra thick] (0,0.0) -- (2.5,0);
          \draw [fill=blue!7,ultra thick,overlay] (0.2,0) ..controls
          (0.5,2.2) and (1.5,0.3) .. (2,0);
        \end{tikzpicture}
    };  
    \draw[->,ultra thick] (node1) -- (node2);
    \draw[->,ultra thick] (node2) -- (tikzpic);
\end{tikzpicture}
\end{document}

enter image description here

percusse
  • 157,807
  • Thanks. How could I draw the bounding box? Also, what gave you idea that the control points are causing this? I would like to know the methodology (if at all) of debugging this kind of a problem? – devendra Dec 12 '12 at 12:33
  • @devendra You can find the details in this : http://tex.stackexchange.com/questions/43621/bounding-box-is-larger-than-expected-when-drawing-a-curved-path – percusse Dec 12 '12 at 12:37