Drawing Guide

Practical Patterns for tkz-euclide

Seventeen small constructions for Euclidean geometry diagrams

A working reference for Euclidean constructions with tkz-euclide, a geometry package built on TikZ.

TikZ is a general-purpose system for producing graphics in TeX. tkz-euclide is a package built on TikZ for Euclidean constructions. TikZ supplies the underlying drawing language, while tkz-euclide adds commands for defining and constructing points, lines, circles, intersections, transformations, and geometric marks.

I use tkz-euclide because it allows the code to follow the geometry. A midpoint is defined as a midpoint; a perpendicular is drawn as a perpendicular; and an intersection is taken as an intersection. The meaning of the figure and the meaning of the code therefore remain close to one another, which makes a construction easier to revise and reuse.

This note collects the patterns I use most often. It is a working reference rather than a complete account of the package. Each example gives the code for one small construction and the figure produced by it. For further options, see the official tkz-euclide documentation.

Preamble

The examples below use a portable English preamble. Each code block contains a complete tikzpicture environment; place one of them between \begin{document} and \end{document}.

\documentclass[border=8pt]{standalone}

\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,intersections,angles,quotes}

\definecolor{egNavy}{HTML}{17243D}
\definecolor{egGray}{HTML}{777671}
\definecolor{egRust}{HTML}{92513F}

\tikzset{
  eg figure/.style={
    line cap=round,
    line join=round,
    every node/.append style={font=\normalsize,text=egNavy}
  },
  eg ref main/.style={
    draw=egNavy,
    line width=0.60pt
  },
  eg ref support/.style={
    draw=egGray,
    line width=0.40pt
  },
  eg ref support dashed/.style={
    draw=egGray,
    line width=0.40pt,
    dash pattern=on 2.5pt off 2.5pt
  },
  eg ref mark/.style={
    draw=egNavy,
    line width=0.40pt
  }
}

\newcommand{\egUseStandardPlateAt}[1]{%
  \pgfresetboundingbox
  \path[use as bounding box]
    ([xshift=-102pt,yshift=-80pt]#1)
    rectangle
    ([xshift=102pt,yshift=80pt]#1);%
}
\newcommand{\egUseStandardPlate}{%
  \coordinate (egPlateCenter) at (current bounding box.center);%
  \egUseStandardPlateAt{egPlateCenter}%
}

\begin{document}
% Insert one tikzpicture environment here.
\end{document}

In each example, the highlighted code lines indicate the principal construction introduced by that pattern.

I. Points and basic constructions

1. Place points by coordinates

Coordinates are useful for the few initial points on which the rest of the construction depends.

A triangle ABC whose three vertices are defined by coordinates.
Pattern 1. Three initial points placed by coordinates.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A} % Place A by coordinates
  \tkzDefPoint(0,0){B} % Place B by coordinates
  \tkzDefPoint(5,0){C} % Place C by coordinates

  \tkzDrawSegments[eg ref main](A,B B,C C,A) % Draw the main lines
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C) % Draw the points in the main ink
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left](B)
  \tkzLabelPoints[below right](C)
  \egUseStandardPlate
\end{tikzpicture}

2. Construct a midpoint and a median

Using the same triangle, \tkzDefMidPoint constructs the midpoint MM of BCBC. The dashed segment AMAM is the median from AA.

Triangle ABC with M at the midpoint of BC and the dashed median AM.
Pattern 2. The midpoint M of BC and the median AM.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A} % Place A by coordinates
  \tkzDefPoint(0,0){B} % Place B by coordinates
  \tkzDefPoint(5,0){C} % Place C by coordinates
  \tkzDefMidPoint(B,C)\tkzGetPoint{M} % Midpoint M of BC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,M)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,M)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left](B)
  \tkzLabelPoints[below right](C)
  \tkzLabelPoints[below](M)
  \egUseStandardPlate
\end{tikzpicture}

3. Place a point on a side by a ratio

Using the same triangle again, a homothety centered at BB places XX on the base BCBC so that BX=0.35 BCBX=0.35\,BC. The dashed segment AXAX shows the resulting cevian.

Triangle ABC with X lying 35 percent of the way from B to C and the dashed cevian AX.
Pattern 3. The point X on the base BC and the cevian AX.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A} % Place A by coordinates
  \tkzDefPoint(0,0){B} % Place B by coordinates
  \tkzDefPoint(5,0){C} % Place C by coordinates
  \tkzDefPointBy[homothety=center B ratio 0.35](C)\tkzGetPoint{X} % Point X on BC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,X)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,X)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left](B)
  \tkzLabelPoints[below right](C)
  \tkzLabelPoints[below](X)
  \egUseStandardPlate
