2

I want to draw this figure, composed by superposition of five circles. enter image description here

But, I can't get rid of the outlines that appear. enter image description here

\documentclass[addpoints,12pt]{exam}    
\usepackage[latin1]{inputenc}       
\usepackage[portuguese,brazil]{babel}     
\usepackage{mathptmx}       
\usepackage{babel}    
\usepackage[T1]{fontenc}        
\usepackage[a4paper,bottom=2cm]{geometry}     
\usepackage{multicol}           
\usepackage{textcomp}    
\usepackage{tikz}       
    \begin{center}    
\begin{tikzpicture}    
\draw  (0,0) circle [radius=1];    
\draw (0.5,0.5) circle [radius=1];    
\draw (0.5,-0.5) circle [radius=1];    
\draw (-0.5,0.5) circle [radius=1];    
\draw (-0.5,-0.5) circle [radius=1];
\end{tikzpicture}
\end{center}
\end{document}
  • 1
    you could try \draw[fill=white] ..... – Faekynn May 21 '16 at 14:43
3

It also possible to solve this by clipping. This avoids that the background of the circles is filled with white.

The are of a circle can be excluded from the clipping path by combining the circle with the full drawing area using the even odd rule. The circle area is covered twice and therefore excluded (even). This needs to be repeated for each circle, which overlaps the circle to be drawn.

Example file:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[radius=1, even odd rule]
  \path
    % Define center points of the circles
    ( .5,  .5) coordinate (Z)
    ( .5, -.5) coordinate (V)
    (-.5, -.5) coordinate (W)
    (-.5,  .5) coordinate (Y)
    (  0,   0) coordinate (X)
    % Simulated drawing of the circles to get the bounding box
    \foreach \M in {V, ..., Z} {(\M) circle[]}
    % The bounding box needs to be increased by half of the line width.
    % Also a small amount is additionally added to avoid cutting
    % the curves because of rounding issues.
    (current bounding box.south west) ++(-.5\pgflinewidth, -.5\pgflinewidth)
      ++(-.1pt, -1.pt)
    (current bounding box.north east) ++(.5\pgflinewidth, .5\pgflinewidth)
      ++(.1pt, .1pt)
    % Shorter names
    (current bounding box.south west) coordinate (ll)
    (current bounding box.north east) coordinate (ur)
  ;

  % Circle Z
  \begin{scope}
    \foreach \M in {V, X, Y} {% W is already covered by V, X, Y
      \clip (ll) rectangle (ur) (\M) circle[];
    }
    \draw (Z) circle[];
  \end{scope}

  % Circle V
  \begin{scope}
    \foreach \M in {W, X} {% Y is covered
      \clip (ll) rectangle (ur) (\M) circle[];
    }
    \draw (V) circle[];
  \end{scope}

  % Circle W
  \begin{scope}
    \foreach \M in {X, Y} {%
      \clip (ll) rectangle (ur) (\M) circle[];
    }
    \draw (W) circle[];
  \end{scope}

  % Circle Y
  \begin{scope}
    \clip (ll) rectangle (ur) (X) circle[];
    \draw (Y) circle[];
  \end{scope}

  % Circle X
  \draw (X) circle[];

  % Annotations
  \node at (  0,  0) {$X$};
  \node at ( .9, .9) {$Z$};
  \node at (-.9, .9) {$Y$};
  \node at (-.9,-.9) {$W$};
  \node at ( .9,-.9) {$V$};
\end{tikzpicture}
\end{document}

Result with clipping

  • Heiko Oberdiek, Show!. – benedito May 22 '16 at 11:54
1

With the option fill=white, you can draw filled white disks above the lines drawn before. Note the changed order of the circles and the cleaned code.

enter image description here

\documentclass[]{article}    
\usepackage{tikz}  

\begin{document}    
\begin{tikzpicture}    
\draw[fill=white] (0.5,0.5) circle [radius=1];    
\draw[fill=white] (0.5,-0.5) circle [radius=1];    
\draw[fill=white] (-0.5,-0.5) circle [radius=1];
\draw[fill=white] (-0.5,0.5) circle [radius=1];    
\draw[fill=white]  (0,0) circle [radius=1];    

\node at (0,0) {X};
\node at (0.875,0.875) {Z};
\node at (-0.875,0.875) {Y};
\node at (-0.875,-0.875) {W};
\node at (0.875,-0.875) {V};
\end{tikzpicture}
\end{document}
  • To address the general case, where you are not lucky enough to fill entire circles, I suspect that one can draw only arcs instead of a full circle, and build up complicated drawings from those atoms. – Matsmath May 21 '16 at 15:35
  • Faekynn, Show!! – benedito May 22 '16 at 11:55
  • @Matsmath I think, arcs will always go to the center of the circle and are thus not the ideal solution. Clipping (as suggested by Heiko Oberdiek) might then be the suitable solution. However, if you have a good idea how to do it, feel free to edit (or post another answer) – Faekynn May 22 '16 at 20:26

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.