Skip to content

Instantly share code, notes, and snippets.

@mountain
Forked from kpym/tkz-euclid-cheatsheet.en.md
Created October 13, 2021 16:44
Show Gist options
  • Save mountain/2be43631ddaa6d2412592b4ea1c0858d to your computer and use it in GitHub Desktop.
Save mountain/2be43631ddaa6d2412592b4ea1c0858d to your computer and use it in GitHub Desktop.
cheatsheet : tkz-euclid (latex library based on tikz)

Gist

Package

\usepackage{tkz-euclide} % checked for version 3.02c

Point definitions

Coordinates

\tkzDefPoints{0/0/O, 1/0/A, 0/1/B}
\tkzDefPoint(35:2){C}
\tkzDefPoint[label=-60:$\mathcal{C}$](2,3){C}
\tkzDefShiftPoint[A](0:4){B}

Barycenters

\tkzDefMidPoint(A,B) \tkzGetPoint{M}
\tkzDefBarycentricPoint(A=1,B=2) \tkzGetPoint{M}
\tkzCentroid(A,B,C) \tkzGetPoint{G}
\tkzDefTriangleCenter[centroid](A,B,C) \tkzGetPoint{G}% same as tkzCentroid

By transformation

\tkzDefPointsBy[translation=from A to B](M,N){K,L}
\tkzDefPointsBy[homothety=center A ratio .5](M,N){K,L}
\tkzDefPointsBy[reflection=over A--B](M,N){K,L}
\tkzDefPointsBy[symmetry=center A](M,N){K,L}
\tkzDefPointsBy[projection=onto A--B](M,N){K,L}
\tkzDefPointsBy[rotation=center O angle 30](M,N){K,L}

By vector relation

\tkzDefPointWith[linear normed](A,B) \tkzGetPoint{K}
\tkzDefPointWith[orthogonal normed](A,B) \tkzGetPoint{K}
\tkzDefPointWith[linear,K=.5](A,M) \tkzGetPoint{K} % <=> By homothety
\tkzDefPointWith[colinear= at M](A,B) \tkzGetPoint{K} % <=> By translation
\tkzDefPointWith[orthogonal,K=-1](A,B) \tkzGetPoint{K} % <=> By rotation

\tkzDefSquare(A,B) \tkzGetPoints{K}{L}

Third vertex of a triangle

\tkzDefTriangle[two angles= 30 and 40](A,B) \tkzGetPoint{C}
\tkzDefTriangle[equilateral](A,B) \tkzGetPoint{C}

By intersection

\tkzInterLL(A,B)(O,C) \tkzGetPoint{D} % two lines
\tkzInterLC(A,B)(O,C) \tkzGetPoints{D}{E} % line and circle
\tkzInterLC[R](A,B)(O,4 cm) \tkzGetFirstPoint{I1}\tkzGetSecondPoint{I2} % line and circle with radius
\tkzInterCC(A,B)(B,A) \tkzGetPoints{C}{D} % two circles

By tangence

\tkzDefTangent[at=A](O) \tkzGetPoint{t} % t is a point on the tangent line at A to the circle with center O
\tkzDefTangent[from = B](O,A) \tkzGetPoints{S}{T} % (BS) and (BT) are tangent lines to the circle with center O passing through A
\tkzDefTangent[from with R = B](O,35 mm) \tkzGetFirstPoint{S} % (BS) is tangent line to the circle with center O and radious 35mm

Points on special lines

\tkzDefLine[mediator](A,B) \tkzGetPoints{C}{D}
\tkzDefLine[orthogonal=through C](B,A) \tkzGetPoint{c}
\tkzDefLine[parallel=through C](A,B) \tkzGetPoint{c}
\tkzDefLine[bisector](A,B,C) \tkzGetPoint{b}

Special points in traingle

\tkzDefTriangleCenter[centroid](A,B,C)\tkzGetPoint{G} % G is the barycenter
\tkzDefTriangleCenter[orthic](A,B,C)\tkzGetPoint{H} % H is the orthocenter
\tkzDefTriangleCenter[in](A,B,C)\tkzGetPoint{I} % I is the center of the inscribed circle

Circles

\tkzDefCircle(A,B) \tkzGetLength{rABpt}
\tkzDefCircle[diameter](A,B) \tkzGetPoint{O}\tkzGetLength{rABpt}
\tkzDefCircle[circum](A,B,C) \tkzGetPoint{O}\tkzGetLength{rABpt}
\tkzDefCircle[in](A,B,C) \tkzGetPoint{O}\tkzGetLength{rABpt}
\tkzDefCircle[orthogonal from=B](O,A) \tkzGetPoint{C}
\tkzDefCircle[orthogonal through=B and C](O,A) \tkzGetPoint{D}

Draw and Fill

Points

\tkzDrawPoints(A,B,C)
\tkzDrawPoint[size=12,color=green](A)

Lines and segments

\tkzDrawPolygon[color=red](A,B,C)
\tkzFillPolygon[color = green](A,B,C)
\tkzDrawSegments(A,B C,D)
\tkzDrawLine[add= 1 and -.2](A,B)
\tkzDrawLines(A,B C,D) % idem \tkzDrawSegments[add .2 and .2]

Special lines

\tkzDrawLine[median](A,C,B) % draw the medial from C to [AB]
\tkzDrawLine[altitude, red](A,C,B) % draw the altitude from C to [AB]
\tkzDrawLine[bisector, blue](A,C,B) % draw the bisector of  ACB

Circles

\tkzDrawCircle[dashed](A,B)
\tkzDrawCircle[diameter](A,B)
\tkzDrawCircle[R](A,\rAB pt)
\tkzDrawCircle[circum](A,B,C)
\tkzDrawCircle[in](A,B,C)

\tkzFillCircle[color = orange](A,B)
\tkzFillCircle[color = orange,R](A,\rAB pt)

Arcs

\tkzDrawArc[delta=10](O,A)(B)
\tkzDrawArc[rotate](O,A)(90)
\tkzDrawArc[R](O,2 cm)(30,90)
\tkzDrawArc[R with nodes](O,2 cm)(A,B)

the arcs style

[compass style/.append style={<->}]

Markings and labels

Points

\tkzLabelPoints[above](A,B,C)
\tkzLabelPoint[below](A){$\mathbb{A}$}

Lines

\tkzLabelLine[pos=1.25,blue,right](A,B){$\Delta$}
\tkzLabelSegment[above](A,B){$a$} % <=> tkzLabelLine
\tkzMarkSegment[size=2pt, pos=0.4, mark=|||](A,B)
\tkzMarkSegments[mark=||](A,B C,D)

Angles

\tkzMarkAngle[arc=lll,size=0.5,mark=|](A,B,C)
\tkzFillAngle[fill=red!50, size=.30](A,B,C)
\tkzMarkAngles[fill opacity=.1,fill](A,B,C D,E,F)
\tkzMarkRightAngle(A,B,C)
\tkzMarkRightAngles(A,B,C D,E,F)
\tkzLabelAngle[pos = .7](A,B,C){$\beta$}
\tkzLabelCircle(A,B)(70){$\mathcal{C}$}
\tkzLabelCircle[R](A,3)(-21){$\mathcal{C}$}
\documentclass[border=7pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
% define points
\tkzDefPoints{0/4/A, 4/3/B, 1/7/C}
% draw triangle
\tkzDrawPolygon(A,B,C)
% label points
\tkzDrawPoints(A,B,C)
\tkzLabelPoints[below](A,B)
\tkzLabelPoints[above](C)
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment