Why does a path drawn from corner of a node doesn't align with the node path? It might even be non-horizontal while coordinates tell that it is. Who can I fix this?

\node (left) at (0cm, 0cm)
    [draw, anchor=south west, minimum height=3cm, minimum width=1.1cm] {};
\node (right) at (3cm, 0cm)
    [draw, anchor=south west, minimum height=3cm, minimum width=1.1cm] {};
\draw (left.north east) -- ++(0.8cm, 0cm)
    .. controls +(0.5cm, -1cm) and +(-0.5cm, 1cm) .. ++(-0.4cm, -3cm)
    -- (left.south east);
\draw (right.north west) -- ++(-0.3cm, 0cm)
    .. controls +(0.5cm, -1cm) and +(-0.5cm, 1cm) .. ++ (-0.4cm, -3cm)
    -- (right.south west);


enter image description here

  • 3
    By default the outer sep for a node is set to .5\pgflinewidth. This means that when you reference the rectangle node anchor the point is at the outside edge of the line when the node is drawn. To make the anchors reference the middle of the line use outer sep=0pt. Jul 4 '13 at 11:03
  • Thanks, Mark! This helped. Still the lines drawn by \draw are different from \node: the \draw lines have smooth antialiased edge, and \node lines have sharp edge. I failed to find in documentation which parameter controls this. Can you give advice on this, please? Jul 4 '13 at 12:03
  • Antialiasing results from the rendering algorithms used by your (PDF?) viewer, and also by (supported) graphics cards. PGF and TikZ do not control this and merely insert relatively abstract path specifications. Jul 4 '13 at 12:33
  • Hmm, strange that horizontal lines drawn via \draw and via \node are rendered differently. AFAIU, they both are implemented via \path and should be same for the renderer. Jul 4 '13 at 13:21
  • (Related: Properly aligning drawn lines between the corners of 2 rectangular nodes in TikZ?) It might be worth noting that here outer ysep=+pt suffices and makes sure that the \drawn lines only touch the rectangular border. By the way, they are rendered exactly the same way for SumatraPDF, Foxit Reader and Adobe Reader. Jul 4 '13 at 14:23

Browse other questions tagged or ask your own question.