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.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
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
add comment

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.