1

Im trying to use this code

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\tikzset{
  anticlockwise arc centered at/.style={
    to path={
      let \p1=(\tikztostart), \p2=(\tikztotarget), \p3=(#1) in
      \pgfextra{
        \pgfmathsetmacro{\anglestart}{atan2(\x1-\x3,\y1-\y3)}
        \pgfmathsetmacro{\angletarget}{atan2(\x2-\x3,\y2-\y3)}
        \pgfmathsetmacro{\angletarget}%
        {\angletarget < \anglestart ? \angletarget+360 : \angletarget}
        \pgfmathsetmacro{\radius}{veclen(\x1-\x3,\y1-\y3)}
      }
      arc(\anglestart:\angletarget:\radius pt) -- (\tikztotarget)
    },
  },
  clockwise arc centered at/.style={
    to path={
      let \p1=(\tikztostart), \p2=(\tikztotarget), \p3=(#1) in
      \pgfextra{
        \pgfmathsetmacro{\anglestart}{atan2(\x1-\x3,\y1-\y3)}
        \pgfmathsetmacro{\angletarget}{atan2(\x2-\x3,\y2-\y3)}
        \pgfmathsetmacro{\angletarget}%
        {\angletarget > \anglestart ? \angletarget - 360 : \angletarget}
        \pgfmathsetmacro{\radius}{veclen(\x1-\x3,\y1-\y3)}
      }
      arc(\anglestart:\angletarget:\radius pt)  -- (\tikztotarget)
    },
  },
}

\begin{document}
\begin{tikzpicture}
  % 3 centers (a, b, c)
  \coordinate (a) at (0,0);
  \coordinate (b) at (-1,-1);
  \coordinate (c) at (1,-1);

  % 3 circles
  \draw[name path=circleA] (a) circle (1.5cm);
  \draw[name path=circleB] (b) circle (1.5cm);
  \draw[name path=circleC] (c) circle (1.5cm);

  % label of circles
  \node (A) at ($(a)+(0,1)$) {$A$};
  \node (B) at ($(b)+(-1,0)$) {$B$};
  \node (C) at ($(c)+(1,0)$) {$C$};

  % intersections of circles (A) and (B)
  \path [name intersections={of=circleA and circleB,name=AB}];
  % show them
  \fill[red] (AB-1) circle (2pt) node[above left] {AB-1};
  \fill[red] (AB-2) circle (2pt) node[below right] {AB-2};

  % intersections of circles (A) and (C)
  \path [name intersections={of=circleA and circleC,name=AC}];
  % show them
  \fill[red] (AC-1) circle (2pt) node[above right] {AC-1};
  \fill[red] (AC-2) circle (2pt) node[below left] {AC-2};

  % intersections of circles (B) and (C)
  \path[name intersections={of=circleB and circleC,name=BC}];
  % show them
  \fill[red] (BC-1) circle (2pt) node[above] {BC-1};
  \fill[red] (BC-2) circle (2pt) node[below] {BC-2};


  \draw[line join=round,orange,fill=orange,fill opacity=.5,line width=1pt]
  (AC-2)
  to[clockwise arc centered at=a] (AB-2)
  to[anticlockwise arc centered at=b] (BC-1)
  to[anticlockwise arc centered at=c] (AC-2);

\end{tikzpicture}
\end{document}

to draw part of a circle. However, when compiling with MikTeX 2.9 or TexLive 2015, the result ends up looking like this enter image description here instead of this enter image description here.

Compiling with older versions of TexLive gives the desired output. I assume this is because these old versions don't use pgf 3.0 yet. How can I fix this code to work properly with the new version of pgf?

0 Answers0