I've just tested it and it looks w a y better than before (thanks!). Btw, where could I read about key-value pairs for ConTeXt fractions (\definemathfraction)? I've seen keys like "threshold" and other weird ones in the command list, so I ask about a reference (maybe somewhere in a manual; the Garden doesn't say a lot about it). Thank you very much.

Sincerely,

Jairo :)

El lun., 29 de jun. de 2020 a la(s) 09:51, Hans Hagen (j.hagen@xs4all.nl) escribió:
On 6/28/2020 6:06 PM, Jairo A. del Rio wrote:
> |Hi list! I've tried adapting the following code for continued fractions:|
> ||
>
> |%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?
> |
In the next version this will look okay:

\definemathfraction
   [gefrac]
   [d:frac]

\setupmathfraction
   [gefrac]
   [mathstyle=display,
    alternative=inner,
    rule=hidden]

\unexpanded\def\cofrac#1#2{%
     \rlap{\cfrac{1}{\phantom{#1}}}%
     \gefrac{}{\gefrac{#1+}{}#2}%
}

\unexpanded\def\endfrac#1{%
     \rlap{\phantom{\cfrac{1}{#1}}}%
     \gefrac{}{#1}%
}

\starttext

\startTEXpage
\startformula \showmakeup[kern]
         \alpha
         +
         \cofrac {\alpha'}
             {\cofrac {\alpha''}
                 {\cofrac {\alpha'''}
                     {\endfrac {\ddots}}}}
         +
         \frac{1}{\alpha'''}
     \stopformula
\stopTEXpage

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------