\end{tikzpicture}

4. Intersect two cevians

Using the same triangle and retaining XX from the preceding pattern, place YY on CACA. Then \tkzInterLL(A,X)(B,Y) constructs PP, the intersection of the cevians AXAX and BYBY.

Triangle ABC with X on BC and Y on CA; the dashed cevians AX and BY meet at P.
Pattern 4. The cevians AX and BY intersect at P.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefPointBy[homothety=center B ratio 0.35](C)\tkzGetPoint{X} % Point X on BC
  \tkzDefPointBy[homothety=center A ratio 0.35](C)\tkzGetPoint{Y} % Point Y on CA
  \tkzInterLL(A,X)(B,Y)\tkzGetPoint{P} % Intersection of AX and BY

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegments[eg ref support dashed](A,X B,Y)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,X,Y,P)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left](B)
  \tkzLabelPoints[below right](C)
  \tkzLabelPoints[below](X)
  \tkzLabelPoints[above right](Y)
  \tkzLabelPoints[above left](P)
  \egUseStandardPlate
\end{tikzpicture}

5. Draw a parallel and take an intersection

First construct a direction point for the line through PP parallel to BCBC. Then intersect that line with ACAC.

A triangle ABC with P on AB and Q on AC, where the dashed segment PQ is parallel to BC.
Pattern 5. A parallel through a given point, followed by an intersection.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefPointBy[homothety=center A ratio 0.45](B)\tkzGetPoint{P} % Point P on AB
  \tkzDefLine[parallel=through P](B,C)\tkzGetPoint{pdir} % Parallel to BC through P
  \tkzInterLL(P,pdir)(A,C)\tkzGetPoint{Q} % Its intersection with AC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](P,Q)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,P,Q)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below](B,C)
  \tkzLabelPoints[left](P)
  \tkzLabelPoints[right](Q)
  \egUseStandardPlate
\end{tikzpicture}

6. Construct a perpendicular foot with a line intersection

This form records both steps of the construction: draw the perpendicular through AA, then intersect it with BCBC.

A triangle ABC with the dashed altitude AH and a right-angle mark at H on BC.
Pattern 6. A perpendicular foot constructed as a line intersection.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefLine[orthogonal=through A](B,C)\tkzGetPoint{adir} % Perpendicular to BC through A
  \tkzInterLL(A,adir)(B,C)\tkzGetPoint{H} % Perpendicular foot H

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,H)
  \tkzMarkRightAngle[eg ref mark, size=0.18](A,H,C)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,H)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below](B,H,C)
  \egUseStandardPlate
\end{tikzpicture}

7. Construct a perpendicular foot by projection

When only the foot is needed, projection gives the same point in one construction command.

A triangle ABC with the dashed altitude AH obtained by projecting A onto BC.
Pattern 7. The same perpendicular foot obtained directly by projection.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefPointBy[projection=onto B--C](A)\tkzGetPoint{H} % Projection of A onto BC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,H)
  \tkzMarkRightAngle[eg ref mark, size=0.18](A,H,C)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,H)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below](B,H,C)
  \egUseStandardPlate
\end{tikzpicture}

II. Circles and intersections

8. Draw a circle

A circle is specified by its center and one point on the circle. In this example, MM is the center and BB determines the radius.

A circle with center M and dashed diameter BC.
Pattern 8. A circle specified by its center and a point on it.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefMidPoint(B,C)\tkzGetPoint{M} % Midpoint M of BC

  \tkzDrawCircle[eg ref main](M,B) % Center M, radius MB
  \tkzDrawSegment[eg ref support dashed](B,C)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](B,C,M)
  \tkzLabelPoints[left](B)
  \tkzLabelPoints[below](M)
  \tkzLabelPoints[right](C)
  \egUseStandardPlate
\end{tikzpicture}

9. Construct a circumcenter and circumcircle

\tkzDefCircle[circum] constructs the circumcircle of ABCABC and returns its center OO.

A triangle ABC inscribed in its circumcircle, with circumcenter O and dashed radii OA, OB, and OC.
Pattern 9. The circumcenter, circumcircle, and three radii of a triangle.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefCircle[circum](A,B,C)\tkzGetPoint{O} % Circumcenter O

  \tkzDrawCircle[eg ref main](O,A)
  \tkzDrawSegments[eg ref support dashed](O,A O,B O,C)
  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,O)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[left](B)
  \tkzLabelPoints[right](C)
  \tkzLabelPoints[above right](O)
  \egUseStandardPlate
