TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is a little snippet of my code:

$\small \displaystyle \underbrace{(- \frac{1}{2})^0}_{\text{1st term, j = 0}} +
\underbrace{(- \frac{1}{2})^1}_{\text{2nd term, j = 1}} + \underbrace{(- \frac{1}{2})^2}_
{\text{3rd term, j = 2}} + ~...+ \underbrace{(- \frac{1}{2})^k}_{\text{kth term, 2nd to \linebreak last term, j = k}} + \underbrace{(- \frac{1}{2})^{k+1}}_{\text{(k+1)th term,
 last in the sum}}$  

and this is the output

enter image description here

I would like this to be on one line, but have the notes underneath the last two terms split into two. How might I do this?

share|improve this question
So do you want two lines in the notes below the fractions? Not two lines for the whole expression? Also, use \[ \] to center a math expression. – Sigur Dec 31 '13 at 16:52
I would like to two lines in the notes below the fractions. How does using [ ] compare to using center? What would I have to change? – Mack Dec 31 '13 at 16:54
@Mack Don't use center for displaying equations, but \[...\] – egreg Dec 31 '13 at 17:19
up vote 8 down vote accepted

this differs only slightly from the answer by Sigur, but i think it's worth some small adjustments.

 \underbrace{\left(-\frac{1}{2}\right)^0}_{\substack{\text{1st term,}\\ j = 0}}
 + \underbrace{\left(-\frac{1}{2}\right)^1}_{\substack{\text{2nd term,}\\ j = 1}}
 + \underbrace{\left(-\frac{1}{2}\right)^2}
   _{\substack{\text{3rd term,}\\ j = 2}}
 + \ \cdots\ 
 + \underbrace{\left(-\frac{1}{2}\right)^k}
   _{\substack{\text{\ \ $k$th term,\ \ }\\ \mathclap{\text{2nd to last term,}}\\ j = k}}
 + \underbrace{\left(-\frac{1}{2}\right)^{k+1\mkern-20mu}}
   _{\substack{\text{$(k{+}1)$th term,}\\ \text{ last in the sum }}}


output of example code

here are the differences:

  • to narrow the next-to-last term (thus reducing the space around the final plus), the widest line in the substack was "compressed" using \mathclap (requires mathtools), and spaces were added to the first line to adjust so that the notations on the last two terms don't overlap. (shortening this phrase is probably a better approach, actually, but that might not always be feasible.)

  • negative space was added to the end of the superscript on the last term, allowing it to hang over the brace, resulting in a brace closer in size to the others.

  • space was added (inside the \text) to the second line of the substack on the last term to further improve the spacing between the last two terms.

  • in the first line of the notation on the last term, braces were put around the {+} so that the spacing within k+1 is optically comparable to the spacing in the superscript. (it should probably be $(k+1)st, but let's not quibble.)

egreg's use of a macro refinement in Sigur's answer is a good idea that would work here too.

share|improve this answer

As suggested by @egreg, using \substack{} you can insert multiple lines. Also, the font size is automatically adjusted.

Note some extra spaces \ \around the \cdots (requested by @Thruston).


\underbrace{\left( -\frac{1}{2}\right)^0}_{\substack{
\text{1st term,}\\ j = 0}} + 
\underbrace{\left( -\frac{1}{2}\right)^1}_{\substack{\text{2nd term,}\\ j = 1}} + 
\underbrace{\left( -\frac{1}{2}\right)^2}_{\substack{\text{3rd term,}\\ j = 2}} 
+ \ \cdots \ + 
\underbrace{\left( -\frac{1}{2}\right)^k}_{\substack{\text{$k$th term,}\\ \text{2nd to last term,}\\ j = k} } + 
\underbrace{\left( -\frac{1}{2}\right)^{k+1}}_{\substack{\text{$(k+1)$th term,}\\ \text{last in the sum}} }

enter image description here

A refinement for using less keystrokes and minimize the chance of errors:


% Define a shortcut macro just for this display;
% use \left and \right instead of \Bigl and \Bigr
% if you feel these are too small
\myterm{0}{\text{1st term,} \\ j=0}+
\myterm{1}{\text{2nd term,} \\ j=1}+
\myterm{2}{\text{3rd term,} \\ j=2}+
\;\cdots\;+ % some space around the dots
\myterm{k}{\text{$k$th term,} \\ \text{2nd to last,} \\ j=k}+
\myterm{k+1}{\text{$(k+1)$th term,} \\ \text{last in the sum}}

enter image description here

share|improve this answer
I'd use \substack (with \text inside) instead of a tabular – egreg Dec 31 '13 at 16:59
This is precisely what I was looking for. Thank you, Sigur. – Mack Dec 31 '13 at 17:02
@egreg, well remembered. I'll edit with your suggestion. – Sigur Dec 31 '13 at 17:02
@Sigur and some extra space around the cdots? – Thruston Dec 31 '13 at 17:03
@Sigur I added a possibly better solution; it's basically the same as yours, the local macro avoids many keystrokes. – egreg Dec 31 '13 at 17:18

Your Answer


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.