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-fra... \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 -----------------------------------------------------------------