2

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

1

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

  • 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 : tex.stackexchange.com/questions/43621/… – percusse Dec 12 '12 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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