1

I've got a continued fraction, where the denominator has a summation...

Here is my code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ y_i = 1 - \cfrac{1}{x_i + \displaystyle \sum_{j=1}^{N}\left(
          \cfrac{1}{x_j +\displaystyle \sum_{k=1}^{N}  \left (
          \cfrac{2}{x_k + \displaystyle \sum_{q=1}^{N} \left(
          \cfrac{3}{x_q-\ddots } \right)} \right) } \right)}
\]
\end{document}

The output looks like:

enter image description here

I can deal with the large amounts of space at the top using this: Proper display of fractions but I'd really like to increase the size of the summations, ideally to the point that the parentheses aren't needed.

  • Remove the parentheses and use \sum\limits instead of \displaystyle\sum. You'll see immediate improvements. For this picture, I also added \; in front of x_ – egreg Jun 24 '15 at 6:41
  • That doesn't increase the summation size noticeably. – Joel Jun 24 '15 at 6:43
  • @Joel There's no need to increase the suze of the summation sign, that's what I want to point out: in my picture it is indeed smaller. Which is the reason why I commented rather than answering. – egreg Jun 24 '15 at 6:45
  • 2
    @Joel I can't help you with that: increasing summation and integral signs is against my religion. ;-) – egreg Jun 24 '15 at 7:49
1

Try this

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ y_i = 1 - \cfrac{1}{x_i + \displaystyle \sum_{j=1}^{N}
          \cfrac{1}{x_j +\displaystyle \sum_{k=1}^{N}  
          \cfrac{2}{x_k + \displaystyle \sum_{q=1}^{N} 
          \cfrac{3}{x_q-\ddots } }  } }
\]

\end{document}

enter image description here

  • @egreg Are you suggesting this? – Ambika Vanchinathan Jun 24 '15 at 6:54
  • No, I suggest \sum\limits instead of \displaystyle\sum – egreg Jun 24 '15 at 6:55
  • I already have a version like this. I'm asking if there is a way to increase the size of the summation more so that at a glance it's obvious that the x_j is part of the summation over j. – Joel Jun 24 '15 at 7:49
  • by adding a small space before the leading $x_j$ (and thus making the fraction line a bit wider at the left) there would be a clearer separation from the sum. that should be enough to make the intention clear. (this is a good-looking answer, and would definitely be a form accepted by a professional copyeditor.) – barbara beeton Jun 24 '15 at 12:53
0

With the \scaleleftright[max_width]{left-delim}{term}{right-delim} macro from the scalerel package, symmetry of vertical height about the fraction bar is not enforced, making for a more pleasing look in this particular case.

With the macro, the delimiters are scaled to the vertical height of the term, but in this case, the maximum delimiter width is constrained to 1.5ex, which can be changed, of course.

RECOMMENDED ANSWER:

\documentclass{article}
\usepackage{amsmath,scalerel}
\begin{document}
\[ y_i = 1 - \cfrac{1}{x_i + \displaystyle \sum_{j=1}^{N}\scaleleftright[1.5ex]{(}{
          \cfrac{1}{x_j +\displaystyle \sum_{k=1}^{N}  \scaleleftright[1.5ex]{(}{
          \cfrac{2}{x_k + \displaystyle \sum_{q=1}^{N} \scaleleftright[1.5ex]{(}{
          \cfrac{3}{x_q-\ddots }}{)}}}{)} }}{)}}
\]
\end{document}

enter image description here

WHAT THE OP ASKED FOR (NOT RECOMMENDED):

This takes the recommended answer, but places the sums as the first argument to the \scalerel{term-to-be-scaled}{term-to-be-scaled-to} macro, effectively growing it to the vertical extent of the associated fraction.

By utilizing the \ignoremathstyle macro (make sure you have V1.7 of scalerel), math style preservation is disabled inside of scalerel arguments, or else the nesting of \mathchoices quickly brings efficiency to its knees.

\documentclass{article}
\usepackage{amsmath}
\usepackage{scalerel}[2015/02/18]
\begin{document}
\[\def\maxwd{2ex}\ignoremathstyle
  y_i = 1 - \cfrac{1}{\raisebox{-18pt}{$x_i +{}$} \scalerel{\displaystyle\sum_{j=1}^{N}}
              {\scaleleftright[\maxwd]{(}{
          \cfrac{1}{\raisebox{-11pt}{$x_i +{}$} \scalerel{\displaystyle\sum_{k=1}^{N}}
              {\scaleleftright[\maxwd]{(}{
          \cfrac{2}{\raisebox{-3pt}{$x_i +{}$} \scalerel{\displaystyle\sum_{q=1}^{N}}
              {\scaleleftright[\maxwd]{(}{
          \cfrac{3}{x_q-\ddots }}{)}}}}{)}}}}{)}}}
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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