[Tex/LaTex] Continued Fractions as an operator.

math-modemath-operators

In dealing with continued fractions in LaTeX, I've become less and less enamored of the \cfrac construct. Especially in my case where I deal with complicated numerators and denominators, listing a few terms can get unwieldy.

I encountered a nice notation for CFs in Lorentzen and Waadeland's "Continued Fractions with Applications" that seemed to be adaptable to my needs. I have no digital copy of the book, so I offer Wolfram's approximation on how this operator is rendered:

continued fraction

(the only difference is that the b terms come before the a terms, and they are separated by a backslash (this is why I asked this question, so I now know how to render the operands and the delimiters properly))

My question now, then, is how can I construct a "continued fraction operator" that acts like \sum and \product? Somehow, trying to use a large letter K and then putting the limits as over- and underscripts has been a bit of a mixed bag (and of course, if the operands themselves are fractions, I have to manually tweak the size of the "K" again!). Might there be a more elegant approach to this?

Best Answer

I'd define a new operator:

\newcommand{\K}{\operatornamewithlimits{K}}

You can then do the following:

Math-mode example:
\[
        \K_{k=0}^\infty \frac{a_k}{b_k}
\]
or inline $\K_k \frac{a_k}{b_k}$.

And get:

alt text

(Note that you must \usepackage{amsmath}.)