# Why is there a light gray border with the tikz fill command?

Here is the source code:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0, 0) circle (1cm);
\path[fill=black] (90:1cm) arc (90:270:1cm);
\path[fill=black] (0:0cm) arc (-90:90:.5cm);
\path[fill=white] (0:0cm) arc (90:270:.5cm);
\path[fill=white] (0, .5) circle (.1cm);
\path[fill=black] (0, -.5) circle (.1cm);
\end{tikzpicture}

\begin{tikzpicture}
\draw (0, 0) circle (1cm);
\filldraw[color=black] (90:1cm) arc (90:270:1cm);
\fill[color=black] (0, .5) circle (.5cm);
\fill[color=white] (0, -.5) circle (.5cm);
\fill[color=white] (0, .5) circle (.1cm);
\fill[color=black] (0, -.5) circle (.1cm);
\end{tikzpicture}

\end{document}


Both approaches should work, but apparently the first one has some flaws, why?

-
It's not a border, it's a rendering mistake of your PDF viewer, basically based on rounding errors. –  tohecz Oct 20 '13 at 20:10
Indeed, and this disappears when zoomed in. –  qed Oct 20 '13 at 20:12

While this may be a rounding errror,it can still be annoying. It's also an artifact of the manner in which you constructed your symbol since you draw and fill a semi-circle. Instead you can do something along the lines of:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw (0, 0) circle (1cm);
\path[fill=black] (90:1cm) arc (90:-90:0.5cm)
(0,0)    arc (90:270:0.5cm)
(0,-1cm) arc (-90:-270:1cm);
\path[fill=white] (0, 0.5) circle (0.1cm);
\path[fill=black] (0,-0.5) circle (0.1cm);
\end{tikzpicture}

\end{document}


-
Well, qed is doing something like this in the second picture, I suppose that it was just an example to show the deeper problem. –  tohecz Oct 20 '13 at 20:26
@tohecz I noticed that. But I thought the OP could benefit from seeing how to draw and fill the tear-drop portion without having to do it in several parts. –  A.Ellett Oct 20 '13 at 20:28

Or, you do it in one path:

## Code

\documentclass[tikz]{standalone}
\tikzset{
YinYang/.style={insert path={{[even odd rule, start angle=90, delta angle=180]
% doing the big circle as an edge allows us to only draw that and only fill the rest
\begin{document}
\tikz\fill[YinYang=1];
\tikz\fill[
draw=white, every edge/.style,
even odd rule, inner color=red,  outer color=blue,
preaction    ={inner color=blue, outer color=red },
% the preaction uses nonzero rule, so it is essentially only the full circle.
] [YinYang=-1];% negative raduius flips the two halves
\end{document}


## Output

-
Nice! How does @aux work? I could not find it in the manual... –  Bordaigorl Oct 21 '13 at 10:10
@Bordaigorl @aux is just the name of the coordinate I use later. –  Qrrbrbirlbel Oct 21 '13 at 15:07
Oh now I see! I thought it was set to the current coord internally but I see now you name the coordinate before drawing the first circle. Thanks! –  Bordaigorl Oct 21 '13 at 18:10