# Adjusting \underbrace “cursor” at horizontal axis

Given is following formula:

$\begin{split} \sum\limits_{k=-n}^k c_ke^{ikx}=\frac{a_0}{2}+&\underbrace{\sum\limits_{k=1}^n\left(c_ke^{ikx}+c_{-k}e^{-ikx}\right)}\\ &=\cos(kx)(c_n+c_{-n})+i\sin(kx)(c_k-c_{-k})\\ &=a_k\cos(kx)+b_k\sin(kx) \end{split}$ The underbrace-command points to the next line, but it should point to the equal sign at the beginning of this line. Is it possible to either move the "cursor" of the underbrace-command to the equal sign or to move the equal sign to the underbrace-"cursor"?

• Should the underbrace cover the summation sign, or only the expression in round parentheses? – Mico Apr 23 '12 at 15:58
• @Mico: This does not make any difference. Sometimes I need such a feature, therefore it should work with any content. – kiritsuku Apr 23 '12 at 17:05
• please put an empty group {} between the plus and the ampersand before the second sum; this is needed to get the correct spacing around the plus. – barbara beeton Apr 23 '12 at 17:44
• @barbarabeeton: Thank you for the tip. I notice the difference. – kiritsuku Apr 23 '12 at 17:48

Is this what you want? I've used \mathrlap from the mathtools package, which loads (and extends) the amsmath package.

\documentclass{article}
\usepackage{mathtools}
\begin{document}

$\begin{split} \sum\limits_{k=-n}^k c_ke^{ikx}=\frac{a_0}{2}+ &\underbrace{\sum\limits_{k=1}^n\left(c_ke^{ikx}+c_{-k}e^{-ikx}\right)} _{\mathrlap{\begin{array}{@{}l} =\cos(kx)(c_n+c_{-n})+i\sin(kx)(c_k-c_{-k})\\ =a_k\cos(kx)+b_k\sin(kx)\end{array}}}\\ \end{split}$

\end{document}

• Haha! Neat trick. – percusse Apr 23 '12 at 15:24
• I'm not totally satisfied with this solution, because the "cursor" of the brace does not exactly point to the equal sign. – kiritsuku Apr 23 '12 at 17:06
• @Antoras so do you want to move it to the left a bit? you could try shifting it left a bit using a negative hspace – cmhughes Apr 23 '12 at 17:17
• Ok, this is not the perfect solution because of hand-adjusting but it works. – kiritsuku Apr 23 '12 at 17:26