# tikz with tkz-euclide: gaps in fill using \tkzFillAngle

I've been using tikz and tkz-euclideto draw a 2D diagram of a section of a triangular mesh.

I have drawn the nodes, edges and angles as in the MWE below. The problem is the fill of one of the angles does not cover the whole area between the two edges. Notice the white space visible between the red fill and the edge between nodes v0 and v5.

I've tried many suggestions posted on this site on how to mark angles using tikz and/or tkz-euclide. This code is nearly exactly what I want - if the fill was correct.

\documentclass[]{article}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{calc,intersections}
\usetkzobj{all}
\tikzstyle{vertex}=[circle, color=black, fill=black, draw, inner sep=0pt, minimum size=6pt]
\tikzstyle{redVertex}=[circle, color=red!100, fill=red!50, draw, inner sep=0pt, minimum size=6pt]

\begin{document}
\begin{tikzpicture}[x=3cm, y=3cm]
\node (v0) at (1,1) [redVertex, label={[yshift=+0.3cm]right:$x_i$}] {};
\node (v1) at (0,1) [vertex, label=left:$x_{k1}$] {};
\node (v2) at (0,2) [vertex] {};
\node (v3) at (1,2) [vertex] {};
\node (v4) at (2,1) [vertex] {};
\node (v5) at (2,0) [vertex, label=below:$x_{k2}$] {};
\node (v6) at (1,0) [redVertex, label=below:$x_j$] {};

\path[thick]
(v1) edge [dashed] (v2)
(v1) edge (v0)
(v1) edge (v6)
(v2) edge [dashed] (v3)
(v2) edge [dashed] (v0)
(v3) edge [dashed] (v0)
(v3) edge [dashed] (v4)
(v0) edge [dashed] (v4)
(v0) edge (v6)
(v0) edge (v5)
(v4) edge [dashed] (v5)
(v6) edge (v5)
;

\tkzMarkAngle[size=.3](v6,v1,v0)
\tkzLabelAngle[pos=.15](v6,v1,v0){$\alpha_{ij}$}
\tkzMarkAngle[size=.3](v0,v5,v6)
\tkzLabelAngle[pos=.15](v0,v5,v6){$\beta_{ij}$}
\tkzMarkAngle[size=.25](v1,v0,v6)
\tkzLabelAngle[pos=-.20](v1,v0,v6){$\theta_{1}$}
\tkzFillAngle[fill=red!50, size=.30](v6,v0,v5)
\tkzLabelAngle[pos=.19](v6,v0,v5){$\theta_{2}$}
\end{tikzpicture}
\end{document}


Which produces:

-

It looks like an anchor problem, but tkz-euclide seems to use a different abstraction from tikz's, and does not let you access the anchor easily.

As a workaround, separating the node from its display, and deferring the display until after the angle is drawn, I get this:

You might want, for consistency, to do the same with all nodes. There is probably a more canonical way of achieving this, using tkz-euclide's Point abstraction.

\documentclass[]{article}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{calc,intersections}
\usetkzobj{all}
\tikzstyle{vertex}=[circle, color=black, fill=black, draw, inner sep=0pt, minimum size=6pt]
\tikzstyle{redVertex}=[circle, color=red!100, fill=red!50, draw, inner sep=0pt, minimum size=6pt]

\begin{document}
\begin{tikzpicture}[x=3cm, y=3cm]
\coordinate (v0) at (1,1) {};

\node (v1) at (0,1) [vertex, label=left:$x_{k1}$] {};
\node (v2) at (0,2) [vertex] {};
\node (v3) at (1,2) [vertex] {};
\node (v4) at (2,1) [vertex] {};
\node (v5) at (2,0) [vertex, label=below:$x_{k2}$] {};
\node (v6) at (1,0) [redVertex, label=below:$x_j$] {};

\path[thick]
(v1) edge [dashed] (v2)
(v1) edge (v0)
(v1) edge (v6)
(v2) edge [dashed] (v3)
(v2) edge [dashed] (v0)
(v3) edge [dashed] (v0)
(v3) edge [dashed] (v4)
(v0) edge [dashed] (v4)
(v0) edge (v6)
(v0) edge (v5)
(v4) edge [dashed] (v5)
(v6) edge (v5)
;

\tkzMarkAngle[size=.3](v6,v1,v0)
\tkzLabelAngle[pos=.15](v6,v1,v0){$\alpha_{ij}$}
\tkzMarkAngle[size=.3](v0,v5,v6)
\tkzLabelAngle[pos=.15](v0,v5,v6){$\beta_{ij}$}
\tkzMarkAngle[size=.25](v1,v0,v6)
\tkzLabelAngle[pos=-.20](v1,v0,v6){$\theta_{1}$}
\tkzFillAngle[fill=red!50, size=.30](v6,v0,v5)
\tkzLabelAngle[pos=.19](v6,v0,v5){$\theta_{2}$}

\node (xi) at (v0) [redVertex, label={[yshift=+0.3cm]right:$x_i$}] {};
\end{tikzpicture}
\end{document}

-
Thanks for the simple fix! I didn't want to have to rewrite using just tikz –  KeithJ108 Mar 5 '14 at 11:09

A plain Metapost solution, showing how to mark an angle and position a label neatly.

prologues := 3;
outputtemplate := "%j%c.eps";

am_size := 1cm;
vardef angle_arc_path(expr a,b,c) =
fullcircle scaled 2am_size rotated angle (a-b) shifted b cutafter (b--c)
enddef;

vardef angle_label_pos(expr a,b,c) =  % unitvector helps avoid rounding errors
right scaled 3/5 am_size rotated angle(unitvector(a-b)+unitvector(c-b)) shifted b
enddef;

beginfig(1);

4cm = y2 = y3 = -y5 = -y6 = -x1 = -x2 = x4 = x5;
0   = y0 = y1 = y4 = x0 = x3 = x6;

color s_fill,s_line; s_fill = (.97,.47,.47); s_line = (.6,.1,.1);
pen thin; thin = pencircle scaled 0.25;

draw angle_arc_path(z6,z1,z0) withpen thin;
draw angle_arc_path(z0,z5,z6) withpen thin;
draw angle_arc_path(z1,z0,z6) withpen thin;

label(btex $\alpha_{ij}$ etex, angle_label_pos(z6,z1,z0));
label(btex $\beta_{ij}$  etex, angle_label_pos(z0,z5,z6));
label(btex $\theta_1$    etex, angle_label_pos(z1,z0,z6));

am_size := 1.2cm;
fill z0 -- angle_arc_path(z6,z0,z5) -- cycle withcolor s_fill;
draw       angle_arc_path(z6,z0,z5)          withcolor s_line withpen thin;
label(btex $\theta_2$    etex, angle_label_pos(z6,z0,z5));

drawoptions(dashed evenly);
draw z1 -- z2 -- z3 -- z4 -- z5;
draw z0 -- z2;
draw z0 -- z3;
draw z0 -- z4;
drawoptions();
draw z1 -- z6 -- z5;
draw z0 -- z1;
draw z0 -- z5;
draw z0 -- z6;

forsuffixes $=1,2,3,4,5: fill fullcircle scaled 4 shifted z$; endfor
forsuffixes $=0,6: fill fullcircle scaled 4 shifted z$ withcolor s_fill;
draw fullcircle scaled 4 shifted z$withcolor s_line; endfor label.lft(btex$x_{k1}$etex,z1); label.bot(btex$x_{k2}$etex,z5); label.urt(btex$x_i$etex,z0); label.bot(btex$x_j\$    etex,z6);

endfig;
end.

-