I have tried adding text as such into the graphic part of the code in all possible places but can’t get any lable to appear in the graphic. I have included the code in its entirety rather than a snippet. I would like to see the dimentions of the 4 triangles included on the graphic if possible.
Clear[x,y,q,p];
list=Reap[Do[p=Solve[x^2+y^2==q^2&&x>0&&y>0&&x<y,{x,y},Integers];
p={x,y}/.p;
k=Total@Flatten[p];
If[k>0,Sow[Partition[Riffle[Flatten[p],q,{3,-1,3}],3]]],{q,5,1000}]];
list=Flatten[list[[2]],2];lst=SortBy[list,{#[[1]],#[[2]]}&];ml=Max[lst[[All,1]]];
flist=Reap[Do[g=Select[lst,#[[1]]==y&];
Do[If[Length[g]>=2,j=Select[lst,#[[1]]==g[[q,2]]&]];
k=Select[lst,#[[1]]==g[[w,2]]&];If[Length[j]<1||Length[k]<1,Continue[]];
j1=Flatten[j];k1=Flatten[k];
m=Take[j1,{2,-1,3}];
m1=Take[k1,{2,-1,3}];
m2=FromDigits[Intersection[m,m1]];
r=Select[j,#[[2]]==m2&];
t=Select[k,#[[2]]==m2&];If[Length[r]>0,Sow[{g[[q]],g[[w]],r,t}]],
{q,1,Length[g]},{w,q+1,Length[g]}],
{y,15,ml}]];
nflist={};flist=Partition[Flatten[flist[[2]]],12];simt=Reap[Do[If[flist[[q,2]]/flist[[q,1]]==flist[[q,11]]/flist[[q,10]],Sow[flist[[q]]],AppendTo[nflist,flist[[q]]]],{q,1,Length[flist]}]];
simt=Flatten[simt[[2]],1];
Do[AppendTo[simt[[q]],simt[[q,3]]+simt[[q,6]]+simt[[q,9]]+simt[[q,12]]],{q,1,Length[simt]}];Do[AppendTo[nflist[[q]],nflist[[q,3]]+nflist[[q,6]]+nflist[[q,9]]+nflist[[q,12]]],{q,1,Length[nflist]}];
nflist=SortBy[nflist,#[[13]]&];simt=SortBy[simt,#[[13]]&];
Print["Number of non similar triangles is ",Length[nflist]];
Print["Number of simmilar triangles is ",Length[simt]];
Do[Print[Partition[nflist[[q]],3,3,1,{}]];
t1={{0,0},{nflist[[q,1]],0},{0,nflist[[q,2]]}};
t2={{0,0},{nflist[[q,1]],0},{0,-nflist[[q,6]]}};
t3={{0,0},{-nflist[[q,8]],0},{0,-nflist[[q,6]]}};
t4={{0,0},{-nflist[[q,8]],0},{0,nflist[[q,2]]}};
Print[Graphics[{EdgeForm[Black],Red,Polygon[{t1}]
,EdgeForm[Black],Yellow,Polygon[{t2}],EdgeForm[Black],Cyan,Polygon[{t3}],EdgeForm[Black],Green,Polygon[{t4}]}]];Print[],{q,1,Length[nflist]}];Print[];Print[];
Print["Similar from here"];
Do[Print[Partition[simt[[q]],3,3,1,{}]];
t1={{0,0},{simt[[q,1]],0},{0,simt[[q,2]]}};
t2={{0,0},{simt[[q,1]],0},{0,-simt[[q,6]]}};
t3={{0,0},{-simt[[q,8]],0},{0,-simt[[q,6]]}};
t4={{0,0},{-simt[[q,8]],0},{0,simt[[q,2]]}};
Print[Graphics[{EdgeForm[Black],Red,Polygon[{t1}]
,EdgeForm[Black],Yellow,Polygon[{t2}],EdgeForm[Black],Red,Polygon[{t3}],EdgeForm[Black],Yellow,Polygon[{t4}]}]];Print[],{q,1,Length[simt]}];Print[];
The figures in the braces are the dimensions I would like inserting into the graphic.
Paul.


