# Have \underbrace lead to an arrow pointing towards expression (not replace underbrace)

I have a long expression coming from using \underbrace. It is causing the equation to look, for lack of a better adjective, strange. Here is the entire equation:

$$\frac{1}{2}g^{\mu\nu}\dm\phi\dn\phi = \frac{1}{2}\left[ \underbrace{g^{0\nu}\d_0\phi\dn\phi}_{g^{00}\d_0\phi\d_0\phi+ \cancel{g^{01}}\d_0\phi\d_1\phi+\cancel{g^{02}}\d_0\phi\d_2\phi+ \cancel{g^{03}}\d_0\phi\d_3\phi}+ g^{1\nu}\d_1\phi\dn\phi+g^{2\nu}\d_2\phi\dn\phi + g^{3\nu}\d_3\phi\dn\phi\right]$$


This is what it looks like:

Is it possible to have an arrow come from the underbrace towards somewhere else under the equation so the main equation does not have to accommodate for the length of the expression beneath the underbrace?

-

You can use \mathclap (or \mathrlap) from the mathtools package:

\documentclass[11pt, letterpaper]{article}
\usepackage{mathtools}
\usepackage{cancel}

\newcommand\dn{\mathrm{d}\, n}
\newcommand\dm{\mathrm{d}\, m}
\def\d{\mathrm{d}}% Don't do this

\begin{document}

$$\frac{1}{2}g^{\mu\nu}\dm\phi\dn\phi = \frac{1}{2}\bigl[\, \underbrace{g^{0\nu}\d_0\phi\dn\phi}_{\mathclap{g^{00}\d_0\phi\d_0\phi+ \cancel{g^{01}}\d_0\phi\d_1\phi+\cancel{g^{02}}\d_0\phi\d_2\phi+ \cancel{g^{03}}\d_0\phi\d_3\phi}}+ g^{1\nu}\d_1\phi\dn\phi+g^{2\nu}\d_2\phi\dn\phi + g^{3\nu}\d_3\phi\dn\phi\bigr]$$

$$\frac{1}{2}g^{\mu\nu}\dm\phi\dn\phi = \frac{1}{2}\bigl[\, \underbrace{g^{0\nu}\d_0\phi\dn\phi}_{\mathrlap{g^{00}\d_0\phi\d_0\phi+ \cancel{g^{01}}\d_0\phi\d_1\phi+\cancel{g^{02}}\d_0\phi\d_2\phi+ \cancel{g^{03}}\d_0\phi\d_3\phi}}+ g^{1\nu}\d_1\phi\dn\phi+g^{2\nu}\d_2\phi\dn\phi + g^{3\nu}\d_3\phi\dn\phi\bigr]$$

\end{document}


I didn't had the original definitions for \dn and \dm so I provided some definitions for the example. From your code, it seems that you are also redefining \d (as I did in my example to reproduce the result); please choose a different name, since \d is an already existing command.

-
@karlkoeller probably, yes, except for \renewcommand\d{...}; he must have \def\d{...}; otherwise, an error is triggered. – Gonzalo Medina Jun 20 '13 at 19:22
I tried the above MWE with \renewcommand{\d}{\partial} and I have no errors. Why should it occur? – karlkoeller Jun 20 '13 at 19:26
I have this: \def\d{\partial} \def\dm{\partial_{\mu}} \def\dn{\partial_{\nu}} with no errors. – dougphy Jun 20 '13 at 19:30