Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Just to know: where is this notation come from? –  Sigur Aug 22 '12 at 11:22
1  
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
3  
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
1  
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

2 Answers 2

up vote 14 down vote accepted

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}
share|improve this answer
    
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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.