#JavaScript, (114) 109 bytes This is my first entry in a codegolf contest! Please tell me how to improve. x="repeat",w="$$\\varphi=";y=n=>{return a=!n?w+"1+\\dots$$":w+"1+\\cfrac1{"[x](n)+"1+\\ddots"+"}"[x](n)+"$$"} Previous example: x="repeat";y=n=>{return a=!n?"$$\\varphi=1+\\dots$$":"$$\\varphi="+"1+\\cfrac1{"[x](n)+"1+\\ddots"+"}"[x](n)+"$$"} Paste into browser console and call as `f(n)` where `n` is the number of 'steps'. **Simplified code**: <!-- language: lang-js --> var x = "repeat"; function y(n) { if(n === 0) { return "$$\\varphi=1+\\dots$$"; } else { return "$$\\varphi=" + "1+\\cfrac1{".repeat(n) + "1+\\ddots"+"}".repeat(n)+"$$"; } // ^in golfed version, String.repeat(n) // is called as String[x](n) } **Returns**: - $n=0$: `$$\varphi=1+\dots$$` which renders as: $$\varphi=1+\dots$$ - $n=1$: `$$\varphi=1+\cfrac1{1+\ddots}$$` which renders as: $$\varphi=1+\cfrac1{1+\ddots}$$ - $n=2$: `$$\varphi=1+\cfrac1{1+\cfrac1{1+\ddots}}$$` which renders as: $$\varphi=1+\cfrac1{1+\cfrac1{1+\ddots}}$$ - $n=3$: `$$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}$$` which renders as: $$\varphi=1+\cfrac1{1+\cfrac1{1+\cfrac1{1+\ddots}}}$$