Anonymous 1123
[Golden triangle](https://en.wikipedia.org/wiki/Golden_triangle_(mathematics)) can be made in [*Mathematica*](https://mathematica.stackexchange.com/questions/239914/how-to-create-a-spiral-using-golden-triangles).
![mathematica.png](/image?hash=43260a50c1ac285b7cfe133a3222296a78db129d7e05acc7ba4d75726381ef1e)
How to creat a Golden triangle in LaTeX?
Top Answer
user 3.14159
Here is a loop that does something of that sort.
```
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,
pics/golden triangle/.style={code={
\path[draw,pic actions] (-#1,0) -- (#1,0) -- (0,{#1*tan(72)}) -- cycle;
}}]
\pgfmathsetmacro{\myratio}{2/(1+sqrt(5))}
\def\mycolors{"red","green","blue","purple","yellow","cyan"}
\pgfmathtruncatemacro{\mydim}{dim({\mycolors})-1}
\path[transform shape] (0,0) foreach \X in {0,...,\mydim}
{[rotate=-108*\X+108] ++({-pow(\myratio,\X-1)},0)++(72:{pow(\myratio,\X)})
coordinate (tmp-\X)
[rotate=-108] (tmp-\X)
pic[fill/.evaluated={{\mycolors}[\X]}]{golden triangle/.evaluated={pow(\myratio,\X)}}};
\end{tikzpicture}
\end{document}
```
![Screen Shot 2021-02-17 at 9.46.07 PM.png](/image?hash=4afa64cde05919d87f1455cbb336bb405754934acd17dfb9c2a6100feae6b851)
Answer #2
Jairo A. del Rio
Easy peasy with MetaPost and `gmp`. It requires `--shell-escape` enabled.
**Edit:** Sorry, I missed the TikZ tag, but another approach won't harm anyone.
```
\documentclass{standalone}
\usepackage[latex,shellescape]{gmp}
\newcommand\goldentriangle[2]%
{\begin{mpost}[name=goldentriangle]
%% n: n of triangles
%% u: unit size
%% b: do we want a spiral? (T/F)
vardef goldentriangle(expr n, u, b) =
save base, nicespiral;
path base[], nicespiral;
%% Base triangle
base[0] := ( xpart dir 72, 0) -- (0, ypart dir 72) -- (-xpart dir 72, 0) -- cycle;
base[0] := base[0] scaled u;
%% More triangles
for i = 1 upto n:
base[i] := point 0 of base[i-1]
rotatedaround (point 2 of base[i-1], 36) --
point 2 of base[i-1] --
point 0 of base[i-1] -- cycle;
endfor;
image(
%% Cute colors
for i = 0 upto n:
fill base[i]
withcolor 1/n*((i-1) mod n, i mod n, (i+1) mod n);
endfor;
%% Spiral, if requested
if b = true:
draw point 1 of base[0]
for i = 1 upto n: .. point 1 of base[i] endfor
withcolor (1,1/2,0);
fi;
)
enddef;
%% Change the boolean if desired
draw goldentriangle(#1,\mpdim{#2},true);
\end{mpost}%
\usempost{goldentriangle}}
\begin{document}
\goldentriangle{6}{10cm}%
\end{document}
```
![123.png](/image?hash=d56a38c0e38fb1397cbf4bfffabcda748e2b5af7e35459518d747093b41b1395)