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.
\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 of . The dashed segment is the median from .
\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 places on the base so that . The dashed segment shows the resulting cevian.
\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 from the preceding pattern, place on . Then \tkzInterLL(A,X)(B,Y) constructs , the intersection of the cevians and .
\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 parallel to . Then intersect that line with .
\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 , then intersect it with .
\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.
\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, is the center and determines the radius.
\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 and returns its center .
\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 , project it onto the three sides at , , and . The equal segments , , and are radii of the incircle.
\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.
\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 and .
\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 is the image of under the rotation through about .
\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 is the axis of reflection, and is the image of .
\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 sends to . The equal-length marks show that is the midpoint of .
\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 and .
\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.
\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.