1

The code below produces the following plot where the path between the frame of the node and the frame around the circles is not the good one. There are two unwanted gaps. How can I fix this ?

enter image description here

% Source
%   * https://tex.stackexchange.com/questions/101839/how-to-draw-a-venn-diagram-in-tikz

\documentclass[a4paper, 12pt]{scrartcl}

\usepackage{tikz} \usetikzlibrary{positioning,fit,calc}

\begin{document}

\begin{tikzpicture} \node(secondcircle) [circle, text width = 3cm, draw, ultra thick] {};

\node(firstcircle)
     [circle, text width = 3cm, 
      left = -1cm of secondcircle,
      draw = orange, ultra thick] {};

\node(box)
     [fit = (firstcircle)(secondcircle),
      inner sep = 1cm,
      draw, ultra thick, rounded corners] {};

\node(universe) at (box.north east)
     [anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
      draw, ultra thick, rounded corners] {$\Omega$};

\path[draw, ultra thick]
     (box.north east) -- (universe.south west);

\end{tikzpicture}

\end{document}

projetmbc
  • 13,315

1 Answers1

1

One non-universal possible solution is to make the line longer in both ends with shorten. You just need to make the line end within the curves. Remove the red option from this:

\documentclass[a4paper, 12pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{tikzpicture}
    \node(secondcircle)
         [circle, text width = 3cm, 
          draw, ultra thick] {};
    \node(firstcircle)
         [circle, text width = 3cm, 
          left = -1cm of secondcircle,
          draw = orange, ultra thick] {};
    \node(box)
         [fit = (firstcircle)(secondcircle),
          inner sep = 1cm,
          draw, ultra thick, rounded corners] {};
    \node(universe) at (box.north east)
         [anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
          draw, ultra thick, rounded corners] {$\Omega$};
    \path[draw, red, ultra thick,shorten <=-0.1cm, shorten >=-0.1cm]
         (box.north east) -- (universe.south west);
\end{tikzpicture}
\end{document}

Longer line