\end{tikzpicture}

10. Construct an incenter and incircle

After constructing the incenter II, project it onto the three sides at DD, EE, and FF. The equal segments IDID, IEIE, and IFIF are radii of the incircle.

A triangle ABC with incenter I, its incircle, and perpendicular radii ID, IE, and IF meeting BC, CA, and AB at D, E, and F, respectively.
Pattern 10. The incenter, incircle, and three perpendicular radii.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefTriangleCenter[in](A,B,C)\tkzGetPoint{I} % Incenter I
  \tkzDefPointBy[projection=onto B--C](I)\tkzGetPoint{D} % Foot on BC
  \tkzDefPointBy[projection=onto C--A](I)\tkzGetPoint{E} % Foot on CA
  \tkzDefPointBy[projection=onto A--B](I)\tkzGetPoint{F} % Foot on AB

  \tkzDrawCircle[eg ref main](I,D)
  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegments[eg ref support dashed](I,D I,E I,F)
  \tkzMarkRightAngle[eg ref mark, size=0.18](I,D,C)
  \tkzMarkRightAngle[eg ref mark, size=0.18](I,E,A)
  \tkzMarkRightAngle[eg ref mark, size=0.18](I,F,B)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,D,E,F,I)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below](B,D,C)
  \tkzLabelPoints[above right](E)
  \tkzLabelPoints[above left](F)
  \tkzLabelPoints[right](I)
  \egUseStandardPlate
\end{tikzpicture}

11. Intersect a line and a circle

\tkzInterLC takes two points defining the line, followed by the center and one point defining the circle. The two intersections are then named together.

A line through A and C crossing a circle with center M at two points P and Q.
Pattern 11. The two intersections of a line and a circle.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(1,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefPoint(2,0){M} % Center M of the circle
  \tkzInterLC(A,C)(M,B)\tkzGetPoints{P}{Q} % Intersections P and Q

  \tkzDrawCircle[eg ref main](M,B)
  \tkzDrawLine[eg ref main](A,C)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,M,P,Q)
  \tkzLabelPoints[above right, xshift=-1pt, yshift=-1pt](A)
  \tkzLabelPoints[left](B)
  \tkzLabelPoints[below](M)
  \tkzLabelPoints[above right, xshift=-1pt, yshift=-1pt](C)
  \tkzLabelPoints[above right, xshift=-1pt, yshift=-1pt](P)
  \tkzLabelPoints[above right, xshift=-1pt, yshift=-1pt](Q)
  \egUseStandardPlate
\end{tikzpicture}

12. Intersect two circles

Each circle is given by its center and one point on it. \tkzInterCC returns the two common points PP and QQ.

Two intersecting circles with centers O and I and common points P and Q.
Pattern 12. The two intersections of two circles.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(0,0){O} % Center O of the first circle
  \tkzDefPoint(2,0){I} % Center I of the second circle
  \tkzDefPoint(0,2){A} % Point defining radius OA
  \tkzDefPoint(2,2){D} % Point defining radius ID
  \tkzInterCC(O,A)(I,D)\tkzGetPoints{P}{Q} % Intersections P and Q

  \tkzDrawCircle[eg ref main](O,A)
  \tkzDrawCircle[eg ref main](I,D)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](O,I,P,Q)
  \tkzLabelPoints[left](O)
  \tkzLabelPoints[right](I)
  \tkzLabelPoints[above](P)
  \tkzLabelPoints[below](Q)
  \egUseStandardPlate
\end{tikzpicture}

III. Transformations

13. Construct a point by rotation

The point BB is the image of AA under the rotation through 60∘60^\circ about OO.

Points A and B on a circle centered at O, with angle AOB marked as 60 degrees.
Pattern 13. A point obtained by rotation.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(0,0){O} % Center O of the rotation
  \tkzDefPoint(2.7,0){A} % Original point A
  \tkzDefPointBy[rotation=center O angle 60](A)\tkzGetPoint{B} % Rotate A by 60 degrees

  \tkzDrawCircle[eg ref main](O,A)
  \tkzDrawSegments[eg ref main](O,A O,B A,B)
  \tkzMarkAngle[eg ref mark, size=0.42](A,O,B)
  \tkzLabelAngle[pos=0.8, xshift=1pt, yshift=-2pt](A,O,B){$60^\circ$}
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](O,A,B)
  \tkzLabelPoints[below](O)
  \tkzLabelPoints[right](A)
  \tkzLabelPoints[above](B)
  \egUseStandardPlate
\end{tikzpicture}

14. Construct a point by reflection

The line ABAB is the axis of reflection, and YY is the image of XX.

A horizontal reflection axis AB with points X and Y on opposite sides of it.
Pattern 14. Reflection of a point in a line.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(0,0){A}
  \tkzDefPoint(4,0){B} % Point B on the reflection axis
  \tkzDefPoint(1.2,1.8){X} % Point to be reflected
  \tkzDefPointBy[reflection=over A--B](X)\tkzGetPoint{Y} % Reflection of X in AB

  \tkzDrawLine[eg ref main](A,B)
  \tkzDrawSegment[eg ref support dashed](X,Y)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,X,Y)
  \tkzLabelPoints[below](A,B,Y)
  \tkzLabelPoints[above](X)
  \egUseStandardPlate
\end{tikzpicture}

15. Construct a point by central symmetry

Central symmetry about OO sends XX to YY. The equal-length marks show that OO is the midpoint of XYXY.

A segment XY with midpoint O and equal-length marks on XO and OY.
Pattern 15. Central symmetry about a point.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(0,0){X} % Original point X
  \tkzDefPoint(2.5,1.3){O} % Center O of the symmetry
  \tkzDefPointBy[symmetry=center O](X)\tkzGetPoint{Y} % Image Y of X

  \tkzDrawSegment[eg ref main](X,Y)
  \tkzMarkSegment[color=egNavy,line width=0.40pt,mark=|](X,O)
  \tkzMarkSegment[color=egNavy,line width=0.40pt,mark=|](O,Y)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](X,O,Y)
  \tkzLabelPoints[below](X,O,Y)
  \egUseStandardPlate
\end{tikzpicture}

IV. Marks and label placement

16. Add right-angle, equal-length, and length marks

Geometric marks should record relations that matter in the argument. Here the figure displays AH⊥BCAH\perp BC and BM=MC=xBM=MC=x.

A triangle ABC with altitude AH, midpoint M of BC, a right-angle mark at H, matching marks on BM and MC, and both lengths labelled x.
Pattern 16. Right-angle, equal-length, and length marks.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefMidPoint(B,C)\tkzGetPoint{M} % Midpoint M of BC
  \tkzDefPointBy[projection=onto B--C](A)\tkzGetPoint{H} % Projection of A onto BC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,H)
  \tkzMarkRightAngle[eg ref mark, size=0.18](A,H,C)
  \tkzMarkSegment[color=egNavy,line width=0.40pt,mark=|](B,M)
  \tkzMarkSegment[color=egNavy,line width=0.40pt,mark=|](M,C)
  \tkzLabelSegment[below,yshift=-2pt](B,M){$x$}
  \tkzLabelSegment[below,yshift=-2pt](M,C){$x$}
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,M,H)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left](B)
  \tkzLabelPoints[below right](C)
  \tkzLabelPoints[below,xshift=-2pt](H)
  \tkzLabelPoints[below,xshift=2pt](M)
  \egUseStandardPlate
\end{tikzpicture}

17. Fine-tune labels with xshift and yshift

Directional placement is usually enough. When labels remain too close to the figure, small shifts give more precise control without changing the construction.

Triangle ABC with M at the midpoint of BC, the dashed median AM, and the labels B, C, and M shifted away from nearby lines and points.
Pattern 17. Small label shifts used to prevent overlap.
\begin{tikzpicture}[eg figure,scale=1.0]
  \tkzDefPoint(2,3){A}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(5,0){C}
  \tkzDefMidPoint(B,C)\tkzGetPoint{M} % Midpoint M of BC

  \tkzDrawSegments[eg ref main](A,B B,C C,A)
  \tkzDrawSegment[eg ref support dashed](A,M)
  \tkzDrawPoints[color=egNavy, fill=egNavy, size=1.3](A,B,C,M)
  \tkzLabelPoints[above](A)
  \tkzLabelPoints[below left,xshift=-2pt,yshift=-2pt](B) % Move slightly down and left
  \tkzLabelPoints[below right,xshift=2pt,yshift=-2pt](C) % Move slightly down and right
  \tkzLabelPoints[below,yshift=-3pt](M) % Move slightly lower
  \egUseStandardPlate
\end{tikzpicture}

Technical note

The examples, diagrams, and explanatory text on this page were prepared independently for Elementary Geometry and are not excerpts from the package manual. All seventeen examples were verified with pdfLaTeX and tkz-euclide 5.13c. tkz-euclide is developed by Alain Matthes and distributed under the LaTeX Project Public License 1.3c.