%!TEX pdflatex

\documentclass{article}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{margin=1cm}
\usepackage{fontawesome5}
\usepackage[upright]{fourier}
\usepackage[scaled=0.875]{helvet}
\renewcommand\ttdefault{lmtt}
\usepackage[scaled=0.875]{cabin}
\usepackage{hvlogos}
\usepackage[most]{tcolorbox}
\usepackage{codehigh}
\usepackage{tabularx}
\usepackage{titlesec}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash }X}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations.pathmorphing}
\tikzset{%
	mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}},
	mainlevee/.default={5mm et 0.6pt}
}

\newtcblisting{codetex}[1][]{%
	colback=white,colframe=red!75!black,title={\small \faCode} Code \LaTeX,fonttitle=\sffamily\bfseries,left=3pt,right=3pt,top=2pt,bottom=2pt,#1}

\newtcolorbox{codesortie}[1][]{%
	colback=white,colframe=red!75!black,title={\small \faArrowAltCircleRight[regular]} Sortie \LaTeX,fonttitle=\sffamily\bfseries,left=3pt,right=3pt,top=2pt,bottom=2pt,#1}

\pagestyle{empty}

\begin{document}

\part*{Figures à \og main levée \fg, avec \TikZ}

\section{Choses utiles}

\begin{codetex}[listing only]
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,decorations}
\tikzset{%
	mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}},
	mainlevee/.default={5mm et 0.6pt}
}
\end{codetex}

\section{Un carré à main levée}

\begin{codetex}[listing only]
\begin{tikzpicture}
	\tkzDefPoints{0/0/A,4/0/B,4/4/C,0/4/D}
	\tkzDrawPolygon[thick,mainlevee](A,B,C,D)
\end{tikzpicture}

\begin{tikzpicture}
	\tkzDefPoints{0/0/A,4/0/B,4/4/C,0/4/D}
	\tkzDrawPolygon[thick,mainlevee=10mm et 2pt](A,B,C,D)
\end{tikzpicture}
\end{codetex}

\begin{codesortie}
\hfill~\begin{tikzpicture}
	\tkzDefPoints{0/0/A,4/0/B,4/4/C,0/4/D}
	\tkzDrawPolygon[thick,mainlevee](A,B,C,D)
\end{tikzpicture}
\hspace{1.5cm}
\begin{tikzpicture}
	\tkzDefPoints{0/0/A,4/0/B,4/4/C,0/4/D}
	\tkzDrawPolygon[thick,mainlevee=10mm et 2pt](A,B,C,D)
\end{tikzpicture}
\hfill~
\end{codesortie}

\section{Un triangle équilatéral à main levée, avec codage}

\begin{codetex}[listing only]
\begin{tikzpicture}
	\tkzDefPoints{0/0/A,5/1/B}
	\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
	\tkzDrawPolygon[thick,mainlevee](A,B,C)
	\tkzLabelPoints[below left](A)\tkzLabelPoints[right](B)\tkzLabelPoints[above](C)
	\tkzMarkSegments[mark=s||](A,B A,C B,C)
	\tkzLabelAngle(C,B,A){60$^\circ$}
	\tkzMarkAngle[size=0.5](C,B,A)
\end{tikzpicture}

\begin{tikzpicture}
	\tkzDefPoints{0/0/A,5/1/B}
	\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
	\tkzDrawPolygon[thick,mainlevee=10mm et 1mm](A,B,C)
	\tkzLabelPoints[below left](A)\tkzLabelPoints[right](B)\tkzLabelPoints[above](C)
	\tkzMarkSegments[mark=s||](A,B A,C B,C)
	\tkzLabelAngle(C,B,A){60$^\circ$}
	\tkzMarkAngle[size=0.5](C,B,A)
\end{tikzpicture}
\end{codetex}

\begin{codesortie}
\hfill~\begin{tikzpicture}
	\tkzDefPoints{0/0/A,5/1/B}
	\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
	\tkzDrawPolygon[thick,mainlevee](A,B,C)
	\tkzLabelPoints[below left](A)
	\tkzLabelPoints[right](B)
	\tkzLabelPoints[above](C)
	\tkzMarkSegments[mark=s||](A,B A,C B,C)
	\tkzLabelAngle(C,B,A){60$^\circ$}
	\tkzMarkAngle[size=0.5](C,B,A)
\end{tikzpicture}
\hspace{0.5cm}
\begin{tikzpicture}
	\tkzDefPoints{0/0/A,5/1/B}
	\tkzDefPointBy[rotation=center A angle 60](B)\tkzGetPoint{C}
	\tkzDrawPolygon[thick,mainlevee=10mm et 1mm](A,B,C)
	\tkzLabelPoints[below left](A)\tkzLabelPoints[right](B)\tkzLabelPoints[above](C)
	\tkzMarkSegments[mark=s||](A,B A,C B,C)
	\tkzLabelAngle(C,B,A){60$^\circ$}
	\tkzMarkAngle[size=0.5](C,B,A)
\end{tikzpicture}
\hfill~
\end{codesortie}

\end{document}