# How do I typeset continued fractions in Pringsheim's concise notation?

I would like to obtain the following formatting so as to write continued fractions in my equations without wasting vertical space.

What I need is one command named \cFrac which writes one fraction and at the same time which adds vertical rules at the right of the denominator and at the left of the numerator. With this command, the preceding output will be typed : A + \cFrac{B}{C} + \cFrac{D}{E}.

The sizes of the rules must be adapted to the size of the denominator and the numerator.

(Added by Andrew Stacey: The duplicate question How to typeset a continued fraction in the following style? has an example from the recent literature together with links to more information.)

-
Just to know: where is this notation come from? – Sigur Aug 22 '12 at 11:22
I've just read this in one french book and I don't know who originally used it. I think this notation is very efficient. – projetmbc Aug 22 '12 at 11:49
small heads up: if you're using amsmath, the command \cfrac is defined there with a display-oriented style of output. (also \lcfrac and \rcfrac.) in that case, you might want to use another name, perhaps \tcfrac. – barbara beeton Aug 22 '12 at 12:12
But apparently Maxwell used it for something else and it was Pringsheim who introduced it for continued fractions. – Loop Space Sep 24 '12 at 15:09
In the book "A history of mathematical notations", volume II, p. 56 (1929 edition), Florian Cajori attributes the notation to Alfred Pringsheim. – egreg Sep 24 '12 at 15:13

A couple of versions, you probably need to fiddle with the spacing to get exactly what you need but:

\documentclass{article}

\def\cFrac#1#2{%
\begin{array}{@{}c@{}}\multicolumn{1}{c|}{#1}\\%
\hline\multicolumn{1}{|c}{#2}\end{array}}

\def\cFracB#1#2{%
\vcenter{\hbox{\strut$#1$\,\vrule}\hrule\hbox{\strut\vrule\,$#2$}}}

\begin{document}

$A + \cFrac{B}{C} + \cFrac{D}{E}$.

$A + \cFracB{B}{C} + \cFracB{D}{E}$.

\end{document}

-
That's look great ! – projetmbc Aug 22 '12 at 11:00
There's a package for this of course, see my answer. – yo' Sep 24 '12 at 12:16
I would say that when typeset as part of a line, all the verticals should be the same height (unless one is excessively outsized). For bonus points, how would you do that? – Loop Space Sep 24 '12 at 17:50
btw, have you tried what happens with \cFrac{B}{\frac{n^6}{n+5}} ? – yo' Sep 26 '12 at 11:53
@tohecz I just tried it, fractions are smaller in array cells is that what you mean? Could change the definition to \displaystyle#2 (and same for #1) if that is not desired. – David Carlisle Sep 26 '12 at 22:14

I'm sure you are looking for the holtpolt package and its command \polter, like in the following example:

\documentclass{standalone}

\usepackage{holtpolt}

\begin{document}

$a_0+\polter{1}{a_1}+\polter{1}{a_2}+\cdots+\polter{1}{a_n}+\cdots$

\end{document}


-