PGF/TikZ Manual

The TikZ and PGF Packages
Manual for version 3.1.9a

Libraries

41 Angle Library

  • TikZ Library angles

  • \usetikzlibrary{angles} % and plain
    \usetikzlibrary[angles] % Cont

    This library defines pic types for drawing angles.

  • Pic type angle=A--B--C

  • This pic adds a drawing of an angle to the current path. This “drawing of an angle” consist of a “sector” or “wedge” or “slice” whose pointed end is at point B and whose straight sides lie on the lines form B to A and from B to C. The length of these lines is governed by the following key:

    The three points A, B, and C must be the names of nodes or coordinates; you cannot use direct coordinates like “(1,1)” here.

    You can leave out the three points, in this case the text A--B--C is used; so in the above examples we could just have written {angle} in the first pic.

    Concerning the sector that makes up the drawing of the angle, the angular part of this sector is drawn in front of the path if the draw option is given to the pic, while filled sector is drawn behind the pic, provided an option like fill or shade is passed to the pic. The following example shows the difference:

    (-tikz- diagram)

    \usetikzlibrary {angles}
    \tikz \draw [line width=2mm]
    (2,0) coordinate (A) -- (0,0) coordinate (B)
    -- (1,1) coordinate (C)
    pic [draw=blue, fill=blue!50, angle radius=1cm] {angle};

    When pic text is set (which you typically do by using the quotes syntax), a node will be created whose name is empty (and, thus, inherits the pic’s name) and which will be at the half-way angle between the lines to A and C and whose distance from B is angle radius times the following factor: