I am currently trying to improve the images of some basic geometry articles in Wikipedia. One image I have improved is the of an Arbelos (en).

This is the LaTeX-Code:



    % Draw A
    \coordinate[label=left:$A$]  (A) at (0,0);

        % big half-circle from A to B
        \draw[thick,fill=green!30] (0,0) -- (0:4cm) arc (0:180:4cm);

        % Draw D
        \coordinate[label=below:$D$] (D) at (2,0);

        % Perpendicular CD
        \draw[thick] (2,0) -- node[] {} (2,3.47);

        % Draw C
        \coordinate[label=above:$C$] (C) at (2,3.47);

        % Crop circle AD from the big green circle AB
        % This is the one I would like to be transparent
        \draw[thick,fill=white] (0,0) -- (0:3cm) arc (0:180:3cm);

        % Draw B
        \coordinate[label=below:$B$] (B) at (5,0);

    % Circle DB - should also be transparent
    \draw[thick,fill=white] (7,0) -- (8cm,0) arc (0:180:1cm);

    % Cirlce CD
    \draw[thick] (6,1.735) circle (1.735cm);

    % I have to draw this one, as "arc" doesn't completely 
    % draw the line AB
    \draw[thick] (0,0) -- node[] {} (8,0);

It is working and looks like that:

enter image description here

Looks fine, except that the two circles AD and DB are white, not transparent. Take a look at the SVG for that: File:Arbelos-tikz.svg. How can I overwrite the green filled circle with transparent / crop this part out of the green circle?

(If it is possible to make this piece of LaTeX-Code simpler, please let me know.)


4 Answers 4


Maybe this?


\draw[fill=green](-1,0) arc (180:0:1) arc (0:180:0.3) arc (0:180:0.7);

enter image description here

  • looks like part of your Batman work :)
    – cmhughes
    Jul 12, 2012 at 15:05
  • @cmhughes Heheh, indeed this is the supplementary batarang accessories.
    – percusse
    Jul 12, 2012 at 15:07
  • @percusse: Very nice! Thank you very much! I still need the rest of the picture (the lines AB and CD, the points A, B, C, D, the circle CD and the margin), so it's not that short, but now its much better than my previous version. I've published the LaTeX-Source Code on commons.wikimedia.org/wiki/File:Arbelos-tikz.svg Jul 12, 2012 at 15:16
  • 1
    @moose Ah, of course but I knew that you can simply replace the relevant part. By the way, great work on Wiki.
    – percusse
    Jul 12, 2012 at 15:19

Just to add an tkz-euclide answer. I am sure Altermondus can improve this answer.

\tkzInit[xmin=-1,xmax=6,ymax=5,ymin=-1] \tkzClip
\tkzDefPoint(0,0){A}            \tkzDefPoint(5,0){B}
\tkzDefMidPoint(A,B)            \tkzGetPoint{M1}
\tkzCalcLength[cm](A,B)         \tkzGetLength{dAB}
\tkzInterLC[R](A,B)(A,\r cm)    \tkzGetPoints(D)

\tkzDefLine[orthogonal=through D](A,D)
\tkzInterLC(D,tkzPointResult)(M1,A) \tkzGetFirstPoint{C}

\tkzDefMidPoint(D,C)            \tkzGetPoint{M2}

\draw[thick,fill=green!30!](A) arc (180:0:\dAB/2) arc (0:180:\dAB/2-\r/2) arc (0:180:\r/2);
\tkzDrawSegments[thick](A,B C,D)

\tkzLabelPoints[below](A,B,D) \tkzLabelPoints[above right](C)

enter image description here

The pros of doing it this way is that you can move A and B around, and everything still works. The point D is defined as \a * length of AB. So to get D closer you B you would increase a. Where 0<a<1. The major difference is that nothing is hardcoded here, everything is related to the first two points.

  • 2
    Pretty! Now you are a pro with tkz-euclide. Jul 12, 2012 at 17:11
  • @Altermundus, there is a problem in the code. Try to set a<0.5 , then the point C is under segment AB. I know you can then use \tkzGetSecondPoint, but is there an more automatic approach ? (I might post this as a new question) Jul 12, 2012 at 17:30
  • No an automatic approach is actually impossible. Jul 12, 2012 at 20:01

enter image description here




We can distinguish the transparent regions from the opaque ones by not viewing the image perpendicularly. Instead view it by placing your eyes near any edge of your screen.


There is the evenodd rule which can be used:

\special{background rgb .5 .5 0} % needs XeTeX
  \filldraw[fill=lime,even odd rule] svg
    "M0,0 a1,1 0 0 1 100,0 h-100 a1,1 0 0 1 80,0 1,1 0 0 1 20,0";

enter image description here

Also note that

<?xml version="1.0" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg"
  viewBox="0 -51 100 100">
  <path fill="lime" fill-rule="evenodd" stroke="black"
    d="M0,0 a1,1 0 0 1 100,0 h-100 a1,1 0 0 1 80,0 1,1 0 0 1 20,0" />

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .