%https://tex.stackexchange.com/questions/73195/how-to-typeset-a-continued-fraction-in-the-following-format
\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}
As I could read from the mailing list, ConTeXt no longer supports \genfrac, so I've tried
the following using \definemathfraction
\definemathfraction[gefrac][cfrac]
\setupmathfraction[gefrac][rule=no]
\def\cofrac#1#2{%
{%
\rlap{\cfrac{1}{\displaystyle\phantom{#1}}}%
\gefrac{}{\displaystyle\gefrac{#1+}{}#2}%
}%
}
\def\cofracnorule#1#2{%
{%
\rlap{\gefrac{\displaystyle\phantom{1}}{\displaystyle\phantom{#1}}}%
\gefrac{}{\displaystyle\gefrac{#1}{}#2}%
}%
}
\def\endfrac#1{\cofracnorule{#1}{\phantom{1}}}
\startTEXpage
\startplacefigure[location=force,number=no]
\externalfigure[cofrac.png]
\stopplacefigure
\startformula
\alpha +
\cofrac{\alpha'}{\cofrac{\alpha''}{\cofrac{\alpha'''}{{\endfrac{\ddots}}}}} \frac{1}{\alpha'''}
\stopformula
\stopTEXpage
Mmm, superscripts and fraction rules superpose, so indeed something is wrong. Any ideas or references to a better result?
I've attached the expected result (it's from Legendre's Théorie des nombres) and a normal fraction for comparison.
Thank you very much.
Jairo :)