\documentclass[a4paper]{article}
%\usepackage{fontspec}
%\setmainfont{Libertinus Serif}
%\usepackage{mathtools,unicode-math}
%\setmainfont{Libertinus Math}
\usepackage[margin=2.2cm]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage{luacode}
\usepackage{../luahyperbolic}
\usepackage{hyperref}
\begin{document}
\title{Triangle groups and tilings}
\author{Damien Mégy}
\date{}
\maketitle
\pagestyle{empty}
\thispagestyle{empty}
Drawn with the \textbf{\textsf{luahyperbolic}} package. (\url{https://github.com/dmegy/luahyperbolic}) 


\subsection*{Triangle tilings of type $(p,\infty,\infty)$ for $p\leq 6$}

\begin{luacode*}
local PI = math.pi
local N=6
local DEPTH=8
for k=2,N do
			tex.print("\\begin{tikzpicture}[scale=1.5]")
			tex.print("\\begin{scope}")
			tex.print("\\draw[very thick] (0,0) circle (1);\\clip (0,0) circle (1);")
			local A, B, C = hyper.triangleWithAngles(PI/k,0, 0)
			hyper.fillTilingFromTriangle(A, B, C, DEPTH)			
			hyper.drawPolygon(A, B, C, "thick, red")
			tex.print("\\end{scope}")
			tex.print(string.format("\\draw (0,-1.2) node {$(%d, \\infty, \\infty)$} ;", k))
			tex.print("\\end{tikzpicture}")
			tex.print("~")
end 
\end{luacode*}


\subsection*{Triangle tilings of type $(p,q,\infty)$ for $2\leq p\leq q \leq 5$}

\begin{luacode*}
local PI = math.pi
local N=5
local DEPTH=8
for k=2,N do
	for l=k, N do
		if 1/k+1/l <1 then
			tex.print("\\begin{tikzpicture}[scale=1.5]")
			tex.print("\\begin{scope}")
			tex.print("\\draw[very thick] (0,0) circle (1);\\clip (0,0) circle (1);")
			local A, B, C = hyper.triangleWithAngles(PI/k, PI/l, 0)
			hyper.fillTilingFromTriangle(A, B, C, DEPTH, "even odd rule")			
			hyper.drawPolygon(A, B, C, "thick, red")
			tex.print("\\end{scope}")
			tex.print(string.format("\\draw (0,-1.2) node {$(%d, %d, \\infty)$} ;", k, l))
			tex.print("\\end{tikzpicture}")
			tex.print("~")
		end
	end
end 
\end{luacode*}


\subsection*{Triangle tilings of type $(p,q,r)$ for $2\leq p\leq q\leq r \leq 6$}

\begin{luacode*}
local PI = math.pi
local N=6
for k=2,N do
	for l=k, N do
	for m=l,N do
		local t = 1/k+1/l +1/m
		if t<0.99 then
			local DEPTH=1+math.round(12*t)
			tex.print("\\begin{tikzpicture}[scale=1.5]")
			tex.print("\\begin{scope}")
			tex.print("\\draw[very thick] (0,0) circle (1);\\clip (0,0) circle (1);")
			local A, B, C = hyper.triangleWithAngles(PI/k, PI/l, PI/m)
			hyper.fillTilingFromTriangle(A, B, C, DEPTH, "even odd rule")			
			hyper.drawPolygon(A, B, C, "thick, red")
			tex.print("\\end{scope}")
			tex.print(string.format("\\draw (0,-1.2) node {$(%d, %d, %d)$} ;", k, l,m))
			tex.print("\\end{tikzpicture}")
			tex.print("~")
		end
	end
	end
end 
\end{luacode*}


\end{document}