17

How do I make this in LaTeX? I keep losing track of the brackets.

enter image description here

9
  • Do you know about the \cfrac macro provided by the amsmath package?
    – Mico
    Dec 30, 2016 at 18:25
  • I don't have any packages, I use latex2png.com, as my teacher told me to use it.
    – user121994
    Dec 30, 2016 at 18:26
  • 3
    \cfrac works at that site, I just tried Dec 30, 2016 at 18:31
  • 1
    Checked with y = 2+\cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{1+\dots}}} on that site, it works
    – user31729
    Dec 30, 2016 at 18:32
  • 2
    See this answer of mine for being able to use the friendlier syntax e=\xcontfrac{2;1,2,1,4,1,1,6+\cfraccdots} (in math mode, of course).
    – egreg
    Dec 30, 2016 at 19:09

2 Answers 2

24

The following code is "full LaTeX":

\documentclass{article}
\usepackage{amsmath} % for "\cfrac" macro
\begin{document}
\[
\mathrm{e}=
2+\cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{1+
  \cfrac{1}{4+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{6+
  \cdots\vphantom{\cfrac{1}{1}} }}}}}}}}
\]
\end{document}

enter image description here

If you want, you can copy and paste the math part -- the stuff between \[ and \] -- into latex2png.com.

3
  • 2
    I am SO grateful! Thank you very much Mico (and all others helping me out)
    – user121994
    Dec 30, 2016 at 18:35
  • 2
    I learned something new today as well: the existence of the site latex2png.com!
    – Mico
    Dec 30, 2016 at 18:36
  • 2
    Our teacher told us we had to use it in our assignments, glad we could learn each other something. I think it's really nice to get into such a respectful and friendly community
    – user121994
    Dec 30, 2016 at 18:38
6

Or, using no packages:

\documentclass{standalone}
\begin{document}
$e=
2+\frac{1}{1+\frac{1}{2+\frac{1}{1+\frac{1}{1+\frac{1}{4+\frac{1}{1+\frac{1}{1+\frac{1}{6+\cdots}}}}}}}
}
$
\end{document}

Yields:

enter image description here

Although \cfrac works better, this seemed to be what you were originally trying to get.

The copyable code for the website would be:

e=2+\frac{1}{1+\frac{1}{2+\frac{1}{1+\frac{1}{1+\frac{1}{4+\frac{1}{1+\frac{1}{1+\frac{1}{6+\cdots}}}}}}}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .