18

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

enter image description here

JPi
  • 13,595

2 Answers2

25

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.

Mico
  • 506,678
  • 2
    I am SO grateful! Thank you very much Mico (and all others helping me out) – user121994 Dec 30 '16 at 18:35
  • 2
    I learned something new today as well: the existence of the site latex2png.com! – Mico Dec 30 '16 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 '16 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}}}}}}}}
Dan
  • 3,699