tkzFillAngle makes a small mistake when filling an angle and I don't know why.

Here is my minimum working example:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{figure*}
    \centering
    \begin{tikzpicture}[scale=5]    
        \node at (0:1) (point) {};
        \node at (30:1) (otherpoint) {};
        \node at (0:0) (O) {};
        \tkzFillAngle[fill=orange, size=0.3, opacity=0.4](point,O,otherpoint)
        % tkz code no ;
        \draw [dashed] (O.center)--(point);
        \draw (O.center)--(otherpoint);
    \end{tikzpicture}
    \caption{asdf}
\end{figure*}   
\end{document}

Here is what I get. Note how the filling doesn't go all the way to the corner of the angle. Any idea what I'm doing wrong?

enter image description here

  • 1
    Welcome to TeX.SE. I see an error of compilation: Missing chars ;. – Sebastiano Aug 15 at 18:52
  • @CarLaTeX Now I'm using Papeeria and I have this bit of error. Can you try here: papeeria.com. That is not, of course, the problem. In my opinion, there are some coordinate errors. – Sebastiano Aug 15 at 19:04
  • @Sebastiano When I compile the code in texpad (using the mactex distribution), I don't get any errors. Also I don't see where I could have misplaced a ; – Fabian Aug 15 at 19:05
  • 3
    Use \coordinate instead of node : \coordinate (O) at (0:0); Nodes are extended objects, they come with inner sep and outer sep. – marmot Aug 15 at 19:09
  • 1
    @Sebastiano you're right there is a wrong ";" at the end of the \tkzFillAngle instruction. – CarLaTeX Aug 16 at 6:34
up vote 10 down vote accepted

You need to use \coordinate instead of \node.

See here: TikZ: difference between \node and \coordinate?.

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{figure*}
    \centering
    \begin{tikzpicture}[scale=5]    
        \coordinate (point) at (0:1);
        \coordinate (otherpoint) at (30:1);
        \coordinate (O) at (0:0);
        \tkzFillAngle[fill=orange, size=0.3, 
        opacity=0.4](point,O,otherpoint)% no ; here
        \draw [dashed] (O)--(point);
        \draw (O)--(otherpoint);
    \end{tikzpicture}
    \caption{asdf}
\end{figure*}   
\end{document}

enter image description here

  • 1
    @Fabian You're welcome, thank you for accepting my answer! We always like to help users who post an MWE. Your question is perfect. – CarLaTeX Aug 15 at 19:15

It is possible to define the points as just done @CarlaTex but it is also possible to define them with the macro tkzDefPoint[< options >](x,y){name}

The tkzFillAngle macro is not documented in the manual, but is quoted. The manual contains the \tkzMarkAngle macro which is used in the same way without being documented either.

The manual documents two macros that allow drawing angular sectors \tkzDrawSector and tkzFillSector which allows to plot angular sectors. In order to understand the difference between these two macros, I drew the angular sector with each one without drawing the sides.

\tkzDrawSector draws the contour of the corner:

draw-euclide \tkzFillSector colors it without drawing its contour:

fill-euclide

It is of course possible to draw and colour the angular sector at the same time. In the example you gave, as the magnification is of factor 5, I put a radius 5 times smaller (2mm)

tkz-euclide Macros don't need semicolons.

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{figure*}
    \centering
    \begin{tikzpicture}[scale=5]    
        \tkzDefPoint(0:1){point}
        \tkzDefPoint(30:1){otherpoint}
        \tkzDefPoint(0:0){O}    
%       \tkzFillAngle[fill=orange, size=0.3, opacity=0.4](point,O,otherpoint);
%       \tkzMarkAngle[fill=orange, size=0.3, opacity=0.4](point,O,otherpoint);
%       \tkzFillSector[R with nodes,fill=orange, opacity=0.4](O,2mm)(point,otherpoint)
        \tkzDrawSector[R with nodes,fill=orange, opacity=0.4](O,2mm)(point,otherpoint)
        \draw [dashed] (O.center)--(point.center);
        \draw (O.center)--(otherpoint.center);
        \tkzDrawPoints(O,point,otherpoint)
    \end{tikzpicture}
    \caption{asdf}
\end{figure*}   
\end{document}

Output with \tkzDrawSector:

draw-euclide-1

Output with \tkzFillSector:

fill-euclide-1 Translated with www.DeepL.com/Translator

  • in the next version of tkz-euclide, I changed some options. No tkzMark,tkzFill, tkzDraw are specific macros. It's not possible to fill with draw or to draw with mark etc... – Alain Matthes Aug 16 at 6:14
  • @AlainMatthes In my opinion, the most practical (user friendly) is to make as on tikz, a single macro corresponding to a single concept like tkzSector and whose options draw, fill, mark, allow to modify its use – AndréC Aug 16 at 6:19
  • 1
    Thanks for this nice overview! This cleared a lot of things up! – Fabian Aug 16 at 15:57

With only tkz-euclide

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{figure*}
    \centering
    \begin{tikzpicture}[scale=5]    
        % \node at (0:1) (point) {};
        % \node at (30:1) (otherpoint) {};
        % \node at (0:0) (O) {};
        \tkzDefPoint(0:1){point}
        \tkzDefPoint(30:1){otherpoint}
        \tkzDefPoint(0:0){O}
        \tkzFillAngle[fill=orange, size=0.3, opacity=0.4](point,O,otherpoint)
        % tkz code no ;
        \tkzDrawSegment[dashed](O,point)
        \tkzDrawSegment(O,otherpoint)
        % \draw [dashed] (O.center)--(point);
        % \draw (O.center)--(otherpoint);
    \end{tikzpicture}
    \caption{asdf}
\end{figure*}   
\end{document}

With only tikz it's possible to fill an angle. You have beautiful examples with the geometry lessons in the pgfmanual. And now you can use a pic with the recent version.

  • Thanks for editing my answer, that's the reason for the error reported by Sebastiano, then. I didn't look at the log because I answered using Overleaf. – CarLaTeX Aug 16 at 6:30
  • Thanks! Yeah, I know I can fill an angle with just tikz, but I need tkz-euclide for some other parts, involving equilateral triangles etc. – Fabian Aug 16 at 15:58

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.