[Tex/LaTex] How to typeset a continued fraction in the following format

fractions

How does one typeset the following continued fraction as shown below?

enter image description here

Source: Notes on continued fractions and recurrence sequences by Alfred van der Poorten.

Note: Alf van der Poorten's style is similar to Euler's (in E071).

enter image description here

Source: The Euler Archive, Index Number E71.

Best Answer

This variant saves a vertical space. Because of the shortened line, there is many free space above the continued fractions that is used in this example. Also it keeps the math axis for the summations.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\newcommand*{\cofrac}[2]{%
  {%
    \rlap{$\dfrac{1}{\phantom{#1}}$}%
    \genfrac{}{}{0pt}{0}{}{#1+#2}%
  }%
}
\[
  a_0 +
  \cofrac{a_1}{
    \cofrac{a_2}{
      \cofrac{a_3}{
        \genfrac{}{}{0pt}{0}{}{\ddots}
  }}}
\]
\end{document}

Result

Related Question