[Tex/LaTex] How to typeset continued fractions in Pringsheim’s concise notation

fractionsinline()

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

Sample of notation

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.)

Best Answer

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

enter image description here

\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}
Related Question